fa285134cb
On assigning the block to a course, a skill needs to be selected in the config, instead of creating a new skill by default
49 lines
1.7 KiB
PHP
49 lines
1.7 KiB
PHP
<?php
|
|
if(isset($_SERVER['SCRIPT_FILENAME']))
|
|
{
|
|
// If SCRIPT_FILENAME is set, use that so the symlinked directories the developmen environment uses are handled correctly
|
|
$root = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
|
|
error_log("Using {$root}/config.php");
|
|
require_once($root."/config.php");
|
|
}
|
|
else
|
|
{
|
|
// If not, assume the cwd is not symlinked and proceed as we are used to
|
|
require_once("../../config.php");
|
|
}
|
|
|
|
// HOW DID WE ENSURE ONLY ADMINS CAN VIEW THIS PAGE?
|
|
|
|
require_once($CFG->libdir.'/adminlib.php');
|
|
|
|
|
|
admin_externalpage_setup("block_gradelevel_config_skills");
|
|
|
|
|
|
$skill_id = required_param('skill_id', PARAM_INT);
|
|
|
|
$systemcontext = context_system::instance();
|
|
// Check if user has capability to manage skills
|
|
require_capability('block/gradelevel:skillmanager', $systemcontext);
|
|
|
|
$skill = block_gradelevel_levelset::find_by_id($skill_id);
|
|
|
|
$PAGE->requires->js_call_amd('block_gradelevel/renderbadge', 'init');
|
|
$PAGE->requires->js_call_amd('block_gradelevel/skilleditor', 'init');
|
|
$PAGE->requires->js_call_amd('block_gradelevel/leveleditor', 'init');
|
|
|
|
print $OUTPUT->header();
|
|
|
|
// render skill editor
|
|
print $OUTPUT->heading(get_string('cfgpage_editskill','block_gradelevel')." ".$skill->getName());
|
|
print block_gradelevel_skillmgmtservice::render_skill_editor($skill_id);
|
|
|
|
// render level editor
|
|
print $OUTPUT->heading(get_string('cfgpage_skilllevels','block_gradelevel'));
|
|
print block_gradelevel_skillmgmtservice::render_leveltable($skill_id);
|
|
|
|
// add back button to return to skill management page
|
|
$cfg_skills_url = $CFG->wwwroot."/blocks/gradelevel/cfg_skills.php";
|
|
print "<button onclick='window.location=\"{$cfg_skills_url}\";'>".get_string('back','core')."</button>";
|
|
print $OUTPUT->footer();
|