19 declare(strict_types=1);
    58         $this->questionAssignmentColumnsEnabled = 
false;
    79         $cmd = $this->
ctrl->getCmd(
'show') . 
'Cmd';
   108     private function saveSkillThresholdsCmd()
   110         if (strtolower(
$_SERVER[
'REQUEST_METHOD']) == 
'post') {
   112             $assignmentList->loadFromDb();
   117             $elements = $table->getInputElements((array) ($_POST[
'rendered'] ?? []));
   118             foreach ($elements as $elm) {
   119                 if (!$elm->checkInput()) {
   123                 $elm->setValue($_POST[$elm->getPostVar()]);
   127                 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'form_input_not_valid'));
   132             $threshold = array();
   133             foreach ($elements as $elm) {
   134                 $key = $elm->getPostVar();
   135                 $value = $_POST[
$key];
   137                 if (preg_match(
'/^threshold_(\d+?):(\d+?)_(\d+?)$/', 
$key, $matches) && is_array($matches)) {
   138                     $threshold[$matches[1] . 
':' . $matches[2]][$matches[3]] = $value;
   143             $skillLevelThresholds = array();
   145             foreach ($assignmentList->getUniqueAssignedSkills() as 
$data) {
   146                 $skill = 
$data[
'skill'];
   147                 $skillKey = 
$data[
'skill_base_id'] . 
':' . 
$data[
'skill_tref_id'];
   148                 $levels = $skill->getLevelData();
   150                 $thresholds_by_level = array();
   152                 foreach ($levels as $level) {
   153                     if (isset($threshold[$skillKey]) && isset($threshold[$skillKey][$level[
'id']])) {
   156                         $skillLevelThreshold->setTestId($this->
getTestId());
   157                         $skillLevelThreshold->setSkillBaseId(
$data[
'skill_base_id']);
   158                         $skillLevelThreshold->setSkillTrefId(
$data[
'skill_tref_id']);
   159                         $skillLevelThreshold->setSkillLevelId($level[
'id']);
   161                         $skillLevelThreshold->setThreshold($threshold[$skillKey][$level[
'id']]);
   162                         $skillLevelThresholds[] = $skillLevelThreshold;
   163                         $thresholds_by_level[] = $threshold[$skillKey][$level[
'id']];
   167                 $sorted_thresholds_by_level = $thresholds_by_level = array_values($thresholds_by_level);
   168                 sort($sorted_thresholds_by_level);
   170                     $sorted_thresholds_by_level != $thresholds_by_level ||
   171                     count($thresholds_by_level) != count(array_unique($thresholds_by_level))
   173                     $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'ass_competence_respect_level_ordering'));
   179             foreach ($skillLevelThresholds as $skillLevelThreshold) {
   180                 $skillLevelThreshold->saveToDb();
   183             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'tst_msg_skl_lvl_thresholds_saved'), 
true);
   186         $this->
ctrl->redirect($this, self::CMD_SHOW_SKILL_THRESHOLDS);
   194         if (null === $table) {
   198         $this->tpl->setContent($this->
ctrl->getHTML($table));
   209         $skillLevelThresholdList->loadFromDb();
   210         $table->setSkillLevelThresholdList($skillLevelThresholdList);
   213         $assignmentList->loadFromDb();
   215         $table->setData($table->completeCompetenceTitles(
   216             $assignmentList->getUniqueAssignedSkills()
   226             self::CMD_SHOW_SKILL_THRESHOLDS,
   231         $table->initColumns();
   241         return $assignmentList;
   247         $thresholdList->setTestId($this->
getTestId());
   249         return $thresholdList;
 
areQuestionAssignmentColumnsEnabled()
 
setQuestionContainerId($questionContainerId)
 
bool $questionAssignmentColumnsEnabled
 
buildSkillQuestionAssignmentList()
 
showSkillThresholdsCmd(ilTestSkillLevelThresholdsTableGUI $table=null)
 
setQuestionAssignmentColumnsEnabled($questionAssignmentColumnsEnabled)
 
const CMD_SHOW_SKILL_THRESHOLDS
 
buildSkillLevelThresholdList()
 
const CMD_SAVE_SKILL_THRESHOLDS
 
ilGlobalTemplateInterface $tpl
 
__construct(ilCtrl $ctrl, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilDBInterface $db, $testId)