2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * This file contains an event for when self-marking is blocked because
19 * another student used the same IP address to self-mark.
21 * @package mod_attendance
22 * @author Dan Marsden <dan@danmarsden.com>
23 * @copyright 2018 Catalyst IT
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 namespace mod_attendance\event
;
28 defined('MOODLE_INTERNAL') ||
die();
31 * Event for when self-marking is blocked
33 * @property-read array $other {
34 * Extra information about event properties.
36 * string mode Mode of the report viewed.
38 * @package mod_attendance
39 * @author Dan Marsden <dan@danmarsden.com>
40 * @copyright 2018 Catalyst IT
41 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
43 class session_ip_shared
extends \core\event
\base
{
48 protected function init() {
49 $this->data
['crud'] = 'r';
50 $this->data
['edulevel'] = self
::LEVEL_PARTICIPATING
;
51 $this->data
['objecttable'] = 'attendance_log';
55 * Returns non-localised description of what happened.
59 public function get_description() {
60 return 'User with id ' . $this->userid
. ' was blocked from taking attendance for sessionid: ' . $this->other
['sessionid'] .
61 ' because user with id '.$this->other
['otheruser'] . ' previously marked attendance with the same IP address.';
65 * Returns localised general event name.
69 public static function get_name() {
70 return get_string('eventsessionipshared', 'mod_attendance');
74 * Get URL related to the action
78 public function get_url() {
79 return new \
moodle_url('/mod/attendance/attendance.php');
83 * Get objectid mapping
85 * @return array of parameters for object mapping.
87 public static function get_objectid_mapping() {
90 'restore' => 'attendance'