Skip to content

Commit

Permalink
✨(project) add boilerplate for Moodle plugin
Browse files Browse the repository at this point in the history
We add the necessary Moodle plugin files to establish a foundation
for further development.
  • Loading branch information
SergioSim committed Jul 9, 2024
1 parent 825a5a6 commit be8af07
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 0 deletions.
64 changes: 64 additions & 0 deletions block_iagora.php
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];
}
}
46 changes: 46 additions & 0 deletions db/access.php
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',
],
];
25 changes: 25 additions & 0 deletions lang/en/block_iagora.php
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';
31 changes: 31 additions & 0 deletions version.php
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';

0 comments on commit be8af07

Please sign in to comment.