diff --git a/db/access.php b/db/access.php
index ecbb0eb..dc9359f 100644
--- a/db/access.php
+++ b/db/access.php
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-defined('MOODLE_INTERNAL') || die();
/**
* Capability definitions for this module.
@@ -23,6 +22,7 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'mod/attendance:view' => array(
diff --git a/db/services.php b/db/services.php
index 27036ac..3ee12c0 100644
--- a/db/services.php
+++ b/db/services.php
@@ -13,7 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
-defined('MOODLE_INTERNAL') || die();
/**
* Web service local plugin attendance external functions and service definitions.
@@ -23,38 +22,41 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
- /**
- * We defined the web service functions to install.
- */
- $functions = array(
- 'mod_wsattendance_get_courses_with_today_sessions' => array(
- 'classname' => 'mod_wsattendance_external',
- 'methodname' => 'get_courses_with_today_sessions',
- 'classpath' => 'mod/attendance/externallib.php',
- 'description' => 'Method that retrieves courses with today sessions of a teacher.',
- 'type' => 'read',
- ),
- 'mod_wsattendance_get_session' => array(
- 'classname' => 'mod_wsattendance_external',
- 'methodname' => 'get_session',
- 'classpath' => 'mod/attendance/externallib.php',
- 'description' => 'Method that retrieves the session data',
- 'type' => 'read',
- ),
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * We defined the web service functions to install.
+ */
+
+$functions = array(
+ 'mod_wsattendance_get_courses_with_today_sessions' => array(
+ 'classname' => 'mod_wsattendance_external',
+ 'methodname' => 'get_courses_with_today_sessions',
+ 'classpath' => 'mod/attendance/externallib.php',
+ 'description' => 'Method that retrieves courses with today sessions of a teacher.',
+ 'type' => 'read',
+ ),
+ 'mod_wsattendance_get_session' => array(
+ 'classname' => 'mod_wsattendance_external',
+ 'methodname' => 'get_session',
+ 'classpath' => 'mod/attendance/externallib.php',
+ 'description' => 'Method that retrieves the session data',
+ 'type' => 'read',
+ ),
- 'mod_wsattendance_update_user_status' => array(
- 'classname' => 'mod_wsattendance_external',
- 'methodname' => 'update_user_status',
- 'classpath' => 'mod/attendance/externallib.php',
- 'description' => 'Method that updates the user status in a session.',
- 'type' => 'write',
- )
- );
+ 'mod_wsattendance_update_user_status' => array(
+ 'classname' => 'mod_wsattendance_external',
+ 'methodname' => 'update_user_status',
+ 'classpath' => 'mod/attendance/externallib.php',
+ 'description' => 'Method that updates the user status in a session.',
+ 'type' => 'write',
+ )
+);
- // We define the services to install as pre-build services. A pre-build service is not editable by administrator.
- $services = array('Attendance' => array('functions' => array('mod_wsattendance_get_courses_with_today_sessions',
- 'mod_wsattendance_get_session',
- 'mod_wsattendance_update_user_status'),
- 'restrictedusers' => 0,
- 'enabled' => 1));
+// We define the services to install as pre-build services. A pre-build service is not editable by administrator.
+$services = array('Attendance' => array('functions' => array('mod_wsattendance_get_courses_with_today_sessions',
+ 'mod_wsattendance_get_session',
+ 'mod_wsattendance_update_user_status'),
+ 'restrictedusers' => 0,
+ 'enabled' => 1));
diff --git a/lib.php b/lib.php
index 442acdc..e5ab12c 100644
--- a/lib.php
+++ b/lib.php
@@ -22,6 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+defined('MOODLE_INTERNAL') || die();
require_once(dirname(__FILE__) . '/classes/calendar_helpers.php');
/**
diff --git a/renderables.php b/renderables.php
index 1131573..105630e 100644
--- a/renderables.php
+++ b/renderables.php
@@ -80,8 +80,9 @@ class attendance_tabs implements renderable {
if (has_capability('mod/attendance:manageattendances', $context)) {
$toprow[] = new tabobject(self::TAB_ADD,
- $this->att->url_sessions()->out(true, array('action' => mod_attendance_sessions_page_params::ACTION_ADD)),
- get_string('addsession', 'attendance'));
+ $this->att->url_sessions()->out(true,
+ array('action' => mod_attendance_sessions_page_params::ACTION_ADD)),
+ get_string('addsession', 'attendance'));
}
if (has_capability('mod/attendance:viewreports', $context)) {
$toprow[] = new tabobject(self::TAB_REPORT, $this->att->url_report()->out(),
@@ -103,8 +104,9 @@ class attendance_tabs implements renderable {
}
if ($this->currenttab == self::TAB_UPDATE && has_capability('mod/attendance:manageattendances', $context)) {
$toprow[] = new tabobject(self::TAB_UPDATE,
- $this->att->url_sessions()->out(true, array('action' => mod_attendance_sessions_page_params::ACTION_UPDATE)),
- get_string('changesession', 'attendance'));
+ $this->att->url_sessions()->out(true,
+ array('action' => mod_attendance_sessions_page_params::ACTION_UPDATE)),
+ get_string('changesession', 'attendance'));
}
return array($toprow);
diff --git a/renderer.php b/renderer.php
index ad07e27..15436d2 100644
--- a/renderer.php
+++ b/renderer.php
@@ -1105,7 +1105,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
// We should probably rewrite this to use mforms but for now add sesskey.
$o .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()))."\n";
- $o .= $this->construct_preferences_button(get_string('update', 'attendance'), mod_attendance_preferences_page_params::ACTION_SAVE);
+ $o .= $this->construct_preferences_button(get_string('update', 'attendance'),
+ mod_attendance_preferences_page_params::ACTION_SAVE);
$o = html_writer::tag('form', $o, array('id' => 'preferencesform', 'method' => 'post',
'action' => $prefdata->url(array(), false)->out_omit_querystring()));
$o = $this->output->container($o, 'generalbox attwidth');
diff --git a/styles.css b/styles.css
index 689624f..a4cb3dc 100644
--- a/styles.css
+++ b/styles.css
@@ -1,13 +1,13 @@
.path-mod-attendance .attbtn {
+ -khtml-border-radius: 5px;
+ -moz-border-radius: 5px;
+ -opera-border-radius: 5px;
+ -webkit-border-radius: 5px;
border:1px solid #AAAAAA;
border-radius: 5px;
margin-left: 2px;
margin-right: 2px;
padding: 5px;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- -opera-border-radius: 5px;
- -khtml-border-radius: 5px;
}
.path-mod-attendance .attcurbtn {
diff --git a/tests/behat/attendance_mod.feature b/tests/behat/attendance_mod.feature
index c7c3a11..1011123 100644
--- a/tests/behat/attendance_mod.feature
+++ b/tests/behat/attendance_mod.feature
@@ -24,12 +24,15 @@ Feature: Teachers and Students can record session attendance
| user | course | role |
| student1 | C101 | student |
| teacher1 | C101 | editingteacher |
- And I log in as "teacher1"
+ When 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 fill the form with:
| Name | Attendance |
And I log out
+ And I log in as "student1"
+ And I follow "Course 1"
+ Then I should see "Attendance"
Scenario: Students can mark their own attendance
When I log in as "teacher1"