mod-hotpot MDL-19810 Updated print_header and build_navigation to OUTPUT and PAGE equivalents

This commit is contained in:
samhemelryk
2009-09-07 03:55:32 +00:00
parent e6855d1aa0
commit cfe1d03998
5 changed files with 33 additions and 38 deletions
+4 -9
View File
@@ -28,15 +28,10 @@
$quotes = array("'"=>"\'", '"'=>'"');
// Print the header
$title = format_string($course->shortname) . ": $strmodulenameplural";
$heading = $course->fullname;
$navlinks = array();
$navlinks[] = array('name' => $strmodulenameplural, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($navlinks);
print_header($title, $heading, $navigation, "", "", true, "", navmenu($course));
$PAGE->navbar->add($strmodulenameplural);
$PAGE->set_title(format_string($course->shortname) . ": $strmodulenameplural");
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
$next_url = "$CFG->wwwroot/course/view.php?id=$course->id";
+7 -7
View File
@@ -426,9 +426,6 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) {
global $OUTPUT;
$strmodulenameplural = get_string("modulenameplural", "hotpot");
$strmodulename = get_string("modulename", "hotpot");
$title = format_string($course->shortname) . ": $hotpot->name";
$heading = $course->fullname;
$modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id);
if (has_capability('mod/hotpot:viewreport',$modulecontext)) {
@@ -438,13 +435,16 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) {
$module = "hotpot";
}
$navigation = build_navigation(get_string("report$mode", $module), $cm);
$PAGE->navbar->add(get_string("report$mode", $module));
} else {
$navigation = build_navigation(get_string("report", "quiz"), $cm);
$PAGE->navbar->add(get_string("report", "quiz"));
}
$button = update_module_button($cm->id, $course->id, $strmodulename);
print_header($title, $heading, $navigation, "", "", true, $button, navmenu($course, $cm));
$PAGE->set_title(format_string($course->shortname) . ": $hotpot->name");
$PAGE->set_heading($course->fullname);
$PAGE->set_button(update_module_button($cm->id, $course->id, $strmodulename));
echo $OUTPUT->header();
$course_context = get_context_instance(CONTEXT_COURSE, $course->id);
if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">'
+5 -6
View File
@@ -51,12 +51,11 @@
$strmodulenameplural = get_string("modulenameplural", "hotpot");
$strmodulename = get_string("modulename", "hotpot");
// print header
$title = format_string($course->shortname) . ": $hotpot->name";
$heading = $course->fullname;
$navigation = build_navigation('', $cm);
$button = update_module_button($cm->id, $course->id, $strmodulename);
print_header($title, $heading, $navigation, "", "", true, $button, navmenu($course, $cm));
$PAGE->set_title(format_string($course->shortname) . ": $hotpot->name");
$PAGE->set_heading($course->fullname);
$PAGE->set_button(update_module_button($cm->id, $course->id, $strmodulename));
echo $OUTPUT->header();
print '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
echo $OUTPUT->heading($hotpot->name);
hotpot_print_attempt_summary($hotpot, $attempt);
+3 -1
View File
@@ -19,7 +19,9 @@
$params->location = HOTPOT_LOCATION_COURSEFILES;
}
$title = get_string($params->action, 'hotpot').': '.$params->reference;
print_header($title, $title);
$PAGE->set_title($title);
$PAGE->set_heading($title);
echo $OUTPUT->header();
hotpot_print_show_links($params->course, $params->location, $params->reference);
?>
<script type="text/javascript">
+14 -15
View File
@@ -43,11 +43,15 @@
$title = format_string($course->shortname.': '.$hotpot->name, true);
$heading = $course->fullname;
$navigation = build_navigation('', $cm);
$button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot"));
$button = '<div style="font-size:0.75em;">'.$button.'</div>';
$loggedinas = '<span class="logininfo">'.user_login_string($course, $USER).'</span>';
$PAGE->set_title($title);
$PAGE->set_heading($heading);
$PAGE->set_button($button);
$PAGE->set_headingmenu($loggedinas);
$time = time();
$hppassword = optional_param('hppassword', '', PARAM_RAW);
if (HOTPOT_FIRST_ATTEMPT && !has_capability('mod/hotpot:grade', $context)) {
@@ -65,7 +69,7 @@
$error = get_string("nomoreattempts", "quiz");
// get password
} else if ($hotpot->password && empty($hppassword)) {
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas, false);
echo $OUTPUT->header();
echo $OUTPUT->heading($hotpot->name);
$boxalign = 'center';
$boxwidth = 500;
@@ -99,7 +103,7 @@
$error = get_string("quizclosed", "quiz", userdate($hotpot->timeclose))."<br />\n";
}
if ($error) {
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas, false);
echo $OUTPUT->header();
notice($error, $nextpage);
//
// script stops here, if quiz is unavailable to student
@@ -328,7 +332,7 @@
} else if ($frameset) { // HP5 v5
switch ($framename) {
case 'top':
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas);
echo $OUTPUT->header();
print $footer;
break;
default:
@@ -367,8 +371,7 @@
switch ($hotpot->navigation) {
case HOTPOT_NAVIGATION_BAR:
//update_module_button($cm->id, $course->id, $strmodulename.'" style="font-size:0.8em')
print_header($title, $heading, $navigation, "", $head.$styles.$scripts, true, $button, $loggedinas, false, $body_tags
);
print_header($title, $heading, '', "", $head.$styles.$scripts, true, $button, $loggedinas, false, $body_tags);
if (!empty($available_msg)) {
echo $OUTPUT->notification($available_msg);
}
@@ -377,7 +380,7 @@
case HOTPOT_NAVIGATION_FRAME:
switch ($framename) {
case 'top':
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas);
echo $OUTPUT->header();
print $footer;
break;
case 'main':
@@ -418,13 +421,9 @@
break;
default:
$iframe_id = 'hotpot_iframe';
$body_tags = " onload=\"set_iframe_height('$iframe_id')\"";
$iframe_js = '<script src="iframe.js" type="text/javascript"></script>'."\n";
print_header(
$title, $heading, $navigation,
"", $head.$styles.$scripts.$iframe_js, true, $button,
$loggedinas, false, $body_tags
);
$PAGE->requires->js('mod/hotpot/iframe.js');
$PAGE->requires->js_function_call('set_iframe_height', array($iframe_id))->on_dom_ready();
echo $OUTPUT->header();
if (!empty($available_msg)) {
echo $OUTPUT->notification($available_msg);
}