]> git.mjollnir.org Git - moodle.git/commitdiff
Breadcrumbs: mod/chat changes
authormattc-catalyst <mattc-catalyst>
Mon, 16 Apr 2007 20:59:17 +0000 (20:59 +0000)
committermattc-catalyst <mattc-catalyst>
Mon, 16 Apr 2007 20:59:17 +0000 (20:59 +0000)
- Modified to use build_navigation() for breadcrumb generation.
- Removed print_header method as base class now provides this
  functionality.

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

mod/chat/index.php
mod/chat/pagelib.php
mod/chat/report.php

index d9d5be8cc0f9da289b35354ff10f9c255ee4f55a..55df4997b11f9b421c4aa814052ad6294ef0ae5d 100644 (file)
 
 /// Print the header
 
-    print_header_simple($strchats, '', $strchats, '', '', true, '', navmenu($course));
+    $crumbs[] = array('name' => $strchats, 'link' => '', 'type' => 'activity');
+    $navigation = build_navigation($crumbs, $course);
+
+    print_header_simple($strchats, '', $navigation, '', '', true, '', navmenu($course));
 
 /// Get all the appropriate data
 
index db4d9635b74238ba25044975ee4212208e558354..e1718f0509860a3432e2c9e9047f7beb016d1ff4 100644 (file)
@@ -25,60 +25,6 @@ class page_chat extends page_generic_activity {
         parent::init_quick($data);
     }
 
-    function print_header($title, $morebreadcrumbs = NULL) {
-        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', 'chat')] = $CFG->wwwroot.'/mod/chat/index.php?id='.$this->courserecord->id;
-        $breadcrumbs[format_string($this->activityrecord->name)]            = $CFG->wwwroot.'/mod/chat/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', 'chat')).'</td>';
-            if(!empty($CFG->showblocksonmodpages)) {
-               $buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php">'.
-                    '<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').'" /></form></td>';
-            }
-            $buttons .= '</tr></table>';
-        }
-        else {
-            $buttons = '&nbsp;';
-        }
-        print_header($title, $this->courserecord->fullname, $crumbtext, '', '', true, $buttons, navmenu($this->courserecord, $this->modulerecord));
-
-    }
-
     function get_type() {
         return PAGE_CHAT_VIEW;
     }
index 8a2ad5a83ca58479b13d81d0f7fcf10274b7631e..bfbf9413adabc751960a760249f188e8118b0941 100644 (file)
 /// Print a session if one has been specified
 
     if ($start and $end and !$confirmdelete) {   // Show a full transcript
-
-        print_header_simple(format_string($chat->name).": $strchatreport", '',
-                     "<a href=\"index.php?id=$course->id\">$strchats</a> ->
-                     <a href=\"view.php?id=$cm->id\">".format_string($chat->name,true)."</a> ->
-                     <a href=\"report.php?id=$cm->id\">$strchatreport</a>",
+        
+        $crumbs[] = array('name' => $strchats, 'link' => "index.php?id=$course->id", 'type' => 'activity');
+        $crumbs[] = array('name' => format_string($chat->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
+        $crumbs[] = array('name' => $strchatreport, 'link' => "report.php?id=$cm->id", 'type' => 'title');
+        
+        $navigation = build_navigation($crumbs, $course);
+        
+        print_header_simple(format_string($chat->name).": $strchatreport", '', $navigation,
                       '', '', true, '', navmenu($course, $cm));
 
     /// Check to see if groups are being used here
 
 
 /// Print the Sessions display
-
-    print_header_simple(format_string($chat->name).": $strchatreport", '',
-                 "<a href=\"index.php?id=$course->id\">$strchats</a> ->
-                 <a href=\"view.php?id=$cm->id\">".format_string($chat->name,true)."</a> -> $strchatreport",
+    $crumbs[] = array('name' => $strchats, 'link' => "index.php?id=$course->id", 'type' => 'activity');
+    $crumbs[] = array('name' => format_string($chat->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
+    $crumbs[] = array('name' => $strchatreport, 'link' => '', 'type' => 'title');
+    
+    $navigation = build_navigation($crumbs, $course);
+    
+    print_header_simple(format_string($chat->name).": $strchatreport", '', $navigation,
                   '', '', true, '', navmenu($course, $cm));
 
     print_heading(format_string($chat->name).': '.get_string('sessions', 'chat'));