MDL-11517 reserved word MOD used in table alias in questions backup code
[moodle-pu.git] / admin / stickyblocks.php
blob45e438e337db230a3ab576a725071ed52a783c2b
1 <?PHP // $Id$
3 require_once('../config.php');
4 require_once($CFG->dirroot.'/my/pagelib.php');
5 require_once($CFG->dirroot.'/lib/pagelib.php');
6 require_once($CFG->dirroot.'/lib/blocklib.php');
8 if (!empty($THEME->customcorners)) {
9 require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
12 $pt = optional_param('pt', null, PARAM_SAFEDIR); //alhanumeric and -
14 $pagetypes = array(PAGE_MY_MOODLE => array('id' => PAGE_MY_MOODLE,
15 'lib' => '/my/pagelib.php',
16 'name' => get_string('mymoodle','admin')),
17 PAGE_COURSE_VIEW => array('id' => PAGE_COURSE_VIEW,
18 'lib' => '/lib/pagelib.php',
19 'name' => get_string('stickyblockscourseview','admin'))
20 // ... more?
23 // for choose_from_menu
24 $options = array();
25 foreach ($pagetypes as $p) {
26 $options[$p['id']] = $p['name'];
29 require_login();
31 require_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
33 // first thing to do is print the dropdown menu
35 $strtitle = get_string('stickyblocks','admin');
36 $strheading = get_string('adminhelpstickyblocks');
40 if (!empty($pt)) {
42 require_once($CFG->dirroot.$pagetypes[$pt]['lib']);
44 define('ADMIN_STICKYBLOCKS',$pt);
46 $PAGE = page_create_object($pt, SITEID);
47 $blocks = blocks_setup($PAGE,BLOCKS_PINNED_TRUE);
48 $blocks_preferred_width = bounded_number(180, blocks_preferred_width($blocks[BLOCK_POS_LEFT]), 210);
50 $navlinks = array(array('name' => get_string('administration'),
51 'link' => "$CFG->wwwroot/$CFG->admin/index.php",
52 'type' => 'misc'));
53 $navlinks[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
54 $navigation = build_navigation($navlinks);
55 print_header($strtitle,$strtitle,$navigation);
57 echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
58 echo '<tr valign="top">';
60 echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="left-column">';
61 if (!empty($THEME->customcorners)) print_custom_corners_start();
62 blocks_print_group($PAGE, $blocks, BLOCK_POS_LEFT);
63 if (!empty($THEME->customcorners)) print_custom_corners_end();
64 echo '</td>';
65 echo '<td valign="top" id="middle-column">';
66 if (!empty($THEME->customcorners)) print_custom_corners_start();
68 } else {
69 require_once($CFG->libdir.'/adminlib.php');
70 admin_externalpage_setup('stickyblocks');
71 admin_externalpage_print_header();
75 print_box_start();
76 print_heading($strheading);
77 popup_form("$CFG->wwwroot/$CFG->admin/stickyblocks.php?pt=", $options, 'selecttype', $pt, 'choose', '', '', false, 'self', get_string('stickyblockspagetype','admin').': ');
78 echo '<p>'.get_string('stickyblocksduplicatenotice','admin').'</p>';
79 print_box_end();
82 if (!empty($pt)) {
83 if (!empty($THEME->customcorners)) print_custom_corners_end();
84 echo '</td>';
85 echo '<td valign="top" style="width: '.$blocks_preferred_width.'px;" id="right-column">';
86 if (!empty($THEME->customcorners)) print_custom_corners_start();
87 blocks_print_group($PAGE, $blocks, BLOCK_POS_RIGHT);
88 if (!empty($THEME->customcorners)) print_custom_corners_end();
89 echo '</td>';
90 echo '</tr></table>';
91 print_footer();
92 } else {
93 admin_externalpage_print_footer();