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 <mattc@catalyst.net.nz>
This commit is contained in:
mattc-catalyst 2007-04-16 20:59:17 +00:00
parent b9dc2734a3
commit 160addd2b2
3 changed files with 19 additions and 64 deletions

View File

@ -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

View 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;
}

View File

@ -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", '',
"<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
@ -92,10 +95,13 @@
/// 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'));