Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]
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 * Email failed event. 19 * 20 * @package core 21 * @since Moodle 2.7 22 * @copyright 2013 Mark Nelson <markn@moodle.com> 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 namespace core\event; 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 /** 31 * Email failed event class. 32 * 33 * @property-read array $other { 34 * Extra information about event. 35 * 36 * - string subject: the message subject. 37 * - string message: the message text. 38 * - string errorinfo: the error info. 39 * } 40 * 41 * @package core 42 * @since Moodle 2.7 43 * @copyright 2013 Mark Nelson <markn@moodle.com> 44 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 45 */ 46 class email_failed extends base { 47 48 /** 49 * Initialise the event data. 50 */ 51 protected function init() { 52 $this->data['crud'] = 'c'; 53 $this->data['edulevel'] = self::LEVEL_OTHER; 54 } 55 56 /** 57 * Returns localised general event name. 58 * 59 * @return string 60 */ 61 public static function get_name() { 62 return get_string('eventemailfailed'); 63 } 64 65 /** 66 * Returns non-localised description of what happened. 67 * 68 * @return string 69 */ 70 public function get_description() { 71 return "Failed to send an email from the user with id '$this->userid' to the user with id '$this->relateduserid' 72 due to the following error: \"{$this->other['errorinfo']}\"."; 73 } 74 75 /** 76 * Custom validation. 77 * 78 * @throws \coding_exception 79 */ 80 protected function validate_data() { 81 parent::validate_data(); 82 83 if (!isset($this->relateduserid)) { 84 throw new \coding_exception('The \'relateduserid\' must be set.'); 85 } 86 if (!isset($this->other['subject'])) { 87 throw new \coding_exception('The \'subject\' value must be set in other.'); 88 } 89 if (!isset($this->other['message'])) { 90 throw new \coding_exception('The \'message\' value must be set in other.'); 91 } 92 if (!isset($this->other['errorinfo'])) { 93 throw new \coding_exception('The \'errorinfo\' value must be set in other.'); 94 } 95 } 96 97 public static function get_other_mapping() { 98 return false; 99 } 100 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body