page_map_class(PAGE_ADMIN, 'page_admin');
class page_admin extends page_base {
-
- var $section = '';
- var $visiblepathtosection;
- var $extraurlparams = array();
var $extrabutton = '';
- var $url = '';
-
- // hack alert!
- // this function works around the inability to store the section name
- // in default block, maybe we should "improve" the blocks a bit?
- function init_extra($section) {
- global $CFG;
-
- if($this->full_init_done) {
- return;
- }
- $adminroot = admin_get_root(false, false); //settings not required - only pages
-
- // fetch the path parameter
- $this->section = $section;
- $current = $adminroot->locate($section, true);
- $this->visiblepathtosection = array_reverse($current->visiblepath);
-
- // all done
- $this->full_init_done = true;
- }
-
- function blocks_get_default() {
+ function _legacy_blocks_get_default() {
return 'admin_tree,admin_bookmarks';
}
return $USER->adminediting;
}
- function url_get_path() {
- global $CFG;
- if (!empty($this->url)) {
- return $this->url;
- }
-
- $adminroot = admin_get_root(false, false); //settings not required - only pages
-
- $root = $adminroot->locate($this->section);
- if ($root instanceof admin_externalpage) {
- return $root->url;
- } else {
- return ($CFG->wwwroot . '/' . $CFG->admin . '/settings.php');
- }
- }
-
/**
* Use this to pass extra HTML that is added after the turn blocks editing on/off button.
*
$this->extrabutton = $extrabutton;
}
- /**
- * Use this to pass extra URL parameters that, for example, the blocks editing controls need to reload the current page accurately.
- *
- * @param array $extraurlparams paramname => value array.
- */
- function set_extra_url_params($extraurlparams, $actualurl = '') {
- $this->extraurlparams = $extraurlparams;
- if (!empty($actualurl)) {
- $this->url = $actualurl;
- }
- }
-
- function url_get_parameters() { // only handles parameters relevant to the admin pagetype
- return array_merge($this->extraurlparams, array('section' => $this->section));
- }
-
- function print_header($section = '', $focus='') {
+ function print_header($focus='') {
global $USER, $CFG, $SITE;
- $this->init_full($section); // we're trusting that init_full() has already been called by now; it should have.
- // if not, print_header() has to be called with a $section parameter
+ $adminroot = admin_get_root(false, false); //settings not required - only pages
+
+ // fetch the path parameter
+ $section = $this->url->param('section');
+ $current = $adminroot->locate($section, true);
+ $visiblepathtosection = array_reverse($current->visiblepath);
// The search page currently doesn't handle block editing
- if ($this->section != 'search' and $this->user_allowed_editing()) {
- $options = $this->url_get_parameters();
+ if ($this->user_allowed_editing()) {
+ $options = $this->url->params();
if ($this->user_is_editing()) {
$caption = get_string('blockseditoff');
$options['adminedit'] = 'off';
$caption = get_string('blocksediton');
$options['adminedit'] = 'on';
}
- $buttons = print_single_button($this->url_get_path(), $options, $caption, 'get', '', true);
- } else {
- $buttons = ' ';
+ $buttons = print_single_button($this->url->out(false), $options, $caption, 'get', '', true);
}
$buttons .= $this->extrabutton;
$navlinks = array();
- foreach ($this->visiblepathtosection as $element) {
+ foreach ($visiblepathtosection as $element) {
$navlinks[] = array('name' => $element, 'link' => null, 'type' => 'misc');
}
$navigation = build_navigation($navlinks);
- print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, $navigation, $focus, '', true, $buttons, '');
+ print_header("$SITE->shortname: " . implode(": ",$visiblepathtosection), $SITE->fullname, $navigation, $focus, '', true, $buttons, '');
}
}
$query = trim(optional_param('query', '', PARAM_NOTAGS)); // Search string
+$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
$adminroot = admin_get_root(); // need all settings here
$adminroot->search = $query; // So we can reference it in search boxes later in this invocation
$statusmsg = '';
$errormsg = '';
$focus = '';
-admin_externalpage_setup('search'); // now hidden page
+admin_externalpage_setup('search', '', array('query' => $query)); // now hidden page
// now we'll deal with the case that the admin has submitted the form with changed settings
if ($data = data_submitted() and confirm_sesskey()) {
/// no guest autologin
require_login(0, false);
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
+$PAGE->set_url($CFG->admin . '/settings.php', array('section' => $section));
$adminroot = admin_get_root(); // need all settings
$page = $adminroot->locate($section);
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
BLOCK_R_MAX_WIDTH);
- $PAGE->print_header('', $focus);
+ $PAGE->print_header($focus);
echo '<table id="layout-table"><tr>';
$lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable;
} else {
$page = page_create_object($this->instance->pagetype, $this->instance->pageid);
}
- $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => sesskey()));
+ $script = $page->url->out(array('instanceid' => $this->instance->id, 'sesskey' => sesskey()));
if (empty($this->instance->pinned)) {
$movebuttons .= '<a class="icon roles" title="'. $this->str->assignroles .'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id.'">' .
//if ($page->user_allowed_editing()) { // for SUBMITTERS_ALL_ACCOUNT_HOLDERS we're going to run into trouble later if we show it and then they don't have write access to the page.
if (isset($this->config)) {
// This instance is configured - show Add/Edit feeds link.
- $script = $page->url_get_full(
+ $script = $page->url->out(
array('instanceid' => $this->instance->id,
'sesskey' => sesskey(),
'blockaction' => 'config',
} else {
// This instance has not been configured yet - show configure link?
if (has_capability('block/rss_client:manageanyfeeds', $context)) {
- $script = $page->url_get_full(
+ $script = $page->url->out(
array('instanceid' => $this->instance->id,
'sesskey' => sesskey(),
'blockaction' => 'config',
if (has_capability('block/rss_client:createprivatefeeds', $context)
|| has_capability('block/rss_client:createsharedfeeds', $context)) {
- $addrsspage = $page->url_get_full(array('instanceid' => $this->instance->id,
+ $addrsspage = $page->url->out(array('instanceid' => $this->instance->id,
'sesskey' => sesskey(),
- 'blockaction' => 'config',
+ 'blockaction' => 'config',
'currentaction' => 'managefeeds',
'id' => $id));
print ' <a href="'.$addrsspage.'">'. get_string('editnewsfeeds', 'block_rss_client') .'</a><br />';
}
if (has_capability('moodle/site:manageblocks', $context)) {
- $script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id, 'section' => 'rss'));
+ $script = $page->url->out(array('instanceid' => $this->instance->id, 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'configblock', 'id' => $id, 'section' => 'rss'));
$row[] = new tabobject('configblock', $script,
get_string('configblock', 'block_rss_client'));
}
-$script = $page->url_get_full(array('instanceid' => $this->instance->id, 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id, 'section' => 'rss'));
+$script = $page->url->out(array('instanceid' => $this->instance->id, 'sesskey' => sesskey(), 'blockaction' => 'config', 'currentaction' => 'managefeeds', 'id' => $id, 'section' => 'rss'));
$row[] = new tabobject('managefeeds', $script,
get_string('managefeeds', 'block_rss_client'));
print_header($pageTitle, $pageHeading, $pageNavigation, $pageFocus, $pageMeta, true, $extraheader );
}
- // This should point to the script that displays us
- function url_get_path() {
- global $CFG;
-
- return $CFG->wwwroot .'/blog/index.php';
- }
-
- function url_get_parameters() {
-
- $array = array();
- if (!$this->full_init_done) {
- $array['userid'] = $this->id;
- return $array;
- }
-
- if (!empty($this->course->id)) {
- $array['courseid'] = $this->course->id;
- }
- if (!empty($this->filtertype)) {
- $array['filtertype'] = $this->filtertype;
- }
- if (!empty($this->filterselect)) {
- $array['filterselect'] = $this->filterselect;
- }
- if (!empty($this->tagid)) {
- $array['tagid'] = $this->tagid;
- }
- return $array;
- }
-
/////////// Blog page specific functions
function get_extra_header_string() {
global $SESSION, $CFG, $USER;
$editingString = get_string('turneditingon');
}
- $params = $this->url_get_parameters();
+ $params = $this->url->params();
$params['edit'] = empty($SESSION->blog_editing_enabled) ? 1 : 0;
$paramstring = '';
foreach ($params as $key=>$val) {
$paramstring .= '<input type="hidden" name="'.$key.'" value="'.s($val).'" />';
}
- $editformstring = '<form '.$CFG->frametarget.' method="get" action="'.$this->url_get_path().'"><div>'
+ $editformstring = '<form '.$CFG->frametarget.' method="get" action="'.$this->url->out(false).'"><div>'
.$paramstring.'<input type="submit" value="'.$editingString.'" /></div></form>';
}
$PAGE->filtertype = $filtertype;
$PAGE->filterselect = $filterselect;
$PAGE->tagid = $tagid;
-
+$array = array();
+if (!empty($course->id)) {
+ $array['courseid'] = $course->id;
+}
+if (!empty($filtertype)) {
+ $array['filtertype'] = $filtertype;
+}
+if (!empty($filterselect)) {
+ $array['filterselect'] = $filterselect;
+}
+if (!empty($tagid)) {
+ $array['tagid'] = $tagid;
+}
+$PAGE->set_url('blog/index.php', $array);
$PAGE->init_full(); //init the BlogInfo object and the courserecord object
$editing = false;
$marker = optional_param('marker',-1 , PARAM_INT);
$switchrole = optional_param('switchrole',-1, PARAM_INT);
-
-
if (empty($id) && empty($name) && empty($idnumber)) {
print_error('unspecifycourseid', 'error');
}
}
$PAGE = page_create_object(PAGE_COURSE_VIEW, $course->id);
+ $PAGE->set_url('course/view.php', array('id' => $course->id));
$pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
if ($reset_user_allowed_editing) {
}
$PAGE = page_create_object(PAGE_COURSE_VIEW, SITEID);
+ $PAGE->set_pagetype('site-index');
+ $PAGE->set_url('');
$PAGE->set_docs_path('');
$pageblocks = blocks_setup($PAGE);
- $editing = $PAGE->user_is_editing();
+ $editing = $PAGE->user_is_editing();
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
BLOCK_L_MAX_WIDTH);
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
* @param string $actualurl if the actual page being viewed is not the normal one for this
* page (e.g. admin/roles/allowassin.php, instead of admin/roles/manage.php, you can pass the alternate URL here.
*/
-function admin_externalpage_setup($section, $extrabutton='', $extraurlparams=array(), $actualurl='') {
+function admin_externalpage_setup($section, $extrabutton = '',
+ $extraurlparams = array(), $actualurl = '') {
global $CFG, $PAGE, $USER;
require_once($CFG->libdir.'/blocklib.php');
page_map_class(PAGE_ADMIN, 'page_admin');
$PAGE = page_create_object(PAGE_ADMIN, 0); // there must be any constant id number
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
- $PAGE->init_extra($section); // hack alert!
$PAGE->set_extra_button($extrabutton);
- $PAGE->set_extra_url_params($extraurlparams, $actualurl);
$adminroot = admin_get_root(false, false); // settings not required for external pages
$extpage = $adminroot->locate($section);
+ if (!$actualurl) {
+ $actualurl = $extpage->url;
+ }
+ $PAGE->set_url(str_replace($CFG->wwwroot . '/', '', $actualurl),
+ array_merge($extraurlparams, array('section' => $section)));
+
if (empty($extpage) or !($extpage instanceof admin_externalpage)) {
print_error('sectionerror', 'admin', "$CFG->wwwroot/$CFG->admin/");
die;
blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
BLOCK_R_MAX_WIDTH);
- $PAGE->print_header('', $focus);
+ $PAGE->print_header($focus);
echo '<table id="layout-table" summary=""><tr>';
$lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable;
$managecourseblocks = has_capability('moodle/site:manageblocks', $coursecontext);
$editmymoodle = $page->pagetype == PAGE_MY_MOODLE && has_capability('moodle/my:manageblocks', $coursecontext);
- if ($page->blocks_default_position() == $position &&
+ if ($page->blocks->get_default_position() == $position &&
$page->user_is_editing() &&
($managecourseblocks || $editmymoodle || $myownblogpage || defined('ADMIN_STICKYBLOCKS'))) {
);
// To this data, add anything the page itself needs to display
- $hiddendata = array_merge($hiddendata, $page->url_get_parameters());
+ $hiddendata = $page->url->params($hiddendata);
if ($data = data_submitted()) {
$remove = array_keys($hiddendata);
echo '<div class="block-config" id="'.$block->name.'">'; /// Make CSS easier
print_heading($strheading);
- echo '<form method="post" name="block-config" action="'. $page->url_get_path() .'">';
+ echo '<form method="post" name="block-config" action="'. $page->url->out(false) .'">';
echo '<p>';
foreach($hiddendata as $name => $val) {
echo '<input type="hidden" name="'. $name .'" value="'. $val .'" />';
break;
}
- $newpos = $page->blocks_default_position();
+ $newpos = $page->blocks->get_default_position();
if (!empty($pinned)) {
$sql = "SELECT 1, MAX(weight) + 1 AS nextfree
FROM {block_pinned}
if ($redirect) {
// In order to prevent accidental duplicate actions, redirect to a page with a clean url
- redirect($page->url_get_full());
+ redirect($page->url->out());
}
}
$blocks = $DB->get_records_select('block_pinned', $select, $params, 'position, weight');
- $positions = $page->blocks_get_positions();
+ $positions = $page->blocks->get_positions();
$arr = array();
foreach($positions as $key => $position) {
$blocks = $DB->get_records_select('block_instance', "pageid = ? AND ? LIKE (" . $DB->sql_concat('pagetype', "'%'") . ")",
array($page->get_id(), $page->pagetype), 'position, weight');
- $positions = $page->blocks_get_positions();
+ $positions = $page->blocks->get_positions();
$arr = array();
foreach($positions as $key => $position) {
$arr[$position] = array();
}
asort($menu);
- $target = $page->url_get_full(array('sesskey' => sesskey(), 'blockaction' => 'add'));
+ $target = $page->url->out(array('sesskey' => sesskey(), 'blockaction' => 'add'));
$content = popup_form($target.'&blockid=', $menu, 'add_block', '', $stradd .'...', '', '', true);
print_side_block($strblocks, $content, NULL, NULL, NULL, array('class' => 'block_adminblock'));
}
$blocknames = $page->blocks_get_default();
}
- $positions = $page->blocks_get_positions();
+ $positions = $page->blocks->get_positions();
$posblocks = explode(':', $blocknames);
// Now one array holds the names of the positions, and the other one holds the blocks
protected $_url = null;
+ protected $_blocks = null;
+
/// Getter methods =============================================================
/// Due to the __get magic below, you normally do not call these as $PAGE->get_x
/// methods, but instead use the $PAGE->x syntax.
debugging('This page did no call $PAGE->set_url(...). Realying on a guess.', DEBUG_DEVELOPER);
return new moodle_url($ME);
}
- return $this->_url;
+ return new moodle_url($this->_url); // Return a clone for safety.
+ }
+
+ /**
+ * @return blocks_manager the blocks manager object for this page.
+ */
+ public function get_blocks() {
+ if (is_null($this->_blocks)) {
+ $this->_blocks = new blocks_manager();
+ }
+ return $this->_blocks;
}
/**
* If legacy code has set $CFG->pagepath that will be used instead, and a
* developer warning issued.
*/
- protected function initialise_default_pagetype($script = '') {
+ protected function initialise_default_pagetype($script = null) {
global $CFG, $SCRIPT;
if (isset($CFG->pagepath)) {
unset($CFG->pagepath);
}
- if (empty($script)) {
+ if (is_null($script)) {
$script = ltrim($SCRIPT, '/');
$len = strlen($CFG->admin);
if (substr($script, 0, $len) == $CFG->admin) {
}
/**
- * @deprecated since Moodle 2.0
+ * @deprecated since Moodle 2.0 - use $PAGE->blocks->get_positions() instead
* @return string the places on this page where blocks can go.
*/
function blocks_get_positions() {
debugging('Call to deprecated method moodle_page::blocks_get_positions. Use $PAGE->blocks->get_positions() instead.');
- return $PAGE->blocks->get_positions();
+ return $this->blocks->get_positions();
}
/**
- * @deprecated since Moodle 2.0
+ * @deprecated since Moodle 2.0 - use $PAGE->blocks->get_default_position() instead
* @return string the default place for blocks on this page.
*/
function blocks_default_position() {
debugging('Call to deprecated method moodle_page::blocks_default_position. Use $PAGE->blocks->get_default_position() instead.');
- return $PAGE->blocks->get_default_position();
+ return $this->blocks->get_default_position();
}
/**
function blocks_move_position(&$instance, $move) {
debugging('Call to deprecated method moodle_page::blocks_move_position. This method has no function any more.');
}
+
+ /**
+ * @deprecated since Moodle 2.0 - use $this->url->params() instead.
+ * @return array URL parameters for this page.
+ */
+ function url_get_parameters() {
+ debugging('Call to deprecated method moodle_page::url_get_parameters. Use $this->url->params() instead.');
+ return $this->url->params();
+ }
+
+ /**
+ * @deprecated since Moodle 2.0 - use $this->url->params() instead.
+ * @return string URL for this page without parameters.
+ */
+ function url_get_path() {
+ debugging('Call to deprecated method moodle_page::url_get_path. Use $this->url->out(false) instead.');
+ return $this->url->out(false);
+ }
+
+ /**
+ * @deprecated since Moodle 2.0 - use $this->url->out() instead.
+ * @return string full URL for this page.
+ */
+ function url_get_full($extraparams = array()) {
+ debugging('Call to deprecated method moodle_page::url_get_full. Use $this->url->out() instead.');
+ return $this->url->out($extraparams);
+ }
+}
+
+/** Stub implementation of the blocks_manager, to stop things from breaking too badly. */
+class blocks_manager {
+ public function get_positions() {
+ return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT);
+ }
+
+ public function get_default_position() {
+ return BLOCK_POS_RIGHT;
+ }
}
/**
$data->pageid = $id;
$classname = page_map_class($type);
- $object = new $classname;
- $object->init_quick($data);
+ $legacypage = new $classname;
+ $legacypage->init_quick($data);
+ // $PAGE->set_pagetype($type);
+ // $PAGE->set_url(str_replace($CFG->wwwroot . '/', '', $legacypage->url_get_full_()));
+ // return $PAGE;
+
$course = $PAGE->course;
if ($course->id != $SITE->id) {
- $object->set_course($course);
+ $legacypage->set_course($course);
} else {
try {
$category = $PAGE->category;
$category = false;
}
if ($category) {
- $object->set_category_by_id($category->id);
+ $legacypage->set_category_by_id($category->id);
} else {
- $object->set_course($SITE);
+ $legacypage->set_course($SITE);
}
}
- //$object->set_pagetype($type);
- return $object;
+ return $legacypage;
}
/**
// SELF-REPORTING SECTION
- // Derived classes HAVE to define their "home url"
- function url_get_path() {
- trigger_error('Page class does not implement method <strong>url_get_path()</strong>', E_USER_WARNING);
- return NULL;
- }
-
- // It's not always required to pass any arguments to the home url, so this doesn't trigger any errors (sensible default)
- function url_get_parameters() {
- return array();
- }
-
- // This should actually NEVER be overridden unless you have GOOD reason. Works fine as it is.
- function url_get_full($extraparams = array()) {
- $path = $this->url_get_path();
- if(empty($path)) {
- return NULL;
- }
-
- $params = $this->url_get_parameters();
- if (!empty($params)) {
- $params = array_merge($params, $extraparams);
- } else {
- $params = $extraparams;
- }
-
- if(empty($params)) {
- return $path;
- }
-
- $first = true;
-
- foreach($params as $var => $value) {
- $path .= $first? '?' : '&';
- $path .= $var .'='. urlencode($value);
- $first = false;
- }
-
- return $path;
- }
// Simple stuff, do not override this.
function get_id() {
// SELF-REPORTING SECTION
- // This should return a fully qualified path to the URL which is responsible for displaying us.
- function url_get_path() {
- global $CFG;
- if (defined('ADMIN_STICKYBLOCKS')) {
- return $CFG->wwwroot.'/'.$CFG->admin.'/stickyblocks.php';
- }
- if($this->id == SITEID) {
- return $CFG->wwwroot .'/index.php';
- }
- else {
- return $CFG->wwwroot .'/course/view.php';
- }
- }
-
- // This should return an associative array of any GET/POST parameters that are needed by the URL
- // which displays us to make it work. If none are needed, return an empty array.
- function url_get_parameters() {
- if (defined('ADMIN_STICKYBLOCKS')) {
- return array('pt' => ADMIN_STICKYBLOCKS);
- }
- if($this->id == SITEID) {
- return array();
- }
- else {
- return array('id' => $this->id);
- }
- }
-
// When we are creating a new page, use the data at your disposal to provide a textual representation of the
// blocks that are going to get added to this new page. Delimit block names with commas (,) and use double
- // colons (:) to delimit between block positions in the page. See blocks_get_positions() for additional info.
+ // colons (:) to delimit between block positions in the page.
function _legacy_blocks_get_default() {
global $CFG;
return isediting($this->modulerecord->course);
}
- function url_get_path() {
- global $CFG;
- return $CFG->wwwroot .'/mod/'.$this->activityname.'/view.php';
- }
-
- function url_get_parameters() {
- $this->init_full();
- return array('id' => $this->modulerecord->id);
- }
-
- function blocks_get_positions() {
- return array(BLOCK_POS_LEFT);
- }
-
- function blocks_default_position() {
- return BLOCK_POS_LEFT;
- }
-
function print_header($title, $morenavlinks = NULL, $bodytags = '', $meta = '') {
global $USER, $CFG;
require_once($CFG->libdir . '/pagelib.php');
class testable_moodle_page extends moodle_page {
- public function initialise_default_pagetype($script = '') {
+ public function initialise_default_pagetype($script = null) {
parent::initialise_default_pagetype($script);
}
public function url_to_class_name($url) {
$this->port = $url->port;
$this->user = $url->user;
$this->pass = $url->pass;
- $this->path = $url->pass;
+ $this->path = $url->path;
$this->fragment = $url->fragment;
$this->params = $url->params;
} else {
// Initialize $PAGE, compute blocks
- $PAGE = page_create_instance($chat->id);
+ $PAGE = page_create_instance($chat->id);
+ $PAGE->set_url('mod/chat/view.php', array('id' => $cm->id));
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
// Initialize $PAGE, compute blocks
- $PAGE = page_create_instance($data->id);
+ $PAGE = page_create_instance($data->id);
+ $PAGE->set_url('mod/data/view.php', array('id' => $cm->id));
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
}
$PAGE = page_create_object('mod-lesson-view', $lesson->id);
+ $PAGE->set_url('mod/lesson/view.php', array('id' => $cm->id, 'pageid' => $page->id));
$PAGE->set_lessonpageid($page->id);
$pageblocks = blocks_setup($PAGE);
lesson_print_messages();
}
- /**
- * Needed to add the ID of the current lesson page
- *
- * @return array
- **/
- function url_get_parameters() {
- $this->init_full();
- return array('id' => $this->modulerecord->id, 'pageid' => $this->lessonpageid);;
- }
-
/**
* Set the current lesson page ID
*
// update the clock
if (!has_capability('mod/lesson:manage', $context)) {
$timer->lessontime = time();
- if (!$DB->update_record('lesson_timer', $timer)) {
- print_error('cannotupdatetimer', 'lesson');
- }
+ $DB->update_record('lesson_timer', $timer);
}
/// This is the warning msg for teachers to inform them that cluster and unseen does not work while logged in as a teacher
}
$PAGE = page_create_instance($lesson->id);
+ $PAGE->set_url('mod/lesson/view.php', array('id' => $cm->id, 'pageid' => $page->id));
$PAGE->set_lessonpageid($page->id);
$pageblocks = blocks_setup($PAGE);
}
$timer->lessontime = time();
- if (!$DB->update_record("lesson_timer", $timer)) {
- print_error('cannotupdatetimer', 'lesson');
- }
+ $DB->update_record("lesson_timer", $timer);
}
add_to_log($course->id, "lesson", "end", "view.php?id=$cm->id", "$lesson->id", $cm->id);
add_to_log($course->id, "quiz", "view", "view.php?id=$cm->id", $quiz->id, $cm->id);
/// Initialize $PAGE, compute blocks
- $PAGE = page_create_instance($quiz->id);
+ $PAGE = page_create_instance($quiz->id);
+ $PAGE->set_url('mod/quiz/view.php', array('id' => $cm->id));
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
require_once($CFG->dirroot.'/course/lib.php'); //required by some blocks
$PAGE = page_create_object(PAGE_COURSE_VIEW, $this->course->id);
+ $PAGE->set_url('mod/resource/view.php', array('id' => $this->cm->id));
$this->PAGE = $PAGE;
$pageblocks = blocks_setup($PAGE);
}
require_login($course->id, false, $cm);
-
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/survey:participate', $context);
require_once($CFG->libdir.'/blocklib.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once('pagelib.php');
-
+
require_login();
$mymoodlestr = get_string('mymoodle','my');
$blockaction = optional_param('blockaction', '', PARAM_ALPHA);
$PAGE = page_create_instance($USER->id);
+ $PAGE->set_url('my/index.php');
$pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
print_header($title, $header,$navigation,'','',true, $button, $loggedinas.$langmenu);
}
-
- function url_get_path() {
- global $CFG;
- if ($PAGE->pagetype == PAGE_MY_MOODLE) {
- return $CFG->wwwroot.'/my/index.php';
- } elseif (defined('ADMIN_STICKYBLOCKS')){
- return $CFG->wwwroot.'/'.$CFG->admin.'/stickyblocks.php';
- }
- }
-
- function url_get_parameters() {
- if (defined('ADMIN_STICKYBLOCKS')) {
- return array('pt' => ADMIN_STICKYBLOCKS);
- } else {
- return array();
- }
- }
}
-
define('PAGE_MY_MOODLE', 'my-index');
define('MY_MOODLE_FORMAT', 'my'); //doing this so we don't run into problems with applicable formats.
//create a new page_tag object, defined in pagelib.php
$PAGE = page_create_object(PAGE_TAG_INDEX, $tag->id);
+$PAGE->set_url('tag/index.php', array('id' => $tag->id));
$pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH);
$PAGE->tag_object = $tag;
return (!empty($USER->editing));
}
-
- function url_get_path() {
- global $CFG;
- return $CFG->wwwroot.'/tag/index.php';
-
- }
-
- function url_get_parameters() {
- $param = array();
- $param['id'] = $this->id;
- return $param;
- }
-
//----------- printing funtions -----------
function print_header() {