Skip to content
Snippets Groups Projects
Unverified Commit cace12d1 authored by Tobias Reischmann's avatar Tobias Reischmann
Browse files

Created a handler for the subplugins settings site

parent 582b3948
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@
* @copyright 2017 Tobias Reischmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(__FILE__) . '/../../config.php');
require_once(dirname(__FILE__) . '/../../../config.php');
require_login();
......@@ -37,7 +37,7 @@ $renderer = $PAGE->get_renderer('tool_cleanupcourses');
echo $renderer->header();
$table->out(0, false);
$table->out(50000, false);
echo $renderer->footer();
......
......@@ -17,6 +17,9 @@
namespace tool_cleanupcourses;
defined('MOODLE_INTERNAL') || die;
require_once($CFG->libdir . '/adminlib.php');
/**
* External Page for showing active cleanup processes
*
......@@ -25,8 +28,7 @@ defined('MOODLE_INTERNAL') || die;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_page_active_processes extends \admin_externalpage
{
class admin_page_active_processes extends \admin_externalpage {
/**
* The constructor - calls parent constructor
......@@ -39,3 +41,99 @@ class admin_page_active_processes extends \admin_externalpage
$url);
}
}
/**
* External Page for defining settings for subplugins
*
* @package tool_cleanupcourses
* @copyright 2017 Tobias Reischmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_page_sublugins extends \admin_externalpage {
/**
* The constructor - calls parent constructor
*
*/
public function __construct() {
$url = new \moodle_url('/admin/tool/cleanupcourses/subpluginssettings.php');
parent::__construct('subpluginssettings',
get_string('subpluginssettings_heading', 'tool_cleanupcourses'),
$url);
}
}
/**
* Class that handles the display and configuration of the subplugin settings.
*
* @package tool_cleanupcourses
* @copyright 2015 Tobias Reischmann
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class subplugin_settings {
/** @var object the url of the subplugin settings page */
private $pageurl;
/**
* Constructor for this assignment plugin manager
* @param string $subtype - either assignsubmission or assignfeedback
*/
public function __construct() {
$this->pageurl = new \moodle_url('/admin/tool/cleanupcourses/subpluginssettings.php');
}
/**
* Write the HTML for the submission plugins table.
*/
private function view_plugins_table() {
// Set up the table.
$this->view_header();
$table = new subplugin_table('tool_cleanupcourses_subplugins');
$table->out(5000, false);
$this->view_footer();
}
/**
* Write the page header
*/
private function view_header() {
global $OUTPUT;
admin_externalpage_setup('subpluginssettings');
// Print the page heading.
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('subpluginssettings_heading', 'tool_cleanupcourses'));
}
/**
* Write the page footer
*/
private function view_footer() {
global $OUTPUT;
echo $OUTPUT->footer();
}
/**
* Check this user has permission to edit the subplugin settings
*/
private function check_permissions() {
// Check permissions.
require_login();
$systemcontext = \context_system::instance();
require_capability('moodle/site:config', $systemcontext);
}
/**
* This is the entry point for this controller class.
*/
public function execute($action, $subplugin) {
$this->check_permissions();
$this->view_plugins_table();
}
}
\ No newline at end of file
<?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/>.
/**
* Table listing active processes
*
* @package tool_cleanupcourses
* @copyright 2017 Tobias Reischmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_cleanupcourses;
defined('MOODLE_INTERNAL') || die;
require_once($CFG->libdir . '/tablelib.php');
class subplugin_table extends \table_sql {
public function __construct($uniqueid) {
parent::__construct($uniqueid);
global $PAGE;
$this->set_sql("name, type, enabled", '{tool_cleanupcourses_plugin}', "TRUE");
$this->define_baseurl($PAGE->url);
$this->pageable(false);
$this->init();
}
public function init() {
$this->define_columns(['name', 'type', 'enabled']);
$this->define_headers([
get_string('subplugin_name', 'tool_cleanupcourses'),
get_string('subplugin_type', 'tool_cleanupcourses'),
get_string('subplugin_enabled', 'tool_cleanupcourses')
]);
$this->setup();
}
}
\ No newline at end of file
......@@ -35,3 +35,7 @@ $string['subplugintype_cleanupcoursestrigger'] = 'Trigger for starting the cours
$string['subplugintype_cleanupcoursestrigger_plural'] = 'Triggers for starting the course cleanup';
$string['active_processes_list_header'] = 'List of Active Course Cleanup Processes';
$string['subpluginssettings_heading'] = 'Subplugin Settings Cleanup Courses';
$string['subplugin_name'] = 'Subplugin Name';
$string['subplugin_type'] = 'Subplugin Type';
$string['subplugin_enabled'] = 'Enabled';
......@@ -25,4 +25,24 @@ defined('MOODLE_INTERNAL') || die();
class tool_cleanupcourses_renderer extends plugin_renderer_base {
/**
* Write the page footer
*
* @return string
*/
public function render_footer() {
global $OUTPUT;
echo $OUTPUT->footer();
}
/**
* Write the page header
*
* @return string
*/
public function render_header() {
global $OUTPUT;
echo $OUTPUT->header();
}
}
\ No newline at end of file
......@@ -27,6 +27,7 @@ if ($hassiteconfig) {
require_once(__DIR__ . '/adminlib.php');
$ADMIN->add('tools', new tool_cleanupcourses\admin_page_active_processes());
$ADMIN->add('tools', new tool_cleanupcourses\admin_page_sublugins());
$settings = new admin_settingpage('tool_cleanupcourses',
get_string('general_config_header', 'tool_cleanupcourses'));
$ADMIN->add('tools', $settings);
......
<?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/>.
/**
* Display the list of active processes
*
* @package tool_cleanupcourses
* @copyright 2017 Tobias Reischmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(__FILE__) . '/../../../config.php');
require_once(__DIR__ . '/adminlib.php');
// Create the class for this controller.
$subpluginsettings = new tool_cleanupcourses\subplugin_settings();
$PAGE->set_context(context_system::instance());
// Execute the controller.
$subpluginsettings->execute(optional_param('action', null, PARAM_TEXT),
optional_param('subplugin', null, PARAM_INT));
\ No newline at end of file
......@@ -23,5 +23,5 @@
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2017051003;
$plugin->version = 2017051004;
$plugin->component = 'tool_cleanupcourses';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment