. /** * The assignsubmission_onlinetext submission_created event. * * @package assignsubmission_onlinetext * @copyright 2014 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace assignsubmission_onlinetext\event; defined('MOODLE_INTERNAL') || die(); /** * The assignsubmission_onlinetext submission_created event class. * * @property-read array $other { * Extra information about the event. * * - int onlinetextwordcount: Word count of the online text submission. * } * * @package assignsubmission_onlinetext * @since Moodle 2.7 * @copyright 2014 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class submission_created extends \mod_assign\event\submission_created { /** * Init method. */ protected function init() { parent::init(); $this->data['objecttable'] = 'assignsubmission_onlinetext'; } /** * Returns non-localised description of what happened. * * @return string */ public function get_description() { $descriptionstring = "The user with id '$this->userid' created an online text submission with " . "'{$this->other['onlinetextwordcount']}' words in the assignment with course module id " . "'$this->contextinstanceid'"; if (!empty($this->other['groupid'])) { $descriptionstring .= " for the group with id '{$this->other['groupid']}'."; } else { $descriptionstring .= "."; } return $descriptionstring; } /** * Custom validation. * * @throws \coding_exception * @return void */ protected function validate_data() { parent::validate_data(); if (!isset($this->other['onlinetextwordcount'])) { throw new \coding_exception('The \'onlinetextwordcount\' value must be set in other.'); } } public static function get_objectid_mapping() { // No mapping available for 'assignsubmission_onlinetext'. return array('db' => 'assignsubmission_onlinetext', 'restore' => \core\event\base::NOT_MAPPED); } }