Skip to content
Snippets Groups Projects
apogeemessage_sent.php 2.99 KiB
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * The block_ubxcoursecreation event raised when apogee support request is sent.
 *
 * @package    block_ubxcoursecreation
 * @copyright  2022 Université de Bordeaux
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

namespace block_ubxcoursecreation\event;

use core\event\base;
use core\exception\moodle_exception;

/**
 * The Apogee message sent event.
 */
class apogeemessage_sent extends base {
    /**
     * Init method.
     *
     * @return void
     */
    protected function init() {
        $this->data['crud'] = 'c';
        $this->data['edulevel'] = self::LEVEL_OTHER;
        $this->data['objecttable'] = 'block_ubxcoursecreation';
    }

    /**
     * Returns description of what happened.
     *
     * @return string
     * @throws \coding_exception
     */
    public function get_description() {
        return get_string('eventapogeemessagesent_desc', 'block_ubxcoursecreation', [
            'requestid' => $this->objectid,
            'contact' => $this->other['contact'],
        ]);
    }

    /**
     * Return localised event name.
     *
     * @return string
     * @throws \coding_exception
     */
    public static function get_name() {
        return get_string('eventapogeemessagesent', 'block_ubxcoursecreation');
    }

    /**
     * Get URL related to the action
     *
     * @return \moodle_url
     * @throws moodle_exception
     */
    public function get_url() {
        $url = new \moodle_url('/blocks/ubxcoursecreation/edit.php', ['id' => $this->objectid]);

        return $url;
    }

    /**
     * This is used when restoring course logs where it is required that we
     * map the objectid to it's new value in the new course.
     *
     * {inheritDoc}
     *
     * @return mixed the name of the restore mapping the objectid links to
     * @see base::get_objectid_mapping
     */
    public static function get_objectid_mapping() {
        return base::NOT_MAPPED;
    }

    /**
     * This is used when restoring course logs where it is required that we
     * map the information in 'other' to it's new value in the new course.
     *
     * {inheritDoc}
     *
     * @return array|int an array of other values and their corresponding mapping
     * @see base::get_other_mapping
     */
    public static function get_other_mapping() {
        return base::NOT_MAPPED;
    }
}