Browse Source

found log function in attforblock

MOODLE_26_STABLE
Joseph Baxter 11 years ago
parent
commit
e5a4dbb12c
  1. 42
      locallib.php

42
locallib.php

@ -810,8 +810,8 @@ class attendance {
} }
$i++; $i++;
} }
add_to_log($this->course->id, 'attendance', 'sessions added', $this->url_manage(),
implode(',', $info_array), $this->cm->id); $this->log('sessions added', $this->url_manage(), implode(', ', $info_array));
} }
public function update_session_from_form_data($formdata, $sessionid) { public function update_session_from_form_data($formdata, $sessionid) {
@ -833,7 +833,7 @@ class attendance {
$url = $this->url_sessions(array('sessionid' => $sessionid, 'action' => att_sessions_page_params::ACTION_UPDATE)); $url = $this->url_sessions(array('sessionid' => $sessionid, 'action' => att_sessions_page_params::ACTION_UPDATE));
$info = construct_session_full_date_time($sess->sessdate, $sess->duration); $info = construct_session_full_date_time($sess->sessdate, $sess->duration);
add_to_log($this->course->id, 'attendance', 'session updated', $url, $info, $this->cm->id); $this->log('session updated', $url, $info);
} }
/** /**
@ -884,18 +884,12 @@ class attendance {
$params = array( $params = array(
'sessionid' => $this->pageparams->sessionid, 'sessionid' => $this->pageparams->sessionid,
'grouptype' => 0, 'grouptype' => 0);
'id' => $this->cm->id);
$url = 'take.php?';
foreach ($params as $param => $value) {
$url = $url . $param . '=' . $value . '&';
}
$url = rtrim($url,'&'); $url = $this->url_take($params);
// Log the change. // Log the change.
add_to_log($this->course->id, 'attendance', 'taken', $url, '', $USER->id); $this->log('attendance taken', $url, $USER->firstname.' '.$USER->lastname);
return true; return true;
} }
@ -950,17 +944,12 @@ class attendance {
// create url for link in log screen // create url for link in log screen
$params = array( $params = array(
'sessionid' => $this->pageparams->sessionid, 'sessionid' => $this->pageparams->sessionid,
'grouptype' => $this->pageparams->grouptype, 'grouptype' => $this->pageparams->grouptype);
'id' => $this->cm->id);
$url = 'take.php?';
foreach ($params as $param => $value) {
$url = $url . $param . '=' . $value . '&';
}
$url = rtrim($url,'&'); $url = $this->url_take($params);
add_to_log($this->course->id, 'attendance', 'taken', $url, '', $this->cm->id); // Log the change.
$this->log('attendance taken', $url, $USER->firstname.' '.$USER->lastname);
$group = 0; $group = 0;
if ($this->pageparams->grouptype != attendance::SESSION_COMMON) { if ($this->pageparams->grouptype != attendance::SESSION_COMMON) {
@ -1392,8 +1381,7 @@ class attendance {
list($sql, $params) = $DB->get_in_or_equal($sessionsids); list($sql, $params) = $DB->get_in_or_equal($sessionsids);
$DB->delete_records_select('attendance_log', "sessionid $sql", $params); $DB->delete_records_select('attendance_log', "sessionid $sql", $params);
$DB->delete_records_list('attendance_sessions', 'id', $sessionsids); $DB->delete_records_list('attendance_sessions', 'id', $sessionsids);
add_to_log($this->course->id, 'attendance', 'sessions deleted', $this->url_manage(), $this->log('sessions deleted', null, get_string('sessionsids', 'attforblock').implode(', ', $sessionsids));
get_string('sessionsids', 'attendance').implode(', ', $sessionsids), $this->cm->id);
} }
public function update_sessions_duration($sessionsids, $duration) { public function update_sessions_duration($sessionsids, $duration) {
@ -1409,6 +1397,8 @@ class attendance {
$sessions->close(); $sessions->close();
add_to_log($this->course->id, 'attendance', 'sessions duration updated', $this->url_manage(), add_to_log($this->course->id, 'attendance', 'sessions duration updated', $this->url_manage(),
get_string('sessionsids', 'attendance').implode(', ', $sessionsids), $this->cm->id); get_string('sessionsids', 'attendance').implode(', ', $sessionsids), $this->cm->id);
$this->log('sessions duration updated', $this->url_manage(), get_string('sessionsids', 'attforblock').implode(', ', $sessionsids));
} }
public function remove_status($statusid) { public function remove_status($statusid) {
@ -1429,8 +1419,7 @@ class attendance {
$rec->grade = $grade; $rec->grade = $grade;
$DB->insert_record('attendance_statuses', $rec); $DB->insert_record('attendance_statuses', $rec);
add_to_log($this->course->id, 'attendance', 'status added', $this->url_preferences(), $this->log('status added', $this->url_preferences(), $acronym.': '.$description.' ('.$grade.')');
$acronym.': '.$description.' ('.$grade.')', $this->cm->id);
} else { } else {
print_error('cantaddstatus', 'attendance', $this->url_preferences()); print_error('cantaddstatus', 'attendance', $this->url_preferences());
} }
@ -1461,8 +1450,7 @@ class attendance {
} }
$DB->update_record('attendance_statuses', $status); $DB->update_record('attendance_statuses', $status);
add_to_log($this->course->id, 'attendance', 'status updated', $this->url_preferences(), $this->log('status updated', $this->url_preferences(), implode(' ', $updated));
implode(' ', $updated), $this->cm->id);
} }
} }

Loading…
Cancel
Save