]> git.mjollnir.org Git - moodle.git/commitdiff
mod-scorm MDL-20261 Added functions to extend navigation and removed update this...
authorSam Hemelryk <sam@moodle.com>
Wed, 23 Dec 2009 01:47:57 +0000 (01:47 +0000)
committerSam Hemelryk <sam@moodle.com>
Wed, 23 Dec 2009 01:47:57 +0000 (01:47 +0000)
lang/en_utf8/scorm.php
mod/scorm/lib.php
mod/scorm/player.php
mod/scorm/view.php

index 81977d899690586c69aff450978296bcd1a19922..5e56041ebb7f323234cf7b25ef2980e5d8bc0fc5 100644 (file)
@@ -155,6 +155,7 @@ $string['scorm:savetrack'] = 'Save tracks';
 $string['scorm:skipview'] = 'Skip overview';
 $string['scorm:viewreport'] = 'View reports';
 $string['scorm:viewscores'] = 'View scores';
+$string['scormadministration'] = 'SCORM/AICC administration';
 $string['scormclose'] = 'Until';
 $string['scormcourse'] = 'Learning Course';
 $string['scormopen'] = 'Open';
index 147a36b927cfd0285013a757148039bec8cfa8ce..42c90a8367686544e3444e86a3728845896ef337 100755 (executable)
@@ -938,3 +938,54 @@ function scorm_supports($feature) {
         default: return null;
     }
 }
+
+/**
+ * This function extends the global navigaiton for the site.
+ * It is important to note that you should not rely on PAGE objects within this
+ * body of code as there is no guarantee that during an AJAX request they are
+ * available
+ *
+ * @param navigation_node $navigation The scorm node within the global navigation
+ * @param stdClass $course The course object returned from the DB
+ * @param stdClass $module The module object returned from the DB
+ * @param stdClass $cm The course module isntance returned from the DB
+ */
+function scorm_extend_navigation($navigation, $course, $module, $cm) {
+    /**
+     * This is currently just a stub so that it can be easily expanded upon.
+     * When expanding just remove this comment and the line below and then add
+     * you content.
+     */
+    $navigation->nodetype = navigation_node::NODETYPE_LEAF;
+}
+
+/**
+ * This function extends the settings navigation block for the site.
+ *
+ * It is safe to rely on PAGE here as we will only ever be within the module
+ * context when this is called.
+ *
+ * @param settings_navigation $settings
+ * @param stdClass $module
+ */
+function scorm_extend_settings_navigation($settings, $module) {
+    global $PAGE, $CFG, $DB;
+
+    // Load the scorm instance from the database
+    $scorm = $DB->get_record('scorm', array('id'=>$PAGE->cm->instance));
+    // Add a scorm node to the settings navigation.
+    $scormnavkey = $settings->add(get_string('scormadministration', 'scorm'));
+    $scormnav = $settings->get($scormnavkey);
+    $scormnav->forceopen = true;
+
+    // If the user has the capability add an update this module link for the scorm instance
+    if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
+        $url = new moodle_url($CFG->wwwroot.'/course/mod.php', array('update'=>$PAGE->cm->id, 'return'=>true, 'sesskey'=>sesskey()));
+        $scormnav->add(get_string('updatethis', '', get_string('modulename', 'scorm')), $url);
+    }
+
+    // Check if any children have been added. If not remove the node to save on clutter.
+    if (count($scormnav->children)<1) {
+        $settings->remove_child($scormnavkey);
+    }
+}
\ No newline at end of file
index bf07086f5406cc90b715056764b1bbbd648a0ba7..f35a41d87a38f3d8c936998dd304a0bf11ad3c59 100755 (executable)
@@ -76,7 +76,6 @@
     $PAGE->set_title($pagetitle);
     $PAGE->set_heading($course->fullname);
     $PAGE->navbar->add(format_string($scorm->name,true), new moodle_url($CFG->wwwroot.'/mode/scorm/view.php', array('id'=>$cm->id)));
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'scorm'));
 
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_COURSE,$course->id))) {
         echo $OUTPUT->header();
 
     $exitlink = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$scorm->course.'" title="'.$strexit.'">'.$strexit.'</a> ';
 
-    $PAGE->set_button($exitlink.$OUTPUT->update_module_button($cm->id, 'scorm'));
+    $PAGE->set_button($exitlink);
 
     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();
index 770acfe654c6b17c98c4feea1b6b3a1548a545c2..fd19ffadf83d3c0a86a5b0159132f87745333772 100755 (executable)
@@ -61,7 +61,6 @@
     //
     $PAGE->set_title($pagetitle);
     $PAGE->set_heading($course->fullname);
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'scorm'));
     echo $OUTPUT->header();
 
     if (has_capability('mod/scorm:viewreport', $context)) {