From 160addd2b2b3ce6979e574de9305c8c4f787324b Mon Sep 17 00:00:00 2001 From: mattc-catalyst Date: Mon, 16 Apr 2007 20:59:17 +0000 Subject: [PATCH] Breadcrumbs: mod/chat changes - Modified to use build_navigation() for breadcrumb generation. - Removed print_header method as base class now provides this functionality. Author: Matt Clarkson --- mod/chat/index.php | 5 +++- mod/chat/pagelib.php | 54 -------------------------------------------- mod/chat/report.php | 24 ++++++++++++-------- 3 files changed, 19 insertions(+), 64 deletions(-) diff --git a/mod/chat/index.php b/mod/chat/index.php index d9d5be8cc0..55df4997b1 100644 --- a/mod/chat/index.php +++ b/mod/chat/index.php @@ -22,7 +22,10 @@ /// 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 diff --git a/mod/chat/pagelib.php b/mod/chat/pagelib.php index db4d9635b7..e1718f0509 100644 --- a/mod/chat/pagelib.php +++ b/mod/chat/pagelib.php @@ -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 .= ' '.$text.' ->'; - } - } - - if(empty($morebreadcrumbs) && $this->user_allowed_editing()) { - $buttons = ''; - if(!empty($CFG->showblocksonmodpages)) { - $buttons .= ''; - } - $buttons .= '
'.update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'chat')).'
frametarget.' method="get" action="view.php">'. - ''. - ''. - '
'; - } - else { - $buttons = ' '; - } - print_header($title, $this->courserecord->fullname, $crumbtext, '', '', true, $buttons, navmenu($this->courserecord, $this->modulerecord)); - - } - function get_type() { return PAGE_CHAT_VIEW; } diff --git a/mod/chat/report.php b/mod/chat/report.php index 8a2ad5a83c..bfbf9413ad 100644 --- a/mod/chat/report.php +++ b/mod/chat/report.php @@ -38,11 +38,14 @@ /// 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", '', - "id\">$strchats -> - id\">".format_string($chat->name,true)." -> - id\">$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' => "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 @@ -92,10 +95,13 @@ /// Print the Sessions display - - print_header_simple(format_string($chat->name).": $strchatreport", '', - "id\">$strchats -> - id\">".format_string($chat->name,true)." -> $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')); -- 2.39.5