]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12744 - Add ability to pass an extra button for use in print header for modules...
authormchurch <mchurch>
Fri, 28 Dec 2007 16:13:09 +0000 (16:13 +0000)
committermchurch <mchurch>
Fri, 28 Dec 2007 16:13:09 +0000 (16:13 +0000)
lib/pagelib.php
mod/resource/lib.php

index 765c9799272b5e12c264e53f4726b10cd757cf4c..952c3af4c1a1f31519233843057806b0b528b46a 100644 (file)
@@ -409,7 +409,7 @@ class page_course extends page_base {
 
     // This function prints out the common part of the page's header.
     // You should NEVER print the header "by hand" in other code.
-    function print_header($title, $morenavlinks=NULL, $meta='', $bodytags='') {
+    function print_header($title, $morenavlinks=NULL, $meta='', $bodytags='', $extrabuttons='') {
         global $USER, $CFG;
 
         $this->init_full();
@@ -436,6 +436,11 @@ class page_course extends page_base {
         }
         $buttons = empty($morenavlinks) ? $buttons : '&nbsp;';
 
+        // Add any extra buttons requested (by the resource module, for example)
+        if ($extrabuttons != '') {
+            $buttons = ($buttons == '&nbsp;') ? $extrabuttons : $buttons.$extrabuttons;
+        }
+
         print_header($title, $this->courserecord->fullname, $navigation,
                      '', $meta, true, $buttons, user_login_string($this->courserecord, $USER), false, $bodytags);
     }
index 8c7f04980884c9b1e577693047cc7079511dd35b..ed432f2a859dbdab4e7d4b398304b6ce05b344fa 100644 (file)
@@ -104,7 +104,8 @@ class resource_base {
         $morenavlinks = array($this->strresources   => 'index.php?id='.$this->course->id,
                                  $this->resource->name => '');
 
-        $PAGE->print_header($this->course->shortname.': %fullname%', $morenavlinks);
+        $PAGE->print_header($this->course->shortname.': %fullname%', $morenavlinks, "", "", 
+                            update_module_button($this->cm->id, $this->course->id, $this->strresource));
 
         echo '<table id="layout-table"><tr>';