\n";
break;
case 'day':
@@ -670,9 +667,9 @@ function calendar_top_controls($type, $data) {
$nextdate = usergetdate(make_timestamp($data['y'], $data['m'], $data['d'] + 1));
$prevname = calendar_wday_name($CALENDARDAYS[$prevdate['wday']]);
$nextname = calendar_wday_name($CALENDARDAYS[$nextdate['wday']]);
- $content .= '
';
- $content .= '
$THEME->larrow ".$prevname."\n";
-
+ $content .= "\n".'
';
+ $content .= calendar_get_link_previous($prevname, 'view.php?view=day&', $prevdate['mday'], $prevdate['mon'], $prevdate['year']);
+
// Get the format string
$text = get_string('strftimedaydate');
/*
@@ -685,7 +682,7 @@ function calendar_top_controls($type, $data) {
// Print the actual thing
$content .= '
| '.$text.'';
- $content .= '
| '.$nextname." $THEME->rarrow\n";
+ $content .= '
| '. calendar_get_link_next($nextname, 'view.php?view=day&', $nextdate['mday'], $nextdate['mon'], $nextdate['year']);
$content .= "
\n";
break;
}
@@ -854,6 +851,34 @@ function calendar_get_link_tag($text, $linkbase, $d, $m, $y) {
return '
'.$text.'';
}
+/**
+ * Build and return a previous month HTML link, with an arrow.
+ * @param string $text The text label.
+ * @param string $linkbase The URL stub.
+ * @param int $d $m $y Day of month, month and year numbers.
+ * @param bool $accesshide Default visible, or hide from all except screenreaders.
+ * @return string HTML string.
+ */
+function calendar_get_link_previous($text, $linkbase, $d, $m, $y, $accesshide=false) {
+ $href = calendar_get_link_href($linkbase, $d, $m, $y);
+ if(empty($href)) return $text;
+ return link_arrow_left($text, $href, $accesshide, 'previous');
+}
+
+/**
+ * Build and return a next month HTML link, with an arrow.
+ * @param string $text The text label.
+ * @param string $linkbase The URL stub.
+ * @param int $d $m $y Day of month, month and year numbers.
+ * @param bool $accesshide Default visible, or hide from all except screenreaders.
+ * @return string HTML string.
+ */
+function calendar_get_link_next($text, $linkbase, $d, $m, $y, $accesshide=false) {
+ $href = calendar_get_link_href($linkbase, $d, $m, $y);
+ if(empty($href)) return $text;
+ return link_arrow_right($text, $href, $accesshide, 'next');
+}
+
function calendar_wday_name($englishname) {
return get_string(strtolower($englishname), 'calendar');
}
diff --git a/lib/weblib.php b/lib/weblib.php
index 66e38ac096f..b0d063eb643 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -2202,10 +2202,11 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
}
@header('Accept-Ranges: none');
+ $currentlanguage = current_language();
+
if (empty($usexml)) {
$direction = ' xmlns="http://www.w3.org/1999/xhtml"'. $direction; // See debug_header
} else {
- $currentlanguage = current_language();
$mathplayer = preg_match("/MathPlayer/i", $_SERVER['HTTP_USER_AGENT']);
if(!$mathplayer) {
header('Content-Type: application/xhtml+xml');
@@ -2262,6 +2263,8 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
$pageclass .= ' drag';
}
+ $pageclass .= ' lang-'.$currentlanguage;
+
$bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
ob_start();
@@ -2833,6 +2836,85 @@ function check_theme_arrows() {
}
}
+/**
+ * Return the right arrow with text ('next'), and optionally embedded in a link.
+ * See function above, check_theme_arrows.
+ * To see examples of this function in use, see function get_separator below (simple),
+ * and function calendar_get_link_next in calendar/lib.php (more complex).
+ * @param string $text Plain text label (set to blank only for breadcrumb separator cases).
+ * @param string $url An optional link to use in a surrounding HTML anchor.
+ * @param bool $accesshide True if text should be hidden (for screen readers only).
+ * @param string $addclass Additional class names for the link, or the arrow character.
+ * @return string HTML string.
+ */
+function link_arrow_right($text, $url='', $accesshide=false, $addclass='') {
+ global $THEME;
+ check_theme_arrows();
+ $arrowclass = 'arrow ';
+ if (! $url) {
+ $arrowclass .= $addclass;
+ }
+ $arrow = '
'.$THEME->rarrow.'';
+ $htmltext = '';
+ if ($text) {
+ $htmltext = htmlspecialchars($text).' ';
+ if ($accesshide) {
+ $htmltext = '
'.$htmltext.'';
+ }
+ }
+ if ($url) {
+ $class = '';
+ if ($addclass) {
+ $class =" class=\"$addclass\"";
+ }
+ return '
'.$htmltext.$arrow.'';
+ }
+ return $htmltext.$arrow;
+}
+
+/**
+ * Return the left arrow with text ('previous'), and optionally embedded in a link.
+ * See function above, check_theme_arrows.
+ * @param string $text Plain text label (set to blank only for breadcrumb separator cases).
+ * @param string $url An optional link to use in a surrounding HTML anchor.
+ * @param bool $accesshide True if text should be hidden (for screen readers only).
+ * @param string $addclass Additional class names for the link, or the arrow character.
+ * @return string HTML string.
+ */
+function link_arrow_left($text, $url='', $accesshide=false, $addclass='') {
+ global $THEME;
+ check_theme_arrows();
+ $arrowclass = 'arrow ';
+ if (! $url) {
+ $arrowclass .= $addclass;
+ }
+ $arrow = '
'.$THEME->larrow.'';
+ $htmltext = '';
+ if ($text) {
+ $htmltext = ' '.htmlspecialchars($text);
+ if ($accesshide) {
+ $htmltext = '
'.$htmltext.'';
+ }
+ }
+ if ($url) {
+ $class = '';
+ if ($addclass) {
+ $class =" class=\"$addclass\"";
+ }
+ return '
'.$arrow.$htmltext.'';
+ }
+ return $arrow.$htmltext;
+}
+
+/**
+ * Return the breadcrumb trail navigation separator.
+ * @return string HTML string.
+ */
+function get_separator() {
+ //Accessibility: the 'hidden' slash is preferred for screen readers.
+ return ' '.link_arrow_right($text='/', $url='', $accesshide=true, 'sep').' ';
+}
+
/**
* Prints breadcrumb trail of links, called in theme/-/header.html
*
@@ -2846,20 +2928,19 @@ function print_navigation ($navigation, $separator=0, $return=false) {
global $CFG, $THEME;
$output = '';
- check_theme_arrows();
if (0 === $separator) {
- $separator = $THEME->rarrow;
+ $separator = get_separator();
}
- if (!empty($separator)) {
+ else {
$separator = '
'. $separator .'';
}
if ($navigation) {
-
+
if (!is_array($navigation)) {
$ar = explode('->', $navigation);
$navigation = array();
-
+
foreach ($ar as $a) {
if (strpos($a, '') === false) {
$navigation[] = array('title' => $a, 'url' => '');
@@ -2875,17 +2956,17 @@ function print_navigation ($navigation, $separator=0, $return=false) {
$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 .= '
'.$nav_text."
\n";
}
@@ -3379,11 +3460,11 @@ has_capability('moodle/course:viewhiddenuserfields', $context)) {
/**
* Print a specified group's avatar.
*
- * @param group $group A {@link group} object representing a group or array of groups
- * @param int $courseid ?
- * @param boolean $large ?
- * @param boolean $return ?
- * @param boolean $link ?
+ * @param group $group A single {@link group} object OR array of groups.
+ * @param int $courseid The course ID.
+ * @param boolean $large Default small picture, or large.
+ * @param boolean $return If false print picture, otherwise return the output as string
+ * @param boolean $link Enclose image in a link to view specified course?
* @return string
* @todo Finish documenting this function
*/
@@ -4353,7 +4434,6 @@ function navmenu($course, $cm=NULL, $targetwindow='self') {
}
}
//Accessibility: added Alt text, replaced > < with 'silent' character and 'accesshide' text.
- check_theme_arrows();
if ($selectmod and has_capability('moodle/site:viewreports', $context)) {
$logstext = get_string('alllogs');
@@ -4367,15 +4447,15 @@ function navmenu($course, $cm=NULL, $targetwindow='self') {
$backtext= get_string('activityprev', 'access');
$backmod = '
'."\n".''."\n".''."\n";
+ '
'."\n".'
'."\n".''."\n".''."\n";
}
if ($nextmod) {
$nexttext= get_string('activitynext', 'access');
$nextmod = '