moodle_page: MDL-12212 remove deprecated calls from course/view.php and page_course::print_header

This commit is contained in:
tjhunt 2009-05-06 09:19:46 +00:00
parent 3179b0006a
commit 5d3e9d9fe3
4 changed files with 16 additions and 46 deletions

View File

@ -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'));

View File

@ -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

View File

@ -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;

View File

@ -1,8 +1,9 @@
<?php // $Id$
require_once("../../config.php");
require_once("lib.php");
require_once("$CFG->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