Browse Source

Coding guideline fixes

MOODLE_23_STABLE
Dan Marsden 12 years ago
parent
commit
a68be60db2
  1. 36
      add_form.php
  2. 16
      duration_form.php
  3. 7
      export.php
  4. 26
      export_form.php
  5. 29
      index.php
  6. 60
      lib.php
  7. 42
      locallib.php
  8. 5
      manage.php
  9. 8
      mod_form.php
  10. 5
      preferences.php
  11. 4
      renderables.php
  12. 4
      renderer.php
  13. 4
      renderhelpers.php
  14. 5
      report.php
  15. 5
      sessions.php
  16. 8
      take.php
  17. 19
      update_form.php
  18. 7
      version.php
  19. 4
      view.php

36
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 <http://www.gnu.org/licenses/>.
/**
* This file contains the forms to add
*
* @package mod_attendance
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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) {
@ -78,7 +84,7 @@ class mod_attforblock_add_form extends moodleform {
}
$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,34 +97,34 @@ 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);

16
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 <http://www.gnu.org/licenses/>.
/**
* This file contains the forms for duration
*
* @package mod_attendance
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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,7 +37,7 @@ 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,11 +46,11 @@ 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)));

7
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 <andreev.artem@gmail.com>
* @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');

26
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 <http://www.gnu.org/licenses/>.
/**
* Export attendance sessions forms
*
* @package mod_attendance
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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 {
@ -30,12 +38,12 @@ 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;
}
@ -58,10 +66,10 @@ class mod_attforblock_export_form extends moodleform {
$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');

29
index.php

@ -14,19 +14,24 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/// 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 <andreev.artem@gmail.com>
* @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');
}

60
lib.php

@ -14,7 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/// Library of functions and constants for module attforblock
/**
* Library of functions and constants for module attforblock
*
* @package mod_attendance
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Returns the information if the module supports a feature
@ -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;
}
@ -100,11 +106,11 @@ function attforblock_delete_instance($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,7 +130,7 @@ 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'),
@ -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) {
@ -243,9 +249,9 @@ 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;
}
@ -276,7 +282,7 @@ 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");
@ -284,17 +290,17 @@ function attforblock_cron () {
$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;
@ -351,7 +357,7 @@ 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');

42
locallib.php

@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* local functions and constants for module attforblock
*
* @package mod_attendance
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
@ -391,10 +399,10 @@ 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*/
@ -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;
@ -580,7 +588,7 @@ 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}
@ -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) {

5
manage.php

@ -17,12 +17,11 @@
/**
* Manage attendance sessions
*
* @package mod
* @subpackage attforblock
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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');

8
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 <http://www.gnu.org/licenses/>.
/**
* Forms for updating/adding attforblock
*
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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
}

5
preferences.php

@ -17,12 +17,11 @@
/**
* Manage attendance settings
*
* @package mod
* @subpackage attforblock
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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');

4
renderables.php

@ -17,8 +17,8 @@
/**
* Attendance module renderable components are defined here
*
* @package mod
* @subpackage attforblock
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

4
renderer.php

@ -17,8 +17,8 @@
/**
* Attendance module renderering methods
*
* @package mod
* @subpackage attforblock
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

4
renderhelpers.php

@ -17,8 +17,8 @@
/**
* Attendance module renderering helpers
*
* @package mod
* @subpackage attforblock
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

5
report.php

@ -17,12 +17,11 @@
/**
* Attendance report
*
* @package mod
* @subpackage attforblock
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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');

5
sessions.php

@ -17,12 +17,11 @@
/**
* Adding attendance sessions
*
* @package mod
* @subpackage attforblock
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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');

8
take.php

@ -14,6 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Take Attendance
*
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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');

19
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 <http://www.gnu.org/licenses/>.
/**
* Update form
*
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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);
@ -41,7 +50,7 @@ class mod_attforblock_update_form extends moodleform {
$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,8 +60,8 @@ 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);

7
version.php

@ -17,13 +17,14 @@
/**
* Version information
*
* @package mod
* @subpackage attforblock
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @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)

4
view.php

@ -17,8 +17,8 @@
/**
* Prints attendance info for particular user
*
* @package mod
* @subpackage attforblock
* @package mod_attforblock
* @copyright 2011 Artem Andreev <andreev.artem@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Loading…
Cancel
Save