From: tjhunt Date: Wed, 6 May 2009 09:19:46 +0000 (+0000) Subject: moodle_page: MDL-12212 remove deprecated calls from course/view.php and page_course... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5d3e9d9fe33a91287ab5aa7031fa3f4ff47caee9;p=moodle.git moodle_page: MDL-12212 remove deprecated calls from course/view.php and page_course::print_header --- diff --git a/course/view.php b/course/view.php index d34ab666b1..d0d0cb83b3 100644 --- a/course/view.php +++ b/course/view.php @@ -89,7 +89,6 @@ $course->format = 'weeks'; // Default format is weeks } - $PAGE = page_create_object(PAGE_COURSE_VIEW, $course->id); $PAGE->set_url('course/view.php', array('id' => $course->id)); $PAGE->set_pagetype('course-view-' . $course->format); $PAGE->set_other_editing_capability('moodle/course:manageactivities'); @@ -193,8 +192,18 @@ $CFG->blocksdrag = $useajax; // this will add a new class to the header so we can style differently + // The "Editing On" button will be appearing only in the "main" course screen + // (i.e., no breadcrumbs other than the default one added inside this function) + $buttons = switchroles_form($course->id); + if ($PAGE->user_allowed_editing()) { + $buttons .= update_course_icon($course->id ); + } + + $title = get_string('course') . ': ' . $course->fullname; + $navigation = build_navigation(array()); + print_header($title, $course->fullname, $navigation, '', '', true, + $buttons, user_login_string($course, $USER), false, $bodytags); - $PAGE->print_header(get_string('course').': %fullname%', NULL, '', $bodytags); $completion=new completion_info($course); if($completion->is_enabled() && ajaxenabled()) { require_js(array('yui_yahoo','yui_event','yui_connection','yui_dom')); diff --git a/lib/pagelib.php b/lib/pagelib.php index 4e75d52be8..878726fbe5 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -1018,46 +1018,6 @@ class page_base extends moodle_page { * @package pages */ class page_course extends page_base { - // HTML OUTPUT SECTION - - // This function prints out the common part of the page's header. - // You should NEVER print the header "by hand" in other code. - function print_header($title, $morenavlinks=NULL, $meta='', $bodytags='', $extrabuttons='') { - global $USER, $CFG; - - $this->init_full(); - $replacements = array( - '%fullname%' => $this->course->fullname - ); - foreach($replacements as $search => $replace) { - $title = str_replace($search, $replace, $title); - } - - $navlinks = array(); - - if(!empty($morenavlinks)) { - $navlinks = array_merge($navlinks, $morenavlinks); - } - - $navigation = build_navigation($navlinks); - - // The "Editing On" button will be appearing only in the "main" course screen - // (i.e., no breadcrumbs other than the default one added inside this function) - $buttons = switchroles_form($this->course->id); - if ($this->user_allowed_editing()) { - $buttons .= update_course_icon($this->course->id ); - } - $buttons = empty($morenavlinks) ? $buttons : ' '; - - // Add any extra buttons requested (by the resource module, for example) - if ($extrabuttons != '') { - $buttons = ($buttons == ' ') ? $extrabuttons : $buttons.$extrabuttons; - } - - print_header($title, $this->course->fullname, $navigation, - '', $meta, true, $buttons, user_login_string($this->course, $USER), false, $bodytags); - } - // SELF-REPORTING SECTION // When we are creating a new page, use the data at your disposal to provide a textual representation of the diff --git a/lib/weblib.php b/lib/weblib.php index b3e326baca..cc08fa943f 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -5138,8 +5138,8 @@ function update_categories_search_button($search,$page,$perpage) { * @todo Finish documenting this function */ function navmenu($course, $cm=NULL, $targetwindow='self') { - global $CFG, $THEME, $USER, $DB; + require_once($CFG->dirroot . '/course/lib.php'); // Required for get_fast_modinfo if (empty($THEME->navmenuwidth)) { $width = 50; diff --git a/mod/forum/index.php b/mod/forum/index.php index 9c331f2e4f..5c10e99edd 100644 --- a/mod/forum/index.php +++ b/mod/forum/index.php @@ -1,8 +1,9 @@ libdir/rsslib.php"); + require_once(dirname(__FILE__) . '/../../config.php'); + require_once($CFG->dirroot . '/course/lib.php'); + require_once($CFG->dirroot . '/mod/forum/lib.php'); + require_once($CFG->libdir . '/rsslib.php'); $id = optional_param('id', 0, PARAM_INT); // Course id $subscribe = optional_param('subscribe', null, PARAM_INT); // Subscribe/Unsubscribe all forums