Browse Source

Improve display of dates within attendance for standard en lang.

MOODLE_32_STABLE
Dan Marsden 8 years ago
parent
commit
f3fa38fe58
  1. 11
      lang/en/attendance.php
  2. 11
      renderer.php
  3. 14
      renderhelpers.php
  4. 2
      student_attendance_form.php

11
lang/en/attendance.php

@ -267,11 +267,12 @@ $string['status'] = 'Status';
$string['statuses'] = 'Statuses';
$string['statusdeleted'] = 'Status deleted';
$string['statusset'] = 'Status set {$a}';
$string['strftimedm'] = '%d.%m';
$string['strftimedmy'] = '%d.%m.%Y';
$string['strftimedmyhm'] = '%d.%m.%Y %H.%M'; // Line added to allow multiple sessions in the same day.
$string['strftimedmyw'] = '%d.%m.%y (%a)';
$string['strftimehm'] = '%H:%M'; // Line added to allow display of time.
$string['strftimedm'] = '%h %d';
$string['strftimedmy'] = '%d %h %Y';
$string['strftimedmyhm'] = '%d %h %Y %I.%M%P'; // Line added to allow multiple sessions in the same day.
$string['strftimedmyw'] = '<nobr>%a %d %h %Y</nobr>';
$string['strftimeh'] = '%l%P';
$string['strftimehm'] = '%l:%M%P';
$string['strftimeshortdate'] = '%d.%m.%Y';
$string['studentid'] = 'Student ID';
$string['summary'] = 'Summary';

11
renderer.php

@ -387,8 +387,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
private function construct_take_session_info(attendance_take_data $takedata) {
$sess = $takedata->sessioninfo;
$date = userdate($sess->sessdate, get_string('strftimedate'));
$starttime = userdate($sess->sessdate, get_string('strftimehm', 'attendance'));
$endtime = userdate($sess->sessdate + $sess->duration, get_string('strftimehm', 'attendance'));
$starttime = attendance_strftimehm($sess->sessdate);
$endtime = attendance_strftimehm($sess->sessdate + $sess->duration);
$time = html_writer::tag('nobr', $starttime . ($sess->duration > 0 ? ' - ' . $endtime : ''));
$sessinfo = $date.' '.$time;
$sessinfo .= html_writer::empty_tag('br');
@ -485,9 +485,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
$options = array();
foreach ($takedata->sessions4copy as $sess) {
$start = userdate($sess->sessdate, get_string('strftimehm', 'attendance'));
$end = $sess->duration ? ' - '.userdate($sess->sessdate + $sess->duration,
get_string('strftimehm', 'attendance')) : '';
$start = attendance_strftimehm($sess->sessdate);
$end = $sess->duration ? ' - '.attendance_strftimehm($sess->sessdate + $sess->duration) : '';
$options[$sess->id] = $start . $end;
}
$select = new single_select($takedata->url(array(), array('copyfrom')), 'copyfrom', $options);
@ -1153,7 +1152,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
foreach ($reportdata->sessions as $sess) {
$sesstext = userdate($sess->sessdate, get_string('strftimedm', 'attendance'));
$sesstext .= html_writer::empty_tag('br');
$sesstext .= userdate($sess->sessdate, '('.get_string('strftimehm', 'attendance').')');
$sesstext .= attendance_strftimehm($sess->sessdate);
$capabilities = array(
'mod/attendance:takeattendances',
'mod/attendance:changeattendances'

14
renderhelpers.php

@ -217,9 +217,19 @@ class user_sessions_cells_text_generator extends user_sessions_cells_generator {
}
}
// Used to print simple time - 1am instead of 1:00am
function attendance_strftimehm($time) {
$mins = userdate($time, '%M');
if ($mins == '00') {
return userdate($time, get_string('strftimeh', 'attendance'));
} else {
return userdate($time, get_string('strftimehm', 'attendance'));
}
}
function construct_session_time($datetime, $duration) {
$starttime = userdate($datetime, get_string('strftimehm', 'attendance'));
$endtime = userdate($datetime + $duration, get_string('strftimehm', 'attendance'));
$starttime = attendance_strftimehm($datetime);
$endtime = attendance_strftimehm($datetime + $duration);
return $starttime . ($duration > 0 ? ' - ' . $endtime : '');
}

2
student_attendance_form.php

@ -38,7 +38,7 @@ class mod_attendance_student_attendance_form extends moodleform {
// Set a title as the date and time of the session.
$sesstiontitle = userdate($attforsession->sessdate, get_string('strftimedate')).' '
.userdate($attforsession->sessdate, get_string('strftimehm', 'mod_attendance'));
.attendance_strftimehm($attforsession->sessdate);
$mform->addElement('header', 'session', $sesstiontitle);

Loading…
Cancel
Save