From ec74ba2dbc53165c905af21460bf5c6a4f61c6b7 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Fri, 27 Jul 2018 22:49:58 +1200 Subject: [PATCH] Fix some coding guideline issues. --- add_form.php | 4 ++-- classes/calendar_helpers.php | 5 ++--- classes/structure.php | 3 ++- db/upgrade.php | 2 +- locallib.php | 2 +- update_form.php | 3 ++- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/add_form.php b/add_form.php index fe4bbed..447a940 100644 --- a/add_form.php +++ b/add_form.php @@ -253,10 +253,10 @@ class mod_attendance_add_form extends moodleform { $mform->hideif('subnetgrp', 'studentscanmark', 'notchecked'); $mform->hideif('subnet', 'usedefaultsubnet', 'checked'); - $mgroup3 = array(); $options = attendance_get_sharedipoptions(); - $mgroup3[] = & $mform->createElement('select', 'preventsharedip', get_string('preventsharedip', 'attendance'), $options); + $mgroup3[] = & $mform->createElement('select', 'preventsharedip', + get_string('preventsharedip', 'attendance'), $options); $mgroup3[] = & $mform->createElement('text', 'preventsharediptime', get_string('preventsharediptime', 'attendance'), '', 'test'); $mform->addGroup($mgroup3, 'preventsharedgroup', get_string('preventsharedip', 'attendance'), array(' '), false); diff --git a/classes/calendar_helpers.php b/classes/calendar_helpers.php index ce9472e..580721f 100644 --- a/classes/calendar_helpers.php +++ b/classes/calendar_helpers.php @@ -116,14 +116,13 @@ function attendance_update_calendar_event($session) { // Should there even be an event? if ($session->calendarevent == 0) { if ($session->caleventid != 0) { - // There is an existing event we should delete - // (calendarevent option just got turned off) + // There is an existing event we should delete, calendarevent just got turned off. $DB->delete_records_list('event', 'id', array($caleventid)); $session->caleventid = 0; $DB->update_record('attendance_sessions', $session); return true; } else { - // This should be the common case when session does not want event + // This should be the common case when session does not want event. return true; } } diff --git a/classes/structure.php b/classes/structure.php index 1df808a..0bda822 100644 --- a/classes/structure.php +++ b/classes/structure.php @@ -1289,7 +1289,8 @@ class mod_attendance_structure { $gradeitem = grade_item::fetch(array('courseid' => $this->course->id, 'itemtype' => 'mod', 'itemmodule' => 'attendance', 'iteminstance' => $this->id)); if ($gradeitem->gradepass > 0 && $gradeitem->grademax != $gradeitem->grademin) { - $this->lowgradethreshold = ($gradeitem->gradepass - $gradeitem->grademin) / ($gradeitem->grademax - $gradeitem->grademin); + $this->lowgradethreshold = ($gradeitem->gradepass - $gradeitem->grademin) / + ($gradeitem->grademax - $gradeitem->grademin); } } } diff --git a/db/upgrade.php b/db/upgrade.php index fc4588e..6790614 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -518,7 +518,7 @@ function xmldb_attendance_upgrade($oldversion=0) { if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); if (empty(get_config('attendance', 'enablecalendar'))) { - // Calendar disabled on this site, set calendarevent for existing records to 0; + // Calendar disabled on this site, set calendarevent for existing records to 0. $DB->execute("UPDATE {attendance_sessions} set calendarevent = 0"); } } diff --git a/locallib.php b/locallib.php index 98b9fb0..6bb233d 100644 --- a/locallib.php +++ b/locallib.php @@ -588,7 +588,7 @@ function attendance_construct_sessions_data_for_add($formdata, mod_attendance_st } $calendarevent = 0; - if (isset($formdata->calendarevent)) { // Calendar event should be created + if (isset($formdata->calendarevent)) { // Calendar event should be created. $calendarevent = 1; } diff --git a/update_form.php b/update_form.php index 113f9cd..3790ecf 100644 --- a/update_form.php +++ b/update_form.php @@ -171,7 +171,8 @@ class mod_attendance_update_form extends moodleform { $mgroup3 = array(); $options = attendance_get_sharedipoptions(); - $mgroup3[] = & $mform->createElement('select', 'preventsharedip', get_string('preventsharedip', 'attendance'), $options); + $mgroup3[] = & $mform->createElement('select', 'preventsharedip', + get_string('preventsharedip', 'attendance'), $options); $mgroup3[] = & $mform->createElement('text', 'preventsharediptime', get_string('preventsharediptime', 'attendance'), '', 'test'); $mform->addGroup($mgroup3, 'preventsharedgroup',