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');
}
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');
}
}
@ -216,11 +216,11 @@ class mod_attendance_add_form extends moodleform {
return $errors;
}
private function checkWeekDays($sessiondate, $sessionenddate, $sdays) {
private function checkweekdays($sessiondate, $sessionenddate, $sdays) {
$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) );
$interval = new DateInterval('P1D');
$end = new DateTime( date("Y-m-d", $sessionenddate) );
@ -230,7 +230,7 @@ class mod_attendance_add_form extends moodleform {
foreach ($period as $date) {
if (!$found) {
foreach ($sdays as $name => $value) {
$key = array_search($name, $daysOfWeek);
$key = array_search($name, $daysofweek);
if ($date->format("w") == $key) {
$found = true;
break;

3
locallib.php

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

Loading…
Cancel
Save