Skip to content

Commit

Permalink
MDL-9615: Correct incorrect use of term breadcrumbs
Browse files Browse the repository at this point in the history
- $crumbs -> $navlinks


Author: Matt Clarkson <[email protected]>
  • Loading branch information
mattc-catalyst committed Jul 5, 2007
1 parent 7994464 commit 3b27b0f
Show file tree
Hide file tree
Showing 99 changed files with 471 additions and 547 deletions.
2 changes: 1 addition & 1 deletion admin/settings/appearance.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$temp->add(new admin_setting_configcheckbox('allowcategorythemes', get_string('allowcategorythemes', 'admin'), get_string('configallowcategorythemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', get_string('allowuserblockhiding', 'admin'), get_string('configallowuserblockhiding', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('showblocksonmodpages', get_string('showblocksonmodpages', 'admin'), get_string('configshowblocksonmodpages', 'admin'), 0));
$temp->add(new admin_setting_configselect('hideactivitytypecrumb', get_string('hideactivitytypecrumb', 'admin'), get_string('confighideactivitytypecrumb', 'admin'), 0,
$temp->add(new admin_setting_configselect('hideactivitytypenavlink', get_string('hideactivitytypenavlink', 'admin'), get_string('confighideactivitytypenavlink', 'admin'), 0,
array(
0 => get_string('hidefromnone', 'admin'),
1 => get_string('hidefromstudents', 'admin'),
Expand Down
6 changes: 3 additions & 3 deletions course/mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,9 @@
$focuscursor = "form.name";
}

$crumbs[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity');
$crumbs[] = array('name' => $streditinga, 'link' => '', 'type' => 'action');
$navigation = build_navigation($crumbs);
$navlinks[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity');
$navlinks[] = array('name' => $streditinga, 'link' => '', 'type' => 'action');
$navigation = build_navigation($navlinks);

print_header_simple($streditinga, '', $navigation, $focuscursor, "", false);

Expand Down
12 changes: 6 additions & 6 deletions course/modedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
$pageheading = get_string("updatinga", "moodle", $fullmodulename);
}

$crumbsinstancename = array('name' => format_string($form->name,true), 'link' => "$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id", 'type' => 'activityinstance');
$navlinksinstancename = array('name' => format_string($form->name,true), 'link' => "$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id", 'type' => 'activityinstance');

$CFG->pagepath = 'mod/'.$module->name;
if (!empty($type)) {
Expand Down Expand Up @@ -299,13 +299,13 @@
$streditinga = get_string("editinga", "moodle", $fullmodulename);
$strmodulenameplural = get_string("modulenameplural", $module->name);

$crumbs[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity');
if (isset($crumbsinstancename)) {
$crumbs[] = $crumbsinstancename;
$navlinks[] = array('name' => $strmodulenameplural, 'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id", 'type' => 'activity');
if (isset($navlinksinstancename)) {
$navlinks[] = $navlinksinstancename;
}
$crumbs[] = array('name' => $streditinga, 'link' => '', 'type' => 'title');
$navlinks[] = array('name' => $streditinga, 'link' => '', 'type' => 'title');

$navigation = build_navigation($crumbs);
$navigation = build_navigation($navlinks);

print_header_simple($streditinga, '', $navigation, $mform->focus(), "", false);

Expand Down
6 changes: 3 additions & 3 deletions grade/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@

$strgrades = get_string('grades');

$crumbs[] = array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id='.$courseid, 'type' => 'misc');
$crumbs[] = array('name' => $reportnames[$report], 'link' => '', 'type' => 'misc');
$navlinks[] = array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id='.$courseid, 'type' => 'misc');
$navlinks[] = array('name' => $reportnames[$report], 'link' => '', 'type' => 'misc');

$navigation = build_navigation($crumbs);
$navigation = build_navigation($navlinks);

// build buttons here
/// setting up editting mode
Expand Down
8 changes: 4 additions & 4 deletions grade/report/grader/preferences.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
$strgraderreport = get_string('graderreport', 'grades');
$strgradepreferences = get_string('gradepreferences', 'grades');

$crumbs[] = array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id='.$courseid, 'type' => 'misc');
$crumbs[] = array('name' => $strgraderreport,
$navlinks[] = array('name' => $strgrades, 'link' => $CFG->wwwroot . '/grade/index.php?id='.$courseid, 'type' => 'misc');
$navlinks[] = array('name' => $strgraderreport,
'link' => $CFG->wwwroot . '/grade/report.php?id=' . $courseid . '&amp;report=grader', 'type' => 'misc');
$crumbs[] = array('name' => $strgradepreferences, 'link' => '', 'type' => 'misc');
$navlinks[] = array('name' => $strgradepreferences, 'link' => '', 'type' => 'misc');

$navigation = build_navigation($crumbs);
$navigation = build_navigation($navlinks);

print_header_simple($strgrades.': '.$strgraderreport . ': ' . $strgradepreferences,': '.$strgradepreferences, $navigation,
'', '', true, '', navmenu($course));
Expand Down
6 changes: 3 additions & 3 deletions lang/en_utf8/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
$string['configgradeexport'] = 'Choose which gradebook export formats are your primary methods for exporting grades. Chosen plugins will then set and use a \"last exported\" field for every grade. For example, this might result in exported records being identified as being \"new\" or \"updated\". If you are not sure about this then leave everything unchecked.';
$string['configguestroleid'] = 'This role is automatically assigned to the guest user. It is also temporarily assigned to not enrolled users when they enter course that allows guests without password. Please verify that the role has moodle/legacy:guest and moodle/course:view capability.';
$string['confighiddenuserfields'] = 'Select which user infomation fields you wish to hide from other users other than course teachers/admins. This will increase student privacy. Hold CTRL key to select multiple fields.';
$string['confighideactivitytypecrumb'] = 'Select from whom to hide the activity type (e.g. Quizzes) crumb in the breadcrumb trail displayed for activity modules.';
$string['confighideactivitytypenavlink'] = 'Select from whom to hide the activity type (e.g. Quizzes) link in the navigation displayed for activity modules.';
$string['confightmleditor'] = 'Choose whether or not to allow use of the embedded HTML text editor. Even if you choose allow, this editor will only appear when the user is using a compatible web browser. Users can also choose not to use it.';
$string['configidnumber'] = 'This option specifies whether (a) Users are not be asked for an ID number at all, (b) Users are asked for an ID number but can leave it blank or (c) Users are asked for an ID Number and cannot leave it blank. If given the User\'s ID number is displayed in their Profile.';
$string['configintcachemax'] = 'For internal cache only. Maximum number of records to keep in the cache. Recommended value: 50. Use lower values to reduce memory usage.';
Expand Down Expand Up @@ -142,7 +142,7 @@
$string['configminpasswordlower'] = 'Passwords must have at least these many lower case letters.';
$string['configminpasswordnonalphanum'] = 'Passwords must have at least these many non-alphanumeric characters.';
$string['configminpasswordupper'] = 'Passwords must have at least these many upper case letters.';
$string['configmymoodleredirect'] = 'This setting forces redirects to /my on login for non-admins and replaces the top level site breadcrumb with /my';
$string['configmymoodleredirect'] = 'This setting forces redirects to /my on login for non-admins and replaces the top level site navigation with /my';
$string['confignodefaultuserrolelists'] = 'This setting prevents all users from being returned from the database from deprecated calls of get_course_user, etc., for the site course if the default role provides that access. Check this, if you suffer a performance hit.';
$string['confignonmetacoursesyncroleids'] = 'By default all enrolments from child courses are synchronised to metacourses. Roles that are selected here will not be included in the synchronisation process.';
$string['confignoreplyaddress'] = 'Emails are sometimes sent out on behalf of a user (eg forum posts). The email address you specify here will be used as the \"From\" address in those cases when the recipients should not be able to reply directly to the user (eg when a user chooses to keep their address private).';
Expand Down Expand Up @@ -330,7 +330,7 @@
$string['helpupcomingmaxevents'] = 'How many (maximum) upcoming events are shown to users by default?';
$string['helpweekenddays'] = 'Which days of the week are treated as \"weekend\" and shown with a different colour?';
$string['hiddenuserfields'] = 'Hide user fields';
$string['hideactivitytypecrumb'] = 'Hide activity type crumb';
$string['hideactivitytypenavlink'] = 'Hide activity type navigation';
$string['hidefromall'] = 'Hide from all users';
$string['hidefromnone'] = 'Hide from nobody';
$string['hidefromstudents'] = 'Hide from students';
Expand Down
30 changes: 15 additions & 15 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>";
}

Expand All @@ -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) {
Expand Down
28 changes: 14 additions & 14 deletions lib/pagelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function user_is_editing() {
// 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;
}
Expand Down Expand Up @@ -386,7 +386,7 @@ function user_is_editing() {

// 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();
Expand All @@ -397,18 +397,18 @@ function print_header($title, $morebreadcrumbs=NULL, $meta='', $bodytags='') {
$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 : '&nbsp;';
$buttons = empty($morenavlinks) ? $buttons : '&nbsp;';

print_header($title, $this->courserecord->fullname, $navigation,
'', $meta, true, $buttons, user_login_string($this->courserecord, $USER), false, $bodytags);
Expand Down Expand Up @@ -611,7 +611,7 @@ function blocks_default_position() {
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();
Expand All @@ -623,14 +623,14 @@ function print_header($title, $morebreadcrumbs = NULL, $bodytags = '', $meta = '
}


$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">'.
Expand All @@ -643,7 +643,7 @@ function print_header($title, $morebreadcrumbs = NULL, $bodytags = '', $meta = '
$buttons = '&nbsp;';
}

$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);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions mod/assignment/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
$strsubmitted = get_string("submitted", "assignment");
$strgrade = get_string("grade");

$crumbs[] = array('name' => $strassignments, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($crumbs);
$navlinks[] = array('name' => $strassignments, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($navlinks);

print_header_simple($strassignments, "", $navigation, "", "", true, "", navmenu($course));

Expand All @@ -45,7 +45,7 @@
$table->align = array ("left", "left", "left", "right");
}

$currentgroup = get_current_group($course->id);
$currentgroup = get_and_set_current_group($course, groupmode($course));
if ($currentgroup and has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE, $id))) {
$group = groups_get_group($currentgroup, false);
$groupname = " ($group->name)";
Expand Down
8 changes: 4 additions & 4 deletions mod/assignment/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -959,10 +959,10 @@ function display_submissions() {

add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id='.$this->assignment->id, $this->assignment->id, $this->cm->id);

$crumbs[] = array('name' => $this->strassignments, 'link' => "index.php?id=$course->id", 'type' => 'activity');
$crumbs[] = array('name' => format_string($this->assignment->name,true), 'link' => "view.php?a={$this->assignment->id}", 'type' => 'activityinstance');
$crumbs[] = array('name' => $this->strsubmissions, 'link' => '', 'type' => 'title');
$navigation = build_navigation($crumbs);
$navlinks[] = array('name' => $this->strassignments, 'link' => "index.php?id=$course->id", 'type' => 'activity');
$navlinks[] = array('name' => format_string($this->assignment->name,true), 'link' => "view.php?a={$this->assignment->id}", 'type' => 'activityinstance');
$navlinks[] = array('name' => $this->strsubmissions, 'link' => '', 'type' => 'title');
$navigation = build_navigation($navlinks);

print_header_simple(format_string($this->assignment->name,true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm));

Expand Down
4 changes: 2 additions & 2 deletions mod/chat/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

/// Print the header

$crumbs[] = array('name' => $strchats, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($crumbs);
$navlinks[] = array('name' => $strchats, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($navlinks);

print_header_simple($strchats, '', $navigation, '', '', true, '', navmenu($course));

Expand Down
Loading

0 comments on commit 3b27b0f

Please sign in to comment.