scorm MDL-19815 Upgraded print_header and build_navigation calls to use PAGE and OUTPUT equivilants

This commit is contained in:
samhemelryk 2009-09-04 01:41:51 +00:00
parent 1918f7e067
commit 52869011ad
4 changed files with 37 additions and 59 deletions

View File

@ -26,12 +26,9 @@
$strreport = get_string("report",'scorm');
$strlastmodified = get_string("lastmodified");
$navlinks = array();
$navlinks[] = array('name' => $strscorms, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($navlinks);
print_header_simple("$strscorms", "", $navigation,
"", "", true, "", navmenu($course));
$PAGE->set_title($strscorms);
$PAGE->navbar->add($strscorms);
echo $OUTPUT->header();
if ($course->format == "weeks" or $course->format == "topics") {
$sortorder = "cw.section ASC";

View File

@ -45,25 +45,26 @@
$strpopup = get_string('popup','scorm');
$strexit = get_string('exitactivity','scorm');
$navlinks = array();
if ($course->id != SITEID) {
if ($scorms = get_all_instances_in_course('scorm', $course)) {
// The module SCORM/AICC activity with the first id is the course
$firstscorm = current($scorms);
if (!(($course->format == 'scorm') && ($firstscorm->id == $scorm->id))) {
$navlinks[] = array('name' => $strscorms, 'link' => "index.php?id=$course->id", 'type' => 'activity');
$PAGE->navbar->add($strscorms, null ,null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/mod/scorm/index.php', array('id'=>$course->id)));
}
}
}
$pagetitle = strip_tags("$course->shortname: ".format_string($scorm->name));
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_COURSE,$course->id))) {
$navlinks[] = array('name' => format_string($scorm->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(format_string($scorm->name,true), null ,null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/mode/scorm/view.php', array('id'=>$cm->id)));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strscorm));
print_header($pagetitle, $course->fullname, $navigation,
'', '', true, update_module_button($cm->id, $course->id, $strscorm), '', false);
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_COURSE,$course->id))) {
echo $OUTPUT->header();
notice(get_string("activityiscurrentlyhidden"));
echo $OUTPUT->footer();
die;
@ -73,18 +74,12 @@
$timenow = time();
if ($scorm->timeclose !=0) {
if ($scorm->timeopen > $timenow) {
$navlinks[] = array('name' => format_string($scorm->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header($pagetitle, $course->fullname, $navigation,
'', '', true, update_module_button($cm->id, $course->id, $strscorm), '', false);
echo $OUTPUT->header();
echo $OUTPUT->box(get_string("notopenyet", "scorm", userdate($scorm->timeopen)), "generalbox boxaligncenter");
echo $OUTPUT->footer();
die;
} elseif ($timenow > $scorm->timeclose) {
$navlinks[] = array('name' => format_string($scorm->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header($pagetitle, $course->fullname, $navigation,
'', '', true, update_module_button($cm->id, $course->id, $strscorm), '', false);
echo $OUTPUT->header();
echo $OUTPUT->box(get_string("expired", "scorm", userdate($scorm->timeclose)), "generalbox boxaligncenter");
echo $OUTPUT->footer();
die;
@ -150,20 +145,18 @@
$bodyscript = 'onunload="main.close();"';
}
$navlinks[] = array('name' => format_string($scorm->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
$exitlink = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$scorm->course.'" title="'.$strexit.'">'.$strexit.'</a> ';
print_header($pagetitle, $course->fullname,
$navigation,
'', '', true, $exitlink.update_module_button($cm->id, $course->id, $strscorm), '', false, $bodyscript);
$PAGE->set_button($exitlink.update_module_button($cm->id, $course->id, $strscorm));
echo $PAGE->requires->data_for_js('scormplayerdata', Array('cwidth'=>$scorm->width,'cheight'=>$scorm->height))->in_head();
echo $PAGE->requires->js('mod/scorm/request.js')->in_head();
echo $PAGE->requires->js('mod/scorm/loaddatamodel.php?id='.$cm->id.$scoidstr.$modestr.$attemptstr)->in_head();
echo $PAGE->requires->js('mod/scorm/rd.js')->in_head();
echo $OUTPUT->header();
echo $PAGE->requires->data_for_js('scormplayerdata', Array('cwidth'=>$scorm->width,'cheight'=>$scorm->height))->asap();
echo $PAGE->requires->js('mod/scorm/request.js')->asap();
echo $PAGE->requires->js('mod/scorm/loaddatamodel.php?id='.$cm->id.$scoidstr.$modestr.$attemptstr)->asap();
echo $PAGE->requires->js('mod/scorm/rd.js')->asap();
$PAGE->requires->js_function_call('attach_resize_event');
if (($sco->previd != 0) && ((!isset($sco->previous)) || ($sco->previous == 0))) {
$scostr = '&scoid='.$sco->previd;
$PAGE->requires->js_function_call('scorm_set_prev', Array($CFG->wwwroot.'/mod/scorm/player.php?id='.$cm->id.$orgstr.$modepop.$scostr));

View File

@ -66,32 +66,21 @@
$strattempt = get_string('attempt', 'scorm');
$strname = get_string('name');
$PAGE->set_title("$course->shortname: ".format_string($scorm->name));
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strreport, null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/mod/scorm/report.php', array('id'=>$cm->id)));
if (empty($b)) {
if (empty($a)) {
$navigation = build_navigation($strreport, $cm);
print_header("$course->shortname: ".format_string($scorm->name), $course->fullname,$navigation,
'', '', true);
} else {
$navlinks = array();
$navlinks[] = array('name' => $strreport, 'link' => "report.php?id=$cm->id", 'type' => 'title');
$navlinks[] = array('name' => "$strattempt $attempt - ".fullname($userdata), 'link' => '', 'type' => 'title');
$navigation = build_navigation($navlinks, $cm);
print_header("$course->shortname: ".format_string($scorm->name), $course->fullname,
$navigation, '', '', true);
if (!empty($a)) {
$PAGE->navbar->add("$strattempt $attempt - ".fullname($userdata));
}
} else {
$navlinks = array();
$navlinks[] = array('name' => $strreport, 'link' => "report.php?id=$cm->id", 'type' => 'title');
$navlinks[] = array('name' => "$strattempt $attempt - ".fullname($userdata), 'link' => "report.php?a=$a&amp;user=$user&amp;attempt=$attempt", 'type' => 'title');
$navlinks[] = array('name' => $sco->title, 'link' => '', 'type' => 'title');
$navigation = build_navigation($navlinks, $cm);
print_header("$course->shortname: ".format_string($scorm->name), $course->fullname, $navigation,
'', '', true);
$PAGE->navbar->add("$strattempt $attempt - ".fullname($userdata), null, null, navigation_node::TYPE_CUSTOM,
new moodle_url($CFG->wwwroot.'/mod/scorm/report.php', array('a'=>$a, 'user'=>$user, 'attempt'=>$attempt)));
$PAGE->navbar->add($sco->title);
}
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($scorm->name));
}

View File

@ -53,11 +53,10 @@
//
// Print the page header
//
$navlinks = array();
$navigation = build_navigation($navlinks, $cm);
print_header($pagetitle, $course->fullname, $navigation,
'', '', true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
$PAGE->set_button(update_module_button($cm->id, $course->id, $strscorm));
echo $OUTPUT->header();
if (has_capability('mod/scorm:viewreport', $context)) {