Browse Source

Fix some coding guideline issues.

MOODLE_35_STABLE
Dan Marsden 7 years ago
parent
commit
ec74ba2dbc
  1. 4
      add_form.php
  2. 5
      classes/calendar_helpers.php
  3. 3
      classes/structure.php
  4. 2
      db/upgrade.php
  5. 2
      locallib.php
  6. 3
      update_form.php

4
add_form.php

@ -253,10 +253,10 @@ class mod_attendance_add_form extends moodleform {
$mform->hideif('subnetgrp', 'studentscanmark', 'notchecked'); $mform->hideif('subnetgrp', 'studentscanmark', 'notchecked');
$mform->hideif('subnet', 'usedefaultsubnet', 'checked'); $mform->hideif('subnet', 'usedefaultsubnet', 'checked');
$mgroup3 = array(); $mgroup3 = array();
$options = attendance_get_sharedipoptions(); $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', $mgroup3[] = & $mform->createElement('text', 'preventsharediptime',
get_string('preventsharediptime', 'attendance'), '', 'test'); get_string('preventsharediptime', 'attendance'), '', 'test');
$mform->addGroup($mgroup3, 'preventsharedgroup', get_string('preventsharedip', 'attendance'), array(' '), false); $mform->addGroup($mgroup3, 'preventsharedgroup', get_string('preventsharedip', 'attendance'), array(' '), false);

5
classes/calendar_helpers.php

@ -116,14 +116,13 @@ function attendance_update_calendar_event($session) {
// Should there even be an event? // Should there even be an event?
if ($session->calendarevent == 0) { if ($session->calendarevent == 0) {
if ($session->caleventid != 0) { if ($session->caleventid != 0) {
// There is an existing event we should delete // There is an existing event we should delete, calendarevent just got turned off.
// (calendarevent option just got turned off)
$DB->delete_records_list('event', 'id', array($caleventid)); $DB->delete_records_list('event', 'id', array($caleventid));
$session->caleventid = 0; $session->caleventid = 0;
$DB->update_record('attendance_sessions', $session); $DB->update_record('attendance_sessions', $session);
return true; return true;
} else { } 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; return true;
} }
} }

3
classes/structure.php

@ -1289,7 +1289,8 @@ class mod_attendance_structure {
$gradeitem = grade_item::fetch(array('courseid' => $this->course->id, 'itemtype' => 'mod', $gradeitem = grade_item::fetch(array('courseid' => $this->course->id, 'itemtype' => 'mod',
'itemmodule' => 'attendance', 'iteminstance' => $this->id)); 'itemmodule' => 'attendance', 'iteminstance' => $this->id));
if ($gradeitem->gradepass > 0 && $gradeitem->grademax != $gradeitem->grademin) { 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);
} }
} }
} }

2
db/upgrade.php

@ -518,7 +518,7 @@ function xmldb_attendance_upgrade($oldversion=0) {
if (!$dbman->field_exists($table, $field)) { if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field); $dbman->add_field($table, $field);
if (empty(get_config('attendance', 'enablecalendar'))) { 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"); $DB->execute("UPDATE {attendance_sessions} set calendarevent = 0");
} }
} }

2
locallib.php

@ -588,7 +588,7 @@ function attendance_construct_sessions_data_for_add($formdata, mod_attendance_st
} }
$calendarevent = 0; $calendarevent = 0;
if (isset($formdata->calendarevent)) { // Calendar event should be created if (isset($formdata->calendarevent)) { // Calendar event should be created.
$calendarevent = 1; $calendarevent = 1;
} }

3
update_form.php

@ -171,7 +171,8 @@ class mod_attendance_update_form extends moodleform {
$mgroup3 = array(); $mgroup3 = array();
$options = attendance_get_sharedipoptions(); $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', $mgroup3[] = & $mform->createElement('text', 'preventsharediptime',
get_string('preventsharediptime', 'attendance'), '', 'test'); get_string('preventsharediptime', 'attendance'), '', 'test');
$mform->addGroup($mgroup3, 'preventsharedgroup', $mform->addGroup($mgroup3, 'preventsharedgroup',

Loading…
Cancel
Save