Skip to content

Commit

Permalink
init plugin structure
Browse files Browse the repository at this point in the history
  • Loading branch information
TamaroWalter committed Apr 15, 2024
1 parent a7d8a84 commit e882210
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 0 deletions.
50 changes: 50 additions & 0 deletions classes/townsquaresupportinterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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/>.

/**
* Interface for all subplugins that improve the townsquare block content.
*
* The Plugins of the type townsquaresupport are used to increase the content of the townsquare block.
* Every module that wants to show content on townsquare can implement this interface.
* Every module must:
* - gather "events" for a user that can be transformed into letters.
* - provide php_unit test to ensure the correct behaviour.
* local_townsquaresupport will call this function of each subplugin. The townsquare block will then gather all events from local_townsquaresupport
*
* @package local_townsquaresupport
* @copyright 2024 Tamaro Walter
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace local_townsquaresupport;

interface townsquaresupportinterface {

/**
* Function to gather the events
* Every event must gain sufficient data so that townsquare can build a letter from it.
* The array should contain following information:
* [courseid] => int Course ID from where the content comes from.
* [modulename] => string Name of the activity module.
* [instancename] => string Name of the instance that shows the notification.
* [content] => string The content that will be showed in the letter.
* [timestart] => int Timestamp that represents the deadline/creation of a notification. Is important to sort events.
* [coursemoduleid] => int Course module id of the content module.
* [eventtype] => string Type of the event.
*
* @return array of events that can be transformed into letters
*/
public function get_events(): array;
}
24 changes: 24 additions & 0 deletions db/access.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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/>.

/**
* Plugin capabilities for the block_townsquare plugin.
*
* @package block_townsquare
* @copyright 2023 Tamaro Walter
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
5 changes: 5 additions & 0 deletions db/subplugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugintypes": {
"supportedmodules": "local/townsquaresupport/supportedmodules"
}
}
27 changes: 27 additions & 0 deletions db/subplugins.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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/>.

/**
* This file defines the sub-plugins for the townsquare block.
*
* @package blocks_townsquare
* @copyright 2023 Tamaro Walter
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

$subplugins = ['supportedmodules' => 'local/townsquaresupport/supportedmodules'];
30 changes: 30 additions & 0 deletions lang/en/local_townsquaresupport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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/>.

/**
* Plugin strings are defined here.
*
* @package local_townsquaresupport
* @category string
* @copyright 2024 Tamaro Walter
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

// Subplugin strings
$string['subplugintype_townsquaresupport'] = 'Supported module';
$string['subplugintype_townsquaresupport_plural'] = 'Supported modules';

0 comments on commit e882210

Please sign in to comment.