Merge branch 'MDL-39954-master' of git://github.com/FMCorz/moodle
authorDan Poltawski <dan@moodle.com>
Wed, 14 Aug 2013 07:38:37 +0000 (15:38 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 14 Aug 2013 07:38:37 +0000 (15:38 +0800)
lib/classes/event/assessable_submitted.php
lib/classes/event/assessable_uploaded.php
mod/assign/classes/event/assessable_submitted.php
mod/assignment/type/online/classes/event/assessable_uploaded.php
mod/assignment/type/upload/classes/event/assessable_submitted.php
mod/assignment/type/upload/classes/event/assessable_uploaded.php
mod/forum/classes/event/assessable_uploaded.php
mod/workshop/submission.php

index dbdc54b..e206117 100644 (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.');
         }
     }
 
index 9d7389c..bfd6a5e 100644 (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.');
         }
     }
 
index ad9d7c8..d893f8e 100644 (file)
@@ -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.');
         }
     }
 }
index e5116ba..efbedf8 100644 (file)
@@ -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');
         }
     }
 }
index 0cd2288..2547c8f 100644 (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();
 
@@ -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.');
         }
     }
 }
index ff7f832..de6fecc 100644 (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');
-        }
-    }
 }
index 408547c..0d8b257 100644 (file)
@@ -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');
         }
     }
 }
index 183889c..2b1c1e7 100644 (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);