]> git.mjollnir.org Git - moodle.git/commitdiff
scorm MDL-19815 Upgraded print_header and build_navigation calls to use PAGE and...
authorsamhemelryk <samhemelryk>
Fri, 4 Sep 2009 01:41:51 +0000 (01:41 +0000)
committersamhemelryk <samhemelryk>
Fri, 4 Sep 2009 01:41:51 +0000 (01:41 +0000)
mod/scorm/index.php
mod/scorm/player.php
mod/scorm/report.php
mod/scorm/view.php

index 3bc18e1e330b4720b2715619752e350fcb96ebe3..b0dc915331a151f8637425bd8698ad383030c2e6 100755 (executable)
     $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";
index d3d77ae2c5902d7b28208a8cc0c237d7cdc0a957..d3d2a9bd4dff5eb06f8c7a8f8ccb378668599963 100755 (executable)
     $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;
     $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;
         $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))->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');
+    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();
 
+    $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));
index c19f9cd9152559007eaab93ffce8a68898cdc819..0756e0549142bea913b69390cc5dc5ab45bce169 100755 (executable)
         $strattempt  = get_string('attempt', 'scorm');
         $strname  = get_string('name');
 
-        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);
+        $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)));
 
-                print_header("$course->shortname: ".format_string($scorm->name), $course->fullname,
-                             $navigation, '', '', true);
+        if (empty($b)) {
+            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));
     }
 
index 6478e91cc03657f0561a8d66d19b9cb658423a45..a6bc100563926a570049285eeb0a9696d27d4e52 100755 (executable)
     //
     // 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)) {