Browse Source

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

MOODLE_26_STABLE
Dan Marsden 12 years ago
parent
commit
fac3f8d18b
  1. 13
      locallib.php

13
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) {
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); $info_array[] = construct_session_full_date_time($sess->sessdate, $sess->duration);
} }
add_to_log($this->course->id, 'attendance', 'sessions added', $this->url_manage(), implode(',', $info_array), $this->cm->id); $i++;
}
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