Browse Source

Prevent too much info in add_to_log - enter first 10 and last session into log

MOODLE_23_STABLE
Dan Marsden 12 years ago
parent
commit
0dc8d1f714
  1. 15
      locallib.php

15
locallib.php

@ -795,10 +795,21 @@ class attendance {
} }
$info_array = array(); $info_array = array();
$maxlog = 10; // Only log first 10 sessions and last session in the log info. as we can only store 255 chars.
$i = 0;
foreach ($sessions as $sess) { foreach ($sessions as $sess) {
$info_array[] = construct_session_full_date_time($sess->sessdate, $sess->duration); if ($i > $maxlog) {
$lastsession = end($sessions);
$info_array[] = '...';
$info_array[] = construct_session_full_date_time($lastsession->sessdate, $lastsession->duration);
break;
} else {
$info_array[] = construct_session_full_date_time($sess->sessdate, $sess->duration);
}
$i++;
} }
add_to_log($this->course->id, 'attendance', 'sessions added', $this->url_manage(), implode(',', $info_array), $this->cm->id); add_to_log($this->course->id, 'attendance', 'sessions added', $this->url_manage(),
implode(',', $info_array), $this->cm->id);
} }
public function update_session_from_form_data($formdata, $sessionid) { public function update_session_from_form_data($formdata, $sessionid) {

Loading…
Cancel
Save