Added external config page for global levels

This commit is contained in:
pmk 2018-09-18 23:25:08 +02:00
parent 78cb3b2e5a
commit 688696fa43
3 changed files with 67 additions and 11 deletions

26
globallevels.php Normal file
View File

@ -0,0 +1,26 @@
<?php
if(isset($_SERVER['SCRIPT_FILENAME']))
{
// If SCRIPT_FILENAME is set, use that one to handle the symlinked directories the develope uses
$cwd = dirname($_SERVER['SCRIPT_FILENAME']);
$root = dirname(dirname($cwd));
print "ROOT {$root}\n";
require_once($root."/config.php");
}
else
{
// If not, assume the cwd is not symlinked
require_once("../../config.php");
}
require_once($CFG->libdir.'/adminlib.php');
admin_externalpage_setup("block_gradelevel_default_levels");
print $OUTPUT->header();
print "<h1>".get_string('cfgpage_globallevels', 'block_gradelevel')."</h1>";
print $OUTPUT->footer();

View File

@ -1,5 +1,5 @@
<?php
$string['pluginname'] = 'Grade Level';
$string['pluginname'] = 'Grade Levelup';
$string['gradelevel'] = 'GradeLevel';
$string['title'] = 'Progress level';
$string['gradelevel:addinstance'] = 'Add a new Grade Level block';
@ -12,7 +12,18 @@ $string['levelset_name'] = "Skill name";
$string['levelset_icon_cur'] = "Current skill icon (for level badge)";
$string['levelset_icon_new'] = "New skill icon (for level badge)";
$string['headerconfig'] = "Grade Level settings";
$string['cfgpage_generic'] = "Grade Level settings";
$string['cfgpage_globallevels'] = "Default levels";
$string['descconfig'] = "Configuration for Grade Level block";
$string['labeltitle'] = "Block title";
$string['desctitle'] = "The title of the gradelevel block";
$string['labeltitle'] = "Title of gradelevel block";
$string['desctitle'] = "The title of the gradelevel block in the courses";
$string['labelshowtitle'] = "Show title bar in block";
$string['descshowtitle'] = "Whether the block should show a title bar or not";
$string['labelnumlevels'] = "Number of deault levels";
$string['descnumlevels'] = "The number of levels that is set by default for all skills";

View File

@ -1,14 +1,33 @@
<?php
$settings->add(new admin_setting_heading(
'gradelevel/headerconfig',
get_string('headerconfig', 'block_gradelevel'),
get_string('descconfig', 'block_gradelevel')
));
$ADMIN->add('blocksettings', new admin_category('block_gradelevel', get_string('cfgpage_generic', 'block_gradelevel')));
$settings->add(new admin_setting_configcheckbox(
'gradelevel/showtitle',
get_string('labelshowtitle', 'block_gradelevel'),
get_string('descshowtitle', 'block_gradelevel'),
true
));
$settings->add(new admin_setting_configtext(
'gradelevel/blocktitle',
get_string('labeltitle', 'block_gradelevel'),
get_string('desctitle', 'block_gradelevel'),
get_string('title', 'block_gradelevel')
));
));
// Add the default levels page
$external = new admin_externalpage(
'block_gradelevel_default_levels',
get_string('cfgpage_globallevels', 'block_gradelevel'),
$CFG->wwwroot . '/blocks/gradelevel/globallevels.php'
);
$ADMIN->add("block_gradelevel", $settings);
$ADMIN->add("block_gradelevel", $external);
$settings = null;