forked from moodle/moodle
-
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.
MDL-72112 admin_presets: Add admin_presets tool
- Loading branch information
Showing
107 changed files
with
9,880 additions
and
3 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,48 @@ | ||
<?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/>. | ||
|
||
namespace tool_admin_presets\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* Admin tool presets event class deleted. | ||
* | ||
* @package tool_admin_presets | ||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com> | ||
* @author Jordan Kesraoui | Sylvain Revenu | Pimenko based on David Monllaó <david.monllao@urv.cat> code | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class preset_deleted extends base { | ||
|
||
public static function get_name(): string { | ||
return get_string('eventpresetdeleted', 'tool_admin_presets'); | ||
} | ||
|
||
public function get_description(): string { | ||
return "User {$this->userid} has deleted the preset with id {$this->objectid}."; | ||
} | ||
|
||
public function get_legacy_logdata(): array { | ||
return [$this->courseid, 'tool_admin_presets', 'delete', '', $this->objectid, $this->contextinstanceid]; | ||
} | ||
|
||
protected function init(): void { | ||
$this->data['crud'] = 'd'; | ||
$this->data['edulevel'] = self::LEVEL_OTHER; | ||
$this->data['objecttable'] = 'tool_admin_presets'; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
admin/tool/admin_presets/classes/event/preset_downloaded.php
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,49 @@ | ||
<?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/>. | ||
|
||
namespace tool_admin_presets\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* Admin tool presets event class downloaded. | ||
* | ||
* @package tool_admin_presets | ||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com> | ||
* @author Jordan Kesraoui | Sylvain Revenu | Pimenko based on David Monllaó <david.monllao@urv.cat> code | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class preset_downloaded extends base { | ||
|
||
public static function get_name(): string { | ||
return get_string('eventpresetdownloaded', 'tool_admin_presets'); | ||
} | ||
|
||
public function get_description(): string { | ||
return "User {$this->userid} has downloaded the preset with id {$this->objectid}."; | ||
} | ||
|
||
public function get_url(): \moodle_url { | ||
return new \moodle_url('/admin/tool/admin_presets/index.php', | ||
['action' => 'export', 'mode' => 'download_xml', 'id' => $this->objectid, 'sesskey' => sesskey()]); | ||
} | ||
|
||
protected function init(): void { | ||
$this->data['crud'] = 'r'; | ||
$this->data['edulevel'] = self::LEVEL_OTHER; | ||
$this->data['objecttable'] = 'tool_admin_presets'; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
admin/tool/admin_presets/classes/event/preset_exported.php
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,53 @@ | ||
<?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/>. | ||
|
||
namespace tool_admin_presets\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* Admin tool presets event class exported. | ||
* | ||
* @package tool_admin_presets | ||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com> | ||
* @author Jordan Kesraoui | Sylvain Revenu | Pimenko based on David Monllaó <david.monllao@urv.cat> code | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class preset_exported extends base { | ||
|
||
public static function get_name(): string { | ||
return get_string('eventpresetexported', 'tool_admin_presets'); | ||
} | ||
|
||
public function get_description(): string { | ||
return "User {$this->userid} has exported the preset with id {$this->objectid}."; | ||
} | ||
|
||
public function get_url(): \moodle_url { | ||
return new \moodle_url('/admin/tool/admin_presets/index.php', | ||
['action' => 'load', 'mode' => 'preview', 'id' => $this->objectid]); | ||
} | ||
|
||
public function get_legacy_logdata(): array { | ||
return [$this->courseid, 'tool_admin_presets', 'export', '', $this->objectid, $this->contextinstanceid]; | ||
} | ||
|
||
protected function init(): void { | ||
$this->data['crud'] = 'c'; | ||
$this->data['edulevel'] = self::LEVEL_OTHER; | ||
$this->data['objecttable'] = 'tool_admin_presets'; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
admin/tool/admin_presets/classes/event/preset_imported.php
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,53 @@ | ||
<?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/>. | ||
|
||
namespace tool_admin_presets\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* Admin tool presets event class imported. | ||
* | ||
* @package tool_admin_presets | ||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com> | ||
* @author Jordan Kesraoui | Sylvain Revenu | Pimenko based on David Monllaó <david.monllao@urv.cat> code | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class preset_imported extends base { | ||
|
||
public static function get_name(): string { | ||
return get_string('eventpresetimported', 'tool_admin_presets'); | ||
} | ||
|
||
public function get_description(): string { | ||
return "User {$this->userid} has imported the preset with id {$this->objectid}."; | ||
} | ||
|
||
public function get_url(): \moodle_url { | ||
return new \moodle_url('/admin/tool/admin_presets/index.php', | ||
['action' => 'load', 'mode' => 'preview', 'id' => $this->objectid]); | ||
} | ||
|
||
public function get_legacy_logdata(): array { | ||
return [$this->courseid, 'tool_admin_presets', 'import', '', $this->objectid, $this->contextinstanceid]; | ||
} | ||
|
||
protected function init(): void { | ||
$this->data['crud'] = 'c'; | ||
$this->data['edulevel'] = self::LEVEL_OTHER; | ||
$this->data['objecttable'] = 'tool_admin_presets'; | ||
} | ||
} |
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,53 @@ | ||
<?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/>. | ||
|
||
namespace tool_admin_presets\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* Admin tool presets event class loaded. | ||
* | ||
* @package tool_admin_presets | ||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com> | ||
* @author Jordan Kesraoui | Sylvain Revenu | Pimenko based on David Monllaó <david.monllao@urv.cat> code | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class preset_loaded extends base { | ||
|
||
public static function get_name(): string { | ||
return get_string('eventpresetloaded', 'tool_admin_presets'); | ||
} | ||
|
||
public function get_description(): string { | ||
return "User {$this->userid} has loaded the preset with id {$this->objectid}."; | ||
} | ||
|
||
public function get_url(): \moodle_url { | ||
return new \moodle_url('/admin/tool/admin_presets/index.php', | ||
['action' => 'load', 'mode' => 'preview', 'id' => $this->objectid]); | ||
} | ||
|
||
public function get_legacy_logdata(): array { | ||
return [$this->courseid, 'tool_admin_presets', 'load', '', $this->objectid, $this->contextinstanceid]; | ||
} | ||
|
||
protected function init(): void { | ||
$this->data['crud'] = 'u'; | ||
$this->data['edulevel'] = self::LEVEL_OTHER; | ||
$this->data['objecttable'] = 'tool_admin_presets'; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
admin/tool/admin_presets/classes/event/preset_previewed.php
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,49 @@ | ||
<?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/>. | ||
|
||
namespace tool_admin_presets\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* Admin tool presets event class previewed. | ||
* | ||
* @package tool_admin_presets | ||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com> | ||
* @author Jordan Kesraoui | Sylvain Revenu | Pimenko based on David Monllaó <david.monllao@urv.cat> code | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class preset_previewed extends base { | ||
|
||
public static function get_name(): string { | ||
return get_string('eventpresetpreviewed', 'tool_admin_presets'); | ||
} | ||
|
||
public function get_description(): string { | ||
return "User {$this->userid} has previewed the preset with id {$this->objectid}."; | ||
} | ||
|
||
public function get_url(): \moodle_url { | ||
return new \moodle_url('/admin/tool/admin_presets/index.php', | ||
['action' => 'load', 'mode' => 'preview', 'id' => $this->objectid]); | ||
} | ||
|
||
protected function init(): void { | ||
$this->data['crud'] = 'r'; | ||
$this->data['edulevel'] = self::LEVEL_OTHER; | ||
$this->data['objecttable'] = 'tool_admin_presets'; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
admin/tool/admin_presets/classes/event/preset_reverted.php
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,48 @@ | ||
<?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/>. | ||
|
||
namespace tool_admin_presets\event; | ||
|
||
use core\event\base; | ||
|
||
/** | ||
* Admin tool presets event class reverted. | ||
* | ||
* @package tool_admin_presets | ||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com> | ||
* @author Jordan Kesraoui | Sylvain Revenu | Pimenko based on David Monllaó <david.monllao@urv.cat> code | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class preset_reverted extends base { | ||
|
||
public static function get_name(): string { | ||
return get_string('eventpresetreverted', 'tool_admin_presets'); | ||
} | ||
|
||
public function get_description(): string { | ||
return "User {$this->userid} has reverted the preset with id {$this->objectid}."; | ||
} | ||
|
||
public function get_legacy_logdata(): array { | ||
return [$this->courseid, 'tool_admin_presets', 'rollback', '', $this->objectid, $this->contextinstanceid]; | ||
} | ||
|
||
protected function init(): void { | ||
$this->data['crud'] = 'u'; | ||
$this->data['edulevel'] = self::LEVEL_OTHER; | ||
$this->data['objecttable'] = 'tool_admin_presets'; | ||
} | ||
} |
Oops, something went wrong.