Browse Source

tidy up some more coding guideline/behat stuff.

MOODLE_32_STABLE
Dan Marsden 8 years ago
parent
commit
8a9f561f22
  1. 2
      db/access.php
  2. 68
      db/services.php
  3. 1
      lib.php
  4. 10
      renderables.php
  5. 3
      renderer.php
  6. 8
      styles.css
  7. 5
      tests/behat/attendance_mod.feature

2
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 <http://www.gnu.org/licenses/>.
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(

68
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 <http://www.gnu.org/licenses/>.
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));

1
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');
/**

10
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);

3
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');

8
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 {

5
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"

Loading…
Cancel
Save