|
|
@ -798,8 +798,7 @@ class attendance { |
|
|
|
foreach ($sessions as $sess) { |
|
|
|
$info_array[] = construct_session_full_date_time($sess->sessdate, $sess->duration); |
|
|
|
} |
|
|
|
|
|
|
|
$this->log('sessions added', $this->url_manage(), implode(', ', $info_array)); |
|
|
|
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) { |
|
|
@ -821,7 +820,7 @@ class attendance { |
|
|
|
|
|
|
|
$url = $this->url_sessions(array('sessionid' => $sessionid, 'action' => att_sessions_page_params::ACTION_UPDATE)); |
|
|
|
$info = construct_session_full_date_time($sess->sessdate, $sess->duration); |
|
|
|
$this->log('session updated', $url, $info); |
|
|
|
add_to_log($this->course->id, 'attendance', 'session updated', $url, $info, $this->cm->id); |
|
|
|
} |
|
|
|
|
|
|
|
public function take_from_form_data($formdata) { |
|
|
@ -875,7 +874,7 @@ class attendance { |
|
|
|
'sessionid' => $this->pageparams->sessionid, |
|
|
|
'grouptype' => $this->pageparams->grouptype); |
|
|
|
$url = $this->url_take($params); |
|
|
|
$this->log('attendance taked', $url, $USER->firstname.' '.$USER->lastname); |
|
|
|
add_to_log($this->course->id, 'attendance', 'taken', $url, '', $this->cm->id); |
|
|
|
|
|
|
|
redirect($this->url_manage(), get_string('attendancesuccess', 'attendance')); |
|
|
|
} |
|
|
@ -1154,8 +1153,8 @@ class attendance { |
|
|
|
list($sql, $params) = $DB->get_in_or_equal($sessionsids); |
|
|
|
$DB->delete_records_select('attendance_log', "sessionid $sql", $params); |
|
|
|
$DB->delete_records_list('attendance_sessions', 'id', $sessionsids); |
|
|
|
|
|
|
|
$this->log('sessions deleted', null, get_string('sessionsids', 'attendance').implode(', ', $sessionsids)); |
|
|
|
add_to_log($this->course->id, 'attendance', 'sessions deleted', $this->url_manage(), |
|
|
|
get_string('sessionsids', 'attendance').implode(', ', $sessionsids), $this->cm->id); |
|
|
|
} |
|
|
|
|
|
|
|
public function update_sessions_duration($sessionsids, $duration) { |
|
|
@ -1168,9 +1167,8 @@ class attendance { |
|
|
|
$sess->timemodified = $now; |
|
|
|
$DB->update_record('attendance_sessions', $sess); |
|
|
|
} |
|
|
|
|
|
|
|
$this->log('sessions duration updated', $this->url_manage(), |
|
|
|
get_string('sessionsids', 'attendance').implode(', ', $sessionsids)); |
|
|
|
add_to_log($this->course->id, 'attendance', 'sessions duration updated', $this->url_manage(), |
|
|
|
get_string('sessionsids', 'attendance').implode(', ', $sessionsids), $this->cm->id); |
|
|
|
} |
|
|
|
|
|
|
|
public function remove_status($statusid) { |
|
|
@ -1191,7 +1189,8 @@ class attendance { |
|
|
|
$rec->grade = $grade; |
|
|
|
$DB->insert_record('attendance_statuses', $rec); |
|
|
|
|
|
|
|
$this->log('status added', $this->url_preferences(), $acronym.': '.$description.' ('.$grade.')'); |
|
|
|
add_to_log($this->course->id, 'attendance', 'status added', $this->url_preferences(), |
|
|
|
$acronym.': '.$description.' ('.$grade.')', $this->cm->id); |
|
|
|
} else { |
|
|
|
print_error('cantaddstatus', 'attendance', $this->url_preferences()); |
|
|
|
} |
|
|
@ -1222,27 +1221,8 @@ class attendance { |
|
|
|
} |
|
|
|
$DB->update_record('attendance_statuses', $status); |
|
|
|
|
|
|
|
$this->log('status updated', $this->url_preferences(), implode(' ', $updated)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* wrapper around {@see add_to_log()} |
|
|
|
* |
|
|
|
* @param string $action to be logged |
|
|
|
* @param moodle_url $url absolute url, if null will be used $this->url_manage() |
|
|
|
* @param mixed $info additional info, usually id in a table |
|
|
|
*/ |
|
|
|
public function log($action, moodle_url $url = null, $info = null) { |
|
|
|
if (is_null($url)) { |
|
|
|
$url = $this->url_manage(); |
|
|
|
} |
|
|
|
|
|
|
|
if (is_null($info)) { |
|
|
|
$info = $this->id; |
|
|
|
} |
|
|
|
|
|
|
|
$logurl = att_log_convert_url($url); |
|
|
|
add_to_log($this->course->id, 'attendance', $action, $logurl, $info, $this->cm->id); |
|
|
|
add_to_log($this->course->id, 'attendance', 'status updated', $this->url_preferences(), |
|
|
|
implode(' ', $updated), $this->cm->id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|