See Release Notes
Long Term Support Release
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 * The assignsubmission_onlinetext submission_updated event. 19 * 20 * @package assignsubmission_onlinetext 21 * @copyright 2014 Adrian Greeve <adrian@moodle.com> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace assignsubmission_onlinetext\event; 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 /** 30 * The assignsubmission_onlinetext submission_updated event class. 31 * 32 * @property-read array $other { 33 * Extra information about the event. 34 * 35 * - int onlinetextwordcount: Word count of the online text submission. 36 * } 37 * 38 * @package assignsubmission_onlinetext 39 * @since Moodle 2.7 40 * @copyright 2014 Adrian Greeve <adrian@moodle.com> 41 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 42 */ 43 class submission_updated extends \mod_assign\event\submission_updated { 44 45 /** 46 * Init method. 47 */ 48 protected function init() { 49 parent::init(); 50 $this->data['objecttable'] = 'assignsubmission_onlinetext'; 51 } 52 53 /** 54 * Returns non-localised description of what happened. 55 * 56 * @return string 57 */ 58 public function get_description() { 59 $descriptionstring = "The user with id '$this->userid' updated an online text submission with " . 60 "'{$this->other['onlinetextwordcount']}' words in the assignment with course module id " . 61 "'$this->contextinstanceid'"; 62 if (!empty($this->other['groupid'])) { 63 $descriptionstring .= " for the group with id '{$this->other['groupid']}'."; 64 } else { 65 $descriptionstring .= "."; 66 } 67 68 return $descriptionstring; 69 } 70 71 /** 72 * Custom validation. 73 * 74 * @throws \coding_exception 75 * @return void 76 */ 77 protected function validate_data() { 78 parent::validate_data(); 79 if (!isset($this->other['onlinetextwordcount'])) { 80 throw new \coding_exception('The \'onlinetextwordcount\' value must be set in other.'); 81 } 82 } 83 84 public static function get_objectid_mapping() { 85 // No mapping available for 'assignsubmission_onlinetext'. 86 return array('db' => 'assignsubmission_onlinetext', 'restore' => \core\event\base::NOT_MAPPED); 87 } 88 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body