From 55fdb47cba75753488b0f7b209fc9e6ad6ff352b Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 20 Nov 2015 11:03:55 +1300 Subject: [PATCH] more coding guideline fixes --- add_form.php | 14 +++++++------- duration_form.php | 2 +- locallib.php | 9 ++++----- update_form.php | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/add_form.php b/add_form.php index 025de7b..a7b9e15 100644 --- a/add_form.php +++ b/add_form.php @@ -114,7 +114,7 @@ class mod_attendance_add_form extends moodleform { 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); } $durtime = array(); @@ -194,12 +194,12 @@ class mod_attendance_add_form extends moodleform { } $addmulti = isset($data['addmultiply']) ? (int)$data['addmultiply'] : 0; - if (($addmulti != 0) && (!array_key_exists('sdays',$data) || empty($data['sdays']))) { - $data['sdays']= array(); + if (($addmulti != 0) && (!array_key_exists('sdays', $data) || empty($data['sdays']))) { + $data['sdays'] = array(); $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; diff --git a/duration_form.php b/duration_form.php index 7bcdcbb..3e067d5 100644 --- a/duration_form.php +++ b/duration_form.php @@ -53,7 +53,7 @@ class mod_attendance_duration_form extends moodleform { 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); diff --git a/locallib.php b/locallib.php index c58c131..9f4d98f 100644 --- a/locallib.php +++ b/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; @@ -1420,7 +1419,7 @@ class attendance { /** * Remove a status variable from an attendance instance - * + * * @global moodle_database $DB * @param stdClass $status */ @@ -1442,7 +1441,7 @@ class attendance { /** * Add an attendance status variable - * + * * @global moodle_database $DB * @param string $acronym * @param string $description @@ -1478,7 +1477,7 @@ class attendance { /** * Update status variable for a particular Attendance module instance - * + * * @global moodle_database $DB * @param stdClass $status * @param string $acronym diff --git a/update_form.php b/update_form.php index 2959940..cd579ee 100644 --- a/update_form.php +++ b/update_form.php @@ -68,7 +68,7 @@ class mod_attendance_update_form extends moodleform { 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);