. /** * The mod_folder course module downloaded event. * * @package mod_folder * @copyright 2015 Andrew Hancox * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace mod_folder\event; defined('MOODLE_INTERNAL') || die(); /** * The mod_folder course module viewed event class. * * @package mod_folder * @since Moodle 3.1 * @copyright 2015 Andrew Hancox * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class all_files_downloaded extends \core\event\base { /** * Init method. * * @return void */ protected function init() { $this->data['crud'] = 'r'; $this->data['edulevel'] = self::LEVEL_PARTICIPATING; $this->data['objecttable'] = 'folder'; } /** * Returns description of what happened. * * @return string */ public function get_description() { return "The user with id '$this->userid' downloaded a zip archive containing all the files from the folder activity with " . "course module id '$this->contextinstanceid'."; } /** * Return localised event name. * * @return string */ public static function get_name() { return get_string('eventallfilesdownloaded', 'folder'); } /** * Get URL related to the action. * * @return \moodle_url */ public function get_url() { return new \moodle_url("/mod/folder/view.php", array('id' => $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.'); } } }