Compare commits
61 Commits
40-behatfi
...
MOODLE_26_
Author | SHA1 | Date |
---|---|---|
|
e420a10c6f | 10 years ago |
|
b5fdee1bcb | 11 years ago |
|
eeafda243a | 11 years ago |
|
8ea4f05d8e | 11 years ago |
|
797040cdb3 | 11 years ago |
|
258abeba87 | 11 years ago |
|
80ab9e8075 | 11 years ago |
|
effd1acc96 | 11 years ago |
|
ea15c2f505 | 11 years ago |
|
8de6c3eba4 | 11 years ago |
|
c6cb46c4f3 | 11 years ago |
|
cc95000198 | 11 years ago |
|
846653b85a | 11 years ago |
|
e3b48d2ba2 | 11 years ago |
|
38d102c56c | 11 years ago |
|
b9ed00d3a8 | 11 years ago |
|
717208e0f8 | 11 years ago |
|
c221a04459 | 11 years ago |
|
39f47348ae | 11 years ago |
|
bc9a079d38 | 11 years ago |
|
b2e962afae | 11 years ago |
|
5b1f3b2390 | 11 years ago |
|
ba1d8545bf | 11 years ago |
|
750a15a38d | 11 years ago |
|
d4fd1f4b4d | 11 years ago |
|
55856e6d4e | 11 years ago |
|
c3383a6d86 | 11 years ago |
|
48f4d81618 | 11 years ago |
|
6dd38ca34f | 11 years ago |
|
105f3598ba | 11 years ago |
|
127a72ed39 | 11 years ago |
|
d217f7ed90 | 11 years ago |
|
11660b2379 | 11 years ago |
|
e5a4dbb12c | 11 years ago |
|
3272e7f45d | 11 years ago |
|
ba31d7ad83 | 11 years ago |
|
91d19e10ea | 11 years ago |
|
c3ea7631ed | 12 years ago |
|
a7c20c31c9 | 11 years ago |
|
05ea479905 | 11 years ago |
|
6cbe540549 | 11 years ago |
|
ce9eb2a16f | 11 years ago |
|
24683d313d | 11 years ago |
|
89b1c5cf2a | 11 years ago |
|
cdd1079f66 | 11 years ago |
|
a1e9d1ff60 | 11 years ago |
|
aa12bb4f22 | 11 years ago |
|
2de47f26ce | 11 years ago |
|
8ddd624c6c | 11 years ago |
|
4be6603034 | 11 years ago |
|
b0da107108 | 11 years ago |
|
5909afa1a4 | 11 years ago |
|
d39f0367f1 | 11 years ago |
|
28bc551ab4 | 11 years ago |
|
066ac50602 | 11 years ago |
|
db23bb526f | 11 years ago |
|
ee20e101bb | 11 years ago |
|
52d116dbb7 | 11 years ago |
|
53c8be2acd | 11 years ago |
|
116c4d55ee | 11 years ago |
|
5dc2534a87 | 12 years ago |
20 changed files with 694 additions and 90 deletions
@ -1,21 +1,15 @@ |
|||||
ABOUT |
ABOUT |
||||
========== |
========== |
||||
The "Attendance" module was developed by |
The Attendance module is supported and maintained by Dan Marsden http://danmarsden.com |
||||
|
|
||||
|
The Attendance module was previously developed by |
||||
Dmitry Pupinin, Novosibirsk, Russia, |
Dmitry Pupinin, Novosibirsk, Russia, |
||||
Artem Andreev, Taganrog, Russia. |
Artem Andreev, Taganrog, Russia. |
||||
|
|
||||
This block may be distributed under the terms of the General Public License |
|
||||
(see http://www.gnu.org/licenses/gpl.txt for details) |
|
||||
|
|
||||
PURPOSE |
PURPOSE |
||||
========== |
========== |
||||
The attendance module and block are designed to allow instructors of a course keep an attendance log of the students in their courses. The instructor will setup the frequency of his classes (# of days per week & length of course) and the attendance is ready for use. To take attendance, the instructor clicks on the "Update Attendance" button and is presented with a list of all the students in that course, along with 4 options: Present, Absent, Late & Excused, with a Remarks textbox. Instructors can download the attendance for their course in Excel format or text format. |
The Attendance module allows teachers to maintain a record of attendance, replacing or supplementing a paper-based attendance register. |
||||
Only the instructor can update the attendance data. However, a student gets to see his attendance record. |
It is primarily used in blended-learning environments where students are required to attend classes, lectures and tutorials and allows |
||||
|
the teacher to track and optionally provide a grade for the students attendance. |
||||
INSTALLATION |
|
||||
========== |
|
||||
The attendance module follows standard installation procedure. |
|
||||
|
|
||||
1. Create folder <path to your moodle dir>/mod/attendance. |
Sessions can be configured to allow students to record their own attendance and a range of different reports are available. |
||||
2. Extract files from folder inside archive to created folder. |
|
||||
3. Visit page Home ► Site administration ► Notifications to complete installation. |
|
@ -0,0 +1,84 @@ |
|||||
|
<?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/>. |
||||
|
|
||||
|
/** |
||||
|
* Prints attendance info for particular user |
||||
|
* |
||||
|
* @package mod |
||||
|
* @subpackage attendance |
||||
|
* @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__).'/student_attenance_form.php'); |
||||
|
|
||||
|
$pageparams = new att_sessions_page_params(); |
||||
|
|
||||
|
// Check that the required parameters are present. |
||||
|
$id = required_param('sessid', PARAM_INT); |
||||
|
$attendance_session_id = required_param('sessid', PARAM_INT); |
||||
|
|
||||
|
|
||||
|
$attforsession = $DB->get_record('attendance_sessions', array('id' => $id), '*', MUST_EXIST); |
||||
|
$attendance = $DB->get_record('attendance', array('id' => $attforsession->attendanceid), '*', MUST_EXIST); |
||||
|
$cm = get_coursemodule_from_instance('attendance', $attendance->id, 0, false, MUST_EXIST); |
||||
|
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); |
||||
|
|
||||
|
// Require the user is logged in. |
||||
|
require_login($course, true, $cm); |
||||
|
|
||||
|
$pageparams->sessionid = $id; |
||||
|
$att = new attendance($attendance, $cm, $course, $PAGE->context, $pageparams); |
||||
|
|
||||
|
// Require that a session key is passed to this page. |
||||
|
require_sesskey(); |
||||
|
|
||||
|
// Create the form. |
||||
|
$mform = new mod_attendance_student_attendance_form(null, |
||||
|
array('course' => $course, 'cm' => $cm, 'modcontext' => $PAGE->context, 'session' => $attforsession, 'attendance' => $att)); |
||||
|
|
||||
|
if ($mform->is_cancelled()) { |
||||
|
// The user cancelled the form, so redirect them to the view page. |
||||
|
$url = new moodle_url('/mod/attendance/view.php', array('id' => $cm->id)); |
||||
|
redirect($url); |
||||
|
} else if ($fromform = $mform->get_data()) { |
||||
|
if (!empty($fromform->status)) { |
||||
|
$success = $att->take_from_student($fromform); |
||||
|
|
||||
|
$url = new moodle_url('/mod/attendance/view.php', array('id' => $cm->id)); |
||||
|
if ($success) { |
||||
|
// Redirect back to the view page for the block. |
||||
|
redirect($url); |
||||
|
} else { |
||||
|
print_error ('attendance_already_submitted', 'mod_attendance', $url); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// The form did not validate correctly so we will set it to display the data they submitted. |
||||
|
$mform->set_data($fromform); |
||||
|
} |
||||
|
|
||||
|
$PAGE->set_url($att->url_sessions()); |
||||
|
$PAGE->set_title($course->shortname. ": ".$att->name); |
||||
|
$PAGE->set_heading($course->fullname); |
||||
|
$PAGE->set_cacheable(true); |
||||
|
$PAGE->navbar->add($att->name); |
||||
|
|
||||
|
$output = $PAGE->get_renderer('mod_attendance'); |
||||
|
echo $output->header(); |
||||
|
$mform->display(); |
||||
|
echo $output->footer(); |
@ -0,0 +1,63 @@ |
|||||
|
<?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/>. |
||||
|
|
||||
|
require_once($CFG->libdir.'/formslib.php'); |
||||
|
|
||||
|
class mod_attendance_student_attendance_form extends moodleform { |
||||
|
public function definition() { |
||||
|
global $CFG, $USER; |
||||
|
|
||||
|
$mform =& $this->_form; |
||||
|
|
||||
|
$course = $this->_customdata['course']; |
||||
|
$cm = $this->_customdata['cm']; |
||||
|
$modcontext = $this->_customdata['modcontext']; |
||||
|
$attforsession = $this->_customdata['session']; |
||||
|
$attblock = $this->_customdata['attendance']; |
||||
|
|
||||
|
$statuses = $attblock->get_statuses(); |
||||
|
|
||||
|
$mform->addElement('hidden', 'sessid', null); |
||||
|
$mform->setType('sessid', PARAM_INT); |
||||
|
$mform->setConstant('sessid', $attforsession->id); |
||||
|
|
||||
|
$mform->addElement('hidden', 'sesskey', null); |
||||
|
$mform->setType('sesskey', PARAM_INT); |
||||
|
$mform->setConstant('sesskey', sesskey()); |
||||
|
|
||||
|
// Set a title as the date and time of the session. |
||||
|
$sesstiontitle = userdate($attforsession->sessdate, get_string('strftimedate')).' ' |
||||
|
.userdate($attforsession->sessdate, get_string('strftimehm', 'mod_attendance')); |
||||
|
|
||||
|
$mform->addElement('header', 'session', $sesstiontitle); |
||||
|
|
||||
|
// If a session description is set display it. |
||||
|
if (!empty($attforsession->description)) { |
||||
|
$mform->addElement('html', $attforsession->description); |
||||
|
} |
||||
|
|
||||
|
// Create radio buttons for setting the attendance status. |
||||
|
$radioarray = array(); |
||||
|
foreach ($statuses as $status) { |
||||
|
$radioarray[] =& $mform->createElement('radio', 'status', '', $status->description, $status->id, array()); |
||||
|
} |
||||
|
// Add the radio buttons as a control with the user's name in front. |
||||
|
$mform->addGroup($radioarray, 'statusarray', $USER->firstname.' '.$USER->lastname.':', array(''), false); |
||||
|
$mform->addRule('statusarray', get_string('attendancenotset', 'attendance'), 'required', '', 'client', false, false); |
||||
|
|
||||
|
$this->add_action_buttons(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,105 @@ |
|||||
|
@mod @uon @mod_attendance |
||||
|
Feature: Teachers and Students can record session attendance |
||||
|
In order to record session attendance |
||||
|
As a student |
||||
|
I need to be able to mark my own attendance to a session |
||||
|
And as a teacher |
||||
|
I need to be able to mark any students attendance to a session |
||||
|
In order to report on session attendance |
||||
|
As a teacher |
||||
|
I need to be able to export session attendance and run reports |
||||
|
In order to contact students with poor attendance |
||||
|
As a teacher |
||||
|
I need the ability to message a group of students with low attendance |
||||
|
|
||||
|
Background: |
||||
|
Given the following "courses" exist: |
||||
|
| fullname | shortname | summary | category | |
||||
|
| Course 1 | C101 | Prove the attendance activity works | 0 | |
||||
|
And the following "users" exist: |
||||
|
| username | firstname | lastname | email | idnumber | department | institution | |
||||
|
| student1 | Sam | Student | student1@asd.com | 1234 | computer science | University of Nottingham | |
||||
|
| teacher1 | Teacher | One | teacher1@asd.com | 5678 | computer science | University of Nottingham | |
||||
|
And the following "course enrolments" exist: |
||||
|
| user | course | role | |
||||
|
| student1 | C101 | student | |
||||
|
| teacher1 | C101 | editingteacher | |
||||
|
And I log in as "teacher1" |
||||
|
And I follow "Course 1" |
||||
|
And I turn editing mode on |
||||
|
And I add a "Attendance" to section "1" |
||||
|
And I press "Save and display" |
||||
|
And I log out |
||||
|
|
||||
|
Scenario: Students can mark their own attendance |
||||
|
When I log in as "teacher1" |
||||
|
And I follow "Course 1" |
||||
|
And I follow "Attendance" |
||||
|
And I follow "Add" |
||||
|
And I check "Allow students to record own attendance" |
||||
|
And I set the following fields to these values: |
||||
|
| id_sessiondate_hour | 23 | |
||||
|
And I click on "id_submitbutton" "button" |
||||
|
And I follow "Continue" |
||||
|
And I log out |
||||
|
When I log in as "student1" |
||||
|
And I follow "Course 1" |
||||
|
And I follow "Attendance" |
||||
|
And I follow "Submit attendance" |
||||
|
And I check "Present" |
||||
|
And I press "Save changes" |
||||
|
Then I should see "Self-recorded" |
||||
|
And I log out |
||||
|
When I log in as "teacher1" |
||||
|
And I follow "Course 1" |
||||
|
And I expand "Reports" node |
||||
|
And I follow "Logs" |
||||
|
And I click on "Get these logs" "button" |
||||
|
Then "attendance taken by student" "link" should exist |
||||
|
|
||||
|
Scenario: Teachers can view low grade report and send a message |
||||
|
When I log in as "teacher1" |
||||
|
And I follow "Course 1" |
||||
|
And I follow "Attendance" |
||||
|
And I follow "Add" |
||||
|
And I set the following fields to these values: |
||||
|
| id_sessiondate_hour | 01 | |
||||
|
And I click on "id_submitbutton" "button" |
||||
|
And I follow "Continue" |
||||
|
And I follow "Report" |
||||
|
And I follow "Low grade" |
||||
|
And I check "user3" |
||||
|
And I click on "Send a message" "button" |
||||
|
Then I should see "Message body" |
||||
|
And I should see "student1@asd.com" |
||||
|
And I expand "Reports" node |
||||
|
And I follow "Logs" |
||||
|
And I click on "Get these logs" "button" |
||||
|
Then "attendance report viewed" "link" should exist |
||||
|
|
||||
|
# Dependency - selenium running with firefox profile with auto saving of txt files to $CFG->behat_download. |
||||
|
@javascript @_file_download |
||||
|
Scenario: Export report includes id number, department and institution |
||||
|
When I log in as "teacher1" |
||||
|
And I follow "Course 1" |
||||
|
And I follow "Attendance" |
||||
|
And I follow "Add" |
||||
|
And I set the following fields to these values: |
||||
|
| id_sessiondate_hour | 01 | |
||||
|
And I click on "id_submitbutton" "button" |
||||
|
And I follow "Continue" |
||||
|
And I follow "Export" |
||||
|
Then the "id_ident_idnumber" checkbox should not be checked |
||||
|
And the "id_ident_institution" checkbox should not be checked |
||||
|
And the "id_ident_department" checkbox should not be checked |
||||
|
And I check "id_ident_idnumber" |
||||
|
And I check "id_ident_institution" |
||||
|
And I check "id_ident_department" |
||||
|
And I set the following fields to these values: |
||||
|
| format | Download in text format | |
||||
|
And I click on "OK" "button" |
||||
|
Then attendance export file is ok |
||||
|
And I should see "ID number" as "1234" in the file |
||||
|
And I should see "Department" as "computer science" in the file |
||||
|
And I should see "Institution" as "University of Nottingham" in the file |
||||
|
|
@ -0,0 +1,116 @@ |
|||||
|
<?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/>. |
||||
|
|
||||
|
|
||||
|
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php. |
||||
|
|
||||
|
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php'); |
||||
|
|
||||
|
use Behat\Mink\Exception\ExpectationException as ExpectationException, |
||||
|
Behat\Behat\Exception\PendingException as PendingException; |
||||
|
|
||||
|
/** |
||||
|
* Attendance steps definitions. |
||||
|
* |
||||
|
* @package mod |
||||
|
* @subpackage attendance |
||||
|
* @category test |
||||
|
* @copyright 2014 University of Nottingham |
||||
|
* @author Joseph Baxter (joseph.baxter@nottingham.ac.uk) |
||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||||
|
*/ |
||||
|
class behat_mod_attendance extends behat_base { |
||||
|
|
||||
|
protected $file_contents; |
||||
|
|
||||
|
/** |
||||
|
* @Then /^attendance export file is ok$/ |
||||
|
*/ |
||||
|
public function attendance_export_file_is_ok() { |
||||
|
|
||||
|
global $CFG; |
||||
|
|
||||
|
$check = true; |
||||
|
|
||||
|
// Location selenium will download to. |
||||
|
$dir = $CFG->behat_download; |
||||
|
$files = scandir($dir, 1); |
||||
|
$filename = $files[0]; |
||||
|
$file = fopen($dir . $filename, "r"); |
||||
|
|
||||
|
$count = 0; |
||||
|
$header = null; |
||||
|
|
||||
|
// The file is tab seperated but not exactly a tsv. |
||||
|
while (($row = fgetcsv($file, 0, "\t")) !== FALSE) { |
||||
|
|
||||
|
// Ignore unwanted information at the start of the file. |
||||
|
if ($count < 3) { |
||||
|
$count++; |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
if (!$header) { |
||||
|
$header = $row; |
||||
|
} else { |
||||
|
$this->file_contents = array_combine($header, $row); |
||||
|
} |
||||
|
|
||||
|
$count++; |
||||
|
} |
||||
|
|
||||
|
fclose($file); |
||||
|
unlink($dir . $filename); |
||||
|
|
||||
|
// Check if data rows exist. |
||||
|
if ($count < 2) { |
||||
|
$check = false; |
||||
|
} |
||||
|
|
||||
|
if ($check) { |
||||
|
|
||||
|
return true; |
||||
|
|
||||
|
} else { |
||||
|
|
||||
|
throw new ExpectationException('Attendance export file not ok', $this->getSession()); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Given /^I should see "([^"]*)" as "([^"]*)" in the file$/ |
||||
|
*/ |
||||
|
public function i_should_see_as_in_the_file($field, $value) { |
||||
|
|
||||
|
foreach ($this->file_contents as $array_field => $array_value) { |
||||
|
|
||||
|
if ($field == $array_field) { |
||||
|
|
||||
|
if ($value == $array_value) { |
||||
|
|
||||
|
return true; |
||||
|
|
||||
|
} else { |
||||
|
|
||||
|
throw new PendingException(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue