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.

This commit is contained in:
mchurch 2007-12-27 21:25:19 +00:00
parent 5a8100234f
commit 7cdb6ee4a9
2 changed files with 8 additions and 2 deletions

View file

@ -366,7 +366,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, $morebreadcrumbs=NULL, $meta='', $bodytags='') {
function print_header($title, $morebreadcrumbs=NULL, $meta='', $bodytags='', $extrabuttons='') {
global $USER, $CFG;
$this->init_full();
@ -405,6 +405,11 @@ class page_course extends page_base {
$buttons = switchroles_form($this->courserecord->id) . update_course_icon($this->courserecord->id );
$buttons = empty($morebreadcrumbs) ? $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, $crumbtext,
'', $meta, true, $buttons, user_login_string($this->courserecord, $USER), false, $bodytags);

View file

@ -163,7 +163,8 @@ function display_course_blocks_start() {
$morebreadcrumbs = array($this->strresources => 'index.php?id='.$this->course->id,
$this->resource->name => '');
$PAGE->print_header($this->course->shortname.': %fullname%', $morebreadcrumbs);
$PAGE->print_header($this->course->shortname.': %fullname%', $morebreadcrumbs, "", "",
update_module_button($this->cm->id, $this->course->id, $this->strresource));
echo '<table id="layout-table"><tr>';