]> git.mjollnir.org Git - moodle.git/commitdiff
Fix for bug 2328:
authordefacer <defacer>
Sun, 2 Jan 2005 15:20:15 +0000 (15:20 +0000)
committerdefacer <defacer>
Sun, 2 Jan 2005 15:20:15 +0000 (15:20 +0000)
* 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
lib/pagelib.php

index 2467b1cc85e5d2c84395dc81e5e398781183b7a8..6fc517e0252781b8a6f629c65072e6cbc8eb748e 100644 (file)
@@ -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 '<form method="post" action="'. $page->url_get_path() .'">';
                 echo '<p>';
                 foreach($hiddendata as $name => $val) {
index ad4a08ac9ed7b87b857e7d0d9de2e9f718022513..e8c6c30bca003c9c61b45ae6431bf78ec4de8828 100644 (file)
@@ -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 <strong>print_header()</strong>', 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 .= ' <a href="'.$href.'">'.$text.'</a> ->';
+            }
+        }
+
         $loggedinas = '<p class="logininfo">'. user_login_string($this->courserecord, $USER) .'</p>';
-        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, '&nbsp;', $loggedinas);
     }
 
     // SELF-REPORTING SECTION