MDL-10970 Reverted changes
This commit is contained in:
@@ -1457,89 +1457,4 @@ function print_group_menu($groups, $groupmode, $currentgroup, $urlroot, $showall
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints breadcrumb trail of links, called in theme/-/header.html
|
||||
*
|
||||
* @uses $CFG
|
||||
* @param mixed $navigation The breadcrumb navigation string to be printed
|
||||
* @param string $separator The breadcrumb trail separator. The default 0 leads to the use
|
||||
* of $THEME->rarrow, themes could use '→', '/', or '' for a style-sheet solution.
|
||||
* @param boolean $return False to echo the breadcrumb string (default), true to return it.
|
||||
*/
|
||||
function print_navigation ($navigation, $separator=0, $return=false) {
|
||||
global $CFG, $THEME;
|
||||
$output = '';
|
||||
|
||||
if (0 === $separator) {
|
||||
$separator = get_separator();
|
||||
}
|
||||
else {
|
||||
$separator = '<span class="sep">'. $separator .'</span>';
|
||||
}
|
||||
|
||||
if ($navigation) {
|
||||
|
||||
if (is_newnav($navigation)) {
|
||||
if ($return) {
|
||||
return($navigation['navlinks']);
|
||||
} else {
|
||||
echo $navigation['navlinks'];
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
debugging('Navigation needs to be updated to use build_navigation()', DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
if (!is_array($navigation)) {
|
||||
$ar = explode('->', $navigation);
|
||||
$navigation = array();
|
||||
|
||||
foreach ($ar as $a) {
|
||||
if (strpos($a, '</a>') === false) {
|
||||
$navigation[] = array('title' => $a, 'url' => '');
|
||||
} else {
|
||||
if (preg_match('/<a.*href="([^"]*)">(.*)<\/a>/', $a, $matches)) {
|
||||
$navigation[] = array('title' => $matches[2], 'url' => $matches[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
$site = new object();
|
||||
$site->shortname = get_string('home');
|
||||
}
|
||||
|
||||
//Accessibility: breadcrumb links now in a list, » replaced with a 'silent' character.
|
||||
$nav_text = get_string('youarehere','access');
|
||||
$output .= '<h2 class="accesshide">'.$nav_text."</h2><ul>\n";
|
||||
|
||||
$output .= '<li class="first">'."\n".'<a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
|
||||
.$CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))
|
||||
&& !empty($USER->id) && !empty($CFG->mymoodleredirect) && !isguest())
|
||||
? '/my' : '') .'/">'. format_string($site->shortname) ."</a>\n</li>\n";
|
||||
|
||||
|
||||
foreach ($navigation as $navitem) {
|
||||
$title = trim(strip_tags(format_string($navitem['title'], false)));
|
||||
$url = $navitem['url'];
|
||||
|
||||
if (empty($url)) {
|
||||
$output .= '<li class="first">'."$separator $title</li>\n";
|
||||
} else {
|
||||
$output .= '<li class="first">'."$separator\n<a ".$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
|
||||
.$url.'">'."$title</a>\n</li>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$output .= "</ul>\n";
|
||||
}
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -3236,6 +3236,91 @@ function get_separator() {
|
||||
return ' '.link_arrow_right($text='/', $url='', $accesshide=true, 'sep').' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints breadcrumb trail of links, called in theme/-/header.html
|
||||
*
|
||||
* @uses $CFG
|
||||
* @param mixed $navigation The breadcrumb navigation string to be printed
|
||||
* @param string $separator The breadcrumb trail separator. The default 0 leads to the use
|
||||
* of $THEME->rarrow, themes could use '→', '/', or '' for a style-sheet solution.
|
||||
* @param boolean $return False to echo the breadcrumb string (default), true to return it.
|
||||
*/
|
||||
function print_navigation ($navigation, $separator=0, $return=false) {
|
||||
global $CFG, $THEME;
|
||||
$output = '';
|
||||
|
||||
if (0 === $separator) {
|
||||
$separator = get_separator();
|
||||
}
|
||||
else {
|
||||
$separator = '<span class="sep">'. $separator .'</span>';
|
||||
}
|
||||
|
||||
if ($navigation) {
|
||||
|
||||
if (is_newnav($navigation)) {
|
||||
if ($return) {
|
||||
return($navigation['navlinks']);
|
||||
} else {
|
||||
echo $navigation['navlinks'];
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
debugging('Navigation needs to be updated to use build_navigation()', DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
if (!is_array($navigation)) {
|
||||
$ar = explode('->', $navigation);
|
||||
$navigation = array();
|
||||
|
||||
foreach ($ar as $a) {
|
||||
if (strpos($a, '</a>') === false) {
|
||||
$navigation[] = array('title' => $a, 'url' => '');
|
||||
} else {
|
||||
if (preg_match('/<a.*href="([^"]*)">(.*)<\/a>/', $a, $matches)) {
|
||||
$navigation[] = array('title' => $matches[2], 'url' => $matches[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
$site = new object();
|
||||
$site->shortname = get_string('home');
|
||||
}
|
||||
|
||||
//Accessibility: breadcrumb links now in a list, » replaced with a 'silent' character.
|
||||
$nav_text = get_string('youarehere','access');
|
||||
$output .= '<h2 class="accesshide">'.$nav_text."</h2><ul>\n";
|
||||
|
||||
$output .= '<li class="first">'."\n".'<a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
|
||||
.$CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))
|
||||
&& !empty($USER->id) && !empty($CFG->mymoodleredirect) && !isguest())
|
||||
? '/my' : '') .'/">'. format_string($site->shortname) ."</a>\n</li>\n";
|
||||
|
||||
|
||||
foreach ($navigation as $navitem) {
|
||||
$title = trim(strip_tags(format_string($navitem['title'], false)));
|
||||
$url = $navitem['url'];
|
||||
|
||||
if (empty($url)) {
|
||||
$output .= '<li class="first">'."$separator $title</li>\n";
|
||||
} else {
|
||||
$output .= '<li class="first">'."$separator\n<a ".$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
|
||||
.$url.'">'."$title</a>\n</li>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$output .= "</ul>\n";
|
||||
}
|
||||
|
||||
if ($return) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will build the navigation string to be used by print_header
|
||||
* and others
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<div class="navbar clearfix">
|
||||
<?php if ($navigation) { // This is the navigation table with breadcrumbs
|
||||
?>
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<?php if ($navigation and false) { ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="menu"><?php echo $menu; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<?php //Accessibility: breadcrumb trail/navbar now a DIV, not a table.
|
||||
if ($navigation) { // This is the navigation bar with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line ?>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<div class="navbar clearfix">
|
||||
<?php if ($navigation) { // This is the navigation table with breadcrumbs
|
||||
?>
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<?php if ($navigation and false) { ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="menu"><?php echo $menu; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<?php //Accessibility: breadcrumb trail/navbar now a DIV, not a table.
|
||||
if ($navigation) { // This is the navigation bar with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="clearer"> </div>
|
||||
<?php if ($navigation) { // This is the navigation table with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<?php if ($navigation and false) { ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="menu"><?php echo $menu; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<?php //Accessibility: breadcrumb trail/navbar now a DIV, not a table.
|
||||
if ($navigation) { // This is the navigation bar with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<?php if ($navigation) { // This is the navigation table with breadcrumbs
|
||||
?>
|
||||
<div class="navbar">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<?php if ($navigation) { // This is the navigation table with breadcrumbs
|
||||
?>
|
||||
<div class="navbar">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<?php if ($navigation and false) { ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="menu"><?php echo $menu; ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<?php //Accessibility: breadcrumb trail/navbar now a DIV, not a table.
|
||||
if ($navigation) { // This is the navigation bar with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<?php //Accessibility: breadcrumb trail/navbar now a DIV, not a table.
|
||||
if ($navigation) { // This is the navigation bar with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<?php //Accessibility: breadcrumb trail/navbar now a DIV, not a table.
|
||||
if ($navigation) { // This is the navigation bar with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<?php //Accessibility: breadcrumb trail/navbar now a DIV, not a table.
|
||||
if ($navigation) { // This is the navigation table with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<?php //Accessibility: breadcrumb trail/navbar now a DIV, not a table.
|
||||
if ($navigation) { // This is the navigation bar with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<?php //Accessibility: breadcrumb trail/navbar now a DIV, not a table.
|
||||
if ($navigation) { // This is the navigation bar with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<?php } ?>
|
||||
<?php if ($navigation) { // This is the navigation table with breadcrumbs ?>
|
||||
<div class="navbar clearfix">
|
||||
<div class="breadcrumb"><?php echo $navigation['navlinks']; ?></div>
|
||||
<div class="breadcrumb"><?php print_navigation($navigation); ?></div>
|
||||
<div class="navbutton"><?php echo $button; ?></div>
|
||||
</div>
|
||||
<?php } else if ($heading) { // If no navigation, but a heading, then print a line
|
||||
|
||||
Reference in New Issue
Block a user