-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MED-101: Add remove resource functionality
- Loading branch information
Daniel Thies
committed
Apr 11, 2024
1 parent
219d061
commit 175b044
Showing
21 changed files
with
609 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. | ||
|
||
namespace tool_mediatime\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* The resource_deleted event class. | ||
* | ||
* @package tool_mediatime | ||
* @category event | ||
* @copyright 2024 bdecent gmbh <https://bdecent.de> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class resource_deleted extends base { | ||
|
||
// For more information about the Events API please visit {@link https://docs.moodle.org/dev/Events_API}. | ||
|
||
/** | ||
* Initialise the event. | ||
*/ | ||
protected function init() { | ||
$this->data['objecttable'] = 'tool_mediatime'; | ||
$this->data['edulevel'] = self::LEVEL_OTHER; | ||
$this->data['crud'] = 'd'; | ||
} | ||
|
||
/** | ||
* Returns event name. | ||
* | ||
* @return string | ||
*/ | ||
public static function get_name() { | ||
return get_string('event_resource_deleted', 'tool_mediatime'); | ||
} | ||
|
||
/** | ||
* Get the event description. | ||
* | ||
* @return string | ||
*/ | ||
public function get_description() { | ||
return "The user with id '{$this->userid}' deleted a mediatime resource with id '{$this->objectid}'."; | ||
} | ||
|
||
/** | ||
* Get URL related to the action. | ||
* | ||
* @return \moodle_url | ||
*/ | ||
public function get_url() { | ||
return new \moodle_url('/admin/tool/mediatime/index.php', [ | ||
]); | ||
} | ||
|
||
/** | ||
* Get the object ID mapping. | ||
* | ||
* @return array | ||
*/ | ||
public static function get_objectid_mapping() { | ||
return array('db' => 'tool_mediatime', 'restore' => \core\event\base::NOT_MAPPED); | ||
} | ||
|
||
/** | ||
* No mapping required for this event because this event is not backed up. | ||
* | ||
* @return bool | ||
*/ | ||
public static function get_other_mapping() { | ||
return false; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. | ||
|
||
namespace tool_mediatime\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* The resource_updated event class. | ||
* | ||
* @package tool_mediatime | ||
* @category event | ||
* @copyright 2024 bdecent gmbh <https://bdecent.de> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class resource_updated extends base { | ||
|
||
// For more information about the Events API please visit {@link https://docs.moodle.org/dev/Events_API}. | ||
|
||
/** | ||
* Initialise the event. | ||
*/ | ||
protected function init() { | ||
$this->data['objecttable'] = 'tool_mediatime'; | ||
$this->data['edulevel'] = self::LEVEL_OTHER; | ||
$this->data['crud'] = 'u'; | ||
} | ||
|
||
/** | ||
* Returns event name. | ||
* | ||
* @return string | ||
*/ | ||
public static function get_name() { | ||
return get_string('event_resource_updated', 'tool_mediatime'); | ||
} | ||
|
||
/** | ||
* Get the event description. | ||
* | ||
* @return string | ||
*/ | ||
public function get_description() { | ||
return "The user with id '{$this->userid}' deleted a mediatime resource with id '{$this->objectid}'."; | ||
} | ||
|
||
/** | ||
* Get URL related to the action. | ||
* | ||
* @return \moodle_url | ||
*/ | ||
public function get_url() { | ||
return new \moodle_url('/admin/tool/mediatime/index.php', [ | ||
'id' => $this->objectid, | ||
]); | ||
} | ||
|
||
/** | ||
* Get the object ID mapping. | ||
* | ||
* @return array | ||
*/ | ||
public static function get_objectid_mapping() { | ||
return array('db' => 'tool_mediatime', 'restore' => \core\event\base::NOT_MAPPED); | ||
} | ||
|
||
/** | ||
* No mapping required for this event because this event is not backed up. | ||
* | ||
* @return bool | ||
*/ | ||
public static function get_other_mapping() { | ||
return false; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Media Time media edit form | ||
* | ||
* @package tool_mediatime | ||
* @copyright 2024 bdecent gmbh <https://bdecent.de> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace tool_mediatime\form; | ||
|
||
use context_system; | ||
use moodleform; | ||
|
||
/** | ||
* Media Time media edit form | ||
* | ||
* @copyright 2024 bdecent gmbh <https://bdecent.de> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class delete_resource extends moodleform { | ||
|
||
/** | ||
* Definition | ||
*/ | ||
public function definition() { | ||
$mform = $this->_form; | ||
require_capability('tool/mediatime:manage', context_system::instance()); | ||
|
||
$mform->addElement('hidden', 'id'); | ||
$mform->setType('id', PARAM_INT); | ||
|
||
$mform->addElement('hidden', 'source'); | ||
$mform->setType('source', PARAM_TEXT); | ||
} | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. | ||
|
||
namespace mediatimesrc_streamio\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* The resource_deleted event class. | ||
* | ||
* @package mediatimesrc_streamio | ||
* @category event | ||
* @copyright 2024 bdecent gmbh <https://bdecent.de> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class resource_deleted extends \tool_mediatime\event\resource_deleted { | ||
/** | ||
* Returns event name. | ||
* | ||
* @return string | ||
*/ | ||
public static function get_name() { | ||
return get_string('event_resource_deleted', 'mediatimesrc_streamio'); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. | ||
|
||
namespace mediatimesrc_streamio\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* The resource_updated event class. | ||
* | ||
* @package mediatimesrc_streamio | ||
* @category event | ||
* @copyright 2024 bdecent gmbh <https://bdecent.de> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class resource_updated extends \tool_mediatime\event\resource_updated { | ||
/** | ||
* Returns event name. | ||
* | ||
* @return string | ||
*/ | ||
public static function get_name() { | ||
return get_string('event_resource_updated', 'mediatimesrc_streamio'); | ||
} | ||
} |
Oops, something went wrong.