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 * mod_assign submission updated event.
21 * @copyright 2013 Frédéric Massart
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 namespace mod_assign\event;
27 defined('MOODLE_INTERNAL') || die();
30 * mod_assign submission updated event class.
32 * @property-read array $other Extra information about the event.
33 * -int submissionid: ID number of this submission.
34 * -int submissionattempt: Number of attempts made on this submission.
35 * -string submissionstatus: Status of the submission.
36 * -int groupid: (optional) The group ID if this is a teamsubmission (optional).
40 * @copyright 2013 Frédéric Massart
41 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
43 abstract class submission_updated extends \core\event\base {
48 protected function init() {
49 $this->data['crud'] = 'u';
50 $this->data['edulevel'] = self::LEVEL_PARTICIPATING;
54 * Returns localised general event name.
58 public static function get_name() {
59 return get_string('eventsubmissionupdated', 'mod_assign');
63 * Returns relevant URL.
66 public function get_url() {
67 return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid));
73 * @throws \coding_exception
76 protected function validate_data() {
77 if (!isset($this->other['submissionid'])) {
78 throw new \coding_exception('Other must contain the key submissionid.');
80 if (!isset($this->other['submissionattempt'])) {
81 throw new \coding_exception('Other must contain the key submissionattempt.');
83 if (!isset($this->other['submissionstatus'])) {
84 throw new \coding_exception('Other must contain the key submissionstatus.');