diff --git a/add_form.php b/add_form.php
index 9b2b7b1..4157c2f 100644
--- a/add_form.php
+++ b/add_form.php
@@ -242,6 +242,13 @@ class mod_attendance_add_form extends moodleform {
return $errors;
}
+ /**
+ * Check weekdays function.
+ * @param int $sessiondate
+ * @param int $sessionenddate
+ * @param int $sdays
+ * @return bool
+ */
private function checkweekdays($sessiondate, $sessionenddate, $sdays) {
$found = false;
diff --git a/classes/attendance_webservices_handler.php b/classes/attendance_webservices_handler.php
index 4809bb3..0b0d079 100644
--- a/classes/attendance_webservices_handler.php
+++ b/classes/attendance_webservices_handler.php
@@ -13,6 +13,7 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+
/**
* Web Services for Attendance plugin.
*
@@ -28,10 +29,17 @@ require_once(dirname(__FILE__).'/structure.php');
require_once(dirname(__FILE__).'/../../../lib/sessionlib.php');
require_once(dirname(__FILE__).'/../../../lib/datalib.php');
+/**
+ * Class attendance_handler
+ * @copyright 2015 Caio Bressan Doneda
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class attendance_handler {
/**
* For this user, this method searches in all the courses that this user has permission to take attendance,
* looking for today sessions and returns the courses with the sessions.
+ * @param int $userid
+ * @return array
*/
public static function get_courses_with_today_sessions($userid) {
$usercourses = enrol_get_users_courses($userid);
@@ -69,6 +77,12 @@ class attendance_handler {
return self::prepare_data($coursessessions);
}
+ /**
+ * Prepare data.
+ *
+ * @param array $coursessessions
+ * @return array
+ */
private static function prepare_data($coursessessions) {
$courses = array();
@@ -82,8 +96,11 @@ class attendance_handler {
return $courses;
}
- /*
- ** For this session, returns all the necessary data to take an attendance
+ /**
+ * For this session, returns all the necessary data to take an attendance.
+ *
+ * @param int $sessionid
+ * @return mixed
*/
public static function get_session($sessionid) {
global $DB;
@@ -103,6 +120,15 @@ class attendance_handler {
return $session;
}
+ /**
+ * Update user status
+ *
+ * @param int $sessionid
+ * @param int $studentid
+ * @param int $takenbyid
+ * @param int $statusid
+ * @param int $statusset
+ */
public static function update_user_status($sessionid, $studentid, $takenbyid, $statusid, $statusset) {
global $DB;
diff --git a/classes/calendar_helpers.php b/classes/calendar_helpers.php
index b6fd53f..723264c 100644
--- a/classes/calendar_helpers.php
+++ b/classes/calendar_helpers.php
@@ -64,7 +64,7 @@ function attendance_create_calendar_event(&$session) {
/**
* Create multiple calendar events based on sessions data.
*
- * @param array %sessionsids array of sessions ids
+ * @param array $sessionsids array of sessions ids
*/
function attendance_create_calendar_events($sessionsids) {
global $DB;
@@ -81,9 +81,9 @@ function attendance_create_calendar_events($sessionsids) {
/**
* Update calendar event duration and date
*
- * @param $caleventid int calendar event id
- * @param $timeduration int duration of the event
- * @param $timestart int start time of the event
+ * @param int $caleventid calendar event id
+ * @param int $timeduration duration of the event
+ * @param int $timestart start time of the event
* @return bool result of updating
*/
function attendance_update_calendar_event($caleventid, $timeduration, $timestart) {
@@ -103,7 +103,7 @@ function attendance_update_calendar_event($caleventid, $timeduration, $timestart
/**
* Delete calendar events for sessions
*
- * @param array %sessionsids array of sessions ids
+ * @param array $sessionsids array of sessions ids
* @return bool result of updating
*/
function attendance_delete_calendar_events($sessionsids) {
diff --git a/classes/manage_page_params.php b/classes/manage_page_params.php
index 93ba64d..48e5a54 100644
--- a/classes/manage_page_params.php
+++ b/classes/manage_page_params.php
@@ -30,10 +30,17 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_attendance_manage_page_params extends mod_attendance_page_with_filter_controls {
+ /**
+ * mod_attendance_manage_page_params constructor.
+ */
public function __construct() {
$this->selectortype = mod_attendance_page_with_filter_controls::SELECTOR_SESS_TYPE;
}
+ /**
+ * Get page params.
+ * @return array
+ */
public function get_significant_params() {
return array();
}
diff --git a/classes/page_with_filter_controls.php b/classes/page_with_filter_controls.php
index e25d529..26a20b4 100644
--- a/classes/page_with_filter_controls.php
+++ b/classes/page_with_filter_controls.php
@@ -24,18 +24,28 @@
defined('MOODLE_INTERNAL') || die();
/**
- * base filter controls class - overridden by different views where needed.
+ * Base filter controls class - overridden by different views where needed.
*
* @copyright 2016 Dan Marsden http://danmarsden.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_attendance_page_with_filter_controls {
+ /** No filter. */
const SELECTOR_NONE = 1;
+
+ /** Filter by group. */
const SELECTOR_GROUP = 2;
+
+ /** Filter by session type. */
const SELECTOR_SESS_TYPE = 3;
+ /** Common. */
const SESSTYPE_COMMON = 0;
+
+ /** All. */
const SESSTYPE_ALL = -1;
+
+ /** No value. */
const SESSTYPE_NO_VALUE = -2;
/** @var int current view mode */
@@ -50,16 +60,26 @@ class mod_attendance_page_with_filter_controls {
/** @var int end date of displayed date range */
public $enddate;
+ /** @var int type. */
public $selectortype = self::SELECTOR_NONE;
+ /** @var int default view. */
protected $defaultview = ATT_VIEW_WEEKS;
+ /** @var stdClass course module record. */
private $cm;
+ /** @var array */
private $sessgroupslist;
+ /** @var int */
private $sesstype;
+ /**
+ * initialise stuff.
+ *
+ * @param stdClass $cm
+ */
public function init($cm) {
$this->cm = $cm;
$this->init_view();
@@ -67,6 +87,9 @@ class mod_attendance_page_with_filter_controls {
$this->init_start_end_date();
}
+ /**
+ * Initialise the view.
+ */
private function init_view() {
global $SESSION;
@@ -79,6 +102,9 @@ class mod_attendance_page_with_filter_controls {
}
}
+ /**
+ * Initialise the current date.
+ */
private function init_curdate() {
global $SESSION;
@@ -91,6 +117,9 @@ class mod_attendance_page_with_filter_controls {
}
}
+ /**
+ * Initialise the end date.
+ */
public function init_start_end_date() {
global $CFG;
@@ -132,6 +161,9 @@ class mod_attendance_page_with_filter_controls {
}
}
+ /**
+ * Calculate the session group list type.
+ */
private function calc_sessgroupslist_sesstype() {
global $SESSION;
@@ -180,6 +212,9 @@ class mod_attendance_page_with_filter_controls {
}
}
+ /**
+ * Calculate the session group list
+ */
private function calc_sessgroupslist() {
global $USER, $PAGE;
@@ -207,6 +242,11 @@ class mod_attendance_page_with_filter_controls {
}
}
+ /**
+ * Return the session groups.
+ *
+ * @return array
+ */
public function get_sess_groups_list() {
if (is_null($this->sessgroupslist)) {
$this->calc_sessgroupslist_sesstype();
@@ -215,6 +255,11 @@ class mod_attendance_page_with_filter_controls {
return $this->sessgroupslist;
}
+ /**
+ * Get the current session type.
+ *
+ * @return int
+ */
public function get_current_sesstype() {
if (is_null($this->sesstype)) {
$this->calc_sessgroupslist_sesstype();
@@ -223,6 +268,11 @@ class mod_attendance_page_with_filter_controls {
return $this->sesstype;
}
+ /**
+ * Set the current session type.
+ *
+ * @param int $sesstype
+ */
public function set_current_sesstype($sesstype) {
$this->sesstype = $sesstype;
}
diff --git a/classes/preferences_page_params.php b/classes/preferences_page_params.php
index 9437b4c..9be3a29 100644
--- a/classes/preferences_page_params.php
+++ b/classes/preferences_page_params.php
@@ -30,19 +30,31 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_attendance_preferences_page_params {
+ /** Add */
const ACTION_ADD = 1;
+ /** Delete */
const ACTION_DELETE = 2;
+ /** Hide */
const ACTION_HIDE = 3;
+ /** Show */
const ACTION_SHOW = 4;
+ /** Save */
const ACTION_SAVE = 5;
/** @var int view mode of taking attendance page*/
public $action;
+ /** @var int */
public $statusid;
+ /** @var array */
public $statusset;
+ /**
+ * Get params for this page.
+ *
+ * @return array
+ */
public function get_significant_params() {
$params = array();
diff --git a/classes/report_page_params.php b/classes/report_page_params.php
index 9a7c2d6..a0d995c 100644
--- a/classes/report_page_params.php
+++ b/classes/report_page_params.php
@@ -30,15 +30,27 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_attendance_report_page_params extends mod_attendance_page_with_filter_controls {
+ /** @var int */
public $group;
+ /** @var int */
public $sort;
+ /** @var int */
public $showsessiondetails;
+ /** @var int */
public $sessiondetailspos;
+ /**
+ * mod_attendance_report_page_params constructor.
+ */
public function __construct() {
$this->selectortype = self::SELECTOR_GROUP;
}
+ /**
+ * Initialise params.
+ *
+ * @param stdClass $cm
+ */
public function init($cm) {
parent::init($cm);
@@ -50,6 +62,10 @@ class mod_attendance_report_page_params extends mod_attendance_page_with_filter_
}
}
+ /**
+ * Get params for this page.
+ * @return array
+ */
public function get_significant_params() {
$params = array();
diff --git a/classes/structure.php b/classes/structure.php
index 3506217..8efdf29 100644
--- a/classes/structure.php
+++ b/classes/structure.php
@@ -32,7 +32,9 @@ require_once(dirname(__FILE__) . '/calendar_helpers.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_attendance_structure {
+ /** Common sessions */
const SESSION_COMMON = 0;
+ /** Group sessions */
const SESSION_GROUP = 1;
/** @var stdclass course module record */
@@ -62,23 +64,27 @@ class mod_attendance_structure {
/** @var int format of the intro (see above) */
public $introformat;
- /** current page parameters */
+ /** @var array current page parameters */
public $pageparams;
+ /** @var string subnets (IP range) for student self selection. */
public $subnet;
- /** Define if session details should be shown in reports */
+ /** @var int Define if session details should be shown in reports */
public $showsessiondetails;
- /** Position for the session detail columns related to summary columns.*/
+ /** @var int Position for the session detail columns related to summary columns.*/
public $sessiondetailspos;
+ /** @var int groupmode */
private $groupmode;
+ /** @var array */
private $statuses;
- private $allstatuses; // Cache list of all statuses (not just one used by current session).
+ /** @var array Cache list of all statuses (not just one used by current session). */
+ private $allstatuses;
- // Array by sessionid.
+ /** @var array of sessionid. */
private $sessioninfo = array();
/**
@@ -91,8 +97,9 @@ class mod_attendance_structure {
* @param stdClass $cm Course module record as returned by {@link get_coursemodule_from_id()}
* @param stdClass $course Course record from {course} table
* @param stdClass $context The context of the workshop instance
+ * @param stdClass $pageparams
*/
- public function __construct(stdclass $dbrecord, stdclass $cm, stdclass $course, stdclass $context=null, $pageparams=null) {
+ public function __construct(stdClass $dbrecord, stdClass $cm, stdClass $course, stdClass $context=null, $pageparams=null) {
global $DB;
foreach ($dbrecord as $field => $value) {
@@ -120,6 +127,11 @@ class mod_attendance_structure {
}
}
+ /**
+ * Get group mode.
+ *
+ * @return int
+ */
public function get_group_mode() {
if (is_null($this->groupmode)) {
$this->groupmode = groups_get_activity_groupmode($this->cm, $this->course);
@@ -179,7 +191,7 @@ class mod_attendance_structure {
* Returns today sessions suitable for copying attendance log
*
* Fetches data from {attendance_sessions}
- *
+ * @param stdClass $sess
* @return array of records or an empty array
*/
public function get_today_sessions_for_copy($sess) {
@@ -237,6 +249,11 @@ class mod_attendance_structure {
return $DB->get_records_select('attendance_sessions', $where, $params);
}
+ /**
+ * Get filtered sessions.
+ *
+ * @return array
+ */
public function get_filtered_sessions() {
global $DB;
@@ -273,6 +290,8 @@ class mod_attendance_structure {
}
/**
+ * Get manage url.
+ * @param array $params
* @return moodle_url of manage.php for attendance instance
*/
public function url_manage($params=array()) {
@@ -281,6 +300,7 @@ class mod_attendance_structure {
}
/**
+ * Get manage temp users url.
* @param array $params optional
* @return moodle_url of tempusers.php for attendance instance
*/
@@ -290,6 +310,8 @@ class mod_attendance_structure {
}
/**
+ * Get temp delete url.
+ *
* @param array $params optional
* @return moodle_url of tempdelete.php for attendance instance
*/
@@ -299,6 +321,8 @@ class mod_attendance_structure {
}
/**
+ * Get temp edit url.
+ *
* @param array $params optional
* @return moodle_url of tempedit.php for attendance instance
*/
@@ -308,6 +332,8 @@ class mod_attendance_structure {
}
/**
+ * Get temp merge url
+ *
* @param array $params optional
* @return moodle_url of tempedit.php for attendance instance
*/
@@ -317,6 +343,8 @@ class mod_attendance_structure {
}
/**
+ * Get url for sessions.
+ * @param array $params
* @return moodle_url of sessions.php for attendance instance
*/
public function url_sessions($params=array()) {
@@ -325,6 +353,8 @@ class mod_attendance_structure {
}
/**
+ * Get url for report.
+ * @param array $params
* @return moodle_url of report.php for attendance instance
*/
public function url_report($params=array()) {
@@ -333,6 +363,8 @@ class mod_attendance_structure {
}
/**
+ * Get url for export.
+ *
* @return moodle_url of export.php for attendance instance
*/
public function url_export() {
@@ -341,6 +373,8 @@ class mod_attendance_structure {
}
/**
+ * Get preferences url
+ * @param array $params
* @return moodle_url of attsettings.php for attendance instance
*/
public function url_preferences($params=array()) {
@@ -353,6 +387,8 @@ class mod_attendance_structure {
}
/**
+ * Get take url.
+ * @param array $params
* @return moodle_url of attendances.php for attendance instance
*/
public function url_take($params=array()) {
@@ -360,11 +396,21 @@ class mod_attendance_structure {
return new moodle_url('/mod/attendance/take.php', $params);
}
+ /**
+ * Get view url.
+ * @param array $params
+ * @return moodle_url
+ */
public function url_view($params=array()) {
$params = array_merge(array('id' => $this->cm->id), $params);
return new moodle_url('/mod/attendance/view.php', $params);
}
+ /**
+ * Add sessions.
+ *
+ * @param array $sessions
+ */
public function add_sessions($sessions) {
global $DB;
@@ -402,6 +448,12 @@ class mod_attendance_structure {
}
}
+ /**
+ * Update session from form.
+ *
+ * @param stdClass $formdata
+ * @param int $sessionid
+ */
public function update_session_from_form_data($formdata, $sessionid) {
global $DB;
@@ -449,7 +501,7 @@ class mod_attendance_structure {
/**
* Used to record attendance submitted by the student.
*
- * @param type $mformdata
+ * @param stdClass $mformdata
* @return boolean
*/
public function take_from_student($mformdata) {
@@ -506,6 +558,11 @@ class mod_attendance_structure {
return true;
}
+ /**
+ * Take attendance from form data.
+ *
+ * @param stdClass $formdata
+ */
public function take_from_form_data($formdata) {
global $DB, $USER;
// TODO: WARNING - $formdata is unclean - comes from direct $_POST - ideally needs a rewrite but we do some cleaning below.
@@ -592,7 +649,11 @@ class mod_attendance_structure {
}
/**
- * MDL-27591 made this method obsolete.
+ * Get users with enrolment status (Feature request MDL-27591)
+ *
+ * @param int $groupid
+ * @param int $page
+ * @return array
*/
public function get_users($groupid = 0, $page = 1) {
global $DB, $CFG;
@@ -687,7 +748,12 @@ class mod_attendance_structure {
return $users;
}
- // Convert a tempuser record into a user object.
+ /**
+ * Convert a tempuser record into a user object.
+ *
+ * @param stdClass $tempuser
+ * @return object
+ */
protected static function tempuser_to_user($tempuser) {
$ret = (object)array(
'id' => $tempuser->studentid,
@@ -708,6 +774,12 @@ class mod_attendance_structure {
return $ret;
}
+ /**
+ * Get user and include extra info.
+ *
+ * @param int $userid
+ * @return mixed|object
+ */
public function get_user($userid) {
global $DB;
@@ -749,6 +821,13 @@ class mod_attendance_structure {
return $user;
}
+ /**
+ * Get possible statuses.
+ *
+ * @param bool $onlyvisible
+ * @param bool $allsets
+ * @return array
+ */
public function get_statuses($onlyvisible = true, $allsets = false) {
if (!isset($this->statuses)) {
// Get the statuses for the current set only.
@@ -770,6 +849,11 @@ class mod_attendance_structure {
return $this->statuses;
}
+ /**
+ * Get session info.
+ * @param int $sessionid
+ * @return mixed
+ */
public function get_session_info($sessionid) {
global $DB;
@@ -785,6 +869,12 @@ class mod_attendance_structure {
return $this->sessioninfo[$sessionid];
}
+ /**
+ * Get sessions info
+ *
+ * @param array $sessionids
+ * @return array
+ */
public function get_sessions_info($sessionids) {
global $DB;
@@ -803,16 +893,31 @@ class mod_attendance_structure {
return $sessions;
}
+ /**
+ * Get log.
+ *
+ * @param int $sessionid
+ * @return array
+ */
public function get_session_log($sessionid) {
global $DB;
return $DB->get_records('attendance_log', array('sessionid' => $sessionid), '', 'studentid,statusid,remarks,id');
}
+ /**
+ * Update user grade.
+ * @param array $userids
+ */
public function update_users_grade($userids) {
attendance_update_users_grade($this, $userids);
}
+ /**
+ * Get filtered log.
+ * @param int $userid
+ * @return array
+ */
public function get_user_filtered_sessions_log($userid) {
global $DB;
@@ -857,6 +962,11 @@ class mod_attendance_structure {
return $sessions;
}
+ /**
+ * Get filtered log extended.
+ * @param int $userid
+ * @return array
+ */
public function get_user_filtered_sessions_log_extended($userid) {
global $DB;
// All taked sessions (including previous groups).
@@ -937,6 +1047,10 @@ class mod_attendance_structure {
return $sessions;
}
+ /**
+ * Delete sessions.
+ * @param array $sessionsids
+ */
public function delete_sessions($sessionsids) {
global $DB;
if (attendance_existing_calendar_events_ids($sessionsids)) {
@@ -954,6 +1068,12 @@ class mod_attendance_structure {
$event->trigger();
}
+ /**
+ * Update duration.
+ *
+ * @param array $sessionsids
+ * @param int $duration
+ */
public function update_sessions_duration($sessionsids, $duration) {
global $DB;
diff --git a/classes/take_page_params.php b/classes/take_page_params.php
index 3857d7e..38f29ec 100644
--- a/classes/take_page_params.php
+++ b/classes/take_page_params.php
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-defined('MOODLE_INTERNAL') || die();
/**
* Class definition for mod_attendance_take_page_params
@@ -23,6 +22,8 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* contains functions/constants used by take attendance page.
*
@@ -30,22 +31,34 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_attendance_take_page_params {
+ /** Sorted list. */
const SORTED_LIST = 1;
+ /** Sorted grid. */
const SORTED_GRID = 2;
+ /** Default view */
const DEFAULT_VIEW_MODE = self::SORTED_LIST;
+ /** @var int */
public $sessionid;
+ /** @var int */
public $grouptype;
+ /** @var int */
public $group;
+ /** @var int */
public $sort;
+ /** @var int */
public $copyfrom;
/** @var int view mode of taking attendance page*/
public $viewmode;
+ /** @var int */
public $gridcols;
+ /**
+ * Initialize params.
+ */
public function init() {
if (!isset($this->group)) {
$this->group = 0;
@@ -57,6 +70,9 @@ class mod_attendance_take_page_params {
$this->init_gridcols();
}
+ /**
+ * Initialise view mode params.
+ */
private function init_view_mode() {
if (isset($this->viewmode)) {
set_user_preference("attendance_take_view_mode", $this->viewmode);
@@ -65,6 +81,9 @@ class mod_attendance_take_page_params {
}
}
+ /**
+ * Initilise grid columns.
+ */
private function init_gridcols() {
if (isset($this->gridcols)) {
set_user_preference("attendance_gridcolumns", $this->gridcols);
@@ -73,6 +92,10 @@ class mod_attendance_take_page_params {
}
}
+ /**
+ * Get main page params.
+ * @return array
+ */
public function get_significant_params() {
$params = array();
diff --git a/classes/view_page_params.php b/classes/view_page_params.php
index 93843ea..c0f98a7 100644
--- a/classes/view_page_params.php
+++ b/classes/view_page_params.php
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-defined('MOODLE_INTERNAL') || die();
/**
* Class definition for mod_attendance_view_page_params
@@ -23,6 +22,8 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
+
/**
* contains functions/constants used by attendance view page.
*
@@ -30,17 +31,30 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_attendance_view_page_params extends mod_attendance_page_with_filter_controls {
+ /** Only This course */
const MODE_THIS_COURSE = 0;
+
+ /** All courses */
const MODE_ALL_COURSES = 1;
+ /** @var int */
public $studentid;
+ /** @var string */
public $mode;
+ /**
+ * mod_attendance_view_page_params constructor.
+ */
public function __construct() {
$this->defaultview = ATT_VIEW_MONTHS;
}
+ /**
+ * Get params for url.
+ *
+ * @return array
+ */
public function get_significant_params() {
$params = array();
diff --git a/export_form.php b/export_form.php
index 053ae44..2a7b280 100644
--- a/export_form.php
+++ b/export_form.php
@@ -137,6 +137,12 @@ class mod_attendance_export_form extends moodleform {
$mform->addElement('hidden', 'id', $cm->id);
}
+ /**
+ * Validate form.
+ * @param array $data
+ * @param array $files
+ * @return array
+ */
public function validation($data, $files) {
$errors = parent::validation($data, $files);
diff --git a/temp_form.php b/temp_form.php
index 1572647..87b2a0b 100644
--- a/temp_form.php
+++ b/temp_form.php
@@ -27,9 +27,16 @@ defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir.'/formslib.php');
+/**
+ * Class temp_form
+ * @copyright 2013 Davo Smith, Synergy Learning
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class temp_form extends moodleform {
+ /**
+ * Define form.
+ */
public function definition() {
-
$mform = $this->_form;
$mform->addElement('hidden', 'id', 0);
@@ -49,11 +56,21 @@ class temp_form extends moodleform {
$mform->closeHeaderBefore('submit');
}
+ /**
+ * Do stuff to form after creation.
+ */
public function definition_after_data() {
$mform = $this->_form;
$mform->applyFilter('tname', 'trim');
}
+ /**
+ * Form validation.
+ *
+ * @param array $data
+ * @param array $files
+ * @return array
+ */
public function validation($data, $files) {
$errors = parent::validation($data, $files);
@@ -63,6 +80,4 @@ class temp_form extends moodleform {
return $errors;
}
-
}
-
diff --git a/tempusers.php b/tempusers.php
index b15f50a..0faf1f1 100644
--- a/tempusers.php
+++ b/tempusers.php
@@ -89,12 +89,18 @@ $tempusers = $DB->get_records('attendance_tempusers', array('courseid' => $cours
echo '
';
echo '
'.get_string('tempuserslist', 'attendance').'
';
if ($tempusers) {
- print_tempusers($tempusers, $att);
+ attendance_print_tempusers($tempusers, $att);
}
echo '
';
echo $output->footer($course);
-function print_tempusers($tempusers, mod_attendance_structure $att) {
+/**
+ * Print list of users.
+ *
+ * @param stdClass $tempusers
+ * @param mod_attendance_structure $att
+ */
+function attendance_print_tempusers($tempusers, mod_attendance_structure $att) {
echo '';
echo '