Compare commits

...

32 Commits

Author SHA1 Message Date
Dan Marsden 47003a429a Fix #340 Check duration of session when checking if a student enrolled before a session. 6 years ago
Dan Marsden 75b4cefed5 Fix #317 typo in html entity, and entities not rendering inside select options. 7 years ago
Dan Marsden 7271ee999f bump version. 7 years ago
Dan Marsden 927d8cef30 Fix fields included in backup. 7 years ago
Dan Marsden dba744a401 bump version for release. 7 years ago
Dan Marsden 5081c982e7 Fixes #265 create calendar events when restoring an attendance. 8 years ago
Dan Marsden c3bb0fc306 include description format when creating event. 7 years ago
Nick Phillips 96cc800e60 Add description to event, and group to event name if present. (#296) 7 years ago
Dan Marsden 5ad7089021 remove reference to user.de domain. 7 years ago
Dan Marsden 5d8cb7cd06 Fix #287 prevent restore from setting takenby when no userdata restored. 7 years ago
Dan Marsden c16b8c3dc3 downgrade to v1 of plugin-ci. 7 years ago
Dan Marsden 20538135a9 update travis commands. 7 years ago
Dan Marsden 3e708daf74 update travis commands. 7 years ago
Dan Marsden 23951d245e update travis config. 7 years ago
Dan Marsden 1c1f335a75 Fix #279 - fix for php 5.4 compatibility. 7 years ago
Dan Marsden 0f9053e26d bump version for plugins db release. 7 years ago
Dan Marsden ef2097167c Fix bug with userdisplay check. 8 years ago
Dan Marsden 3b88a4441c Fixes #266 - groupmemembersonly setting removed by MDL-44725 8 years ago
Dan Marsden 50addfda9d Fix #264 improve radio button spacing on self-marking page 8 years ago
Dan Marsden f84d4f78b3 remove params not needed in 3.1 branch. 8 years ago
Dan Marsden b484162c72 Fixes #214 use correct prefix on attendance functions to avoid clashing with other code. 8 years ago
Daniel Thee Roperto 15792f7646 Moodle 31 - Global Search issue with Database Schema (#247) 8 years ago
Marty Gilbert e3411c05ec https://github.com/danmarsden/moodle-mod_attendance/issues/234 (#236) 8 years ago
Dan Marsden b053e129ca Travis incorrectly failing on adding activity during behat tests. 8 years ago
Dan Marsden 2b116a43b9 Use sudo: true to get around travis ci bug with builds timing out. 8 years ago
Dan Marsden 3a70ad5e3b Revert "Fix #217 - hide percentage/points columns when no grade is set." 8 years ago
Dan Marsden f92ef4b921 Fixes #223 allow student attendance to be disabled at site-level 8 years ago
Dan Marsden 5735e04fa6 remove old calendar behat test - feature not used anymore. 8 years ago
Dan Marsden c4fa8a6a85 Fix #217 - hide percentage/points columns when no grade is set. 8 years ago
Dan Marsden 0cfc155d91 Fix #220 remove bulk functions not needed. 8 years ago
Dan Marsden 90e336920c Fix #221 always pass timestart to calendar update function. 8 years ago
Dan Marsden 5ddb37b124 new 3.1 branch - split from master. 8 years ago
  1. 7
      .travis.yml
  2. 6
      add_form.php
  3. 5
      attendance.php
  4. 5
      backup/moodle2/backup_attendance_stepslib.php
  5. 16
      backup/moodle2/restore_attendance_stepslib.php
  6. 20
      classes/calendar_helpers.php
  7. 80
      classes/header.php
  8. 2
      classes/sessions_page_params.php
  9. 29
      classes/structure.php
  10. 9
      db/install.xml
  11. 31
      db/upgrade.php
  12. 2
      db/upgradelib.php
  13. 5
      lang/en/attendance.php
  14. 16
      lib.php
  15. 2
      locallib.php
  16. 6
      manage.php
  17. 2
      mod_form.php
  18. 2
      renderables.php
  19. 29
      renderer.php
  20. 2
      renderhelpers.php
  21. 7
      report.php
  22. 19
      sessions.php
  23. 3
      settings.php
  24. 6
      student_attendance_form.php
  25. 3
      styles.css
  26. 4
      tempusers.php
  27. 43
      tests/behat/calendar_features.feature
  28. 4
      version.php
  29. 2
      view.php

7
.travis.yml

@ -2,6 +2,9 @@ language: php
sudo: false sudo: false
addons:
firefox: "47.0.1"
cache: cache:
directories: directories:
- $HOME/.composer/cache - $HOME/.composer/cache
@ -13,15 +16,13 @@ php:
env: env:
matrix: matrix:
- DB=pgsql MOODLE_BRANCH=MOODLE_31_STABLE - DB=pgsql MOODLE_BRANCH=MOODLE_31_STABLE
- DB=pgsql MOODLE_BRANCH=master
- DB=mysqli MOODLE_BRANCH=MOODLE_31_STABLE - DB=mysqli MOODLE_BRANCH=MOODLE_31_STABLE
- DB=mysqli MOODLE_BRANCH=master
before_install: before_install:
- phpenv config-rm xdebug.ini - phpenv config-rm xdebug.ini
- cd ../.. - cd ../..
- composer selfupdate - composer selfupdate
- composer create-project -n --no-dev moodlerooms/moodle-plugin-ci ci ^1 - composer create-project -n --no-dev --prefer-dist moodlerooms/moodle-plugin-ci ci ^1
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH" - export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
install: install:

6
add_form.php

@ -118,8 +118,14 @@ class mod_attendance_add_form extends moodleform {
} }
// Students can mark own attendance. // Students can mark own attendance.
$configcanmark = get_config('attendance', 'studentscanmark');
if (!empty($configcanmark)) {
$mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance')); $mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance'));
$mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance'); $mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance');
} else {
$mform->addElement('hidden', 'studentscanmark', '0');
$mform->settype('studentscanmark', PARAM_INT);
}
$mform->addElement('editor', 'sdescription', get_string('description', 'attendance'), array('rows' => 1, 'columns' => 80), $mform->addElement('editor', 'sdescription', get_string('description', 'attendance'), array('rows' => 1, 'columns' => 80),
array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true, 'context' => $modcontext)); array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true, 'context' => $modcontext));

5
attendance.php

@ -39,6 +39,11 @@ $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST)
// Require the user is logged in. // Require the user is logged in.
require_login($course, true, $cm); require_login($course, true, $cm);
$canmark = get_config('attendance', 'studentscanmark');
if (empty($canmark) || empty($attforsession->studentscanmark)) {
redirect(new moodle_url('/mod/attendance/view.php', array('id' => $cm->id)));
exit;
}
$pageparams->sessionid = $id; $pageparams->sessionid = $id;
$att = new mod_attendance_structure($attendance, $cm, $course, $PAGE->context, $pageparams); $att = new mod_attendance_structure($attendance, $cm, $course, $PAGE->context, $pageparams);

5
backup/moodle2/backup_attendance_stepslib.php

@ -44,7 +44,7 @@ class backup_attendance_activity_structure_step extends backup_activity_structur
// XML nodes declaration - non-user data. // XML nodes declaration - non-user data.
$attendance = new backup_nested_element('attendance', array('id'), array( $attendance = new backup_nested_element('attendance', array('id'), array(
'name', 'grade')); 'name', 'intro', 'introformat', 'grade'));
$statuses = new backup_nested_element('statuses'); $statuses = new backup_nested_element('statuses');
$status = new backup_nested_element('status', array('id'), array( $status = new backup_nested_element('status', array('id'), array(
@ -53,7 +53,8 @@ class backup_attendance_activity_structure_step extends backup_activity_structur
$sessions = new backup_nested_element('sessions'); $sessions = new backup_nested_element('sessions');
$session = new backup_nested_element('session', array('id'), array( $session = new backup_nested_element('session', array('id'), array(
'groupid', 'sessdate', 'duration', 'lasttaken', 'lasttakenby', 'groupid', 'sessdate', 'duration', 'lasttaken', 'lasttakenby',
'timemodified', 'description', 'descriptionformat', 'caleventid')); 'timemodified', 'description', 'descriptionformat', 'studentscanmark',
'statusset', 'caleventid'));
// XML nodes declaration - user data. // XML nodes declaration - user data.
$logs = new backup_nested_element('logs'); $logs = new backup_nested_element('logs');

16
backup/moodle2/restore_attendance_stepslib.php

@ -108,19 +108,31 @@ class restore_attendance_activity_structure_step extends restore_activity_struct
protected function process_attendance_session($data) { protected function process_attendance_session($data) {
global $DB; global $DB;
$userinfo = $this->get_setting_value('userinfo'); // Are we including userinfo?
$data = (object)$data; $data = (object)$data;
$oldid = $data->id; $oldid = $data->id;
$data->attendanceid = $this->get_new_parentid('attendance'); $data->attendanceid = $this->get_new_parentid('attendance');
$data->groupid = $this->get_mappingid('group', $data->groupid); $data->groupid = $this->get_mappingid('group', $data->groupid);
$data->sessdate = $this->apply_date_offset($data->sessdate); $data->sessdate = $this->apply_date_offset($data->sessdate);
$data->lasttaken = $this->apply_date_offset($data->lasttaken);
$data->lasttakenby = $this->get_mappingid('user', $data->lasttakenby);
$data->timemodified = $this->apply_date_offset($data->timemodified); $data->timemodified = $this->apply_date_offset($data->timemodified);
$data->caleventid = $this->get_mappingid('event', $data->caleventid); $data->caleventid = $this->get_mappingid('event', $data->caleventid);
if ($userinfo) {
$data->lasttaken = $this->apply_date_offset($data->lasttaken);
$data->lasttakenby = $this->get_mappingid('user', $data->lasttakenby);
} else {
$data->lasttaken = 0;
$data->lasttakenby = 0;
}
$newitemid = $DB->insert_record('attendance_sessions', $data); $newitemid = $DB->insert_record('attendance_sessions', $data);
$data->id = $newitemid;
$this->set_mapping('attendance_session', $oldid, $newitemid, true); $this->set_mapping('attendance_session', $oldid, $newitemid, true);
// Create Calendar event.
attendance_create_calendar_event($data);
} }
/** /**

20
classes/calendar_helpers.php

@ -29,7 +29,7 @@ require_once(dirname(__FILE__).'/../../../calendar/lib.php');
* @param stdClass $session initial sessions to take data from * @param stdClass $session initial sessions to take data from
* @return bool result of calendar event creation * @return bool result of calendar event creation
*/ */
function create_calendar_event(&$session) { function attendance_create_calendar_event(&$session) {
// We don't want to create multiple calendar events for 1 session. // We don't want to create multiple calendar events for 1 session.
if ($session->caleventid) { if ($session->caleventid) {
return $session->caleventid; return $session->caleventid;
@ -45,10 +45,16 @@ function create_calendar_event(&$session) {
$caleventdata->instance = $session->attendanceid; $caleventdata->instance = $session->attendanceid;
$caleventdata->timestart = $session->sessdate; $caleventdata->timestart = $session->sessdate;
$caleventdata->timeduration = $session->duration; $caleventdata->timeduration = $session->duration;
$caleventdata->description = $session->description;
$caleventdata->format = $session->descriptionformat;
$caleventdata->eventtype = 'attendance'; $caleventdata->eventtype = 'attendance';
$caleventdata->timemodified = time(); $caleventdata->timemodified = time();
$caleventdata->modulename = 'attendance'; $caleventdata->modulename = 'attendance';
if (!empty($session->groupid)) {
$caleventdata->name .= " (". get_string('group', 'group') ." ". groups_get_group_name($session->groupid) .")";
}
$calevent = new stdClass(); $calevent = new stdClass();
if ($calevent = calendar_event::create($caleventdata, false)) { if ($calevent = calendar_event::create($caleventdata, false)) {
$session->caleventid = $calevent->id; $session->caleventid = $calevent->id;
@ -64,12 +70,12 @@ function create_calendar_event(&$session) {
* *
* @param array %sessionsids array of sessions ids * @param array %sessionsids array of sessions ids
*/ */
function create_calendar_events($sessionsids) { function attendance_create_calendar_events($sessionsids) {
global $DB; global $DB;
$sessions = $DB->get_recordset_list('attendance_sessions', 'id', $sessionsids); $sessions = $DB->get_recordset_list('attendance_sessions', 'id', $sessionsids);
foreach ($sessions as $session) { foreach ($sessions as $session) {
create_calendar_event($session); attendance_create_calendar_event($session);
if ($session->caleventid) { if ($session->caleventid) {
$DB->update_record('attendance_sessions', $session); $DB->update_record('attendance_sessions', $session);
} }
@ -84,7 +90,7 @@ function create_calendar_events($sessionsids) {
* @param $timestart int start time of the event * @param $timestart int start time of the event
* @return bool result of updating * @return bool result of updating
*/ */
function update_calendar_event($caleventid, $timeduration, $timestart = null) { function attendance_update_calendar_event($caleventid, $timeduration, $timestart = null) {
$caleventdata = new stdClass(); $caleventdata = new stdClass();
$caleventdata->timeduration = $timeduration; $caleventdata->timeduration = $timeduration;
$caleventdata->timestart = $timestart; $caleventdata->timestart = $timestart;
@ -104,9 +110,9 @@ function update_calendar_event($caleventid, $timeduration, $timestart = null) {
* @param array %sessionsids array of sessions ids * @param array %sessionsids array of sessions ids
* @return bool result of updating * @return bool result of updating
*/ */
function delete_calendar_events($sessionsids) { function attendance_delete_calendar_events($sessionsids) {
global $DB; global $DB;
$caleventsids = existing_calendar_events_ids($sessionsids); $caleventsids = attendance_existing_calendar_events_ids($sessionsids);
if ($caleventsids) { if ($caleventsids) {
$DB->delete_records_list('event', 'id', $caleventsids); $DB->delete_records_list('event', 'id', $caleventsids);
} }
@ -124,7 +130,7 @@ function delete_calendar_events($sessionsids) {
* @param array $sessionsids of sessions ids * @param array $sessionsids of sessions ids
* @return array | bool array of existing calendar events or false if none found * @return array | bool array of existing calendar events or false if none found
*/ */
function existing_calendar_events_ids($sessionsids) { function attendance_existing_calendar_events_ids($sessionsids) {
global $DB; global $DB;
$caleventsids = array_keys($DB->get_records_list('attendance_sessions', 'id', $sessionsids, '', 'caleventid')); $caleventsids = array_keys($DB->get_records_list('attendance_sessions', 'id', $sessionsids, '', 'caleventid'));
$existingcaleventsids = array_filter($caleventsids); $existingcaleventsids = array_filter($caleventsids);

80
classes/header.php

@ -0,0 +1,80 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Class definition for mod_attendance_header
*
* @package mod_attendance
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2017 Catalyst IT Australia {@link http://www.catalyst-au.net}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Used to render the page header.
*
* @package mod_attendance
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2017 Catalyst IT Australia {@link http://www.catalyst-au.net}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_attendance_header implements renderable {
/** @var mod_attendance_structure */
private $attendance;
/** @var string */
private $title;
/**
* mod_attendance_header constructor.
*
* @param mod_attendance_structure $attendance
* @param null $title
*/
public function __construct(mod_attendance_structure $attendance, $title = null) {
$this->attendance = $attendance;
$this->title = $title;
}
/**
* Gets the attendance data.
*
* @return mod_attendance_structure
*/
public function get_attendance() {
return $this->attendance;
}
/**
* Gets the title. If title was not provided, use the module name.
*
* @return string
*/
public function get_title() {
return is_null($this->title) ? $this->attendance->name : $this->title;
}
/**
* Checks if the header should be rendered.
*
* @return bool
*/
public function should_render() {
return !is_null($this->title) || !empty($this->attendance->intro);
}
}

2
classes/sessions_page_params.php

@ -36,8 +36,6 @@ class mod_attendance_sessions_page_params {
const ACTION_DELETE_SELECTED = 4; const ACTION_DELETE_SELECTED = 4;
const ACTION_CHANGE_DURATION = 5; const ACTION_CHANGE_DURATION = 5;
const ACTION_DELETE_HIDDEN = 6; const ACTION_DELETE_HIDDEN = 6;
const ACTION_CREATE_CAL_EVENTS = 7;
const ACTION_DELETE_CAL_EVENTS = 8;
/** @var int view mode of taking attendance page*/ /** @var int view mode of taking attendance page*/
public $action; public $action;

29
classes/structure.php

@ -52,6 +52,15 @@ class mod_attendance_structure {
/** @var float number (10, 5) unsigned, the maximum grade for attendance */ /** @var float number (10, 5) unsigned, the maximum grade for attendance */
public $grade; public $grade;
/** @var int when was this module last modified */
public $timemodified;
/** @var string required field for activity modules and searching */
public $intro;
/** @var int format of the intro (see above) */
public $introformat;
/** current page parameters */ /** current page parameters */
public $pageparams; public $pageparams;
@ -352,7 +361,7 @@ class mod_attendance_structure {
$DB->set_field('attendance_sessions', 'description', $description, array('id' => $sess->id)); $DB->set_field('attendance_sessions', 'description', $description, array('id' => $sess->id));
$sess->caleventid = 0; $sess->caleventid = 0;
create_calendar_event($sess); attendance_create_calendar_event($sess);
$infoarray = array(); $infoarray = array();
$infoarray[] = construct_session_full_date_time($sess->sessdate, $sess->duration); $infoarray[] = construct_session_full_date_time($sess->sessdate, $sess->duration);
@ -394,8 +403,12 @@ class mod_attendance_structure {
$sess->timemodified = time(); $sess->timemodified = time();
$DB->update_record('attendance_sessions', $sess); $DB->update_record('attendance_sessions', $sess);
if (empty($sess->caleventid)) {
update_calendar_event($sess->caleventid, $sess->duration, $sess->sessdate); // This shouldn't really happen, but just in case to prevent fatal error.
attendance_create_calendar_event($sess);
} else {
attendance_update_calendar_event($sess->caleventid, $sess->duration, $sess->sessdate);
}
$info = construct_session_full_date_time($sess->sessdate, $sess->duration); $info = construct_session_full_date_time($sess->sessdate, $sess->duration);
$event = \mod_attendance\event\session_updated::create(array( $event = \mod_attendance\event\session_updated::create(array(
@ -569,7 +582,7 @@ class mod_attendance_structure {
if ($page) { if ($page) {
$usersperpage = $this->pageparams->perpage; $usersperpage = $this->pageparams->perpage;
if (!empty($CFG->enablegroupmembersonly) and $this->cm->groupmembersonly) { if (!empty($this->cm->groupingid)) {
$startusers = ($page - 1) * $usersperpage; $startusers = ($page - 1) * $usersperpage;
if ($groupid == 0) { if ($groupid == 0) {
$groups = array_keys(groups_get_all_groups($this->cm->course, 0, $this->cm->groupingid, 'g.id')); $groups = array_keys(groups_get_all_groups($this->cm->course, 0, $this->cm->groupingid, 'g.id'));
@ -586,7 +599,7 @@ class mod_attendance_structure {
$orderby, $startusers, $usersperpage); $orderby, $startusers, $usersperpage);
} }
} else { } else {
if (!empty($CFG->enablegroupmembersonly) and $this->cm->groupmembersonly) { if (!empty($this->cm->groupingid)) {
if ($groupid == 0) { if ($groupid == 0) {
$groups = array_keys(groups_get_all_groups($this->cm->course, 0, $this->cm->groupingid, 'g.id')); $groups = array_keys(groups_get_all_groups($this->cm->course, 0, $this->cm->groupingid, 'g.id'));
} else { } else {
@ -891,8 +904,8 @@ class mod_attendance_structure {
public function delete_sessions($sessionsids) { public function delete_sessions($sessionsids) {
global $DB; global $DB;
if (existing_calendar_events_ids($sessionsids)) { if (attendance_existing_calendar_events_ids($sessionsids)) {
delete_calendar_events($sessionsids); attendance_delete_calendar_events($sessionsids);
} }
list($sql, $params) = $DB->get_in_or_equal($sessionsids); list($sql, $params) = $DB->get_in_or_equal($sessionsids);
@ -916,7 +929,7 @@ class mod_attendance_structure {
$sess->timemodified = $now; $sess->timemodified = $now;
$DB->update_record('attendance_sessions', $sess); $DB->update_record('attendance_sessions', $sess);
if ($sess->caleventid) { if ($sess->caleventid) {
update_calendar_event($sess->caleventid, $duration); attendance_update_calendar_event($sess->caleventid, $duration);
} }
$event = \mod_attendance\event\session_duration_updated::create(array( $event = \mod_attendance\event\session_duration_updated::create(array(
'objectid' => $this->id, 'objectid' => $this->id,

9
db/install.xml

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/attendance/db" VERSION="20130704" COMMENT="XMLDB file for Moodle mod/attendance" <XMLDB PATH="mod/attendance/db" VERSION="20170307" COMMENT="XMLDB file for Moodle mod/attendance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd" xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
> >
<TABLES> <TABLES>
<TABLE NAME="attendance" COMMENT="Attendance module table"> <TABLE NAME="attendance" COMMENT="Attendance module table">
<FIELDS> <FIELDS>
@ -10,6 +10,9 @@
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false" COMMENT="This is maximum grade for instance"/> <FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false" COMMENT="This is maximum grade for instance"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time the settings for this attendance instance were last modified."/>
<FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="This field is a requirement for activity modules."/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="This field is a requirement for activity modules."/>
</FIELDS> </FIELDS>
<KEYS> <KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for attendance"/> <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for attendance"/>
@ -30,7 +33,7 @@
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false"/> <FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="studentscanmark" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="studentscanmark" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="statusset" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Which set of statuses to use"/> <FIELD NAME="statusset" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Which set of statuses to use"/>
<FIELD NAME="caleventid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="caleventid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
</FIELDS> </FIELDS>

31
db/upgrade.php

@ -171,11 +171,40 @@ function xmldb_attendance_upgrade($oldversion=0) {
} }
// Creating events for all existing sessions. // Creating events for all existing sessions.
create_calendar_events(); attendance_upgrade_create_calendar_events();
// Attendance savepoint reached. // Attendance savepoint reached.
upgrade_mod_savepoint(true, 2016052202, 'attendance'); upgrade_mod_savepoint(true, 2016052202, 'attendance');
} }
if ($oldversion < 2016052203) {
// Define field timemodified to be added to attendance.
$table = new xmldb_table('attendance');
$field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'grade');
// Conditionally launch add field timemodified.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Define field timemodified to be added to attendance.
$table = new xmldb_table('attendance');
$fields = [];
$fields[] = new xmldb_field('intro', XMLDB_TYPE_TEXT, null, null, null, null, null, 'timemodified');
$fields[] = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, 0, 'intro');
// Conditionally launch add field.
foreach ($fields as $field) {
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
}
// Attendance savepoint reached.
upgrade_mod_savepoint(true, 2016052203, 'attendance');
}
return $result; return $result;
} }

2
db/upgradelib.php

@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
function create_calendar_events() { function attendance_upgrade_create_calendar_events() {
global $DB; global $DB;
$attendances = $DB->get_records('attendance', null, null, 'id, name, course'); $attendances = $DB->get_records('attendance', null, null, 'id, name, course');

5
lang/en/attendance.php

@ -77,8 +77,6 @@ $string['commonsessions'] = 'All students';
$string['confirmdeleteuser'] = 'Are you sure you want to delete user \'{$a->fullname}\' ({$a->email})?<br/>All of their attendance records will be permanently deleted.'; $string['confirmdeleteuser'] = 'Are you sure you want to delete user \'{$a->fullname}\' ({$a->email})?<br/>All of their attendance records will be permanently deleted.';
$string['countofselected'] = 'Count of selected'; $string['countofselected'] = 'Count of selected';
$string['copyfrom'] = 'Copy attendance data from'; $string['copyfrom'] = 'Copy attendance data from';
$string['createcalevents'] = 'Create calendar events';
$string['createcheckcalevents'] = 'Are you sure you want to create the calendar events for the following sessions?';
$string['createmultiplesessions'] = 'Create multiple sessions'; $string['createmultiplesessions'] = 'Create multiple sessions';
$string['createmultiplesessions_help'] = 'This function allows you to create multiple sessions in one simple step. $string['createmultiplesessions_help'] = 'This function allows you to create multiple sessions in one simple step.
The sessions begin on the date of the base session and continue until the \'repeat until\' date. The sessions begin on the date of the base session and continue until the \'repeat until\' date.
@ -92,8 +90,6 @@ $string['days'] = 'Days';
$string['defaults'] = 'Defaults'; $string['defaults'] = 'Defaults';
$string['defaultdisplaymode'] = 'Default display mode'; $string['defaultdisplaymode'] = 'Default display mode';
$string['delete'] = 'Delete'; $string['delete'] = 'Delete';
$string['deletecalevents'] = 'Delete calendar events';
$string['deletecheckcalevents'] = 'Are you absolutely sure you want to delete the calendar events for the following sessions?';
$string['deletelogs'] = 'Delete attendance data'; $string['deletelogs'] = 'Delete attendance data';
$string['deleteselected'] = 'Delete selected'; $string['deleteselected'] = 'Delete selected';
$string['deletesession'] = 'Delete session'; $string['deletesession'] = 'Delete session';
@ -306,6 +302,7 @@ $string['eventstatusupdated'] = 'Status updated';
$string['eventstatusadded'] = 'Status added'; $string['eventstatusadded'] = 'Status added';
$string['studentscanmark'] = 'Allow students to record own attendance'; $string['studentscanmark'] = 'Allow students to record own attendance';
$string['studentscanmark_desc'] = 'If checked, teachers will be able to allow students to mark their own attendance.';
$string['studentscanmark_help'] = 'If checked students will be able to change their own attendance status for the session.'; $string['studentscanmark_help'] = 'If checked students will be able to change their own attendance status for the session.';
$string['set_by_student'] = 'Self-recorded'; $string['set_by_student'] = 'Self-recorded';
$string['attendance_already_submitted'] = 'You may not self register attendance that has already been set.'; $string['attendance_already_submitted'] = 'You may not self register attendance that has already been set.';

16
lib.php

@ -39,10 +39,8 @@ function attendance_supports($feature) {
return true; return true;
case FEATURE_GROUPINGS: case FEATURE_GROUPINGS:
return true; return true;
case FEATURE_GROUPMEMBERSONLY:
return true;
case FEATURE_MOD_INTRO: case FEATURE_MOD_INTRO:
return false; return true;
case FEATURE_BACKUP_MOODLE2: case FEATURE_BACKUP_MOODLE2:
return true; return true;
// Artem Andreev: AFAIK it's not tested. // Artem Andreev: AFAIK it's not tested.
@ -104,8 +102,8 @@ function attendance_delete_instance($id) {
} }
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'))) {
if (existing_calendar_events_ids($sessids)) { if (attendance_existing_calendar_events_ids($sessids)) {
delete_calendar_events($sessids); attendance_delete_calendar_events($sessids);
} }
$DB->delete_records_list('attendance_log', 'sessionid', $sessids); $DB->delete_records_list('attendance_log', 'sessionid', $sessids);
$DB->delete_records('attendance_sessions', array('attendanceid' => $id)); $DB->delete_records('attendance_sessions', array('attendanceid' => $id));
@ -124,8 +122,8 @@ function attendance_delete_course($course, $feedback=true) {
$attids = array_keys($DB->get_records('attendance', array('course' => $course->id), '', 'id')); $attids = array_keys($DB->get_records('attendance', array('course' => $course->id), '', 'id'));
$sessids = array_keys($DB->get_records_list('attendance_sessions', 'attendanceid', $attids, '', 'id')); $sessids = array_keys($DB->get_records_list('attendance_sessions', 'attendanceid', $attids, '', 'id'));
if (existing_calendar_events_ids($sessids)) { if (attendance_existing_calendar_events_ids($sessids)) {
delete_calendar_events($sessids); attendance_delete_calendar_events($sessids);
} }
if ($sessids) { if ($sessids) {
$DB->delete_records_list('attendance_log', 'sessionid', $sessids); $DB->delete_records_list('attendance_log', 'sessionid', $sessids);
@ -203,8 +201,8 @@ function attendance_reset_userdata($data) {
if (!empty($data->reset_attendance_sessions)) { if (!empty($data->reset_attendance_sessions)) {
$sessionsids = array_keys($DB->get_records_list('attendance_sessions', 'attendanceid', $attids, '', 'id')); $sessionsids = array_keys($DB->get_records_list('attendance_sessions', 'attendanceid', $attids, '', 'id'));
if (existing_calendar_events_ids($sessionsids)) { if (attendance_existing_calendar_events_ids($sessionsids)) {
delete_calendar_events($sessionsids); attendance_delete_calendar_events($sessionsids);
} }
$DB->delete_records_list('attendance_sessions', 'attendanceid', $attids); $DB->delete_records_list('attendance_sessions', 'attendanceid', $attids);

2
locallib.php

@ -80,7 +80,7 @@ function attendance_get_setname($attid, $statusset, $includevalues = true) {
if ($statusesout) { if ($statusesout) {
if (count($statusesout) > 6) { if (count($statusesout) > 6) {
$statusesout = array_slice($statusesout, 0, 6); $statusesout = array_slice($statusesout, 0, 6);
$statusesout[] = '&helip;'; $statusesout[] = '...';
} }
$statusesout = implode(' ', $statusesout); $statusesout = implode(' ', $statusesout);
$statusname .= ' ('.$statusesout.')'; $statusname .= ' ('.$statusesout.')';

6
manage.php

@ -83,10 +83,14 @@ $tabs = new attendance_tabs($att, attendance_tabs::TAB_SESSIONS);
$filtercontrols = new attendance_filter_controls($att); $filtercontrols = new attendance_filter_controls($att);
$sesstable = new attendance_manage_data($att); $sesstable = new attendance_manage_data($att);
$title = get_string('attendanceforthecourse', 'attendance').' :: ' .format_string($course->fullname);
$header = new mod_attendance_header($att, $title);
// Output starts here. // Output starts here.
echo $output->header(); echo $output->header();
echo $output->heading(get_string('attendanceforthecourse', 'attendance').' :: ' .format_string($course->fullname)); echo $output->render($header);
mod_attendance_notifyqueue::show(); mod_attendance_notifyqueue::show();
echo $output->render($tabs); echo $output->render($tabs);
echo $output->render($filtercontrols); echo $output->render($filtercontrols);

2
mod_form.php

@ -51,6 +51,8 @@ class mod_attendance_mod_form extends moodleform_mod {
$mform->addRule('name', null, 'required', null, 'client'); $mform->addRule('name', null, 'required', null, 'client');
$mform->setDefault('name', get_string('modulename', 'attendance')); $mform->setDefault('name', get_string('modulename', 'attendance'));
$this->standard_intro_elements();
// Grade settings. // Grade settings.
$this->standard_grading_coursemodule_elements(); $this->standard_grading_coursemodule_elements();

2
renderables.php

@ -374,7 +374,7 @@ class attendance_user_data implements renderable {
foreach ($this->coursesatts as $atid => $ca) { foreach ($this->coursesatts as $atid => $ca) {
// Check to make sure the user can view this cm. // Check to make sure the user can view this cm.
if (!get_fast_modinfo($ca->courseid)->instances['attendance'][$ca->attid]->uservisible) { if (!get_fast_modinfo($ca->courseid)->instances['attendance'][$ca->attid]->uservisible) {
unset($this->courseatts[$atid]); unset($this->coursesatts[$atid]);
continue; continue;
} }
$this->statuses[$ca->attid] = attendance_get_statuses($ca->attid); $this->statuses[$ca->attid] = attendance_get_statuses($ca->attid);

29
renderer.php

@ -320,9 +320,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
} }
$options = array(mod_attendance_sessions_page_params::ACTION_DELETE_SELECTED => get_string('delete'), $options = array(mod_attendance_sessions_page_params::ACTION_DELETE_SELECTED => get_string('delete'),
mod_attendance_sessions_page_params::ACTION_CHANGE_DURATION => get_string('changeduration', 'attendance'), mod_attendance_sessions_page_params::ACTION_CHANGE_DURATION => get_string('changeduration', 'attendance'));
mod_attendance_sessions_page_params::ACTION_CREATE_CAL_EVENTS => get_string('createcalevents', 'attendance'),
mod_attendance_sessions_page_params::ACTION_DELETE_CAL_EVENTS => get_string('deletecalevents', 'attendance'));
$controls = html_writer::select($options, 'action'); $controls = html_writer::select($options, 'action');
$attributes = array( $attributes = array(
@ -414,7 +412,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
} }
} }
if (!empty($CFG->enablegroupmembersonly) and $takedata->cm->groupmembersonly) { if (!empty($takedata->cm->groupingid)) {
if ($group == 0) { if ($group == 0) {
$groups = array_keys(groups_get_all_groups($takedata->cm->course, 0, $takedata->cm->groupingid, 'g.id')); $groups = array_keys(groups_get_all_groups($takedata->cm->course, 0, $takedata->cm->groupingid, 'g.id'));
} else { } else {
@ -698,6 +696,23 @@ class mod_attendance_renderer extends plugin_renderer_base {
return $celldata; return $celldata;
} }
protected function render_mod_attendance_header(mod_attendance_header $header) {
if (!$header->should_render()) {
return '';
}
$attendance = $header->get_attendance();
$heading = format_string($header->get_title(), false, ['context' => $attendance->context]);
$o = $this->output->heading($heading);
$o .= $this->output->box_start('generalbox boxaligncenter', 'intro');
$o .= format_module_intro('attendance', $attendance, $attendance->cm->id);
$o .= $this->output->box_end();
return $o;
}
protected function render_attendance_user_data(attendance_user_data $userdata) { protected function render_attendance_user_data(attendance_user_data $userdata) {
$o = $this->render_user_report_tabs($userdata); $o = $this->render_user_report_tabs($userdata);
@ -804,7 +819,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$row->cells[] = format_float($status->grade, 1, true, true) . ' / ' . $row->cells[] = format_float($status->grade, 1, true, true) . ' / ' .
format_float($statussetmaxpoints[$status->setnumber], 1, true, true); format_float($statussetmaxpoints[$status->setnumber], 1, true, true);
$row->cells[] = $sess->remarks; $row->cells[] = $sess->remarks;
} else if ($sess->sessdate < $userdata->user->enrolmentstart) { } else if (($sess->sessdate + $sess->duration) < $userdata->user->enrolmentstart) {
$cell = new html_table_cell(get_string('enrolmentstart', 'attendance', $cell = new html_table_cell(get_string('enrolmentstart', 'attendance',
userdate($userdata->user->enrolmentstart, '%d.%m.%Y'))); userdate($userdata->user->enrolmentstart, '%d.%m.%Y')));
$cell->colspan = 2; $cell->colspan = 2;
@ -815,7 +830,9 @@ class mod_attendance_renderer extends plugin_renderer_base {
$cell->colspan = 2; $cell->colspan = 2;
$row->cells[] = $cell; $row->cells[] = $cell;
} else { } else {
if (!empty($sess->studentscanmark)) { // Student can mark their own attendance. $configjs = get_config('attendance', 'studentscanmark');
if (!empty($configjs) && !empty($sess->studentscanmark)) {
// Student can mark their own attendance.
// URL to the page that lets the student modify their attendance. // URL to the page that lets the student modify their attendance.
$url = new moodle_url('/mod/attendance/attendance.php', $url = new moodle_url('/mod/attendance/attendance.php',
array('sessid' => $sess->id, 'sesskey' => sesskey())); array('sessid' => $sess->id, 'sesskey' => sesskey()));

2
renderhelpers.php

@ -60,7 +60,7 @@ class user_sessions_cells_generator {
$this->construct_remarks_cell($this->reportdata->sessionslog[$this->user->id][$sess->id]->remarks); $this->construct_remarks_cell($this->reportdata->sessionslog[$this->user->id][$sess->id]->remarks);
} }
} else { } else {
if ($this->user->enrolmentstart > $sess->sessdate) { if ($this->user->enrolmentstart > ($sess->sessdate + $sess->duration)) {
$starttext = get_string('enrolmentstart', 'attendance', userdate($this->user->enrolmentstart, '%d.%m.%Y')); $starttext = get_string('enrolmentstart', 'attendance', userdate($this->user->enrolmentstart, '%d.%m.%Y'));
$this->construct_enrolments_info_cell($starttext); $this->construct_enrolments_info_cell($starttext);
} else if ($this->user->enrolmentend and $this->user->enrolmentend < $sess->sessdate) { } else if ($this->user->enrolmentend and $this->user->enrolmentend < $sess->sessdate) {

7
report.php

@ -71,13 +71,14 @@ $event->add_record_snapshot('course_modules', $cm);
$event->add_record_snapshot('attendance', $attrecord); $event->add_record_snapshot('attendance', $attrecord);
$event->trigger(); $event->trigger();
// Output starts here. $title = get_string('attendanceforthecourse', 'attendance').' :: ' .format_string($course->fullname);
$header = new mod_attendance_header($att, $title);
// Output starts here.
echo $output->header(); echo $output->header();
echo $output->heading(get_string('attendanceforthecourse', 'attendance').' :: ' .format_string($course->fullname)); echo $output->render($header);
echo $output->render($tabs); echo $output->render($tabs);
echo $output->render($filtercontrols); echo $output->render($filtercontrols);
echo $output->render($reportdata); echo $output->render($reportdata);
echo $output->footer(); echo $output->footer();

19
sessions.php

@ -133,8 +133,6 @@ switch ($att->pageparams->action) {
echo $OUTPUT->footer(); echo $OUTPUT->footer();
exit; exit;
case mod_attendance_sessions_page_params::ACTION_DELETE_SELECTED: case mod_attendance_sessions_page_params::ACTION_DELETE_SELECTED:
case mod_attendance_sessions_page_params::ACTION_CREATE_CAL_EVENTS:
case mod_attendance_sessions_page_params::ACTION_DELETE_CAL_EVENTS:
$confirm = optional_param('confirm', null, PARAM_INT); $confirm = optional_param('confirm', null, PARAM_INT);
$message = get_string('deletecheckfull', '', get_string('session', 'attendance')); $message = get_string('deletecheckfull', '', get_string('session', 'attendance'));
@ -145,12 +143,6 @@ switch ($att->pageparams->action) {
$att->delete_sessions($sessionsids); $att->delete_sessions($sessionsids);
attendance_update_users_grade($att); attendance_update_users_grade($att);
redirect($att->url_manage(), get_string('sessiondeleted', 'attendance')); redirect($att->url_manage(), get_string('sessiondeleted', 'attendance'));
} else if ($att->pageparams->action == mod_attendance_sessions_page_params::ACTION_CREATE_CAL_EVENTS) {
create_calendar_events($sessionsids);
redirect($att->url_manage(), get_string('createcheckcalevents', 'attendance'));
} else if ($att->pageparams->action == mod_attendance_sessions_page_params::ACTION_DELETE_CAL_EVENTS) {
delete_calendar_events($sessionsids);
redirect($att->url_manage(), get_string('deletecheckcalevents', 'attendance'));
} }
} }
$sessid = optional_param_array('sessid', '', PARAM_SEQUENCE); $sessid = optional_param_array('sessid', '', PARAM_SEQUENCE);
@ -159,12 +151,6 @@ switch ($att->pageparams->action) {
} }
$sessionsinfo = $att->get_sessions_info($sessid); $sessionsinfo = $att->get_sessions_info($sessid);
if ($att->pageparams->action == mod_attendance_sessions_page_params::ACTION_CREATE_CAL_EVENTS) {
$message = get_string('createcheckcalevents', 'attendance');
} else if ($att->pageparams->action == mod_attendance_sessions_page_params::ACTION_DELETE_CAL_EVENTS) {
$message = get_string('deletecheckcalevents', 'attendance');
}
$message .= html_writer::empty_tag('br'); $message .= html_writer::empty_tag('br');
foreach ($sessionsinfo as $sessinfo) { foreach ($sessionsinfo as $sessinfo) {
$message .= html_writer::empty_tag('br'); $message .= html_writer::empty_tag('br');
@ -248,6 +234,11 @@ function construct_sessions_data_for_add($formdata) {
$duration = $sesendtime - $sesstarttime; $duration = $sesendtime - $sesstarttime;
$now = time(); $now = time();
$configcanmark = get_config('attendance', 'studentscanmark');
if (empty($configcanmark)) {
$formdata->studentscanmark = 0;
}
$sessions = array(); $sessions = array();
if (isset($formdata->addmultiply)) { if (isset($formdata->addmultiply)) {
$startdate = $sessiondate; $startdate = $sessiondate;

3
settings.php

@ -41,4 +41,7 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configselect('attendance/resultsperpage', $settings->add(new admin_setting_configselect('attendance/resultsperpage',
get_string('resultsperpage', 'attendance'), get_string('resultsperpage_desc', 'attendance'), 25, $options)); get_string('resultsperpage', 'attendance'), get_string('resultsperpage_desc', 'attendance'), 25, $options));
$settings->add(new admin_setting_configcheckbox('attendance/studentscanmark',
get_string('studentscanmark', 'attendance'), get_string('studentscanmark_desc', 'attendance'), 1));
} }

6
student_attendance_form.php

@ -52,10 +52,12 @@ class mod_attendance_student_attendance_form extends moodleform {
// Create radio buttons for setting the attendance status. // Create radio buttons for setting the attendance status.
$radioarray = array(); $radioarray = array();
foreach ($statuses as $status) { foreach ($statuses as $status) {
$radioarray[] =& $mform->createElement('radio', 'status', '', $status->description, $status->id, array()); $name = html_writer::span($status->description, 'statusdesc');
$radioarray[] =& $mform->createElement('radio', 'status', '', $name, $status->id, array());
} }
// Add the radio buttons as a control with the user's name in front. // Add the radio buttons as a control with the user's name in front.
$mform->addGroup($radioarray, 'statusarray', $USER->firstname.' '.$USER->lastname.':', array(''), false); $radiogroup = $mform->addGroup($radioarray, 'statusarray', $USER->firstname.' '.$USER->lastname.':', array(''), false);
$radiogroup->setAttributes(array('class' => 'statusgroup'));
$mform->addRule('statusarray', get_string('attendancenotset', 'attendance'), 'required', '', 'client', false, false); $mform->addRule('statusarray', get_string('attendancenotset', 'attendance'), 'required', '', 'client', false, false);
$this->add_action_buttons(); $this->add_action_buttons();

3
styles.css

@ -177,3 +177,6 @@
.path-mod-attendance .summaryreport .c7 { .path-mod-attendance .summaryreport .c7 {
background-color: #EAEAEA; background-color: #EAEAEA;
} }
#page-mod-attendance-sessions .statusgroup .statusdesc {
margin-right: 12px;
}

4
tempusers.php

@ -60,8 +60,8 @@ if ($data = $mform->get_data()) {
$user->auth = 'manual'; $user->auth = 'manual';
$user->confirmed = 1; $user->confirmed = 1;
$user->deleted = 1; $user->deleted = 1;
$user->email = time().'@ghost.user.de'; $user->email = time().'@attendance.danmarsden.com';
$user->username = time().'@ghost.user.de'; $user->username = time().'@attendance.danmarsden.com';
$user->idnumber = 'tempghost'; $user->idnumber = 'tempghost';
$user->mnethostid = $CFG->mnet_localhost_id; $user->mnethostid = $CFG->mnet_localhost_id;
$studentid = $DB->insert_record('user', $user); $studentid = $DB->insert_record('user', $user);

43
tests/behat/calendar_features.feature

@ -36,46 +36,3 @@ Feature: Test the calendar related features in the attendance module
And I log in as "student1" And I log in as "student1"
And I follow "Go to calendar" And I follow "Go to calendar"
Then I should see "Test attendance" Then I should see "Test attendance"
Scenario: Teacher can delete and create calendar events for sessions
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Test attendance"
And I follow "Add session"
And I set the following fields to these values:
| id_sestime_starthour | 01 |
| id_sestime_endhour | 02 |
And I click on "id_submitbutton" "button"
And I set the following fields to these values:
| cb_selector | 1 |
| menuaction | Delete calendar events |
And I click on "OK" "button"
And I click on "Continue" "button"
And I follow "Course 1"
And I follow "Go to calendar"
Then I should not see "Test attendance"
And I log out
And I log in as "student1"
And I follow "Go to calendar"
Then I should not see "Test attendance"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Test attendance"
And I follow "Add session"
And I set the following fields to these values:
| id_sestime_starthour | 01 |
| id_sestime_endhour | 02 |
And I click on "id_submitbutton" "button"
And I set the following fields to these values:
| cb_selector | 1 |
| menuaction | Create calendar events |
And I click on "OK" "button"
And I click on "Continue" "button"
And I follow "Course 1"
And I follow "Go to calendar"
Then I should see "Test attendance"
And I log out
And I log in as "student1"
And I follow "Go to calendar"
Then I should see "Test attendance"

4
version.php

@ -22,9 +22,9 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
$plugin->version = 2016052202; $plugin->version = 2016052206;
$plugin->requires = 2016052300; $plugin->requires = 2016052300;
$plugin->release = '3.1.1.0'; $plugin->release = '3.1.1.2';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
$plugin->cron = 0; $plugin->cron = 0;
$plugin->component = 'mod_attendance'; $plugin->component = 'mod_attendance';

2
view.php

@ -78,9 +78,11 @@ if (isset($pageparams->studentid) && $USER->id != $pageparams->studentid) {
} }
$userdata = new attendance_user_data($att, $userid); $userdata = new attendance_user_data($att, $userid);
$header = new mod_attendance_header($att);
echo $output->header(); echo $output->header();
echo $output->render($header);
echo $output->render($userdata); echo $output->render($userdata);
echo $output->footer(); echo $output->footer();

Loading…
Cancel
Save