Skip to content

Commit

Permalink
course MDL-19794 Upgraded print_header and build_navigation calls to …
Browse files Browse the repository at this point in the history
…use PAGE and OUTPUT equivilants
  • Loading branch information
samhemelryk committed Sep 3, 2009
1 parent f716d0d commit 0a12204
Show file tree
Hide file tree
Showing 25 changed files with 182 additions and 163 deletions.
8 changes: 5 additions & 3 deletions course/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,11 @@
admin_externalpage_setup('coursemgmt', '', $urlparams, $CFG->wwwroot . '/course/category.php');
$PAGE->set_context($context); // Ensure that we are actually showing blocks etc for the cat context
admin_externalpage_print_header();
} else {
$navbaritem = print_course_search('', true, 'navbar');
print_header("$site->shortname: $category->name", "$site->fullname: $strcourses", array(), '', '', true, $navbaritem);
} else {
$PAGE->set_title("$site->shortname: $category->name");
$PAGE->set_heading("$site->fullname: $strcourses");
$PAGE->set_button(print_course_search('', true, 'navbar'));
echo $OUTPUT->header();
}

/// Print link to roles
Expand Down
30 changes: 14 additions & 16 deletions course/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@
}

$category = $DB->get_record("course_categories", array("id"=>$course->category));
$navlinks = array();

$PAGE->navbar->add($stradministration, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php/'));
$PAGE->navbar->add($strcategories, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/index.php'));
$PAGE->navbar->add($category->name, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/category.php', array('id'=>$course->category)));
if (! $delete) {
$strdeletecheck = get_string("deletecheck", "", $course->shortname);
$strdeletecoursecheck = get_string("deletecoursecheck");

$navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
$navlinks[] = array('name' => $strcategories, 'link' => "index.php", 'type' => 'misc');
$navlinks[] = array('name' => $category->name, 'link' => "category.php?id=$course->category", 'type' => 'misc');
$navlinks[] = array('name' => $strdeletecheck, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);

print_header("$site->shortname: $strdeletecheck", $site->fullname, $navigation);
$PAGE->navbar->add($strdeletecheck);
$PAGE->set_title("$site->shortname: $strdeletecheck");
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();

$message = "$strdeletecoursecheck<br /><br />" . format_string($course->fullname) . " (" . format_string($course->shortname) . ")";
echo $OUTPUT->confirm($message, "delete.php?id=$course->id&delete=".md5($course->timemodified), "category.php?id=$course->category");
Expand All @@ -62,14 +64,10 @@

$strdeletingcourse = get_string("deletingcourse", "", format_string($course->shortname));

$navlinks[] = array('name' => $stradministration, 'link' => "../$CFG->admin/index.php", 'type' => 'misc');
$navlinks[] = array('name' => $strcategories, 'link' => "index.php", 'type' => 'misc');
$navlinks[] = array('name' => $category->name, 'link' => "category.php?id=$course->category", 'type' => 'misc');
$navlinks[] = array('name' => $strdeletingcourse, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);

print_header("$site->shortname: $strdeletingcourse", $site->fullname, $navigation);

$PAGE->navbar->add($strdeletingcourse);
$PAGE->set_title("$site->shortname: $strdeletingcourse");
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading($strdeletingcourse);

delete_course($course);
Expand Down
25 changes: 10 additions & 15 deletions course/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,30 +118,25 @@
$straddnewcourse = get_string("addnewcourse");
$stradministration = get_string("administration");
$strcategories = get_string("categories");
$navlinks = array();

if (!empty($course)) {
$navlinks[] = array('name' => $streditcoursesettings,
'link' => null,
'type' => 'misc');
$PAGE->navbar->add($streditcoursesettings);
$title = $streditcoursesettings;
$fullname = $course->fullname;
} else {
$navlinks[] = array('name' => $stradministration,
'link' => "$CFG->wwwroot/$CFG->admin/index.php",
'type' => 'misc');
$navlinks[] = array('name' => $strcategories,
'link' => 'index.php',
'type' => 'misc');
$navlinks[] = array('name' => $straddnewcourse,
'link' => null,
'type' => 'misc');
$PAGE->navbar->add($stradministration, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php'));
$PAGE->navbar->add($strcategories, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/index.php'));
$PAGE->navbar->add($straddnewcourse);
$title = "$site->shortname: $straddnewcourse";
$fullname = $site->fullname;
}

$navigation = build_navigation($navlinks);
print_header($title, $fullname, $navigation, $editform->focus());
$PAGE->set_title($title);
$PAGE->set_heading($fullname);
$PAGE->set_focuscontrol($editform->focus());
echo $OUTPUT->header();
echo $OUTPUT->heading($streditcoursesettings);

$editform->display();
Expand Down
7 changes: 5 additions & 2 deletions course/enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
foreach ($roles as $role) {
if ($role->timestart and ($role->timestart >= time())) {
$message = get_string('enrolmentnotyet', '', userdate($student->timestart));
print_header();
echo $OUTPUT->header();
notice($message, "$CFG->wwwroot/index.php");
}
}
Expand All @@ -84,7 +84,10 @@
($course->enrollable == 2 && $course->enrolstartdate > 0 && $course->enrolstartdate > time()) ||
($course->enrollable == 2 && $course->enrolenddate > 0 && $course->enrolenddate <= time())
) {
print_header($course->shortname, $course->fullname, build_navigation(array(array('name'=>$course->shortname,'link'=>'','type'=>'misc'))) );
$PAGE->set_title($course->shortname);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($course->shortname);
echo $OUTPUT->header();
notice(get_string('notenrollable'), "$CFG->wwwroot/index.php");
}

Expand Down
9 changes: 5 additions & 4 deletions course/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
}

$strimport = get_string('import');
$navlinks = array();
$navlinks[] = array('name' => $strimport, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);

print_header($course->fullname.': '.$strimport, $course->fullname.': '.$strimport, $navigation);
$PAGE->set_title($course->fullname.': '.$strimport);
$PAGE->set_heading($course->fullname.': '.$strimport);
$PAGE->navbar->add($strimport);

echo $OUTPUT->header();

$imports = get_plugin_list('import');

Expand Down
19 changes: 9 additions & 10 deletions course/import/activities/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,16 @@
}
}

$navlinks = array();
$navlinks[] = array('name' => $course->shortname,
'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
'type' => 'misc');
$navlinks[] = array('name' => get_string('import'),
'link' => "$CFG->wwwroot/course/import.php?id=$course->id",
'type' => 'misc');
$navlinks[] = array('name' => $strimportactivities, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
$PAGE->navbar->add($course->shortname, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
$PAGE->navbar->add(get_string('import'), null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/import.php', array('id'=>$course->id)));
$PAGE->navbar->add($strimportactivities);

$PAGE->set_title("$course->shortname: $strimportactivities");
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();

print_header("$course->shortname: $strimportactivities", $course->fullname, $navigation);
require_once('mod.php');

echo $OUTPUT->footer();
Expand Down
20 changes: 9 additions & 11 deletions course/import/groups/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,15 @@
}

/// Print the header
$navlinks = array();
$navlinks[] = array('name' => $course->shortname,
'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
'type' => 'misc');
$navlinks[] = array('name' => get_string('import'),
'link' => "$CFG->wwwroot/course/import.php?id=$course->id",
'type' => 'misc');
$navlinks[] = array('name' => $strimportgroups, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);

print_header("$course->shortname: $strimportgroups", $course->fullname, $navigation);
$PAGE->navbar->add($course->shortname, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id)));
$PAGE->navbar->add(get_string('import'), null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/import.php', array('id'=>$course->id)));
$PAGE->navbar->add($strimportgroups);

$PAGE->set_title("$course->shortname: $strimportgroups");
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();

/// If a file has been uploaded, then process it

Expand Down
9 changes: 5 additions & 4 deletions course/importstudents.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@
$strcourses = get_string("courses");
$strshowall = get_string("showall");

print_header("$course->shortname: $strassigncourses",
$site->fullname,
build_navigation(array(array('name' => $strassigncourses, 'link' => null, 'type' => 'misc'))), "searchtext");

$PAGE->navbar->add($strassigncourses);
$PAGE->set_title("$course->shortname: $strassigncourses");
$PAGE->set_heading($site->fullname);
$PAGE->set_focuscontrol("searchtext");
echo $OUTPUT->header();

/// Print a help notice about the need to use this page

Expand Down
18 changes: 10 additions & 8 deletions course/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,23 @@
$strcourses = get_string('courses');
$strcategories = get_string('categories');

$navlinks = array();
$navlinks[] = array('name'=>$strcategories,'link'=>'','type'=>'misc');
$navigation = build_navigation($navlinks);
print_header("$site->shortname: $strcategories", $strcourses, $navigation, '', '', true, update_category_button());
$PAGE->navbar->add($strcategories);
$PAGE->set_title("$site->shortname: $strcategories");
$PAGE->set_heading($strcourses);
$PAGE->set_button(update_category_button());
echo $OUTPUT->header();
echo $OUTPUT->heading($strcategories);
echo skip_main_destination();
echo $OUTPUT->box_start('categorybox');
print_whole_category_list();
echo $OUTPUT->box_end();
print_course_search();
} else {
$strfulllistofcourses = get_string('fulllistofcourses');
print_header("$site->shortname: $strfulllistofcourses", $strfulllistofcourses,
build_navigation(array(array('name'=>$strfulllistofcourses, 'link'=>'','type'=>'misc'))),
'', '', true, update_category_button());
$PAGE->navbar->add($strfulllistofcourses);
$PAGE->set_title("$site->shortname: $strfulllistofcourses");
$PAGE->set_heading($strfulllistofcourses);
$PAGE->set_button(update_category_button());
echo $OUTPUT->header();
echo skip_main_destination();
echo $OUTPUT->box_start('courseboxes');
print_courses(0);
Expand Down
4 changes: 2 additions & 2 deletions course/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
print_error('coursehidden', '', $CFG->wwwroot .'/');
}

print_header(get_string("summaryof", "", $course->fullname));

$PAGE->set_title(get_string("summaryof", "", $course->fullname));
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($course->fullname) . '<br />(' . format_string($course->shortname) . ')');

if ($course->guest || $course->password) {
Expand Down
13 changes: 6 additions & 7 deletions course/recent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

$context = get_context_instance(CONTEXT_COURSE, $course->id);

$meta = '<meta name="robots" content="none" />'; // prevent duplicate content in search engines MDL-7299

$lastlogin = time() - COURSE_MAX_RECENT_PERIOD;
if (!isguestuser() and !empty($USER->lastcourseaccess[$COURSE->id])) {
if ($USER->lastcourseaccess[$COURSE->id] > $lastlogin) {
Expand Down Expand Up @@ -52,11 +50,12 @@
}

$strrecentactivity = get_string('recentactivity');
$navlinks = array();
$navlinks[] = array('name' => $strrecentactivity, 'link' => "recent.php?id=$course->id", 'type' => 'misc');
$navlinks[] = array('name' => $userinfo, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$course->shortname: $strrecentactivity", $course->fullname, $navigation, '', $meta);
$PAGE->navbar->add($strrecentactivity, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/recent.php', array('id'=>$course->id)));
$PAGE->navbar->add($userinfo);
$PAGE->set_title("$course->shortname: $strrecentactivity");
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($course->fullname) . ": $userinfo", 3);

$mform->display();
Expand Down
8 changes: 4 additions & 4 deletions course/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

$strreports = get_string('reports');

$navlinks = array();
$navlinks[] = array('name' => $strreports, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($course->fullname.': '.$strreports, $course->fullname.': '.$strreports, $navigation);
$PAGE->navbar->add($strreports);
$PAGE->set_title($course->fullname.': '.$strreports);
$PAGE->set_heading($course->fullname.': '.$strreports);
echo $OUTPUT->header();

$reports = get_plugin_list('coursereport');

Expand Down
23 changes: 14 additions & 9 deletions course/report/log/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@
admin_externalpage_print_header();

} else {
$navlinks[] = array('name' => $strreports, 'link' => "$CFG->wwwroot/course/report.php?id=$course->id", 'type' => 'misc');
$navlinks[] = array('name' => $strlogs, 'link' => "index.php?id=$course->id", 'type' => 'misc');
$navlinks[] = array('name' => "$userinfo, $dateinfo", 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($course->shortname .': '. $strlogs, $course->fullname, $navigation);
$PAGE->set_title($course->shortname .': '. $strlogs);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
$PAGE->navbar->add($strlogs, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/index.php', array('id'=>$course->id)));
$PAGE->navbar->add("$userinfo, $dateinfo");
echo $OUTPUT->header();
}

echo $OUTPUT->heading(format_string($course->fullname) . ": $userinfo, $dateinfo (".usertimezone().")");
Expand Down Expand Up @@ -128,10 +131,12 @@
admin_externalpage_setup('reportlog');
admin_externalpage_print_header();
} else {
$navlinks[] = array('name' => $strreports, 'link' => "$CFG->wwwroot/course/report.php?id=$course->id", 'type' => 'misc');
$navlinks[] = array('name' => $strlogs, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($course->shortname .': '. $strlogs, $course->fullname, $navigation, '');
$PAGE->set_title($course->shortname .': '. $strlogs);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
$PAGE->navbar->add($strlogs);
echo $OUTPUT->header();
}

echo $OUTPUT->heading(get_string('chooselogs') .':');
Expand Down
11 changes: 6 additions & 5 deletions course/report/log/indexlive.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
admin_externalpage_print_header();

} else {
$navlinks = array();
$navlinks[] = array('name' => $strreports, 'link' => "$CFG->wwwroot/course/report.php?id=$course->id", 'type' => 'misc');
$navlinks[] = array('name' => $strlogs, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($course->shortname .': '. $strlogs, $course->fullname, $navigation, '');
$PAGE->set_title($course->shortname .': '. $strlogs);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
$PAGE->navbar->add($strlogs);
echo $OUTPUT->header();
}

echo $OUTPUT->heading(get_string('loglive', 'coursereport_log'));
Expand Down
13 changes: 6 additions & 7 deletions course/report/outline/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@
$strreports = get_string('reports');
$strviews = get_string('views');

$navlinks = array();
$navlinks[] = array('name' => $strreports, 'link' => "../../report.php?id=$course->id", 'type' => 'misc');
$navlinks[] = array('name' => $stractivityreport, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);

print_header("$course->shortname: $stractivityreport", $course->fullname, $navigation);

$PAGE->set_title($course->shortname .': '. $stractivityreport);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
$PAGE->navbar->add($stractivityreport);
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($course->fullname));

if (!$logstart = $DB->get_field_sql("SELECT MIN(time) FROM {log}")) {
Expand Down
11 changes: 6 additions & 5 deletions course/report/participation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@
$action = '';
}

$navlinks = array();
$navlinks[] = array('name' => $strreports, 'link' => "../../report.php?id=$course->id", 'type' => 'misc');
$navlinks[] = array('name' => $strparticipation, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("$course->shortname: $strparticipation", $course->fullname, $navigation);
$PAGE->set_title($course->shortname .': '. $strparticipation);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strreports, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/course/report.php', array('id'=>$course->id)));
$PAGE->navbar->add($strparticipation);
echo $OUTPUT->header();

$modinfo = get_fast_modinfo($course);

Expand Down
Loading

0 comments on commit 0a12204

Please sign in to comment.