mod-assignment MDL-23848 Fixed regression causing group dropdowns to be ignored when...
[moodle.git] / blocks / admin_bookmarks / create.php
blobc21e18e224bd7c34c6ff7ee35c10ddd40b7214d8
1 <?php // $Id$
3 require('../../config.php');
5 require_once($CFG->libdir.'/adminlib.php');
6 require_login();
7 $adminroot =& admin_get_root(false, false); // settings not required - only pages
9 if ($section = optional_param('section', '', PARAM_SAFEDIR) and confirm_sesskey()) {
11 if (get_user_preferences('admin_bookmarks')) {
12 $bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
14 if (in_array($section, $bookmarks)) {
15 print_error('bookmarkalreadyexists','admin');
16 die;
19 } else {
20 $bookmarks = array();
23 $temp = $adminroot->locate($section);
25 if (is_a($temp, 'admin_settingpage') || is_a($temp, 'admin_externalpage')) {
26 $bookmarks[] = $section;
27 $bookmarks = implode(',', $bookmarks);
28 set_user_preference('admin_bookmarks', $bookmarks);
30 } else {
31 print_error('invalidsection','admin');
32 die;
35 if (is_a($temp, 'admin_settingpage')) {
36 redirect($CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=' . $section);
38 } elseif (is_a($temp, 'admin_externalpage')) {
39 redirect($temp->url);
42 } else {
43 print_error('invalidsection','admin');
44 die;