-
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.
✨(project) add boilerplate for Moodle plugin
We add the necessary Moodle plugin files to establish a foundation for further development.
- Loading branch information
Showing
4 changed files
with
166 additions
and
0 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,64 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Block definition class for the block_iagora plugin. | ||
* | ||
* @package block_iagora | ||
* @copyright 2024, Datum Academy <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
/** | ||
* The iagora block class. | ||
*/ | ||
class block_iagora extends block_base { | ||
|
||
/** | ||
* Initialises the block. | ||
* | ||
* @return void | ||
*/ | ||
public function init() { | ||
$this->title = get_string('pluginname', 'block_iagora'); | ||
} | ||
|
||
/** | ||
* Gets the block contents. | ||
* | ||
* @return string The block HTML. | ||
*/ | ||
public function get_content() { | ||
if ($this->content !== null) { | ||
return $this->content; | ||
} | ||
|
||
$this->content = new stdClass(); | ||
$this->content->footer = ''; | ||
$this->content->text = ''; | ||
|
||
return $this->content; | ||
} | ||
|
||
/** | ||
* Defines in which pages this block can be added. | ||
* | ||
* @return array of the pages where the block can be added. | ||
*/ | ||
public function applicable_formats() { | ||
return ['all' => true]; | ||
} | ||
} |
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,46 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Plugin capabilities for the block_iagora plugin. | ||
* | ||
* @package block_iagora | ||
* @copyright 2024, Datum Academy <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
$capabilities = [ | ||
'block/iagora:myaddinstance' => [ | ||
'captype' => 'write', | ||
'contextlevel' => CONTEXT_SYSTEM, | ||
'archetypes' => [ | ||
'user' => CAP_ALLOW, | ||
], | ||
'clonepermissionsfrom' => 'moodle/my:manageblocks', | ||
], | ||
'block/iagora:addinstance' => [ | ||
'riskbitmask' => RISK_SPAM | RISK_XSS, | ||
'captype' => 'write', | ||
'contextlevel' => CONTEXT_BLOCK, | ||
'archetypes' => [ | ||
'editingteacher' => CAP_ALLOW, | ||
'manager' => CAP_ALLOW, | ||
], | ||
'clonepermissionsfrom' => 'moodle/site:manageblocks', | ||
], | ||
]; |
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,25 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Languages configuration for the block_iagora plugin. | ||
* | ||
* @package block_iagora | ||
* @copyright 2024, Datum Academy <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
$string['pluginname'] = 'IAGORA'; |
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,31 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Version details. | ||
* | ||
* @package block_iagora | ||
* @copyright 2024, Datum Academy <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
$plugin->component = 'block_iagora'; | ||
$plugin->version = 2024070800; // YYYYMMDDXX. | ||
$plugin->requires = 2023100900.00; // Moodle 4.3.0. | ||
$plugin->maturity = MATURITY_ALPHA; | ||
$plugin->release = '0.1.0'; |