Merge branch 'MDL-39954-master' of git://github.com/FMCorz/moodle

This commit is contained in:
Dan Poltawski
2013-08-14 15:38:37 +08:00
8 changed files with 19 additions and 31 deletions
+2 -2
View File
@@ -55,12 +55,12 @@ abstract class assessable_submitted extends \core\event\base {
/**
* Custom validation.
*
* @throws coding_exception on error.
* @throws \coding_exception on error.
* @return void
*/
protected function validate_data() {
if (!$this->context->contextlevel === CONTEXT_MODULE) {
throw new coding_exception('Content level must be CONTEXT_MODULE.');
throw new \coding_exception('Content level must be CONTEXT_MODULE.');
}
}
+4 -4
View File
@@ -55,16 +55,16 @@ abstract class assessable_uploaded extends \core\event\base {
/**
* Validation that should be shared among child classes.
*
* @throws coding_exception when validation fails.
* @throws \coding_exception when validation fails.
* @return void
*/
protected function validate_data() {
if (!$this->context->contextlevel === CONTEXT_MODULE) {
throw new coding_exception('Content level must be CONTEXT_MODULE.');
throw new \coding_exception('Content level must be CONTEXT_MODULE.');
} else if (!isset($this->other['pathnamehashes']) || !is_array($this->other['pathnamehashes'])) {
throw new coding_exception('pathnamehashes must be set in $other and must be an array.');
throw new \coding_exception('pathnamehashes must be set in $other and must be an array.');
} else if (!isset($this->other['content']) || !is_string($this->other['content'])) {
throw new coding_exception('content must be set in $other and must be a string.');
throw new \coding_exception('content must be set in $other and must be a string.');
}
}
@@ -126,13 +126,13 @@ class assessable_submitted extends \core\event\assessable_submitted {
/**
* Custom validation.
*
* @throws coding_exception
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['submission_editable'])) {
throw new coding_exception('Other must contain the key submission_editable.');
throw new \coding_exception('Other must contain the key submission_editable.');
}
}
}
@@ -104,13 +104,13 @@ class assessable_uploaded extends \core\event\assessable_uploaded {
/**
* Custom validation
*
* @throws coding_exception
* @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');
throw new \coding_exception('triggeredfrom must be set in $other');
}
}
}
@@ -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();
@@ -109,13 +109,13 @@ class assessable_submitted extends \core\event\assessable_submitted {
/**
* Custom validation
*
* @throws coding_exception
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['submission_editable'])) {
throw new coding_exception('Other must contain the key submission_editable.');
throw new \coding_exception('Other must contain the key submission_editable.');
}
}
}
@@ -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');
}
}
}
@@ -104,15 +104,15 @@ class assessable_uploaded extends \core\event\assessable_uploaded {
/**
* Custom validation.
*
* @throws coding_exception
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['discussionid'])) {
throw new coding_exception('discussionid must be set in $other.');
throw new \coding_exception('discussionid must be set in $other.');
} else if (!isset($this->other['triggeredfrom'])) {
throw new coding_exception('triggeredfrom must be set in $other');
throw new \coding_exception('triggeredfrom must be set in $other');
}
}
}
+1 -1
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);