mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-9615: Correct incorrect use of term breadcrumbs
- $crumbs -> $navlinks Author: Matt Clarkson <mattc@catalyst.net.nz>
This commit is contained in:
parent
7994464178
commit
3b27b0fe21
99 changed files with 471 additions and 547 deletions
|
@ -7019,51 +7019,51 @@ function setup_lang_from_browser() {
|
|||
* and others
|
||||
* @uses $CFG
|
||||
* @uses $THEME
|
||||
* @param $extrabreadcrumbs - array of associative arrays, keys: name, link, type
|
||||
* @param $extranavlinks - array of associative arrays, keys: name, link, type
|
||||
* @return $navigation as an object so it can be differentiated from old style
|
||||
* navigation strings.
|
||||
*/
|
||||
function build_navigation($extrabreadcrumbs) {
|
||||
function build_navigation($extranavlinks) {
|
||||
global $CFG, $COURSE;
|
||||
|
||||
$navigation = '';
|
||||
|
||||
//Site name
|
||||
if ($site = get_site()) {
|
||||
$breadcrumbs[] = array('name' => format_string($site->shortname), 'link' => "$CFG->wwwroot/", 'type' => 'home');
|
||||
$navlinks[] = array('name' => format_string($site->shortname), 'link' => "$CFG->wwwroot/", 'type' => 'home');
|
||||
}
|
||||
|
||||
|
||||
if ($COURSE) {
|
||||
if ($COURSE->id != SITEID) {
|
||||
//Course
|
||||
$breadcrumbs[] = array('name' => format_string($COURSE->shortname), 'link' => "$CFG->wwwroot/course/view.php?id=$COURSE->id",'type' => 'course');
|
||||
$navlinks[] = array('name' => format_string($COURSE->shortname), 'link' => "$CFG->wwwroot/course/view.php?id=$COURSE->id",'type' => 'course');
|
||||
}
|
||||
}
|
||||
|
||||
//Merge in extra bread crumbs
|
||||
$breadcrumbs = array_merge($breadcrumbs, $extrabreadcrumbs);
|
||||
//Merge in extra navigation links
|
||||
$navlinks = array_merge($navlinks, $extranavlinks);
|
||||
|
||||
//Construct an unordered list from $breadcrumbs
|
||||
//Construct an unordered list from $navlinks
|
||||
//Accessibility: heading hidden from visual browsers by default.
|
||||
$navigation = '<h2 class="accesshide">'.get_string('youarehere','access')."</h2> <ul>\n";
|
||||
$countcrumb = count($breadcrumbs);
|
||||
$countlinks = count($navlinks);
|
||||
|
||||
for($i=0;$i<$countcrumb;$i++) {
|
||||
for($i=0;$i<$countlinks;$i++) {
|
||||
|
||||
// Check the link type to see if this link should appear in the trail
|
||||
if ($breadcrumbs[$i]['type'] == 'activity' && $i+1 < $countcrumb && ($CFG->hideactivitytypecrumb == 2 || ($CFG->hideactivitytypecrumb == 1 && !has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))))) {
|
||||
if ($navlinks[$i]['type'] == 'activity' && $i+1 < $countlinks && ($CFG->hideactivitytypenavlink == 2 || ($CFG->hideactivitytypenavlink == 1 && !has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))))) {
|
||||
continue;
|
||||
}
|
||||
$navigation .= '<li class="first">';
|
||||
if ($i > 0) {
|
||||
$navigation .= get_separator();
|
||||
}
|
||||
if ($breadcrumbs[$i]['link'] && $i+1 < $countcrumb) {
|
||||
$navigation .= "<a onclick=\"this.target='$CFG->framename'\" href=\"{$breadcrumbs[$i]['link']}\">";
|
||||
if ($navlinks[$i]['link'] && $i+1 < $countlinks) {
|
||||
$navigation .= "<a onclick=\"this.target='$CFG->framename'\" href=\"{$navlinks[$i]['link']}\">";
|
||||
}
|
||||
$navigation .= "{$breadcrumbs[$i]['name']}";
|
||||
if ($breadcrumbs[$i]['link'] && $i+1 < $countcrumb) {
|
||||
$navigation .= "{$navlinks[$i]['name']}";
|
||||
if ($navlinks[$i]['link'] && $i+1 < $countlinks) {
|
||||
$navigation .= "</a>";
|
||||
}
|
||||
|
||||
|
@ -7072,7 +7072,7 @@ function build_navigation($extrabreadcrumbs) {
|
|||
|
||||
$navigation .= "</ul>";
|
||||
|
||||
return(array('newnav' => true, 'breadcrumbs' => $navigation));
|
||||
return(array('newnav' => true, 'navlinks' => $navigation));
|
||||
}
|
||||
|
||||
function is_newnav($navigation) {
|
||||
|
|
|
@ -181,7 +181,7 @@ class page_base {
|
|||
// HTML OUTPUT SECTION
|
||||
|
||||
// We have absolutely no idea what derived pages are all about
|
||||
function print_header($title, $morebreadcrumbs) {
|
||||
function print_header($title, $morenavlinks) {
|
||||
trigger_error('Page class does not implement method <strong>print_header()</strong>', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ class page_course extends page_base {
|
|||
|
||||
// This function prints out the common part of the page's header.
|
||||
// You should NEVER print the header "by hand" in other code.
|
||||
function print_header($title, $morebreadcrumbs=NULL, $meta='', $bodytags='') {
|
||||
function print_header($title, $morenavlinks=NULL, $meta='', $bodytags='') {
|
||||
global $USER, $CFG;
|
||||
|
||||
$this->init_full();
|
||||
|
@ -397,18 +397,18 @@ class page_course extends page_base {
|
|||
$title = str_replace($search, $replace, $title);
|
||||
}
|
||||
|
||||
$crumbs = array();
|
||||
$navlinks = array();
|
||||
|
||||
if(!empty($morebreadcrumbs)) {
|
||||
$crumbs = array_merge($crumbs, $morebreadcrumbs);
|
||||
if(!empty($morenavlinks)) {
|
||||
$navlinks = array_merge($navlinks, $morenavlinks);
|
||||
}
|
||||
|
||||
$navigation = build_navigation($crumbs);
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
// The "Editing On" button will be appearing only in the "main" course screen
|
||||
// (i.e., no breadcrumbs other than the default one added inside this function)
|
||||
$buttons = switchroles_form($this->courserecord->id) . update_course_icon($this->courserecord->id );
|
||||
$buttons = empty($morebreadcrumbs) ? $buttons : ' ';
|
||||
$buttons = empty($morenavlinks) ? $buttons : ' ';
|
||||
|
||||
print_header($title, $this->courserecord->fullname, $navigation,
|
||||
'', $meta, true, $buttons, user_login_string($this->courserecord, $USER), false, $bodytags);
|
||||
|
@ -611,7 +611,7 @@ class page_generic_activity extends page_base {
|
|||
return BLOCK_POS_LEFT;
|
||||
}
|
||||
|
||||
function print_header($title, $morebreadcrumbs = NULL, $bodytags = '', $meta = '') {
|
||||
function print_header($title, $morenavlinks = NULL, $bodytags = '', $meta = '') {
|
||||
global $USER, $CFG;
|
||||
|
||||
$this->init_full();
|
||||
|
@ -623,14 +623,14 @@ class page_generic_activity extends page_base {
|
|||
}
|
||||
|
||||
|
||||
$crumbs[] = array('name' => get_string('modulenameplural', $this->activityname), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/index.php?id={$this->courserecord->id}", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => format_string($this->activityrecord->name), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/view.php?id={$this->modulerecord->id}", 'type' => 'activityinstance');
|
||||
$navlinks[] = array('name' => get_string('modulenameplural', $this->activityname), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/index.php?id={$this->courserecord->id}", 'type' => 'activity');
|
||||
$navlinks[] = array('name' => format_string($this->activityrecord->name), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/view.php?id={$this->modulerecord->id}", 'type' => 'activityinstance');
|
||||
|
||||
if (!empty($morebreadcrumbs)) {
|
||||
$breadcrumbs = array_merge($crumbs, $morebreadcrumbs);
|
||||
if (!empty($morenavlinks)) {
|
||||
$navlinks = array_merge($navlinks, $morenavlinks);
|
||||
}
|
||||
|
||||
if (empty($morebreadcrumbs) && $this->user_allowed_editing()) {
|
||||
if (empty($morenavlinks) && $this->user_allowed_editing()) {
|
||||
$buttons = '<table><tr><td>'.update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', $this->activityname)).'</td>';
|
||||
if (!empty($CFG->showblocksonmodpages)) {
|
||||
$buttons .= '<td><form target="'.$CFG->framename.'" method="get" action="view.php">'.
|
||||
|
@ -643,7 +643,7 @@ class page_generic_activity extends page_base {
|
|||
$buttons = ' ';
|
||||
}
|
||||
|
||||
$navigation = build_navigation($crumbs);
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord), false, $bodytags);
|
||||
}
|
||||
|
|
|
@ -3242,9 +3242,9 @@ function print_navigation ($navigation, $separator=0, $return=false) {
|
|||
|
||||
if (is_newnav($navigation)) {
|
||||
if ($return) {
|
||||
return($navigation['breadcrumbs']);
|
||||
return($navigation['navlinks']);
|
||||
} else {
|
||||
echo $navigation['breadcrumbs'];
|
||||
echo $navigation['navlinks'];
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue