// Check that the required parameters are present.
$id = required_param('sessid', PARAM_INT);
-$attendance_session_id = required_param('sessid', PARAM_INT);
-
$attforsession = $DB->get_record('attendance_sessions', array('id' => $id), '*', MUST_EXIST);
$attendance = $DB->get_record('attendance', array('id' => $attforsession->attendanceid), '*', MUST_EXIST);
// Link to attendance view by moduleid.
$search = "/(" . $base . "\/mod\/attendance\/view.php\?id\=)([0-9]+)/";
- $content= preg_replace($search, '$@ATTENDANCEVIEWBYID*$2@$', $content);
+ $content = preg_replace($search, '$@ATTENDANCEVIEWBYID*$2@$', $content);
// Link to attendance view by moduleid and studentid.
$search = "/(" . $base . "\/mod\/attendance\/view.php\?id\=)([0-9]+)\&studentid\=([0-9]+)/";
- $content= preg_replace($search, '$@ATTENDANCEVIEWBYIDSTUD*$2*$3@$', $content);
+ $content = preg_replace($search, '$@ATTENDANCEVIEWBYIDSTUD*$2*$3@$', $content);
return $content;
}
$rules[] = new restore_decode_rule('ATTENDANCEVIEWBYIDSTUD',
'/mod/attendance/view.php?id=$1&studentid=$2', array('course_module', 'user'));
- // Older style backups using previous plugin name
+ // Older style backups using previous plugin name.
$rules[] = new restore_decode_rule('ATTFORBLOCKVIEWBYID',
'/mod/attendance/view.php?id=$1', 'course_module');
$rules[] = new restore_decode_rule('ATTFORBLOCKVIEWBYIDSTUD',
calendar.cfg.setProperty("start_weekday", M.attendance.cal_start_weekday);
calendar.cfg.setProperty("MONTHS_LONG", M.attendance.cal_months);
calendar.cfg.setProperty("WEEKDAYS_SHORT", M.attendance.cal_week_days);
- calendar.select(new Date(M.attendance.cal_cur_date*1000));
+ calendar.select(new Date(M.attendance.cal_cur_date * 1000));
calendar.render();
calendar.selectEvent.subscribe(function() {
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
return array($this->courseid, 'attendance', 'report', 'report.php?id=' . $this->objectid,
$this->objectid, $this->contextinstanceid);
}
-
- /**
- * Custom validation.
- *
- * @throws \coding_exception
- * @return void
- */
- protected function validate_data() {
- parent::validate_data();
- }
}
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
return array($this->courseid, 'attendance', 'status added', $this->get_url(),
$this->other['acronym'].': '.$this->other['description'].' ('.$this->other['grade'].')', $this->contextinstanceid);
}
-
- /**
- * Custom validation.
- *
- * @throws \coding_exception
- * @return void
- */
- protected function validate_data() {
- parent::validate_data();
- }
}
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
* @return string
*/
public function get_description() {
- return 'User with id ' . $this->userid . ' deleted attendance status "' . $this->data['other']['acronym'] . ' - ' . $this->data['other']['description'] . '" with instanceid ' .
+ return 'User with id ' . $this->userid . ' deleted attendance status "' . $this->data['other']['acronym'] .
+ ' - ' . $this->data['other']['description'] . '" with instanceid ' .
$this->objectid . '';
}
return array($this->courseid, 'attendance', 'status removed', $this->get_url(),
$this->other['acronym'] . ' - ' . $this->other['description'], $this->contextinstanceid);
}
-
- /**
- * Custom validation.
- *
- * @throws \coding_exception
- * @return void
- */
- protected function validate_data() {
- parent::validate_data();
- }
}
* @property-read array $other {
* Extra information about event properties.
*
- * @string mode Mode of the report viewed.
+ * string mode Mode of the report viewed.
* }
* @package mod_attendance
* @since Moodle 2.7
return array($this->courseid, 'attendance', 'status updated', $this->get_url(),
$this->other['updated'], $this->contextinstanceid);
}
-
- /**
- * Custom validation.
- *
- * @throws \coding_exception
- * @return void
- */
- protected function validate_data() {
- parent::validate_data();
- }
}
global $SESSION, $OUTPUT;
if (isset($SESSION->mod_attendance_notifyqueue)) {
- foreach ($SESSION->mod_attendance_notifyqueue AS $message) {
+ foreach ($SESSION->mod_attendance_notifyqueue as $message) {
echo $OUTPUT->notification($message->message, 'notify'.$message->type);
}
unset($SESSION->mod_attendance_notifyqueue);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
-
+
upgrade_mod_savepoint($result, 2014112000, 'attendance');
}
$mform->addElement('header', 'general', get_string('changeduration', 'attendance'));
$mform->addElement('static', 'count', get_string('countofselected', 'attendance'), count(explode('_', $ids)));
- for ($i=0; $i<=23; $i++) {
+ for ($i = 0; $i <= 23; $i++) {
$hours[$i] = sprintf("%02d", $i);
}
- for ($i=0; $i<60; $i+=5) {
+ for ($i = 0; $i < 60; $i+=5) {
$minutes[$i] = sprintf("%02d", $i);
}
$durselect[] =& $mform->createElement('select', 'hours', '', $hours);
$mform->addElement('hidden', 'action', att_sessions_page_params::ACTION_CHANGE_DURATION);
$mform->setType('action', PARAM_INT);
- $mform->setDefaults(array('durtime' => array('hours'=>0, 'minutes'=>0)));
+ $mform->setDefaults(array('durtime' => array('hours' => 0, 'minutes' => 0)));
- $submit_string = get_string('update', 'attendance');
- $this->add_action_buttons(true, $submit_string);
+ $submitstring = get_string('update', 'attendance');
+ $this->add_action_buttons(true, $submitstring);
}
}
if (isset($formdata->ident['uname'])) {
$data->tabhead[] = get_string('username');
}
-
+
$optional = array('idnumber', 'institution', 'department');
foreach ($optional as $opt) {
if (isset($formdata->ident[$opt])) {
$data->tabhead[] = get_string($opt);
}
}
-
+
$data->tabhead[] = get_string('lastname');
$data->tabhead[] = get_string('firstname');
$groupmode = groups_get_activity_groupmode($cm, $course);
if (isset($formdata->ident['uname'])) {
$data->table[$i][] = $user->username;
}
-
- $optional_row = array('idnumber', 'institution', 'department');
- foreach ($optional_row as $opt) {
+
+ $optionalrow = array('idnumber', 'institution', 'department');
+ foreach ($optionalrow as $opt) {
if (isset($formdata->ident[$opt])) {
$data->table[$i][] = $user->$opt;
}
}
-
+
$data->table[$i][] = $user->lastname;
$data->table[$i][] = $user->firstname;
if (!empty($groupmode)) {
$mform->addElement('header', 'general', get_string('export', 'attendance'));
- $groupmode=groups_get_activity_groupmode($cm, $course);
+ $groupmode = groups_get_activity_groupmode($cm, $course);
$groups = groups_get_activity_allowed_groups($cm, $USER->id);
if ($groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $modcontext)) {
$grouplist[0] = get_string('allparticipants');
}
$mform->addElement('select', 'group', get_string('group'), $grouplist);
-
// Restrict the export to the selected users.
$namefields = get_all_user_name_fields(true, 'u');
$allusers = get_enrolled_users($modcontext, 'mod/attendance:canbelisted', 0, 'u.id,'.$namefields);
$ident = array();
$ident[] =& $mform->createElement('checkbox', 'id', '', get_string('studentid', 'attendance'));
$ident[] =& $mform->createElement('checkbox', 'uname', '', get_string('username'));
-
+
$optional = array('idnumber', 'institution', 'department');
foreach ($optional as $opt) {
$ident[] =& $mform->createElement('checkbox', $opt, '', get_string($opt));
$mform->setType($opt, PARAM_NOTAGS);
}
-
+
$mform->addGroup($ident, 'ident', get_string('identifyby', 'attendance'), array('<br />'), true);
$mform->setDefaults(array('ident[id]' => true, 'ident[uname]' => true));
$mform->setType('id', PARAM_INT);
'text' => get_string('downloadtext', 'attendance')
));
- $submit_string = get_string('ok');
- $this->add_action_buttons(false, $submit_string);
+ $submitstring = get_string('ok');
+ $this->add_action_buttons(false, $submitstring);
$mform->addElement('hidden', 'id', $cm->id);
}
- function validation($data, $files) {
+ public function validation($data, $files) {
$errors = parent::validation($data, $files);
// Validate the 'users' field.
function att_add_default_statuses($attid) {
global $DB;
- $statuses = $DB->get_recordset('attendance_statuses', array('attendanceid'=> 0), 'id');
+ $statuses = $DB->get_recordset('attendance_statuses', array('attendanceid' => 0), 'id');
foreach ($statuses as $st) {
$rec = $st;
$rec->attendanceid = $attid;
function attendance_delete_instance($id) {
global $DB;
- if (! $attendance = $DB->get_record('attendance', array('id'=> $id))) {
+ if (! $attendance = $DB->get_record('attendance', array('id' => $id))) {
return false;
}
- if ($sessids = array_keys($DB->get_records('attendance_sessions', array('attendanceid'=> $id), '', 'id'))) {
+ if ($sessids = array_keys($DB->get_records('attendance_sessions', array('attendanceid' => $id), '', 'id'))) {
$DB->delete_records_list('attendance_log', 'sessionid', $sessids);
- $DB->delete_records('attendance_sessions', array('attendanceid'=> $id));
+ $DB->delete_records('attendance_sessions', array('attendanceid' => $id));
}
- $DB->delete_records('attendance_statuses', array('attendanceid'=> $id));
+ $DB->delete_records('attendance_statuses', array('attendanceid' => $id));
- $DB->delete_records('attendance', array('id'=> $id));
+ $DB->delete_records('attendance', array('id' => $id));
attendance_grade_item_delete($attendance);
function attendance_delete_course($course, $feedback=true) {
global $DB;
- $attids = array_keys($DB->get_records('attendance', array('course'=> $course->id), '', 'id'));
+ $attids = array_keys($DB->get_records('attendance', array('course' => $course->id), '', 'id'));
$sessids = array_keys($DB->get_records_list('attendance_sessions', 'attendanceid', $attids, '', 'id'));
if ($sessids) {
$DB->delete_records_list('attendance_log', 'sessionid', $sessids);
$DB->delete_records_list('attendance_statuses', 'attendanceid', $attids);
$DB->delete_records_list('attendance_sessions', 'attendanceid', $attids);
}
- $DB->delete_records('attendance', array('course'=> $course->id));
+ $DB->delete_records('attendance', array('course' => $course->id));
return true;
}
* Course reset form defaults.
*/
function attendance_reset_course_form_defaults($course) {
- return array('reset_attendance_log'=>0, 'reset_attendance_statuses'=>0, 'reset_attendance_sessions'=>0);
+ return array('reset_attendance_log' => 0, 'reset_attendance_statuses' => 0, 'reset_attendance_sessions' => 0);
}
function attendance_reset_userdata($data) {
$status = array();
- $attids = array_keys($DB->get_records('attendance', array('course'=> $data->courseid), '', 'id'));
+ $attids = array_keys($DB->get_records('attendance', array('course' => $data->courseid), '', 'id'));
if (!empty($data->reset_attendance_log)) {
$sess = $DB->get_records_list('attendance_sessions', 'attendanceid', $attids, '', 'id');
if (!isset($attendance->courseid)) {
$attendance->courseid = $attendance->course;
}
- if (! $course = $DB->get_record('course', array('id'=> $attendance->course))) {
+ if (! $course = $DB->get_record('course', array('id' => $attendance->course))) {
error("Course is misconfigured");
}
if (!empty($attendance->cmidnumber)) {
- $params = array('itemname'=>$attendance->name, 'idnumber'=>$attendance->cmidnumber);
+ $params = array('itemname' => $attendance->name, 'idnumber' => $attendance->cmidnumber);
} else {
// MDL-14303.
$cm = get_coursemodule_from_instance('attendance', $attendance->id);
- $params = array('itemname'=>$attendance->name/*, 'idnumber'=>$attendance->id*/);
+ $params = array('itemname' => $attendance->name/*, 'idnumber'=>$attendance->id*/);
}
if ($attendance->grade > 0) {
$params['gradetype'] = GRADE_TYPE_NONE;
}
- if ($grades === 'reset') {
+ if ($grades === 'reset') {
$params['reset'] = true;
$grades = null;
}
}
return grade_update('mod/attendance', $attendance->courseid, 'mod', 'attendance',
- $attendance->id, 0, null, array('deleted'=>1));
+ $attendance->id, 0, null, array('deleted' => 1));
}
function attendance_get_participants($attendanceid) {
$mform->addElement('header', 'general', get_string('general', 'form'));
- $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
+ $mform->addElement('text', 'name', get_string('name'), array('size' => '64'));
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', null, 'required', null, 'client');
$mform->setDefault('name', get_string('modulename', 'attendance'));