diff --git a/add_form.php b/add_form.php
index 3ce9fa5..61b8f6e 100644
--- a/add_form.php
+++ b/add_form.php
@@ -14,11 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * This file contains the forms to add
+ *
+ * @package mod_attendance
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
require_once($CFG->libdir.'/formslib.php');
class mod_attforblock_add_form extends moodleform {
- function definition() {
+ public function definition() {
global $CFG, $USER;
$mform =& $this->_form;
@@ -27,9 +35,7 @@ class mod_attforblock_add_form extends moodleform {
$cm = $this->_customdata['cm'];
$modcontext = $this->_customdata['modcontext'];
-
- $mform->addElement('header', 'general', get_string('addsession','attforblock'));//fill in the data depending on page params
- //later using set_data
+ $mform->addElement('header', 'general', get_string('addsession','attforblock'));
$groupmode = groups_get_activity_groupmode($cm);
switch ($groupmode) {
@@ -76,10 +82,10 @@ class mod_attforblock_add_form extends moodleform {
return;
}
}
-
+
$mform->addElement('checkbox', 'addmultiply', '', get_string('createmultiplesessions','attforblock'));
- $mform->addHelpButton('addmultiply', 'createmultiplesessions', 'attforblock');
-
+ $mform->addHelpButton('addmultiply', 'createmultiplesessions', 'attforblock');
+
// $mform->addElement('date_selector', 'sessiondate', get_string('sessiondate','attforblock'));
$mform->addElement('date_time_selector', 'sessiondate', get_string('sessiondate','attforblock'));
@@ -91,38 +97,38 @@ class mod_attforblock_add_form extends moodleform {
}
$durtime = array();
$durtime[] =& $mform->createElement('select', 'hours', get_string('hour', 'form'), $hours, false, true);
- $durtime[] =& $mform->createElement('select', 'minutes', get_string('minute', 'form'), $minutes, false, true);
+ $durtime[] =& $mform->createElement('select', 'minutes', get_string('minute', 'form'), $minutes, false, true);
$mform->addGroup($durtime, 'durtime', get_string('duration','attforblock'), array(' '), true);
-
+
$mform->addElement('date_selector', 'sessionenddate', get_string('sessionenddate','attforblock'));
- $mform->disabledIf('sessionenddate', 'addmultiply', 'notchecked');
-
+ $mform->disabledIf('sessionenddate', 'addmultiply', 'notchecked');
+
$sdays = array();
- if ($CFG->calendar_startwday === '0') { //week start from sunday
- $sdays[] =& $mform->createElement('checkbox', 'Sun', '', get_string('sunday','calendar'));
- }
+ if ($CFG->calendar_startwday === '0') { //week start from sunday
+ $sdays[] =& $mform->createElement('checkbox', 'Sun', '', get_string('sunday','calendar'));
+ }
$sdays[] =& $mform->createElement('checkbox', 'Mon', '', get_string('monday','calendar'));
$sdays[] =& $mform->createElement('checkbox', 'Tue', '', get_string('tuesday','calendar'));
$sdays[] =& $mform->createElement('checkbox', 'Wed', '', get_string('wednesday','calendar'));
$sdays[] =& $mform->createElement('checkbox', 'Thu', '', get_string('thursday','calendar'));
$sdays[] =& $mform->createElement('checkbox', 'Fri', '', get_string('friday','calendar'));
$sdays[] =& $mform->createElement('checkbox', 'Sat', '', get_string('saturday','calendar'));
- if ($CFG->calendar_startwday !== '0') { //week start from sunday
- $sdays[] =& $mform->createElement('checkbox', 'Sun', '', get_string('sunday','calendar'));
- }
+ if ($CFG->calendar_startwday !== '0') { //week start from sunday
+ $sdays[] =& $mform->createElement('checkbox', 'Sun', '', get_string('sunday','calendar'));
+ }
$mform->addGroup($sdays, 'sdays', get_string('sessiondays','attforblock'), array(' '), true);
- $mform->disabledIf('sdays', 'addmultiply', 'notchecked');
-
+ $mform->disabledIf('sdays', 'addmultiply', 'notchecked');
+
$period = array(1=>1,2,3,4,5,6,7,8);
$periodgroup = array();
$periodgroup[] =& $mform->createElement('select', 'period', '', $period, false, true);
$periodgroup[] =& $mform->createElement('static', 'perioddesc', '', get_string('week','attforblock'));
$mform->addGroup($periodgroup, 'periodgroup', get_string('period','attforblock'), array(' '), false);
- $mform->disabledIf('periodgroup', 'addmultiply', 'notchecked');
-
+ $mform->disabledIf('periodgroup', 'addmultiply', 'notchecked');
+
$mform->addElement('editor', 'sdescription', get_string('description', 'attforblock'), null, array('maxfiles'=>EDITOR_UNLIMITED_FILES, 'noclean'=>true, 'context'=>$modcontext));
$mform->setType('sdescription', PARAM_RAW);
-
+
//-------------------------------------------------------------------------------
// buttons
$submit_string = get_string('addsession', 'attforblock');
diff --git a/duration_form.php b/duration_form.php
index 0403b93..090bf7a 100644
--- a/duration_form.php
+++ b/duration_form.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * This file contains the forms for duration
+ *
+ * @package mod_attendance
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
require_once($CFG->libdir.'/formslib.php');
class mod_attforblock_duration_form extends moodleform {
@@ -29,8 +37,8 @@ class mod_attforblock_duration_form extends moodleform {
$ids = $this->_customdata['ids'];
$mform->addElement('header', 'general', get_string('changeduration','attforblock'));
- $mform->addElement('static', 'count', get_string('countofselected','attforblock'), count(explode('_', $ids)));
-
+ $mform->addElement('static', 'count', get_string('countofselected','attforblock'), count(explode('_', $ids)));
+
for ($i=0; $i<=23; $i++) {
$hours[$i] = sprintf("%02d",$i);
}
@@ -38,15 +46,15 @@ class mod_attforblock_duration_form extends moodleform {
$minutes[$i] = sprintf("%02d",$i);
}
$durselect[] =& $mform->createElement('select', 'hours', '', $hours);
- $durselect[] =& $mform->createElement('select', 'minutes', '', $minutes, false, true);
- $mform->addGroup($durselect, 'durtime', get_string('newduration','attforblock'), array(' '), true);
-
+ $durselect[] =& $mform->createElement('select', 'minutes', '', $minutes, false, true);
+ $mform->addGroup($durselect, 'durtime', get_string('newduration','attforblock'), array(' '), true);
+
$mform->addElement('hidden', 'ids', $ids);
- $mform->addElement('hidden', 'id', $cm->id);
+ $mform->addElement('hidden', 'id', $cm->id);
$mform->addElement('hidden', 'action', att_sessions_page_params::ACTION_CHANGE_DURATION);
-
+
$mform->setDefaults(array('durtime' => array('hours'=>0, 'minutes'=>0)));
-
+
//-------------------------------------------------------------------------------
// buttons
$submit_string = get_string('update', 'attforblock');
diff --git a/export.php b/export.php
index 8f85436..4091d27 100644
--- a/export.php
+++ b/export.php
@@ -17,12 +17,11 @@
/**
* Export attendance sessions
*
- * @package mod
- * @subpackage attforblock
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package mod_attendance
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
require_once(dirname(__FILE__).'/../../config.php');
require_once(dirname(__FILE__).'/locallib.php');
require_once(dirname(__FILE__).'/export_form.php');
diff --git a/export_form.php b/export_form.php
index 0a91d81..9d5398d 100644
--- a/export_form.php
+++ b/export_form.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * Export attendance sessions forms
+ *
+ * @package mod_attendance
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
require_once($CFG->libdir.'/formslib.php');
class mod_attforblock_export_form extends moodleform {
@@ -29,25 +37,25 @@ class mod_attforblock_export_form extends moodleform {
$mform->addElement('header', 'general', get_string('export','quiz'));
-
- $groupmode=groups_get_activity_groupmode($cm);
+
+ $groupmode=groups_get_activity_groupmode($cm);
$groups = groups_get_activity_allowed_groups($cm, $USER->id);
- if ($groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $modcontext)) {
- $grouplist[0] = get_string('allparticipants');
- }
- if ($groups) {
+ if ($groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $modcontext)) {
+ $grouplist[0] = get_string('allparticipants');
+ }
+ if ($groups) {
foreach ($groups as $group) {
$grouplist[$group->id] = $group->name;
}
}
$mform->addElement('select', 'group', get_string('group'), $grouplist);
-
+
$ident = array();
$ident[] =& $mform->createElement('checkbox', 'id', '', get_string('studentid', 'attforblock'));
$ident[] =& $mform->createElement('checkbox', 'uname', '', get_string('username'));
$mform->addGroup($ident, 'ident', get_string('identifyby','attforblock'), array('
'), true);
$mform->setDefaults(array('ident[id]' => true, 'ident[uname]' => true));
-
+
$mform->addElement('checkbox', 'includeallsessions', get_string('includeall','attforblock'), get_string('yes'));
$mform->setDefault('includeallsessions', true);
$mform->addElement('checkbox', 'includenottaken', get_string('includenottaken','attforblock'), get_string('yes'));
@@ -56,13 +64,13 @@ class mod_attforblock_export_form extends moodleform {
$mform->disabledIf('sessionstartdate', 'includeallsessions', 'checked');
$mform->addElement('date_selector', 'sessionenddate', get_string('endofperiod','attforblock'));
$mform->disabledIf('sessionenddate', 'includeallsessions', 'checked');
-
+
$mform->addElement('select', 'format', get_string('format'),
- array('excel' => get_string('downloadexcel','attforblock'),
- 'ooo' => get_string('downloadooo','attforblock'),
- 'text' => get_string('downloadtext','attforblock')
- ));
-
+ array('excel' => get_string('downloadexcel','attforblock'),
+ 'ooo' => get_string('downloadooo','attforblock'),
+ 'text' => get_string('downloadtext','attforblock')
+ ));
+
// buttons
$submit_string = get_string('ok');
$this->add_action_buttons(false, $submit_string);
diff --git a/index.php b/index.php
index 97b6add..f47311a 100644
--- a/index.php
+++ b/index.php
@@ -14,19 +14,24 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-/// This page lists all the instances of attforblock in a particular course
-/// Replace attforblock with the name of your module
+/**
+ * lists all the instances of attforblock in a particular course
+ *
+ * @package mod_attendance
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
- require_once('../../config.php');
+require_once('../../config.php');
- $id = required_param('id', PARAM_INT); // Course id
+$id = required_param('id', PARAM_INT); // Course id
- if (! $course = $DB->get_record('course', array('id'=> $id))) {
- error('Course ID is incorrect');
- }
+if (! $course = $DB->get_record('course', array('id'=> $id))) {
+ error('Course ID is incorrect');
+}
- if ($att = array_pop(get_all_instances_in_course('attforblock', $course, NULL, true))) {
- redirect("view.php?id=$att->coursemodule");
- } else {
- print_error('notfound', 'attforblock');
- }
+if ($att = array_pop(get_all_instances_in_course('attforblock', $course, NULL, true))) {
+ redirect("view.php?id=$att->coursemodule");
+} else {
+ print_error('notfound', 'attforblock');
+}
diff --git a/lib.php b/lib.php
index 3efaf25..5c9834b 100644
--- a/lib.php
+++ b/lib.php
@@ -14,7 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-/// Library of functions and constants for module attforblock
+/**
+ * Library of functions and constants for module attforblock
+ *
+ * @package mod_attendance
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
/**
* Returns the information if the module supports a feature
@@ -60,7 +66,7 @@ function attforblock_add_instance($attforblock) {
/// of the new instance.
global $DB;
-
+
$attforblock->timemodified = time();
$attforblock->id = $DB->insert_record('attforblock', $attforblock);
@@ -68,7 +74,7 @@ function attforblock_add_instance($attforblock) {
att_add_default_statuses($attforblock->id);
attforblock_grade_item_update($attforblock);
-// attforblock_update_grades($attforblock);
+ //attforblock_update_grades($attforblock);
return $attforblock->id;
}
@@ -99,12 +105,12 @@ function attforblock_delete_instance($id) {
if (! $attforblock = $DB->get_record('attforblock', array('id'=> $id))) {
return false;
}
-
- if ($sessids = array_keys($DB->get_records('attendance_sessions', array('attendanceid'=> $id), '', 'id'))) {
+
+ if ($sessids = array_keys($DB->get_records('attendance_sessions', array('attendanceid'=> $id), '', 'id'))) {
$DB->delete_records_list('attendance_log', 'sessionid', $sessids);
$DB->delete_records('attendance_sessions', array('attendanceid'=> $id));
}
- $DB->delete_records('attendance_statuses', array('attendanceid'=> $id));
+ $DB->delete_records('attendance_statuses', array('attendanceid'=> $id));
$DB->delete_records('attforblock', array('id'=> $id));
@@ -124,8 +130,8 @@ function attforblock_delete_course($course, $feedback=true){
$DB->delete_records_list('attendance_statuses', 'attendanceid', $attids);
$DB->delete_records_list('attendance_sessions', 'attendanceid', $attids);
}
- $DB->delete_records('attforblock', array('course'=> $course->id));
-
+ $DB->delete_records('attforblock', array('course'=> $course->id));
+
return true;
}
@@ -136,8 +142,8 @@ function attforblock_delete_course($course, $feedback=true){
function attforblock_reset_course_form_definition(&$mform) {
$mform->addElement('header', 'attendanceheader', get_string('modulename', 'attforblock'));
- $mform->addElement('static', 'description', get_string('description', 'attforblock'),
- get_string('resetdescription', 'attforblock'));
+ $mform->addElement('static', 'description', get_string('description', 'attforblock'),
+ get_string('resetdescription', 'attforblock'));
$mform->addElement('checkbox', 'reset_attendance_log', get_string('deletelogs','attforblock'));
$mform->addElement('checkbox', 'reset_attendance_sessions', get_string('deletesessions','attforblock'));
@@ -163,7 +169,7 @@ function attforblock_reset_userdata($data) {
$attids = array_keys($DB->get_records('attforblock', array('course'=> $data->courseid), '', 'id'));
if (!empty($data->reset_attendance_log)) {
- $sess = $DB->get_records_list('attendance_sessions', 'attendanceid', $attids, '', 'id');
+ $sess = $DB->get_records_list('attendance_sessions', 'attendanceid', $attids, '', 'id');
if (!empty($sess)) {
list($sql, $params) = $DB->get_in_or_equal(array_keys($sess));
$DB->delete_records_select('attendance_log', "sessionid $sql", $params);
@@ -179,7 +185,7 @@ function attforblock_reset_userdata($data) {
}
if (!empty($data->reset_attendance_statuses)) {
- $DB->delete_records_list('attendance_statuses', 'attendanceid', $attids);
+ $DB->delete_records_list('attendance_statuses', 'attendanceid', $attids);
foreach($attids as $attid) {
att_add_default_statuses($attid);
}
@@ -192,7 +198,7 @@ function attforblock_reset_userdata($data) {
}
if (!empty($data->reset_attendance_sessions)) {
- $DB->delete_records_list('attendance_sessions', 'attendanceid', $attids);
+ $DB->delete_records_list('attendance_sessions', 'attendanceid', $attids);
$status[] = array(
'component' => get_string('modulenameplural', 'attforblock'),
@@ -211,7 +217,7 @@ function attforblock_user_outline($course, $user, $mod, $attforblock) {
/// $return->time = the time they did it
/// $return->info = a short text description
global $CFG;
-
+
require_once(dirname(__FILE__).'/locallib.php');
require_once($CFG->libdir.'/gradelib.php');
@@ -224,15 +230,15 @@ function attforblock_user_outline($course, $user, $mod, $attforblock) {
}
else
$result->time = 0;
- if (has_capability('mod/attforblock:canbelisted', $mod->context, $user->id)) {
+ if (has_capability('mod/attforblock:canbelisted', $mod->context, $user->id)) {
$statuses = att_get_statuses($attforblock->id);
$grade = att_get_user_grade(att_get_user_statuses_stat($attforblock->id, $course->startdate, $user->id), $statuses);
$maxgrade = att_get_user_max_grade(att_get_user_taken_sessions_count($attforblock->id, $course->startdate, $user->id), $statuses);
$result->info = $grade.' / '.$maxgrade;
- }
-
- return $result;
+ }
+
+ return $result;
}
function attforblock_user_complete($course, $user, $mod, $attforblock) {
@@ -242,10 +248,10 @@ function attforblock_user_complete($course, $user, $mod, $attforblock) {
require_once(dirname(__FILE__).'/renderhelpers.php');
require_once($CFG->libdir.'/gradelib.php');
-
- if (has_capability('mod/attforblock:canbelisted', $mod->context, $user->id)) {
+
+ if (has_capability('mod/attforblock:canbelisted', $mod->context, $user->id)) {
echo construct_full_user_stat_html_table($attforblock, $course, $user);
- }
+ }
//return true;
}
@@ -275,26 +281,26 @@ function attforblock_cron () {
*/
/*function attforblock_get_user_grades($attforblock, $userid=0) {
global $CFG, $DB;
-
- require_once('_locallib.php');
-
+
+ require_once('_locallib.php');
+
if (! $course = $DB->get_record('course', array('id'=> $attforblock->course))) {
error("Course is misconfigured");
}
$result = false;
if ($userid) {
- $result = array();
- $result[$userid]->userid = $userid;
- $result[$userid]->rawgrade = $attforblock->grade * get_percent($userid, $course, $attforblock) / 100;
+ $result = array();
+ $result[$userid]->userid = $userid;
+ $result[$userid]->rawgrade = $attforblock->grade * get_percent($userid, $course, $attforblock) / 100;
} else {
- if ($students = get_course_students($course->id)) {
- $result = array();
- foreach ($students as $student) {
- $result[$student->id]->userid = $student->id;
- $result[$student->id]->rawgrade = $attforblock->grade * get_percent($student->id, $course, $attforblock) / 100;
- }
- }
+ if ($students = get_course_students($course->id)) {
+ $result = array();
+ foreach ($students as $student) {
+ $result[$student->id]->userid = $student->id;
+ $result[$student->id]->rawgrade = $attforblock->grade * get_percent($student->id, $course, $attforblock) / 100;
+ }
+ }
}
return $result;
@@ -350,9 +356,9 @@ function attforblock_cron () {
*/
function attforblock_grade_item_update($attforblock, $grades=NULL) {
global $CFG, $DB;
-
- require_once('locallib.php');
-
+
+ require_once('locallib.php');
+
if (!function_exists('grade_update')) { //workaround for buggy PHP versions
require_once($CFG->libdir.'/gradelib.php');
}
@@ -372,7 +378,7 @@ function attforblock_grade_item_update($attforblock, $grades=NULL) {
$cm = get_coursemodule_from_instance('attforblock', $attforblock->id);
$params = array('itemname'=>$attforblock->name/*, 'idnumber'=>$attforblock->id*/);
}
-
+
if ($attforblock->grade > 0) {
$params['gradetype'] = GRADE_TYPE_VALUE;
$params['grademax'] = $attforblock->grade;
diff --git a/locallib.php b/locallib.php
index a4f3bad..7221714 100644
--- a/locallib.php
+++ b/locallib.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * local functions and constants for module attforblock
+ *
+ * @package mod_attendance
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
defined('MOODLE_INTERNAL') || die();
global $CFG;
@@ -249,7 +257,7 @@ class att_page_with_filter_controls {
private function calc_sessgroupslist_sesstype() {
global $SESSION;
-
+
if (!array_key_exists('attsessiontype', $SESSION)) {
$SESSION->attsessiontype = array($this->cm->course => self::SESSTYPE_ALL);
}
@@ -295,10 +303,10 @@ class att_page_with_filter_controls {
$this->sesstype = key($this->sessgroupslist);
}
}
-
+
private function calc_sessgroupslist() {
global $USER, $PAGE;
-
+
$this->sessgroupslist = array();
$groupmode = groups_get_activity_groupmode($this->cm);
if ($groupmode == NOGROUPS)
@@ -391,12 +399,12 @@ class att_take_page_params {
const DEFAULT_VIEW_MODE = self::SORTED_LIST;
- public $sessionid;
+ public $sessionid;
public $grouptype;
public $group;
- public $sort;
+ public $sort;
public $copyfrom;
-
+
/** @var int view mode of taking attendance page*/
public $viewmode;
@@ -442,7 +450,7 @@ class att_take_page_params {
class att_report_page_params extends att_page_with_filter_controls {
public $group;
- public $sort;
+ public $sort;
public function __construct() {
$this->selectortype = self::SELECTOR_GROUP;
@@ -450,11 +458,11 @@ class att_report_page_params extends att_page_with_filter_controls {
public function init($cm) {
parent::init($cm);
-
+
if (!isset($this->group)) $this->group = $this->get_current_sesstype() > 0 ? $this->get_current_sesstype() : 0;
if (!isset($this->sort)) $this->sort = ATT_SORT_LASTNAME;
}
-
+
public function get_significant_params() {
$params = array();
@@ -580,8 +588,8 @@ class attforblock {
public function get_current_sessions() {
global $DB;
- $today = time(); // because we compare with database, we don't need to use usertime()
-
+ $today = time(); // because we compare with database, we don't need to use usertime()
+
$sql = "SELECT *
FROM {attendance_sessions}
WHERE :time BETWEEN sessdate AND (sessdate + duration)
@@ -789,7 +797,7 @@ class attforblock {
$info = construct_session_full_date_time($sess->sessdate, $sess->duration);
$this->log('session updated', $url, $info);
}
-
+
public function take_from_form_data($formdata) {
global $DB, $USER;
@@ -797,19 +805,19 @@ class attforblock {
$now = time();
$sesslog = array();
$formdata = (array)$formdata;
- foreach($formdata as $key => $value) {
- if(substr($key, 0, 4) == 'user') {
- $sid = substr($key, 4);
- $sesslog[$sid] = new stdClass();
- $sesslog[$sid]->studentid = $sid;
- $sesslog[$sid]->statusid = $value;
- $sesslog[$sid]->statusset = $statuses;
- $sesslog[$sid]->remarks = array_key_exists('remarks'.$sid, $formdata) ? $formdata['remarks'.$sid] : '';
- $sesslog[$sid]->sessionid = $this->pageparams->sessionid;
- $sesslog[$sid]->timetaken = $now;
- $sesslog[$sid]->takenby = $USER->id;
- }
- }
+ foreach($formdata as $key => $value) {
+ if(substr($key, 0, 4) == 'user') {
+ $sid = substr($key, 4);
+ $sesslog[$sid] = new stdClass();
+ $sesslog[$sid]->studentid = $sid;
+ $sesslog[$sid]->statusid = $value;
+ $sesslog[$sid]->statusset = $statuses;
+ $sesslog[$sid]->remarks = array_key_exists('remarks'.$sid, $formdata) ? $formdata['remarks'.$sid] : '';
+ $sesslog[$sid]->sessionid = $this->pageparams->sessionid;
+ $sesslog[$sid]->timetaken = $now;
+ $sesslog[$sid]->takenby = $USER->id;
+ }
+ }
$dbsesslog = $this->get_session_log($this->pageparams->sessionid);
foreach ($sesslog as $log) {
@@ -861,7 +869,7 @@ class attforblock {
//add a flag to each user indicating whether their enrolment is active
if (!empty($users)) {
list($usql, $uparams) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED, 'usid0');
-
+
//CONTRIB-3549
$sql = "SELECT ue.userid, ue.status, ue.timestart, ue.timeend
FROM {user_enrolments} ue
@@ -909,7 +917,7 @@ class attforblock {
if (!isset($this->statuses)) {
$this->statuses = att_get_statuses($this->id, $onlyvisible);
}
-
+
return $this->statuses;
}
@@ -944,7 +952,7 @@ class attforblock {
'pluginfile.php', $this->context->id, 'mod_attforblock', 'session', $sess->id);
}
}
-
+
return $sessions;
}
@@ -988,7 +996,7 @@ class attforblock {
$this->userstatusesstat[$userid] = $DB->get_records_sql($qry, $params);
}
-
+
return $this->userstatusesstat[$userid];
}
@@ -1303,7 +1311,7 @@ function att_calc_user_grade_fraction($grade, $maxgrade) {
function att_get_gradebook_maxgrade($attid) {
global $DB;
-
+
return $DB->get_field('attforblock', 'grade', array('id' => $attid));
}
diff --git a/manage.php b/manage.php
index 57a72c0..ceee62d 100644
--- a/manage.php
+++ b/manage.php
@@ -17,12 +17,11 @@
/**
* Manage attendance sessions
*
- * @package mod
- * @subpackage attforblock
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
require_once(dirname(__FILE__).'/../../config.php');
require_once(dirname(__FILE__).'/locallib.php');
diff --git a/mod_form.php b/mod_form.php
index 82e7afd..845f063 100644
--- a/mod_form.php
+++ b/mod_form.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * Forms for updating/adding attforblock
+ *
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
@@ -34,7 +42,7 @@ class mod_attforblock_mod_form extends moodleform_mod {
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', null, 'required', null, 'client');
$mform->setDefault('name', get_string('modulename', 'attforblock'));
-
+
$mform->addElement('modgrade', 'grade', get_string('grade'));
$mform->setDefault('grade', 100);
diff --git a/preferences.php b/preferences.php
index 24ef61d..837452e 100644
--- a/preferences.php
+++ b/preferences.php
@@ -17,12 +17,11 @@
/**
* Manage attendance settings
*
- * @package mod
- * @subpackage attforblock
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
require_once(dirname(__FILE__).'/../../config.php');
require_once(dirname(__FILE__).'/locallib.php');
diff --git a/renderables.php b/renderables.php
index 01076e1..3f2e237 100644
--- a/renderables.php
+++ b/renderables.php
@@ -17,8 +17,8 @@
/**
* Attendance module renderable components are defined here
*
- * @package mod
- * @subpackage attforblock
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/renderer.php b/renderer.php
index 86e0f93..6a0f61b 100644
--- a/renderer.php
+++ b/renderer.php
@@ -17,8 +17,8 @@
/**
* Attendance module renderering methods
*
- * @package mod
- * @subpackage attforblock
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/renderhelpers.php b/renderhelpers.php
index f200b2a..db91096 100644
--- a/renderhelpers.php
+++ b/renderhelpers.php
@@ -17,8 +17,8 @@
/**
* Attendance module renderering helpers
*
- * @package mod
- * @subpackage attforblock
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/report.php b/report.php
index d6e4466..8011f4c 100644
--- a/report.php
+++ b/report.php
@@ -17,12 +17,11 @@
/**
* Attendance report
*
- * @package mod
- * @subpackage attforblock
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
require_once(dirname(__FILE__).'/../../config.php');
require_once(dirname(__FILE__).'/locallib.php');
diff --git a/sessions.php b/sessions.php
index f2067fa..c683f05 100644
--- a/sessions.php
+++ b/sessions.php
@@ -17,12 +17,11 @@
/**
* Adding attendance sessions
*
- * @package mod
- * @subpackage attforblock
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
require_once(dirname(__FILE__).'/../../config.php');
require_once(dirname(__FILE__).'/locallib.php');
require_once(dirname(__FILE__).'/add_form.php');
diff --git a/take.php b/take.php
index b7415d4..bb934b8 100644
--- a/take.php
+++ b/take.php
@@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * Take Attendance
+ *
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
require_once(dirname(__FILE__).'/../../config.php');
require_once(dirname(__FILE__).'/locallib.php');
diff --git a/update_form.php b/update_form.php
index 4425c41..398cd0c 100644
--- a/update_form.php
+++ b/update_form.php
@@ -14,6 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+/**
+ * Update form
+ *
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
require_once($CFG->libdir.'/formslib.php');
class mod_attforblock_update_form extends moodleform {
@@ -29,8 +38,8 @@ class mod_attforblock_update_form extends moodleform {
$sessionid = $this->_customdata['sessionid'];
if (!$sess = $DB->get_record('attendance_sessions', array('id'=> $sessionid) )) {
- error('No such session in this course');
- }
+ error('No such session in this course');
+ }
$dhours = floor($sess->duration / HOURSECS);
$dmins = floor(($sess->duration - $dhours * HOURSECS) / MINSECS);
$defopts = array('maxfiles'=>EDITOR_UNLIMITED_FILES, 'noclean'=>true, 'context'=>$modcontext);
@@ -40,8 +49,8 @@ class mod_attforblock_update_form extends moodleform {
'sdescription' => $sess->description_editor);
$mform->addElement('header', 'general', get_string('changesession','attforblock'));
-
- $mform->addElement('static', 'olddate', get_string('olddate','attforblock'), userdate($sess->sessdate, get_string('strftimedmyhm', 'attforblock')));
+
+ $mform->addElement('static', 'olddate', get_string('olddate','attforblock'), userdate($sess->sessdate, get_string('strftimedmyhm', 'attforblock')));
$mform->addElement('date_time_selector', 'sessiondate', get_string('newdate','attforblock'));
for ($i=0; $i<=23; $i++) {
@@ -51,14 +60,14 @@ class mod_attforblock_update_form extends moodleform {
$minutes[$i] = sprintf("%02d",$i);
}
$durselect[] =& $mform->createElement('select', 'hours', '', $hours);
- $durselect[] =& $mform->createElement('select', 'minutes', '', $minutes, false, true);
- $mform->addGroup($durselect, 'durtime', get_string('duration','attforblock'), array(' '), true);
-
+ $durselect[] =& $mform->createElement('select', 'minutes', '', $minutes, false, true);
+ $mform->addGroup($durselect, 'durtime', get_string('duration','attforblock'), array(' '), true);
+
$mform->addElement('editor', 'sdescription', get_string('description', 'attforblock'), null, $defopts);
$mform->setType('sdescription', PARAM_RAW);
-
+
$mform->setDefaults($data);
-
+
//-------------------------------------------------------------------------------
// buttons
$submit_string = get_string('update', 'attforblock');
diff --git a/version.php b/version.php
index 1550508..e3d94c3 100644
--- a/version.php
+++ b/version.php
@@ -17,13 +17,14 @@
/**
* Version information
*
- * @package mod
- * @subpackage attforblock
+ * @package mod_attforblock
* @copyright 2011 Artem Andreev
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$module->version = 2012120700; // The current module version (Date: YYYYMMDDXX)
-$module->release = '2.4.0';
+$module->requires = 2012120300;
+$module->release = '2.4.1';
+$module->maturity = MATURITY_ALPHA;
$module->cron = 0; // Period for cron to check this module (secs)
$module->component = 'mod_attforblock'; // Full name of the plugin (used for diagnostics)
diff --git a/view.php b/view.php
index 93c64f6..dc415a1 100644
--- a/view.php
+++ b/view.php
@@ -17,8 +17,8 @@
/**
* Prints attendance info for particular user
*
- * @package mod
- * @subpackage attforblock
+ * @package mod_attforblock
+ * @copyright 2011 Artem Andreev
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/