1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of the Zoom plugin for Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
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.
|
|
|
8 |
//
|
|
|
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.
|
|
|
13 |
//
|
|
|
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/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Contains the event class for when a user clicks a 'Join Meeting' button.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_zoom
|
|
|
21 |
* @copyright 2015 UC Regents
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
namespace mod_zoom\event;
|
|
|
26 |
|
|
|
27 |
use coding_exception;
|
|
|
28 |
use moodle_url;
|
|
|
29 |
|
|
|
30 |
/**
|
|
|
31 |
* Records when a join meeting button is clicked.
|
|
|
32 |
*/
|
|
|
33 |
class join_meeting_button_clicked extends \core\event\base {
|
|
|
34 |
/**
|
|
|
35 |
* Initializes the event.
|
|
|
36 |
*/
|
|
|
37 |
protected function init() {
|
|
|
38 |
$this->data['edulevel'] = self::LEVEL_PARTICIPATING;
|
|
|
39 |
$this->data['crud'] = 'r';
|
|
|
40 |
$this->data['objecttable'] = 'zoom';
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* Validates arguments.
|
|
|
45 |
*/
|
|
|
46 |
protected function validate_data() {
|
|
|
47 |
$fieldstovalidate = ['cmid' => "integer", 'meetingid' => "integer", 'userishost' => "boolean"];
|
|
|
48 |
foreach ($fieldstovalidate as $field => $shouldbe) {
|
|
|
49 |
if (is_null($this->other[$field])) {
|
|
|
50 |
throw new coding_exception("The $field value must be set in other.");
|
|
|
51 |
} else if (gettype($this->other[$field]) != $shouldbe) {
|
|
|
52 |
throw new coding_exception("The $field value must be an $shouldbe.");
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
/**
|
|
|
58 |
* Returns the name of the event.
|
|
|
59 |
*
|
|
|
60 |
* @return string
|
|
|
61 |
*/
|
|
|
62 |
public static function get_name() {
|
|
|
63 |
return get_string('clickjoin', 'mod_zoom');
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
/**
|
|
|
67 |
* Returns a short description for the event.
|
|
|
68 |
*
|
|
|
69 |
* @return string
|
|
|
70 |
*/
|
|
|
71 |
public function get_description() {
|
|
|
72 |
return "User '$this->userid' " . ($this->other['userishost'] ? 'started' : 'joined') . " meeting with meeting_id '" .
|
|
|
73 |
$this->other['meetingid'] . "' in course '$this->courseid'";
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
/**
|
|
|
77 |
* Returns URL to meeting view page.
|
|
|
78 |
*
|
|
|
79 |
* @return moodle_url
|
|
|
80 |
*/
|
|
|
81 |
public function get_url() {
|
|
|
82 |
return new moodle_url('/mod/zoom/view.php', ['id' => $this->other['cmid']]);
|
|
|
83 |
}
|
|
|
84 |
}
|