Skip to content

Commit

Permalink
Add site level setting to enable/disable the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
aydevworks committed Sep 16, 2024
1 parent dc782d2 commit 674114c
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lang/en/local_assess_type.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
$string['info'] = 'Summative activities count towards the course mark in SITS and are flagged to learners as mandatory.';
$string['pluginname'] = 'Assessment type';
$string['privacy:metadata'] = 'Assessment type does not store any personal data.';
$string['settings:enable'] = 'Enable assessment type plugin';
$string['settings:enable:desc'] = 'Enable the assessment type plugin for course activities.';
$string['settings:pagename'] = 'Assessment type settings';
$string['summative'] = 'Summative';
$string['summativeoption'] = 'Summative - counts towards course mark and is mapped in SITS';
$string['warning'] = 'This activity must be marked as Formative or Summative.';
5 changes: 5 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
function local_assess_type_coursemodule_standard_elements($formwrapper, $mform) {
global $DB;

// Do not show assessment type options in activity's editing page if not enabled.
if (!get_config('local_assess_type', 'enabled')) {
return;
}

$cm = $formwrapper->get_current();

// Check list of mods where this is enabled.
Expand Down
45 changes: 45 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?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 <http://www.gnu.org/licenses/>.

/**
* Plugin administration pages are defined here.
*
* @package local_assess_type
* @category admin
* @copyright 2024 onwards University College London {@link https://www.ucl.ac.uk/}
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Alex Yeung <[email protected]>
*/

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

if ($hassiteconfig) {
$ADMIN->add(
'localplugins',
new admin_category('local_assess_type_settings', new lang_string('pluginname', 'local_assess_type'))
);
$settings = new admin_settingpage('managelocalassesstype', new lang_string('settings:pagename', 'local_assess_type'));

// Setting to enable/disable the plugin.
$settings->add(new admin_setting_configcheckbox(
'local_assess_type/enabled',
get_string('settings:enable', 'local_assess_type'),
get_string('settings:enable:desc', 'local_assess_type'),
'1'
));

$ADMIN->add('localplugins', $settings);
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@

$plugin->component = 'local_assess_type';
$plugin->release = '1.0';
$plugin->version = 2024091300; // YYYYMMDD.
$plugin->version = 2024091400; // YYYYMMDD.
$plugin->requires = 2023100900;
$plugin->maturity = MATURITY_STABLE;

0 comments on commit 674114c

Please sign in to comment.