Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 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 namespace core\event; 18 19 /** 20 * Abstract grade report exported event class. 21 * 22 * @package core 23 * @since Moodle 3.2 24 * @copyright 2016 Zane Karl <zkarl@oid.ucla.edu> 25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 26 */ 27 abstract class grade_exported extends base { 28 29 /** 30 * Initialise the event data. 31 */ 32 protected function init() { 33 if (!($this instanceof grade_exported)) { 34 throw new Exception('grade_exported abstract is NOT extended by a valid component.'); 35 } 36 $this->data['crud'] = 'r'; 37 $this->data['edulevel'] = self::LEVEL_TEACHING; 38 } 39 40 /** 41 * Returns localised export type. 42 * 43 * @return string 44 */ 45 public static function get_export_type() { 46 $classname = explode('\\', get_called_class()); 47 $exporttype = explode('_', $classname[0]); 48 return $exporttype[1] ?? ''; 49 } 50 51 /** 52 * Returns localised general event name. 53 * 54 * @return string 55 */ 56 public static function get_name() { 57 $component = 'gradeexport_' . self::get_export_type(); 58 if (get_string_manager()->string_exists('eventgradeexported', $component)) { 59 return get_string('eventgradeexported', $component); 60 } 61 62 // Fallback to generic name. 63 return get_string('eventgradeexported', 'core_grades'); 64 } 65 66 /** 67 * Returns non-localised description of what happened. 68 * 69 * @return string 70 */ 71 public function get_description() { 72 return "The user with id '$this->userid'" 73 . " exported grades using the ". 74 $this->get_export_type() ." export in the gradebook."; 75 } 76 77 /** 78 * Returns relevant URL. 79 * 80 * @return \moodle_url 81 */ 82 public function get_url() { 83 $url = '/grade/export/' . $this->get_export_type() . '/export.php'; 84 return new \moodle_url($url, array('id' => $this->courseid)); 85 } 86 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body