]> git.mjollnir.org Git - moodle.git/commitdiff
Breadcrumbs: mod/quiz changes
authormattc-catalyst <mattc-catalyst>
Mon, 16 Apr 2007 21:23:17 +0000 (21:23 +0000)
committermattc-catalyst <mattc-catalyst>
Mon, 16 Apr 2007 21:23:17 +0000 (21:23 +0000)
- Modified to use build_navigation() for breadcrumb generation.
- Removed print_header method is now provided by base class.

Author: Matt Clarkson <mattc@catalyst.net.nz>

mod/quiz/attempt.php
mod/quiz/edit.php
mod/quiz/index.php
mod/quiz/pagelib.php
mod/quiz/report/default.php
mod/quiz/review.php

index 9b2030138d36bf4e381390b7efe71f0d63c207a7..14a193eeae183a2d0e12fc07cbd6e7f1ea609628 100644 (file)
         $strupdatemodule = has_capability('moodle/course:manageactivities', $coursecontext)
                     ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz'))
                     : "";
-        print_header_simple(format_string($quiz->name), "",
-                 "<a href=\"index.php?id=$course->id\">$strquizzes</a> ->
-                  <a href=\"view.php?id=$cm->id\">".format_string($quiz->name)."</a> -> $strattemptnum",
-                  "", $headtags, true, $strupdatemodule);
+        $crumbs[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity');
+        $crumbs[] = array('name' => format_string($quiz->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
+        $crumbs[] = array('name' => $strattemptnum, 'link' => '', 'type' => 'title');
+        
+        $navigation = build_navigation($crumbs, $course);
+        
+        print_header_simple(format_string($quiz->name), "", $navigation, "", "", true, $strupdatemodule);
     }
 
     echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
index 7cd6a1e22e7959546e9e987ce0210e58d41e1a0a..23042a12f9bb0a53d16907d1a5a5b54df8f63ad3 100644 (file)
         $strupdatemodule = has_capability('moodle/course:manageactivities', $coursecontext)
                     ? update_module_button($modform->cmid, $course->id, get_string('modulename', 'quiz'))
                     : "";
-        print_header_simple($streditingquiz, '',
-                 "<a href=\"index.php?id=$course->id\">$strquizzes</a>".
-                 " -> <a href=\"view.php?q=$modform->instance\">".format_string($modform->name).'</a>'.
-                 " -> $streditingquiz", "", "",
+        $crumbs[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity');    
+        $crumbs[] = array('name' => format_string($modform->name), 'link' => "view.php?q=$modform->instance", 'type' => 'activityinstance');    
+        $crumbs[] = array('name' => $streditingquiz, 'link' => '', 'type' => 'title');
+        $navigation = build_navigation($crumbs, $course);
+           
+        print_header_simple($streditingquiz, '', $navigation, "", "",
                  true, $strupdatemodule);
 
         $currenttab = 'edit';
     $strupdatemodule = has_capability('moodle/course:manageactivities', $coursecontext)
         ? update_module_button($modform->cmid, $course->id, get_string('modulename', 'quiz'))
         : "";
-    print_header_simple($streditingquiz, '',
-             "<a href=\"index.php?id=$course->id\">$strquizzes</a>".
-             " -> <a href=\"view.php?q=$modform->instance\">".format_string($modform->name).'</a>'.
-             " -> $streditingquiz",
-             "", "", true, $strupdatemodule);
+      
+    $crumbs[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity');    
+    $crumbs[] = array('name' => format_string($modform->name), 'link' => "view.php?q=$modform->instance", 'type' => 'activityinstance');    
+    $crumbs[] = array('name' => $streditingquiz, 'link' => '', 'type' => 'title');
+    $navigation = build_navigation($crumbs, $course);
+    
+    print_header_simple($streditingquiz, '', $navigation, "", "", true, $strupdatemodule);
 
     $currenttab = 'edit';
     $mode = 'editq';
index c3049646e495c164c92696ac671547169e5883cf..eeee9f3d4338321604a7d137c0688720b7ab7d79 100644 (file)
                    </div>
                  </form>";
     }
-    print_header_simple($strquizzes, '', $strquizzes,
+    
+    $crumbs[] = array('name' => $strquizzes, 'link' => '', 'type' => 'activity');
+    $navigation = build_navigation($crumbs, $course);
+    
+    print_header_simple($strquizzes, '', $navigation,
                  '', '', true, $streditquestions, navmenu($course));
 
 // Get all the appropriate data
index 16bdad19eeb78f720e0fd7d85bd3ab12d19e0a09..23326292fdd916cc7cc177a5a21000452ad19bdb 100644 (file)
@@ -25,64 +25,7 @@ class page_quiz extends page_generic_activity {
         $this->activityname = 'quiz';
         parent::init_quick($data);
     }
-
-    function print_header($title, $morebreadcrumbs = NULL, $bodytags ='') {
-        global $USER, $CFG;
-
-        $this->init_full();
-        $replacements = array(
-            '%fullname%' => format_string($this->activityrecord->name)
-        );
-        foreach($replacements as $search => $replace) {
-            $title = str_replace($search, $replace, $title);
-        }
-
-        if($this->courserecord->id == SITEID) {
-            $breadcrumbs = array();
-        }
-        else {
-            $breadcrumbs = array($this->courserecord->shortname => $CFG->wwwroot.'/course/view.php?id='.$this->courserecord->id);
-        }
-
-        $breadcrumbs[get_string('modulenameplural', 'quiz')] = $CFG->wwwroot.'/mod/quiz/index.php?id='.$this->courserecord->id;
-        $breadcrumbs[format_string($this->activityrecord->name)]            = $CFG->wwwroot.'/mod/quiz/view.php?id='.$this->modulerecord->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> ->';
-            }
-        }
-
-        if(empty($morebreadcrumbs) && $this->user_allowed_editing()) {
-            $buttons = '<table><tr><td>'.
-               update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'quiz')).'</td>';
-            if(!empty($CFG->showblocksonmodpages)) {
-                $buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php">'.
-                    '<div>'.
-                    '<input type="hidden" name="id" value="'.$this->modulerecord->id.'" />'.
-                    '<input type="hidden" name="edit" value="'.($this->user_is_editing()?'off':'on').'" />'.
-                    '<input type="submit" value="'.get_string($this->user_is_editing()?'blockseditoff':'blocksediton').'" />'.
-                    '</div></form></td>';
-            }
-            $buttons .= '</tr></table>';
-        }
-        else {
-            $buttons = '&nbsp;';
-        }
-        print_header($title, $this->courserecord->fullname, $crumbtext, '', '', true, $buttons, navmenu($this->courserecord, $this->modulerecord),false,$bodytags);
-
-    }
-
+  
     function get_type() {
         return PAGE_QUIZ_VIEW;
     }
index d27ee925770425a0264a8ebd46e6475c5c29fa5f..ca5b0e07c97e4cf7dca6c323376fc1ffa1ae57c3 100644 (file)
@@ -27,9 +27,11 @@ class quiz_default_report {
         $strquizzes = get_string("modulenameplural", "quiz");
         $strquiz  = get_string("modulename", "quiz");
     /// Print the page header
-        print_header_simple(format_string($quiz->name), "",
-                     "<a href=\"index.php?id=$course->id\">$strquizzes</a>
-                      -> ".format_string($quiz->name),
+        $crumbs[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity');
+        $crumbs[] = array('name' => format_string($quiz->name), 'link' => '', 'type' => 'activityinstance');
+        $navigation = build_navigation($crumbs, $course);
+        
+        print_header_simple(format_string($quiz->name), "", $navigation,
                      '', $meta, true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
     /// Print the tabs    
         $currenttab = 'reports';
index 653a447d130524c789c9f3cea77b26691f985c0c..f0de1dd24eeab0e20bc6b1bbb2d7cc887c4c49d1 100644 (file)
         $strupdatemodule = has_capability('moodle/course:manageactivities', $coursecontext)
                     ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz'))
                     : "";
-        print_header_simple(format_string($quiz->name), "",
-                 "<a href=\"index.php?id=$course->id\">$strquizzes</a>
-                  -> <a href=\"view.php?id=$cm->id\">".format_string($quiz->name,true)."</a> -> $strreview",
-                 "", "", true, $strupdatemodule);
+                    
+        $crumbs[] = array('name' => $strquizzes, 'link' => "index.php?id=$course->id", 'type' => 'activity');
+        $crumbs[] = array('name' => format_string($quiz->name), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
+        $crumbs[] = array('name' => $strreview, 'link' => '', 'type' => 'title');
+        
+        $navigation = build_navigation($crumbs, $course);
+               
+        print_header_simple(format_string($quiz->name), "", $navigation, "", "", true, $strupdatemodule);
     }
     echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib