Last active
July 4, 2017 09:36
-
-
Save xyulex/88d9356e71bb3a4b63e3e6004d99814e to your computer and use it in GitHub Desktop.
MOODLE: Eventos al borrar un curso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// local/altamarimport/db/events.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/>. | |
/** | |
* Event observer. | |
* | |
* @package block_recent_activity | |
* @category event | |
* @copyright 2014 Marina Glancy | |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | |
*/ | |
defined('MOODLE_INTERNAL') || die(); | |
$observers = array ( | |
array ( | |
'eventname' => '\core\event\course_deleted', | |
'callback' => 'local_altamarimport_observer::delete' | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// local/altamarimport/classes/observer.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/>. | |
/** | |
* Event observer. | |
* | |
* @package local_altamarimport | |
* @copyright 2017 Raúl Martínez | |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | |
*/ | |
defined('MOODLE_INTERNAL') || die(); | |
/** | |
* Event observer. | |
* | |
* @package local_altamarimport | |
* @copyright 2017 Raúl Martínez | |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | |
*/ | |
class local_altamarimport_observer { | |
/** | |
* Delete all images and URL from Altamar when a course is deleted. | |
* | |
* @param \core\event\base $event | |
*/ | |
public static function delete(\core\event\course_deleted $event) { | |
global $DB; | |
$courseid = $event->objectid; | |
$DB->delete_records('config_plugins', array('plugin' => 'local_altamarimport', 'name' => 'coursecover_'.$courseid)); | |
$DB->delete_records_select('config_plugins', $DB->sql_like('name', '?'), array('%sectioncover_'.$courseid.'_%')); | |
$DB->delete_records_select('config_plugins', $DB->sql_like('name', '?'), array('%sectioncovertn_'.$courseid.'_%')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment