diff --git a/lib.php b/lib.php index e2dbc88..eeb9d03 100644 --- a/lib.php +++ b/lib.php @@ -395,15 +395,3 @@ function attendance_pluginfile($course, $cm, $context, $filearea, $args, $forced } send_stored_file($file, 0, 0, true); } - -// Count the number of status sets that exist for this instance. -function attendance_get_max_statusset($attendanceid) { - global $DB; - - $max = $DB->get_field_sql('SELECT MAX(setnumber) FROM {attendance_statuses} WHERE attendanceid = ? AND deleted = 0', - array($attendanceid)); - if ($max) { - return $max; - } - return 0; -} diff --git a/locallib.php b/locallib.php index b13046a..6f1eb6b 100644 --- a/locallib.php +++ b/locallib.php @@ -281,4 +281,21 @@ function attendance_form_sessiondate_selector (MoodleQuickForm $mform) { $sesendtime[] =& $mform->createElement('select', 'endhour', get_string('hour', 'form'), $hours, false, true); $sesendtime[] =& $mform->createElement('select', 'endminute', get_string('minute', 'form'), $minutes, false, true); $mform->addGroup($sesendtime, 'sestime', get_string('time', 'attendance'), array(' '), true); -} \ No newline at end of file +} + +/** + * Count the number of status sets that exist for this instance. + * + * @param int $attendanceid + * @return int + */ +function attendance_get_max_statusset($attendanceid) { + global $DB; + + $max = $DB->get_field_sql('SELECT MAX(setnumber) FROM {attendance_statuses} WHERE attendanceid = ? AND deleted = 0', + array($attendanceid)); + if ($max) { + return $max; + } + return 0; +}