mirror of
https://github.com/moodle/moodle.git
synced 2025-06-01 05:35:55 +02:00
Breadcrumbs: mod/quiz changes
- 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>
This commit is contained in:
parent
f8513eca8d
commit
9ac0c1b328
@ -402,10 +402,13 @@
|
||||
$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
|
||||
|
@ -296,10 +296,12 @@
|
||||
$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';
|
||||
@ -333,11 +335,13 @@
|
||||
$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';
|
||||
|
@ -30,7 +30,11 @@
|
||||
</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
|
||||
|
@ -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 = ' ';
|
||||
}
|
||||
print_header($title, $this->courserecord->fullname, $crumbtext, '', '', true, $buttons, navmenu($this->courserecord, $this->modulerecord),false,$bodytags);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function get_type() {
|
||||
return PAGE_QUIZ_VIEW;
|
||||
}
|
||||
|
@ -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';
|
||||
|
@ -98,10 +98,14 @@
|
||||
$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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user