From edb42f0924349fa3b7d04d6418e5f5f8631f762b Mon Sep 17 00:00:00 2001 From: defacer Date: Sun, 2 Jan 2005 15:20:15 +0000 Subject: [PATCH] Fix for bug 2328: * When configuring a block instance, "Turn editing off" button is not shown anymore. * When configuring a block instance, the breadcrumbs are now better, providing a link to the course page. This could be done in a much better way if we had a comprehensive template system but it will suffice for now. --- lib/blocklib.php | 5 +++-- lib/pagelib.php | 28 +++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/lib/blocklib.php b/lib/blocklib.php index 2467b1cc85..6fc517e025 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -333,8 +333,9 @@ function blocks_execute_action($page, &$pageblocks, $blockaction, $instanceorid) } else { // We need to show the config screen, so we highjack the display logic and then die - $page->print_header(get_string('pageheaderconfigablock', 'moodle')); - print_heading(get_string('blockconfiga', 'moodle', $block->name)); + $strheading = get_string('blockconfiga', 'moodle', $block->name); + $page->print_header(get_string('pageheaderconfigablock', 'moodle'), array($strheading => '')); + print_heading($strheading); echo '
'; echo '

'; foreach($hiddendata as $name => $val) { diff --git a/lib/pagelib.php b/lib/pagelib.php index ad4a08ac9e..e8c6c30bca 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -113,7 +113,7 @@ class page_base { // HTML OUTPUT SECTION // We have absolutely no idea what derived pages are all about - function print_header($title) { + function print_header($title, $morebreadcrumbs) { trigger_error('Page class does not implement method print_header()', E_USER_WARNING); return; } @@ -268,8 +268,9 @@ 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) { - global $USER; + function print_header($title, $morebreadcrumbs = NULL) { + global $USER, $CFG; + $this->init_full(); $replacements = array( '%fullname%' => $this->courserecord->fullname @@ -278,9 +279,26 @@ class page_course extends page_base { $title = str_replace($search, $replace, $title); } + $breadcrumbs = array($this->courserecord->shortname => $CFG->wwwroot.'/course/view.php?id='.$this->courserecord->id); + if(!empty($morebreadcrumbs)) { + $breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs); + } + + $total = count($breadcrumbs); + $current = 1; + $crumbtext = ''; + foreach($breadcrumbs as $text => $href) { + if($current++ == $total) { + $crumbtext .= ' '.$text; + } + else { + $crumbtext .= ' '.$text.' ->'; + } + } + $loggedinas = '

'. user_login_string($this->courserecord, $USER) .'

'; - print_header($title, $this->courserecord->fullname, $this->courserecord->shortname, - '', '', true, update_course_icon($this->courserecord->id), $loggedinas); + print_header($title, $this->courserecord->fullname, $crumbtext, + '', '', true, ' ', $loggedinas); } // SELF-REPORTING SECTION -- 2.39.5