Browse Source

more coding guideline fixes

MOODLE_29_STABLE
Dan Marsden 9 years ago
parent
commit
55fdb47cba
  1. 8
      add_form.php
  2. 3
      locallib.php

8
add_form.php

@ -199,7 +199,7 @@ class mod_attendance_add_form extends moodleform {
$errors['sdays'] = get_string('required', 'attendance'); $errors['sdays'] = get_string('required', 'attendance');
} }
if (isset($data['sdays'])) { if (isset($data['sdays'])) {
if (!$this->checkWeekDays($data['sessiondate'], $data['sessionenddate'], $data['sdays']) ) { if (!$this->checkweekdays($data['sessiondate'], $data['sessionenddate'], $data['sdays']) ) {
$errors['sdays'] = get_string('checkweekdays', 'attendance'); $errors['sdays'] = get_string('checkweekdays', 'attendance');
} }
} }
@ -216,11 +216,11 @@ class mod_attendance_add_form extends moodleform {
return $errors; return $errors;
} }
private function checkWeekDays($sessiondate, $sessionenddate, $sdays) { private function checkweekdays($sessiondate, $sessionenddate, $sdays) {
$found = false; $found = false;
$daysOfWeek = array(0 => "Sun", 1 => "Mon", 2 => "Tue", 3 => "Wed", 4 => "Thu", 5 => "Fri", 6 => "Sat"); $daysofweek = array(0 => "Sun", 1 => "Mon", 2 => "Tue", 3 => "Wed", 4 => "Thu", 5 => "Fri", 6 => "Sat");
$start = new DateTime( date("Y-m-d", $sessiondate) ); $start = new DateTime( date("Y-m-d", $sessiondate) );
$interval = new DateInterval('P1D'); $interval = new DateInterval('P1D');
$end = new DateTime( date("Y-m-d", $sessionenddate) ); $end = new DateTime( date("Y-m-d", $sessionenddate) );
@ -230,7 +230,7 @@ class mod_attendance_add_form extends moodleform {
foreach ($period as $date) { foreach ($period as $date) {
if (!$found) { if (!$found) {
foreach ($sdays as $name => $value) { foreach ($sdays as $name => $value) {
$key = array_search($name, $daysOfWeek); $key = array_search($name, $daysofweek);
if ($date->format("w") == $key) { if ($date->format("w") == $key) {
$found = true; $found = true;
break; break;

3
locallib.php

@ -856,8 +856,7 @@ class attendance {
$sesslog[$sid]->studentid = $sid; // We check is_numeric on this above. $sesslog[$sid]->studentid = $sid; // We check is_numeric on this above.
$sesslog[$sid]->statusid = $value; // We check is_numeric on this above. $sesslog[$sid]->statusid = $value; // We check is_numeric on this above.
$sesslog[$sid]->statusset = $statuses; $sesslog[$sid]->statusset = $statuses;
$sesslog[$sid]->remarks = array_key_exists('remarks'.$sid, $formdata) ? $sesslog[$sid]->remarks = array_key_exists('remarks'.$sid, $formdata) ? clean_param($formdata['remarks'.$sid], PARAM_TEXT) : '';
clean_param($formdata['remarks'.$sid], PARAM_TEXT) : '';
$sesslog[$sid]->sessionid = $this->pageparams->sessionid; $sesslog[$sid]->sessionid = $this->pageparams->sessionid;
$sesslog[$sid]->timetaken = $now; $sesslog[$sid]->timetaken = $now;
$sesslog[$sid]->takenby = $USER->id; $sesslog[$sid]->takenby = $USER->id;

Loading…
Cancel
Save