MDL-39954 event: Fixed errors raised while triggering event

This commit is contained in:
Frederic Massart 2013-08-14 14:53:43 +08:00
parent dde244c046
commit 29b8b7c7ad
3 changed files with 4 additions and 16 deletions

View file

@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace assignment_submitted\event;
namespace assignment_upload\event;
defined('MOODLE_INTERNAL') || die();

View file

@ -63,8 +63,8 @@ class assessable_uploaded extends \core\event\assessable_uploaded {
$eventdata->itemid = $this->objectid;
$eventdata->courseid = $this->courseid;
$eventdata->userid = $this->userid;
if ($this->get_legacy_files()) {
$eventdata->files = $this->get_legacy_files(); // This is depreceated - please use pathnamehashes instead!
if ($this->legacyfiles) {
$eventdata->files = $this->legacyfiles; // This is depreceated - please use pathnamehashes instead!
}
$eventdata->pathnamehashes = $this->other['pathnamehashes'];
return $eventdata;
@ -127,16 +127,4 @@ class assessable_uploaded extends \core\event\assessable_uploaded {
$this->legacyfiles = $files;
}
/**
* Custom validation
*
* @throws coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['triggeredfrom'])) {
throw new coding_exception('triggeredfrom must be set in $other');
}
}
}

View file

@ -218,7 +218,7 @@ if ($edit) {
'objectid' => $submission->id,
'other' => array(
'content' => $formdata->content,
'files' => array_keys($files)
'pathnamehashes' => array_keys($files)
)
);
$event = \mod_workshop\event\assessable_uploaded::create($params);