MDL-43238 mod_assign: removed incorrect validation
[moodle.git] / mod / assign / submission / onlinetext / classes / event / assessable_uploaded.php
CommitLineData
7dceb500
FM
1<?php
2// This file is part of 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 * assignsubmission_onlinetext assessable uploaded event.
19 *
20 * @package assignsubmission_onlinetext
21 * @copyright 2013 Frédéric Massart
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25namespace assignsubmission_onlinetext\event;
26
27defined('MOODLE_INTERNAL') || die();
28
29/**
30 * assignsubmission_onlinetext assessable uploaded event class.
31 *
184afb6b
RT
32 * @property-read array $other {
33 * Extra information about event.
34 *
35 * @type array pathnamehashes uploaded files path name hashes.
36 * @type string content string.
37 * @type string format content format.
38 * }
39 *
7dceb500
FM
40 * @package assignsubmission_onlinetext
41 * @copyright 2013 Frédéric Massart
42 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
43 */
44class assessable_uploaded extends \core\event\assessable_uploaded {
45
46 /**
3785358d 47 * Returns description of what happened.
7dceb500 48 *
3785358d 49 * @return string
7dceb500
FM
50 */
51 public function get_description() {
3785358d 52 return "User {$this->userid} has saved an online text in submission {$this->objectid}.";
7dceb500
FM
53 }
54
55 /**
56 * Legacy event data if get_legacy_eventname() is not empty.
57 *
58 * @return stdClass
59 */
60 protected function get_legacy_eventdata() {
61 $eventdata = new \stdClass();
62 $eventdata->modulename = 'assign';
63 $eventdata->cmid = $this->context->instanceid;
64 $eventdata->itemid = $this->objectid;
65 $eventdata->courseid = $this->courseid;
66 $eventdata->userid = $this->userid;
67 $eventdata->content = $this->other['content'];
68 if ($this->other['pathnamehashes']) {
69 $eventdata->pathnamehashes = $this->other['pathnamehashes'];
70 }
71 return $eventdata;
72 }
73
74 /**
75 * Return the legacy event name.
76 *
77 * @return string
78 */
0528361c 79 public static function get_legacy_eventname() {
7dceb500
FM
80 return 'assessable_content_uploaded';
81 }
82
83 /**
84 * Return localised event name.
85 *
86 * @return string
87 */
88 public static function get_name() {
89 return get_string('event_assessable_uploaded', 'assignsubmission_onlinetext');
90 }
91
92 /**
93 * Get URL related to the action.
94 *
95 * @return \moodle_url
96 */
97 public function get_url() {
98 return new \moodle_url('/mod/assign/view.php', array('id' => $this->context->instanceid));
99 }
100
101 /**
102 * Init method.
103 *
104 * @return void
105 */
106 protected function init() {
107 parent::init();
108 $this->data['objecttable'] = 'assign_submission';
109 }
7dceb500 110}