diff --git a/db/services.php b/db/services.php index 50fd480..6cc2584 100644 --- a/db/services.php +++ b/db/services.php @@ -26,50 +26,50 @@ defined('MOODLE_INTERNAL') || die(); $functions = array( 'mod_attendance_add_attendance' => array( - 'classname' => 'mod_wsattendance_external', + 'classname' => 'mod_attendance_external', 'methodname' => 'add_attendance', 'classpath' => 'mod/attendance/externallib.php', 'description' => 'Add attendance instance to course.', 'type' => 'write', ), 'mod_attendance_remove_attendance' => array( - 'classname' => 'mod_wsattendance_external', + 'classname' => 'mod_attendance_external', 'methodname' => 'remove_attendance', 'classpath' => 'mod/attendance/externallib.php', 'description' => 'Delete attendance instance.', 'type' => 'write', ), 'mod_attendance_add_session' => array( - 'classname' => 'mod_wsattendance_external', + 'classname' => 'mod_attendance_external', 'methodname' => 'add_session', 'classpath' => 'mod/attendance/externallib.php', 'description' => 'Add a new session.', 'type' => 'write', ), 'mod_attendance_remove_session' => array( - 'classname' => 'mod_wsattendance_external', + 'classname' => 'mod_attendance_external', 'methodname' => 'remove_session', 'classpath' => 'mod/attendance/externallib.php', 'description' => 'Delete a session.', 'type' => 'write', ), - 'mod_wsattendance_get_courses_with_today_sessions' => array( - 'classname' => 'mod_wsattendance_external', + 'mod_attendance_get_courses_with_today_sessions' => array( + 'classname' => 'mod_attendance_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', + 'mod_attendance_get_session' => array( + 'classname' => 'mod_attendance_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', + 'mod_attendance_update_user_status' => array( + 'classname' => 'mod_attendance_external', 'methodname' => 'update_user_status', 'classpath' => 'mod/attendance/externallib.php', 'description' => 'Method that updates the user status in a session.', @@ -86,12 +86,12 @@ $services = array( 'mod_attendance_remove_attendance', 'mod_attendance_add_session', 'mod_attendance_remove_session', - 'mod_wsattendance_get_courses_with_today_sessions', - 'mod_wsattendance_get_session', - 'mod_wsattendance_update_user_status' + 'mod_attendance_get_courses_with_today_sessions', + 'mod_attendance_get_session', + 'mod_attendance_update_user_status' ), 'restrictedusers' => 0, 'enabled' => 1, - 'shortname' => 'mod_attendance_ws' + 'shortname' => 'mod_attendance' ) ); diff --git a/externallib.php b/externallib.php index 1877ae2..ac734fb 100644 --- a/externallib.php +++ b/externallib.php @@ -28,11 +28,11 @@ require_once($CFG->libdir . '/filelib.php'); require_once(dirname(__FILE__).'/classes/attendance_webservices_handler.php'); /** - * Class mod_wsattendance_external + * Class mod_attendance_external * @copyright 2015 Caio Bressan Doneda * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class mod_wsattendance_external extends external_api { +class mod_attendance_external extends external_api { /** * Describes the parameters for add_attendance. diff --git a/tests/externallib_test.php b/tests/externallib_test.php index 6060da5..a382c0d 100644 --- a/tests/externallib_test.php +++ b/tests/externallib_test.php @@ -241,7 +241,7 @@ class mod_attendance_external_testcase extends externallib_advanced_testcase { $this->assertCount(0, $DB->get_records('attendance', ['course' => $course->id])); // Create attendance. - $result = mod_wsattendance_external::add_attendance($course->id, 'test', 'test', NOGROUPS); + $result = mod_attendance_external::add_attendance($course->id, 'test', 'test', NOGROUPS); // Check attendance exist. $this->assertCount(1, $DB->get_records('attendance', ['course' => $course->id])); @@ -254,7 +254,7 @@ class mod_attendance_external_testcase extends externallib_advanced_testcase { $this->assertEquals($groupmode, NOGROUPS); // Create attendance with "separate groups" group mode. - $result = mod_wsattendance_external::add_attendance($course->id, 'testsepgrp', 'testsepgrp', SEPARATEGROUPS); + $result = mod_attendance_external::add_attendance($course->id, 'testsepgrp', 'testsepgrp', SEPARATEGROUPS); // Check attendance exist. $this->assertCount(2, $DB->get_records('attendance', ['course' => $course->id])); @@ -268,7 +268,7 @@ class mod_attendance_external_testcase extends externallib_advanced_testcase { // Create attendance with wrong group mode. $this->expectException('invalid_parameter_exception'); - $result = mod_wsattendance_external::add_attendance($course->id, 'test1', 'test1', 100); + $result = mod_attendance_external::add_attendance($course->id, 'test1', 'test1', 100); } public function test_remove_attendance() { @@ -286,7 +286,7 @@ class mod_attendance_external_testcase extends externallib_advanced_testcase { $this->assertCount(1, $DB->get_records('attendance_sessions', ['attendanceid' => $this->attendance->id])); // Remove attendance. - mod_wsattendance_external::remove_attendance($this->attendance->id); + mod_attendance_external::remove_attendance($this->attendance->id); // Check attendance removed. $this->assertCount(0, $DB->get_records('attendance', ['course' => $this->course->id])); @@ -307,29 +307,29 @@ class mod_attendance_external_testcase extends externallib_advanced_testcase { $this->setUser($teacher); // Create attendances. - $attendancenogroups = mod_wsattendance_external::add_attendance($course->id, 'nogroups', 'test', NOGROUPS); - $attendancesepgroups = mod_wsattendance_external::add_attendance($course->id, 'sepgroups', 'test', SEPARATEGROUPS); - $attendancevisgroups = mod_wsattendance_external::add_attendance($course->id, 'visgroups', 'test', VISIBLEGROUPS); + $attendancenogroups = mod_attendance_external::add_attendance($course->id, 'nogroups', 'test', NOGROUPS); + $attendancesepgroups = mod_attendance_external::add_attendance($course->id, 'sepgroups', 'test', SEPARATEGROUPS); + $attendancevisgroups = mod_attendance_external::add_attendance($course->id, 'visgroups', 'test', VISIBLEGROUPS); // Check attendances exist. $this->assertCount(3, $DB->get_records('attendance', ['course' => $course->id])); // Create session with group in "no groups" attendance. $this->expectException('invalid_parameter_exception'); - mod_wsattendance_external::add_session($attendancenogroups['attendanceid'], 'test', time(), 3600, $group->id, false); + mod_attendance_external::add_session($attendancenogroups['attendanceid'], 'test', time(), 3600, $group->id, false); // Create session with no group in "separate groups" attendance. $this->expectException('invalid_parameter_exception'); - mod_wsattendance_external::add_session($attendancesepgroups['attendanceid'], 'test', time(), 3600, 0, false); + mod_attendance_external::add_session($attendancesepgroups['attendanceid'], 'test', time(), 3600, 0, false); // Create session with invalid group in "visible groups" attendance. $this->expectException('invalid_parameter_exception'); - mod_wsattendance_external::add_session($attendancevisgroups['attendanceid'], 'test', time(), 3600, $group->id + 100, false); + mod_attendance_external::add_session($attendancevisgroups['attendanceid'], 'test', time(), 3600, $group->id + 100, false); // Create session and validate record. $time = time(); $duration = 3600; - $result = mod_wsattendance_external::add_session($attendancesepgroups['attendanceid'], + $result = mod_attendance_external::add_session($attendancesepgroups['attendanceid'], 'testsession', $time, $duration, $group->id, true); $this->assertCount(1, $DB->get_records('attendance_sessions', ['id' => $result['sessionid']])); @@ -355,23 +355,23 @@ class mod_attendance_external_testcase extends externallib_advanced_testcase { $this->setUser($teacher); // Create attendance. - $attendance = mod_wsattendance_external::add_attendance($course->id, 'test', 'test', NOGROUPS); + $attendance = mod_attendance_external::add_attendance($course->id, 'test', 'test', NOGROUPS); // Check attendance exist. $this->assertCount(1, $DB->get_records('attendance', ['course' => $course->id])); // Create session. - $result0 = mod_wsattendance_external::add_session($attendance['attendanceid'], 'test0', time(), 3600, 0, false); - $result1 = mod_wsattendance_external::add_session($attendance['attendanceid'], 'test1', time(), 3600, 0, false); + $result0 = mod_attendance_external::add_session($attendance['attendanceid'], 'test0', time(), 3600, 0, false); + $result1 = mod_attendance_external::add_session($attendance['attendanceid'], 'test1', time(), 3600, 0, false); $this->assertCount(2, $DB->get_records('attendance_sessions', ['attendanceid' => $attendance['attendanceid']])); // Delete session 0. - mod_wsattendance_external::remove_session($result0['sessionid']); + mod_attendance_external::remove_session($result0['sessionid']); $this->assertCount(1, $DB->get_records('attendance_sessions', ['attendanceid' => $attendance['attendanceid']])); // Delete session 1. - mod_wsattendance_external::remove_session($result1['sessionid']); + mod_attendance_external::remove_session($result1['sessionid']); $this->assertCount(0, $DB->get_records('attendance_sessions', ['attendanceid' => $attendance['attendanceid']])); } @@ -388,7 +388,7 @@ class mod_attendance_external_testcase extends externallib_advanced_testcase { $this->setUser($teacher); // Create attendance. - $attendance = mod_wsattendance_external::add_attendance($course->id, 'test', 'test', NOGROUPS); + $attendance = mod_attendance_external::add_attendance($course->id, 'test', 'test', NOGROUPS); // Check attendance exist. $this->assertCount(1, $DB->get_records('attendance', ['course' => $course->id])); @@ -397,7 +397,7 @@ class mod_attendance_external_testcase extends externallib_advanced_testcase { $sink = $this->redirectEvents(); // Create session with no calendar event. - mod_wsattendance_external::add_session($attendance['attendanceid'], 'test0', time(), 3600, 0, false); + mod_attendance_external::add_session($attendance['attendanceid'], 'test0', time(), 3600, 0, false); // Capture the event. $events = $sink->get_events(); @@ -408,7 +408,7 @@ class mod_attendance_external_testcase extends externallib_advanced_testcase { $this->assertInstanceOf('\mod_attendance\event\session_added', $events[0]); // Create session with calendar event. - mod_wsattendance_external::add_session($attendance['attendanceid'], 'test0', time(), 3600, 0, true); + mod_attendance_external::add_session($attendance['attendanceid'], 'test0', time(), 3600, 0, true); // Capture the event. $events = $sink->get_events(); diff --git a/version.php b/version.php index 72ccc1c..4e3330f 100755 --- a/version.php +++ b/version.php @@ -23,7 +23,7 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2019072700; +$plugin->version = 2019072900; $plugin->requires = 2019072500; // Requires 3.8. $plugin->release = '3.8.0'; $plugin->maturity = MATURITY_STABLE;