芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/www/cepali/lib/classes/event/course_module_viewed.php
. /** * Course module viewed event. * * @package core * @copyright 2013 onwards Ankit Agarwal * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core\event; defined('MOODLE_INTERNAL') || die(); /** * Abstract Course module viewed event class. * * Class for event to be triggered when a course module is viewed. * * @package core * @since Moodle 2.7 * @copyright 2013 onwards Ankit Agarwal * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class course_module_viewed extends base { /** * Init method. * * Please override this in extending class and specify objecttable. * * @return void */ protected function init() { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; } /** * Returns description of what happened. * * @return string */ public function get_description() { return "The user with id '$this->userid' viewed the '{$this->objecttable}' activity with " . "course module id '$this->contextinstanceid'."; } /** * Return localised event name. * * @return string */ public static function get_name() { return get_string('eventcoursemoduleviewed', 'core'); } /** * Get URL related to the action. * * @return \moodle_url */ public function get_url() { return new \moodle_url("/mod/$this->objecttable/view.php", array('id' => $this->contextinstanceid)); } /** * Return the legacy event log data. * * @return array|null */ protected function get_legacy_logdata() { return array($this->courseid, $this->objecttable, 'view', 'view.php?id=' . $this->contextinstanceid, $this->objectid, $this->contextinstanceid); } /** * Custom validation. * * @throws \coding_exception * @return void */ protected function validate_data() { parent::validate_data(); // Make sure this class is never used without proper object details. if (empty($this->objectid) || empty($this->objecttable)) { throw new \coding_exception('The course_module_viewed event must define objectid and object table.'); } // Make sure the context level is set to module. if ($this->contextlevel != CONTEXT_MODULE) { throw new \coding_exception('Context level must be CONTEXT_MODULE.'); } } }