Browse Source

Fix some coding guideline issues.

MOODLE_29_STABLE
Dan Marsden 9 years ago
parent
commit
396d24d047
  1. 2
      attendance.php
  2. 2
      backup/moodle2/restore_attendance_activity_task.class.php
  3. 2
      classes/event/attendance_taken.php
  4. 2
      classes/event/attendance_taken_by_student.php
  5. 12
      classes/event/report_viewed.php
  6. 2
      classes/event/session_added.php
  7. 2
      classes/event/session_deleted.php
  8. 2
      classes/event/session_duration_updated.php
  9. 2
      classes/event/session_updated.php
  10. 12
      classes/event/status_added.php
  11. 15
      classes/event/status_removed.php
  12. 12
      classes/event/status_updated.php
  13. 2
      classes/notifyqueue.php
  14. 4
      duration_form.php
  15. 4
      export.php
  16. 7
      export_form.php

2
attendance.php

@ -30,8 +30,6 @@ $pageparams = new att_sessions_page_params();
// Check that the required parameters are present. // Check that the required parameters are present.
$id = required_param('sessid', PARAM_INT); $id = required_param('sessid', PARAM_INT);
$attendance_session_id = required_param('sessid', PARAM_INT);
$attforsession = $DB->get_record('attendance_sessions', array('id' => $id), '*', MUST_EXIST); $attforsession = $DB->get_record('attendance_sessions', array('id' => $id), '*', MUST_EXIST);
$attendance = $DB->get_record('attendance', array('id' => $attforsession->attendanceid), '*', MUST_EXIST); $attendance = $DB->get_record('attendance', array('id' => $attforsession->attendanceid), '*', MUST_EXIST);

2
backup/moodle2/restore_attendance_activity_task.class.php

@ -72,7 +72,7 @@ class restore_attendance_activity_task extends restore_activity_task {
$rules[] = new restore_decode_rule('ATTENDANCEVIEWBYIDSTUD', $rules[] = new restore_decode_rule('ATTENDANCEVIEWBYIDSTUD',
'/mod/attendance/view.php?id=$1&studentid=$2', array('course_module', 'user')); '/mod/attendance/view.php?id=$1&studentid=$2', array('course_module', 'user'));
// Older style backups using previous plugin name // Older style backups using previous plugin name.
$rules[] = new restore_decode_rule('ATTFORBLOCKVIEWBYID', $rules[] = new restore_decode_rule('ATTFORBLOCKVIEWBYID',
'/mod/attendance/view.php?id=$1', 'course_module'); '/mod/attendance/view.php?id=$1', 'course_module');
$rules[] = new restore_decode_rule('ATTFORBLOCKVIEWBYIDSTUD', $rules[] = new restore_decode_rule('ATTFORBLOCKVIEWBYIDSTUD',

2
classes/event/attendance_taken.php

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7

2
classes/event/attendance_taken_by_student.php

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7

12
classes/event/report_viewed.php

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7
@ -86,14 +86,4 @@ class report_viewed extends \core\event\base {
return array($this->courseid, 'attendance', 'report', 'report.php?id=' . $this->objectid, return array($this->courseid, 'attendance', 'report', 'report.php?id=' . $this->objectid,
$this->objectid, $this->contextinstanceid); $this->objectid, $this->contextinstanceid);
} }
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
}
} }

2
classes/event/session_added.php

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7

2
classes/event/session_deleted.php

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7

2
classes/event/session_duration_updated.php

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7

2
classes/event/session_updated.php

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7

12
classes/event/status_added.php

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7
@ -86,14 +86,4 @@ class status_added extends \core\event\base {
return array($this->courseid, 'attendance', 'status added', $this->get_url(), return array($this->courseid, 'attendance', 'status added', $this->get_url(),
$this->other['acronym'].': '.$this->other['description'].' ('.$this->other['grade'].')', $this->contextinstanceid); $this->other['acronym'].': '.$this->other['description'].' ('.$this->other['grade'].')', $this->contextinstanceid);
} }
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
}
} }

15
classes/event/status_removed.php

@ -32,7 +32,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7
@ -56,7 +56,8 @@ class status_removed extends \core\event\base {
* @return string * @return string
*/ */
public function get_description() { public function get_description() {
return 'User with id ' . $this->userid . ' deleted attendance status "' . $this->data['other']['acronym'] . ' - ' . $this->data['other']['description'] . '" with instanceid ' . return 'User with id ' . $this->userid . ' deleted attendance status "' . $this->data['other']['acronym'] .
' - ' . $this->data['other']['description'] . '" with instanceid ' .
$this->objectid . ''; $this->objectid . '';
} }
@ -87,14 +88,4 @@ class status_removed extends \core\event\base {
return array($this->courseid, 'attendance', 'status removed', $this->get_url(), return array($this->courseid, 'attendance', 'status removed', $this->get_url(),
$this->other['acronym'] . ' - ' . $this->other['description'], $this->contextinstanceid); $this->other['acronym'] . ' - ' . $this->other['description'], $this->contextinstanceid);
} }
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
}
} }

12
classes/event/status_updated.php

@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event properties. * Extra information about event properties.
* *
* @string mode Mode of the report viewed. * string mode Mode of the report viewed.
* } * }
* @package mod_attendance * @package mod_attendance
* @since Moodle 2.7 * @since Moodle 2.7
@ -86,14 +86,4 @@ class status_updated extends \core\event\base {
return array($this->courseid, 'attendance', 'status updated', $this->get_url(), return array($this->courseid, 'attendance', 'status updated', $this->get_url(),
$this->other['updated'], $this->contextinstanceid); $this->other['updated'], $this->contextinstanceid);
} }
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
}
} }

2
classes/notifyqueue.php

@ -33,7 +33,7 @@ class mod_attendance_notifyqueue {
global $SESSION, $OUTPUT; global $SESSION, $OUTPUT;
if (isset($SESSION->mod_attendance_notifyqueue)) { if (isset($SESSION->mod_attendance_notifyqueue)) {
foreach ($SESSION->mod_attendance_notifyqueue AS $message) { foreach ($SESSION->mod_attendance_notifyqueue as $message) {
echo $OUTPUT->notification($message->message, 'notify'.$message->type); echo $OUTPUT->notification($message->message, 'notify'.$message->type);
} }
unset($SESSION->mod_attendance_notifyqueue); unset($SESSION->mod_attendance_notifyqueue);

4
duration_form.php

@ -69,8 +69,8 @@ class mod_attendance_duration_form extends moodleform {
$mform->setDefaults(array('durtime' => array('hours' => 0, 'minutes' => 0))); $mform->setDefaults(array('durtime' => array('hours' => 0, 'minutes' => 0)));
$submit_string = get_string('update', 'attendance'); $submitstring = get_string('update', 'attendance');
$this->add_action_buttons(true, $submit_string); $this->add_action_buttons(true, $submitstring);
} }
} }

4
export.php

@ -134,8 +134,8 @@ if ($formdata = $mform->get_data()) {
$data->table[$i][] = $user->username; $data->table[$i][] = $user->username;
} }
$optional_row = array('idnumber', 'institution', 'department'); $optionalrow = array('idnumber', 'institution', 'department');
foreach ($optional_row as $opt) { foreach ($optionalrow as $opt) {
if (isset($formdata->ident[$opt])) { if (isset($formdata->ident[$opt])) {
$data->table[$i][] = $user->$opt; $data->table[$i][] = $user->$opt;
} }

7
export_form.php

@ -60,7 +60,6 @@ class mod_attendance_export_form extends moodleform {
} }
$mform->addElement('select', 'group', get_string('group'), $grouplist); $mform->addElement('select', 'group', get_string('group'), $grouplist);
// Restrict the export to the selected users. // Restrict the export to the selected users.
$namefields = get_all_user_name_fields(true, 'u'); $namefields = get_all_user_name_fields(true, 'u');
$allusers = get_enrolled_users($modcontext, 'mod/attendance:canbelisted', 0, 'u.id,'.$namefields); $allusers = get_enrolled_users($modcontext, 'mod/attendance:canbelisted', 0, 'u.id,'.$namefields);
@ -128,13 +127,13 @@ class mod_attendance_export_form extends moodleform {
'text' => get_string('downloadtext', 'attendance') 'text' => get_string('downloadtext', 'attendance')
)); ));
$submit_string = get_string('ok'); $submitstring = get_string('ok');
$this->add_action_buttons(false, $submit_string); $this->add_action_buttons(false, $submitstring);
$mform->addElement('hidden', 'id', $cm->id); $mform->addElement('hidden', 'id', $cm->id);
} }
function validation($data, $files) { public function validation($data, $files) {
$errors = parent::validation($data, $files); $errors = parent::validation($data, $files);
// Validate the 'users' field. // Validate the 'users' field.

Loading…
Cancel
Save