From: mchurch Date: Fri, 28 Dec 2007 16:13:09 +0000 (+0000) Subject: MDL-12744 - Add ability to pass an extra button for use in print header for modules... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ca29e37d24c3de497731eede8598b436e1f9d7e2;p=moodle.git MDL-12744 - Add ability to pass an extra button for use in print header for modules that use the course page to display themselves with blocks. --- diff --git a/lib/pagelib.php b/lib/pagelib.php index 765c979927..952c3af4c1 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -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 : ' '; + // Add any extra buttons requested (by the resource module, for example) + if ($extrabuttons != '') { + $buttons = ($buttons == ' ') ? $extrabuttons : $buttons.$extrabuttons; + } + print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, user_login_string($this->courserecord, $USER), false, $bodytags); } diff --git a/mod/resource/lib.php b/mod/resource/lib.php index 8c7f049808..ed432f2a85 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -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 '';