|
| 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 | + * Event that gets triggered when a custom content type is created in the database |
| 19 | + * |
| 20 | + * @package mod_cms |
| 21 | + * @author Marcus Boon<[email protected]> |
| 22 | + * @copyright Catalyst IT |
| 23 | + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
| 24 | + */ |
| 25 | +namespace mod_cms\event; |
| 26 | + |
| 27 | +use stdClass; |
| 28 | +use core\event\base; |
| 29 | + |
| 30 | +/** |
| 31 | + * Event that gets triggered when a custom content type is created in the database |
| 32 | + * |
| 33 | + * @package mod_cms |
| 34 | + * @author Marcus Boon<[email protected]> |
| 35 | + * @copyright Catalyst IT |
| 36 | + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
| 37 | + */ |
| 38 | +class cms_type_created extends base { |
| 39 | + |
| 40 | + /** |
| 41 | + * Initialise the event data. |
| 42 | + */ |
| 43 | + protected function init() { |
| 44 | + $this->data['edulevel'] = self::LEVEL_OTHER; |
| 45 | + $this->data['crud'] = 'c'; |
| 46 | + $this->data['objecttable'] = 'cms_types'; |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Return localised event name. |
| 51 | + * |
| 52 | + * @return string |
| 53 | + */ |
| 54 | + public static function get_name(): string { |
| 55 | + return get_string('event:cms_type_created', 'mod_cms'); |
| 56 | + } |
| 57 | + |
| 58 | + /** |
| 59 | + * Returns description of what happened. |
| 60 | + * |
| 61 | + * @return string |
| 62 | + */ |
| 63 | + public function get_description(): string { |
| 64 | + $a = new stdClass(); |
| 65 | + $a->userid = $this->userid; |
| 66 | + $a->typeid = $this->objectid; |
| 67 | + |
| 68 | + return get_string('event:cms_type_created_desc', 'mod_cms', $a); |
| 69 | + } |
| 70 | +} |
0 commit comments