]> git.mjollnir.org Git - moodle.git/commitdiff
mod MDL-21169 Removed update this module button and ensured there was a link in the...
authorSam Hemelryk <sam@moodle.com>
Wed, 23 Dec 2009 01:57:55 +0000 (01:57 +0000)
committerSam Hemelryk <sam@moodle.com>
Wed, 23 Dec 2009 01:57:55 +0000 (01:57 +0000)
53 files changed:
lang/en_utf8/folder.php
lang/en_utf8/imscp.php
lang/en_utf8/page.php
lang/en_utf8/url.php
mod/assignment/lib.php
mod/chat/view.php
mod/choice/report.php
mod/choice/view.php
mod/data/edit.php
mod/data/export.php
mod/data/lib.php
mod/data/templates.php
mod/data/view.php
mod/feedback/analysis.php
mod/feedback/analysis_course.php
mod/feedback/complete.php
mod/feedback/complete_guest.php
mod/feedback/delete_completed.php
mod/feedback/delete_item.php
mod/feedback/delete_template.php
mod/feedback/edit.php
mod/feedback/edit_item.php
mod/feedback/import.php
mod/feedback/mapcourse.php
mod/feedback/print.php
mod/feedback/show_entries.php
mod/feedback/show_entries_anonym.php
mod/feedback/use_templ.php
mod/feedback/view.php
mod/folder/lib.php
mod/folder/view.php
mod/glossary/deleteentry.php
mod/glossary/editcategories.php
mod/glossary/export.php
mod/glossary/import.php
mod/glossary/view.php
mod/imscp/lib.php
mod/imscp/view.php
mod/lesson/locallib.php
mod/page/lib.php
mod/page/view.php
mod/quiz/addrandom.php
mod/quiz/attempt.php
mod/quiz/attemptlib.php
mod/quiz/edit.php
mod/quiz/report/default.php
mod/quiz/review.php
mod/quiz/summary.php
mod/quiz/view.php
mod/survey/report.php
mod/survey/view.php
mod/url/lib.php
mod/url/locallib.php

index 842a765b1b2d98ee2eb48b3543a58573ecf7378c..b2a687743756676a3ea31f1a73b0ac89a4bc6a6a 100644 (file)
@@ -2,6 +2,7 @@
 
 $string['contentheader'] = 'Content';
 $string['foldercontent'] = 'Files and subfolders';
+$string['folderadministration'] = 'Folder administration';
 $string['modulename'] = 'Folder';
 $string['modulenameplural'] = 'Folders';
 $string['neverseen'] = 'Never seen';
index 5d71ccbdd44b872a2250b5629ab8c5e4dc4a60aa..414f803d2e7e271c4cd873e79af5a7d21854f042 100644 (file)
@@ -6,6 +6,7 @@ $string['contentheader'] = 'Content';
 $string['deploymenterror'] = 'Content package error!';
 $string['keepold'] = 'Archive packages';
 $string['keepoldexplain'] = 'How many packages should be archived?';
+$string['imscpadministration'] = 'IMSCP Administration';
 $string['modulename'] = 'IMS Content Package';
 $string['modulenameplural'] = 'IMS Content packages';
 $string['navigation'] = 'Navigation';
index 983c7c1b267d0a46725d22bceffb22c95057bc4a..a300273268ca16a589b49c031c6f0fc5e4e4f0ea 100644 (file)
@@ -13,6 +13,7 @@ $string['legacyfilesactive'] = 'Active';
 $string['legacyfilesdone'] = 'Finished';
 $string['modulename'] = 'Page';
 $string['modulenameplural'] = 'Pages';
+$string['pageadministration'] = 'Page administration';
 $string['popupheight'] = 'Popup height (in pixels)';
 $string['popupheightexplain'] = 'Specifies default height of popup windows.';
 $string['popupwidth'] = 'Popup width (in pixels)';
index 48f76ff5a75a05a8fead81a29dad592cbdb6cfa6..0c2507c3a119a3fabaf45f887218971a1c28627d 100644 (file)
@@ -33,3 +33,4 @@ $string['printheadingexplain'] = 'Display URL name above content? Some display t
 $string['printintro'] = 'Display URL description';
 $string['printintroexplain'] = 'Display URL description bellow content? Some display types may not display description even if enabled.';
 $string['rolesinparams'] = 'Include role names in parameters';
+$string['urladministration'] = 'URL administration';
index 011961182dcd7f6b454bf668a6dd818bb2ecce01..a3eaf7ddc7d8f7add8004c1dfc1a8562d745f78e 100644 (file)
@@ -186,7 +186,6 @@ class assignment_base {
 
         $PAGE->set_title($this->pagetitle);
         $PAGE->set_heading($this->course->fullname);
-        $PAGE->set_button($OUTPUT->update_module_button($this->cm->id, 'assignment'));
 
         echo $OUTPUT->header();
 
@@ -1126,7 +1125,6 @@ class assignment_base {
         add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id='.$this->cm->id, $this->assignment->id, $this->cm->id);
         $PAGE->navbar->add($this->strsubmissions);
         $PAGE->set_title(format_string($this->assignment->name,true));
-        $PAGE->set_button( update_module_button($cm->id, $course->id, $this->strassignment));
         echo $OUTPUT->header();
 
         $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
index 2219811c9f5bc4d849019c6a82ebc1a4136caf98..7ee891e1a062c2cd12852340548a028cf083233e 100644 (file)
 
     $title = $course->shortname . ': ' . format_string($chat->name);
 
-    $buttons = '<table><tr><td>'.$OUTPUT->update_module_button($cm->id, $cm->modname).'</td>';
     if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
-        $buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
+        $buttons = '<table><tr><td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
                 '<input type="hidden" name="id" value="'.$cm->id.'" />'.
                 '<input type="hidden" name="edit" value="'.($PAGE->user_is_editing()?'off':'on').'" />'.
-                '<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td>';
+                '<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td></tr></table>';
+        $PAGE->set_button($buttons);
     }
-    $buttons .= '</tr></table>';
 
     $PAGE->set_title($title);
     $PAGE->set_heading($course->fullname);
-    $PAGE->set_button($buttons);
     echo $OUTPUT->header();
 
     /// Check to see if groups are being used here
index 7812ea3667344570d308df655de1c11c9ad3fa44..7428ac58f4a1a94ed4cb8689d4e39aa7d35bd1be 100644 (file)
@@ -53,7 +53,6 @@
     if (!$download) {
         $PAGE->navbar->add($strresponses);
         $PAGE->set_title(format_string($choice->name).": $strresponses");
-        $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'choice'));
         echo $OUTPUT->header();
         /// Check to see if groups are being used in this choice
         $groupmode = groups_get_activity_groupmode($cm);
index c8ebe40b4671377f97e61dc5dd9f78edce2deee6..a2ed7ec55774b7a2aa8b3b1f7aab730fffe05a66 100644 (file)
@@ -43,7 +43,6 @@
     }
 
     $PAGE->set_title(format_string($choice->name));
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'choice'));
     echo $OUTPUT->header();
 
 /// Submit any new data if there is any
index ffafe10ee9be2ede473a489e27a4ba409e9a7b50..b6c91db4a21ecce05fa4b1ec9b683e868011bc3a 100755 (executable)
@@ -131,7 +131,6 @@ if ($rid) {
 }
 
 $PAGE->set_title($data->name);
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'data'));
 echo $OUTPUT->header();
 
 /// Check to see if groups are being used here
index 85a5eddae10111757e04a337ece053dddeba4853..9489d13c3854a6c7180891f3115e9e7421c64edb 100644 (file)
@@ -83,7 +83,6 @@ if($mform->is_cancelled()) {
 } elseif (!$formdata = (array) $mform->get_data()) {
     // build header to match the rest of the UI
     $PAGE->set_title($data->name);
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'data'));
     echo $OUTPUT->header();
     echo $OUTPUT->heading(format_string($data->name));
 
index d9bc28f9a7d8f2be9274c763a27159a5b5c1e720..a9ec74b3bc4f49f4b43b5e0378822eb0af7b6826 100755 (executable)
@@ -1984,7 +1984,6 @@ function data_print_header($course, $cm, $data, $currenttab='') {
     global $CFG, $displaynoticegood, $displaynoticebad, $OUTPUT, $PAGE;
 
     $PAGE->set_title($data->name);
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'data'));
     echo $OUTPUT->header();
     echo $OUTPUT->heading(format_string($data->name));
 
index 9855a0e2e217eaccc7a71dffd8324d3d2c842ab4..21214c43d7856384502b903cac07c579546fd280 100755 (executable)
@@ -91,7 +91,6 @@ $bodytag .= '" ';
 $PAGE->navbar->add(get_string($mode,'data'));
 $PAGE->requires->js('mod/data/data.js');
 $PAGE->set_title($data->name);
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'data'));
 echo $OUTPUT->header();
 echo $OUTPUT->heading(format_string($data->name));
 
index d52b72d60759235c06fc766af30d9cf763c8a68e..35b8e8a2c898ac30be900720fbf4535966d928d3 100755 (executable)
     // The code will be much nicer than this eventually.
     $title = $course->shortname.': ' . format_string($data->name);
 
-    $buttons = '<table><tr><td>'.$OUTPUT->update_module_button($cm->id, $cm->modname).'</td>';
     if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
-        $buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
+        $buttons = '<table><tr><td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
             '<input type="hidden" name="id" value="'.$cm->id.'" />'.
             '<input type="hidden" name="edit" value="'.($PAGE->user_is_editing()?'off':'on').'" />'.
-            '<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td>';
+            '<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td></tr></table>';
+        $PAGE->set_button($buttons);
     }
-    $buttons .= '</tr></table>';
 
     if ($mode == 'asearch') {
         $PAGE->navbar->add(get_string('search'));
 
     $PAGE->set_title($title);
     $PAGE->set_heading($course->fullname);
-    $PAGE->set_button($buttons);
+    
     echo $OUTPUT->header();
 
 /// Check to see if groups are being used here
index 46ccb985546bc6471a95607ded39e0071e4ab5db..4636414d515d6182b47127f60b8b39e5e6ed6c8a 100644 (file)
@@ -65,7 +65,6 @@ $strfeedback  = get_string("modulename", "feedback");
 
 $PAGE->navbar->add(get_string('analysis','feedback'));
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 /// print the tabs
index 67b5bbddd4a7443d9b4ab5e612f6735ff1272d7a..5e5f9f30af705dd82722acc49af0dbbdfd456d1b 100644 (file)
@@ -73,7 +73,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
 $PAGE->navbar->add(format_string($feedback->name));
 
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 /// print the tabs
index bfd24b36a280ff2c1f53e52f2091b0c4cac956fb..4f994c22e37e3cb7485ff6a9924a351f94e7b24a 100644 (file)
@@ -127,7 +127,6 @@ $strfeedback  = get_string("modulename", "feedback");
 $PAGE->navbar->add(get_string('feedback:complete', 'feedback'));
 $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/complete.php', array('id'=>$cm->id, 'gopage'=>$gopage, 'courseid'=>$course->id)));
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 //ishidden check.
index 0c07c177b550f9785369d8141d3727e3fbaec311..43318e8e1c2b28540f9cd83528c1c06e7e0c8aec 100644 (file)
@@ -131,7 +131,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
 $PAGE->navbar->add(format_string($feedback->name));
 
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 //ishidden check. hidden feedbacks except feedbacks on mainsite are only accessible with related capabilities
index c094887f52af8fedc171b8a9f605e0f912c163bc..2b565025e1b653c7a40ecb109c56605f2e7c87de 100644 (file)
@@ -70,7 +70,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
 $PAGE->navbar->add(format_string($feedback->name));
 
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 /// Print the main part of the page
index aa975be19a9e68c06ed31486989f924ea61a831c..eb4ff951033974cce9e5606a7187be12af87b294 100644 (file)
@@ -62,7 +62,6 @@
     $PAGE->navbar->add(format_string($feedback->name));
 
     $PAGE->set_title(format_string($feedback->name));
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
     echo $OUTPUT->header();
 
     /// Print the main part of the page
index 4ebfdfb37a70fdb18013f4efb3e0b64e76b0e6e5..fbd6f207e63d74f5ec06662d6902de20bedf181b 100644 (file)
@@ -87,7 +87,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
 $PAGE->navbar->add(format_string($feedback->name));
 
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 /// print the tabs
index 3e081b7bb892168cb80bddfa54e4119012f521d5..f6c082942f33d469c18e1d1089b889992ba669e2 100644 (file)
@@ -152,7 +152,6 @@ if ($do_show == 'edit') {
 }
 $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/edit.php', array('id'=>$cm->id, 'do_show'=>$do_show)));
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 /// print the tabs
index 3ac893703d76f74a7b5151beb65bcf55baf59054..25adb1272c98554ee65cf85e7bb2dfadfaab686b 100644 (file)
@@ -170,7 +170,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
 $PAGE->navbar->add(format_string($feedback->name));
 
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 /// print the tabs
 include('tabs.php');
index 44d3a012aa5b9ca76b2380d1addfc7b4fba5befa..0a9fd2e1f6f723c4afd2c37ac1a6baa155f23337 100644 (file)
@@ -88,7 +88,6 @@
     $PAGE->navbar->add(format_string($feedback->name));
 
     $PAGE->set_title(format_string($feedback->name));
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
     echo $OUTPUT->header();
 
     /// Print the main part of the page
index 97c2c23d216a6ddec907f614e868e34d1d5329da..8b413d162e36f727919e4dac2ce12ca129185975 100644 (file)
@@ -77,7 +77,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
 $PAGE->navbar->add(format_string($feedback->name));
 
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 include('tabs.php');
index 615eeb682c5df7d8c3b49a18ffc69b06a536e867..c416f4703dd59897f82aef6dd8c881443855a156 100644 (file)
@@ -46,7 +46,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
 $PAGE->navbar->add(format_string($feedback->name));
 
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 /// Print the main part of the page
index 074db2878cb89878e3e291d4851591f6a4213706..75547aa7d55a32693bb823cf4e3e9ebe0538a423 100644 (file)
@@ -71,7 +71,6 @@ $strfeedback  = get_string("modulename", "feedback");
 
 $PAGE->navbar->add(get_string('show_entries','feedback'));
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 include('tabs.php');
index 98257b4b0afcdd5a1a72da86c587305f5bc65e32..e9a30f0da47e73c3dcff6e9ceff6f8c87246fb3b 100644 (file)
@@ -72,7 +72,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
 $PAGE->navbar->add(format_string($feedback->name));
 
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 /// Print the main part of the page
index 734ed42683640777a848030d4b67deec13be32fb..47fec370a23701edd729d16ecab12695127a5841 100644 (file)
@@ -73,7 +73,6 @@ $PAGE->navbar->add($strfeedbacks, new moodle_url($CFG->wwwroot.'/mod/feedback/in
 $PAGE->navbar->add(format_string($feedback->name));
 
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 /// Print the main part of the page
index f8116592c6f4c8ed012865c94fbf135a775a9384..882c0069be5506ae8def046eab5f7f90653d71d9 100644 (file)
@@ -82,7 +82,6 @@ $strfeedback  = get_string("modulename", "feedback");
 
 $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/feedback/view.php', array('id'=>$cm->id, 'do_show'=>'view')));
 $PAGE->set_title(format_string($feedback->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'feedback'));
 echo $OUTPUT->header();
 
 //ishidden check.
index 4842edccd0136e9ec1f9e850a010747e510c6910..895417daae6c438b2cb61da0ad42d869dc4ee292 100644 (file)
@@ -306,3 +306,54 @@ function folder_pluginfile($course, $cminfo, $context, $filearea, $args, $forced
     // finally send the file
     send_stored_file($file, 86400, 0, $forcedownload);
 }
+
+/**
+ * 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 folder 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 folder_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 folder_extend_settings_navigation($settings, $module) {
+    global $PAGE, $CFG, $DB;
+
+    // Load the folder instance from the database
+    $folder = $DB->get_record('folder', array('id'=>$PAGE->cm->instance));
+    // Add a folder node to the settings navigation.
+    $foldernavkey = $settings->add(get_string('folderadministration', 'folder'));
+    $foldernav = $settings->get($foldernavkey);
+    $foldernav->forceopen = true;
+
+    // If the user has the capability add an update this module link for the folder 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()));
+        $foldernav->add(get_string('updatethis', '', get_string('modulename', 'folder')), $url);
+    }
+
+    // Check if any children have been added. If not remove the node to save on clutter.
+    if (count($foldernav->children)<1) {
+        $settings->remove_child($foldernavkey);
+    }
+}
\ No newline at end of file
index 785981d53cd36ba0462f16f981e1bd3d5d7cc1ab..b217f6aecb8c2e501cf7f6a4ac4bfd4a2640faa5 100644 (file)
@@ -53,7 +53,6 @@ $PAGE->requires->js('mod/folder/functions.js');
 $PAGE->set_title($course->shortname.': '.$folder->name);
 $PAGE->set_heading($course->fullname);
 $PAGE->set_activity_record($folder);
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'folder'));
 echo $OUTPUT->header();
 
 echo $OUTPUT->heading(format_string($folder->name), 2);
index 674f017c801691b3895feae14e563e7861dfd280..7aaa3af73c79529420a35f263a8a05ec649d78da 100644 (file)
@@ -103,7 +103,6 @@ if ($confirm and confirm_sesskey()) { // the operation was confirmed.
 
 } else {        // the operation has not been confirmed yet so ask the user to do so
     $PAGE->set_title(format_string($glossary->name));
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
     echo $OUTPUT->header();
     $areyousure = "<b>".format_string($entry->concept)."</b><p>$strareyousuredelete</p>";
     $linkyes    = 'deleteentry.php';
index a2bfa24269c75aeb49f7869b3d3464d8793cd19f..4a2dcae74606e680adc842eeebdf0bfda628cb9b 100644 (file)
@@ -73,7 +73,6 @@ $PAGE->navbar->add($strglossaries, new moodle_url($CFG->wwwroot.'/mod/glossary/i
 $PAGE->navbar->add(format_string($glossary->name),  new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->id,'tab'=>'GLOSSARY_CATEGORY_VIEW')));
 $PAGE->navbar->add(get_string("categories","glossary"));
 $PAGE->set_title(format_string($glossary->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
 echo $OUTPUT->header();
 
 if ( $hook >0 ) {
index bb1f46840e5859e5b62701449f9886e32703e6c7..decac245fb483ea2d6841fb764bcc09224862654 100644 (file)
@@ -52,7 +52,6 @@ $strexportentries = get_string('exportentriestoxml', 'glossary');
 $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/export.php', array('id'=>$cm->id)));
 $PAGE->navbar->add($strexportentries);
 $PAGE->set_title(format_string($glossary->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
 
 echo $OUTPUT->header();
 echo $OUTPUT->heading($strexportentries);
index c93c54a5c017bc3b330c483bceb8cb43bfaf3c22..9080713b45d7e95e2ad27d671f1d1c441ede2831 100644 (file)
@@ -68,7 +68,6 @@ $strimportentries = get_string('importentriesfromxml', 'glossary');
 $PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/import.php', array('id'=>$cm->id, 'mode'=>$mode, 'hook'=>$hook)));
 $PAGE->navbar->add($strimportentries);
 $PAGE->set_title(format_string($glossary->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
 
 echo $OUTPUT->header();
 echo $OUTPUT->heading($strimportentries);
index 1467818fa7f3df0067a3a1951936c3186c6ca93b..ca056867f3a703069b838d574379416dae3fc7d6 100644 (file)
@@ -230,7 +230,6 @@ $strwaitingapproval = get_string('waitingapproval', 'glossary');
 
 /// If we are in approval mode, prit special header
 $PAGE->set_title(format_string($glossary->name));
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
 $url = new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->id));
 if (isset($mode)) {
     $url->param('mode', $mode);
index 1ab3519e0d5e2fe41f95b1dc6ce9858db4eb1574..25f5173b5099354b5f6e15502daafc894b3f7442 100644 (file)
@@ -373,3 +373,54 @@ function imscp_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedo
         return false;
     }
 }
+
+/**
+ * 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 imscp 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 imscp_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 imscp_extend_settings_navigation($settings, $module) {
+    global $PAGE, $CFG, $DB;
+
+    // Load the imscp instance from the database
+    $imscp = $DB->get_record('imscp', array('id'=>$PAGE->cm->instance));
+    // Add a imscp node to the settings navigation.
+    $imscpnavkey = $settings->add(get_string('imscpadministration', 'imscp'));
+    $imscpnav = $settings->get($imscpnavkey);
+    $imscpnav->forceopen = true;
+
+    // If the user has the capability add an update this module link for the imscp instance
+    if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
+        $imscp = new moodle_imscp($CFG->wwwroot.'/course/mod.php', array('update'=>$PAGE->cm->id, 'return'=>true, 'sesskey'=>sesskey()));
+        $imscpnav->add(get_string('updatethis', '', get_string('modulename', 'imscp')), $imscp);
+    }
+
+    // Check if any children have been added. If not remove the node to save on clutter.
+    if (count($imscpnav->children)<1) {
+        $settings->remove_child($imscpnavkey);
+    }
+}
\ No newline at end of file
index 92f57e76860c1cca828e7d52059b1a343843d52c..4cb7f94138289dd68cef1b7d3f4a12933dfbc627 100644 (file)
@@ -67,7 +67,6 @@ $PAGE->requires->string_for_js('show', 'moodle');
 $PAGE->set_title($course->shortname.': '.$imscp->name);
 $PAGE->set_heading($course->fullname);
 $PAGE->set_activity_record($imscp);
-$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'imscp'));
 echo $OUTPUT->header();
 
 // verify imsmanifest was parsed properly
index 90ad679cd3fa1cc5015e80768d2510eb92189c92..e02d9601a9adae8c6d45434bf334019bd515e6d7 100644 (file)
@@ -562,19 +562,14 @@ function lesson_menu_block_contents($cmid, $lesson) {
  */
 function lesson_add_header_buttons($cm, $context, $extraeditbuttons=false, $lessonpageid=null) {
     global $CFG, $PAGE, $OUTPUT;
-    if (has_capability('mod/lesson:edit', $context)) {
-        $buttons = $OUTPUT->update_module_button($cm->id, 'lesson');
-        if ($extraeditbuttons) {
-            if ($lessonpageid === null) {
-                print_error('invalidpageid', 'lesson');
-            }
-            if (!empty($lessonpageid) && $lessonpageid != LESSON_EOL) {
-                $options = array('id'=>$cm->id, 'redirect'=>'navigation', 'pageid'=>$lessonpageid);
-                $buttonform = html_form::make_button($CFG->wwwroot.'/mod/lesson/lesson.php', $options, get_string('editpagecontent', 'lesson'));
-                $buttons .= $OUTPUT->button($buttonform);
-            }
-            $buttons = $OUTPUT->box($buttons, 'edit_buttons');
+    if (has_capability('mod/lesson:edit', $context) && $extraeditbuttons) {
+        if ($lessonpageid === null) {
+            print_error('invalidpageid', 'lesson');
+        }
+        if (!empty($lessonpageid) && $lessonpageid != LESSON_EOL) {
+            $options = array('id'=>$cm->id, 'redirect'=>'navigation', 'pageid'=>$lessonpageid);
+            $buttonform = html_form::make_button($CFG->wwwroot.'/mod/lesson/lesson.php', $options, get_string('editpagecontent', 'lesson'));
+            $PAGE->set_button($OUTPUT->button($buttonform));
         }
-        $PAGE->set_button($buttons);
     }
 }
\ No newline at end of file
index 01fb5a68897ca7f9ae4a320c364e2106e8efd65f..5507f00386c3ff75d264e65c45b85f66751227a3 100644 (file)
@@ -378,3 +378,55 @@ function page_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedow
     // finally send the file
     send_stored_file($file, 86400, 0, $forcedownload);
 }
+
+
+/**
+ * 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 page 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 page_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 page_extend_settings_navigation($settings, $module) {
+    global $PAGE, $CFG, $DB;
+
+    // Load the page instance from the database
+    $page = $DB->get_record('page', array('id'=>$PAGE->cm->instance));
+    // Add a page node to the settings navigation.
+    $pagenavkey = $settings->add(get_string('pageadministration', 'page'));
+    $pagenav = $settings->get($pagenavkey);
+    $pagenav->forceopen = true;
+
+    // If the user has the capability add an update this module link for the page 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()));
+        $pagenav->add(get_string('updatethis', '', get_string('modulename', 'page')), $url);
+    }
+
+    // Check if any children have been added. If not remove the node to save on clutter.
+    if (count($pagenav->children)<1) {
+        $settings->remove_child($pagenavkey);
+    }
+}
\ No newline at end of file
index c0fd27976b24c93aed62a0e890e8934eaf8b5d12..e995639426f32dd4ab618da80c6dafcfe77afbc2 100644 (file)
@@ -70,7 +70,6 @@ if ($inpopup and $page->display == RESOURCELIB_DISPLAY_POPUP) {
     $PAGE->set_title($course->shortname.': '.$page->name);
     $PAGE->set_heading($course->fullname);
     $PAGE->set_activity_record($page);
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'page'));
     echo $OUTPUT->header();
 
     if (!empty($options['printheading'])) {
index a1e6db45285b88a6a06f964c59daec0b0358b519..e477a4bf4be66921b7f0ba71e166ac7dfb2e21c4 100644 (file)
@@ -76,13 +76,8 @@ if (! $course = $DB->get_record('course', array('id' => $quiz->course))) {
 require_capability('mod/quiz:manage', $contexts->lowest());
 
 // Print basic page layout.
-$strupdatemodule = '';
-if (has_capability('moodle/course:manageactivities', $contexts->lowest())) {
-    $strupdatemodule = $OUTPUT->update_module_button($cm->id, 'quiz');
-}
 $PAGE->navbar->add($streditingquiz);
 $PAGE->set_title($streditingquiz);
-$PAGE->set_button($strupdatemodule);
 echo $OUTPUT->header();
 
 if (!$quizname = $DB->get_field($cm->modname, 'name', array('id' => $cm->instance))) {
index 9242b15db4ca13a99f243fefd7665f1ec40ce195..1a88d0ebc9f1918f2997462464c7269cb1fcbed2 100644 (file)
         echo $OUTPUT->header();
     } else {
         $PAGE->set_title(format_string($attemptobj->get_quiz_name()));
-        $PAGE->set_button($attemptobj->update_module_button());
         echo $OUTPUT->header();
     }
     echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
index 7209f507f03b5a946c09d2b0fccbc14f6599a695..4d8631a4cb253dcaf91caf9a0a1f146f9787355d 100644 (file)
@@ -315,21 +315,6 @@ class quiz {
     }
 
     // Bits of content =====================================================================
-    /**
-     * @return string the HTML snipped that needs to be supplied to print_header_simple
-     * as the $button parameter.
-     */
-    public function update_module_button() {
-        global $OUTPUT ;
-        if (has_capability('moodle/course:manageactivities',
-                get_context_instance(CONTEXT_COURSE, $this->course->id))) {
-
-
-            return $OUTPUT->update_module_button($this->cm->id, 'quiz');
-        } else {
-            return '';
-        }
-    }
 
     /**
      * @param string $title the name of this particular quiz page.
index 0f98ab10ae3577cb43fe2dbd26fc78b18e08f8fe..1b1576ba1bc2a53efb9d339b843c6d0ef7587f21 100644 (file)
@@ -438,17 +438,13 @@ $questionbank->process_actions($thispageurl, $cm);
 $questionbankmanagement = '<a href="'.$CFG->wwwroot.
         '/question/edit.php?courseid='.$course->id.'">'.
         get_string('questionbankmanagement', 'quiz').'</a> ';
-$strupdatemodule = has_capability('moodle/course:manageactivities',
-        $contexts->lowest()) ?
-        $OUTPUT->update_module_button($cm->id, 'quiz') :
-        "";
 
 $PAGE->navbar->add($pagetitle);
 $PAGE->requires->skip_link_to('questionbank',  get_string('skipto', 'access', get_string('questionbank', 'question')));
 $PAGE->requires->skip_link_to('quizcontentsblock',  get_string('skipto', 'access', get_string('questionsinthisquiz', 'quiz')));
 
 $PAGE->set_title($pagetitle);
-$PAGE->set_button($questionbankmanagement.$strupdatemodule);
+$PAGE->set_button($questionbankmanagement);
 echo $OUTPUT->header();
 
 // Initialise the JavaScript.
index 52d6e921de03d7593ccdf1e63f9c6d9cac5e11eb..dd75cf9477410a6d4c651b01e46c88a2691cdf0d 100644 (file)
@@ -28,7 +28,6 @@ class quiz_default_report {
         $strquiz  = get_string("modulename", "quiz");
     /// Print the page header
         $PAGE->set_title(format_string($quiz->name));
-        $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'quiz'));
         echo $OUTPUT->header();
     /// Print the tabs
         $currenttab = 'reports';
index bbc77a6086274a46d217bb818ba1f814759bcfdd..015697d87603fa8222d50f32cf8b2cfbc0486a51 100644 (file)
@@ -99,7 +99,6 @@
     } else {
         $attemptobj->navigation($strreviewtitle);
         $PAGE->set_title(format_string($attemptobj->get_quiz_name()));
-        $PAGE->set_button($attemptobj->update_module_button());
         echo $OUTPUT->header();
     }
     echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
index 8780cb38be668eddafe5d2f174e40dfc311f2d1d..0f918e4ee4975f15ac65b70dde7c2ec8fedde9c2 100644 (file)
@@ -59,7 +59,6 @@ if ($accessmanager->securewindow_required($attemptobj->is_preview_user())) {
 } else {
     $attemptobj->navigation($title);
     $PAGE->set_title(format_string($attemptobj->get_quiz_name()));
-    $PAGE->set_button($attemptobj->update_module_button());
     echo $OUTPUT->header();
 }
 
index 14ac628a6ce189e7e7373d37fe7d6dacb5d236f7..7cd5df7e9ea5c1950820e87c4f1e043b73defcab 100644 (file)
     // The code will be much nicer than this eventually.
     $title = $course->shortname . ': ' . format_string($quiz->name);
 
-    $buttons = '<table><tr><td>'.$OUTPUT->update_module_button($cm->id, $cm->modname).'</td>';
     if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
-        $buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
+        $buttons = '<table><tr><td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
             '<input type="hidden" name="id" value="'.$cm->id.'" />'.
             '<input type="hidden" name="edit" value="'.($PAGE->user_is_editing()?'off':'on').'" />'.
-            '<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td>';
+            '<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td></tr></table>';
+        $PAGE->set_button($buttons);
     }
-    $buttons .= '</tr></table>';
 
     $PAGE->set_title($title);
     $PAGE->set_heading($course->fullname);
-    $PAGE->set_button($buttons);
+    
     echo $OUTPUT->header();
 
 /// Print heading and tabs (if there is more than one).
index 8763493b4e59dc0939d31d366aa7653228d68b87..c7b300f0df0174d88a9583de89a10fccb38598b9 100644 (file)
 
     $PAGE->set_title("$course->shortname: ".format_string($survey->name));
     $PAGE->set_heading($course->fullname);
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'survey'));
     echo $OUTPUT->header();
 
 /// Check to see if groups are being used in this survey
index 6b84b6b0659b65e9c5e14e54e61f106351219924..ae0418bf1b6466b987491e35de37954f8a8648e5 100644 (file)
@@ -59,7 +59,6 @@
 
     $strsurvey = get_string("modulename", "survey");
     $PAGE->set_title(format_string($survey->name));
-    $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'survey'));
     echo $OUTPUT->header();
 
 /// Check to see if groups are being used in this survey
index 304903fa9e8385ef519e0c24e439f9e5d2d26964..7bcdbcc1cc9cdb288a975a9d7c207aeea3160e36 100644 (file)
@@ -286,3 +286,53 @@ function url_get_coursemodule_info($coursemodule) {
     return $info;
 }
 
+/**
+ * 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 url 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 url_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 url_extend_settings_navigation($settings, $module) {
+    global $PAGE, $CFG, $DB;
+
+    // Load the url instance from the database
+    $url = $DB->get_record('url', array('id'=>$PAGE->cm->instance));
+    // Add a url node to the settings navigation.
+    $urlnavkey = $settings->add(get_string('urladministration', 'url'));
+    $urlnav = $settings->get($urlnavkey);
+    $urlnav->forceopen = true;
+
+    // If the user has the capability add an update this module link for the url 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()));
+        $urlnav->add(get_string('updatethis', '', get_string('modulename', 'url')), $url);
+    }
+
+    // Check if any children have been added. If not remove the node to save on clutter.
+    if (count($urlnav->children)<1) {
+        $settings->remove_child($urlnavkey);
+    }
+}
\ No newline at end of file
index 4e7ae7a0592926600529f4139e09d6d060037a23..ca7dffc520e5ff933fe44b382a746384cb6b1400 100644 (file)
@@ -83,7 +83,6 @@ function url_print_header($url, $cm, $course) {
     $PAGE->set_title($course->shortname.': '.$url->name);
     $PAGE->set_heading($course->fullname);
     $PAGE->set_activity_record($url);
-    $PAGE->set_button(update_module_button($cm->id, '', get_string('modulename', 'url')));
     echo $OUTPUT->header();
 }