56 $this->questionAssignmentColumnsEnabled =
false;
77 $cmd = $this->ctrl->getCmd(
'show') .
'Cmd';
106 private function saveSkillThresholdsCmd()
108 require_once
'Modules/Test/classes/class.ilTestSkillLevelThreshold.php';
110 if (strtolower(
$_SERVER[
'REQUEST_METHOD']) ==
'post') {
112 $assignmentList->loadFromDb();
117 $renderedElements = [];
118 if (isset(
$_POST[
'rendered']) && is_array(
$_POST[
'rendered'])) {
119 $renderedElements =
$_POST[
'rendered'];
121 $elements =
$table->getInputElements($renderedElements);
122 foreach ($elements as $elm) {
123 if (!$elm->checkInput()) {
127 $elm->setValueByArray(
$_POST);
135 $threshold = array();
138 if (preg_match(
'/^threshold_(\d+?):(\d+?)_(\d+?)$/',
$key, $matches) && is_array($matches)) {
139 $threshold[$matches[1] .
':' . $matches[2]][$matches[3]] = $value;
144 $skillLevelThresholds = array();
146 foreach ($assignmentList->getUniqueAssignedSkills() as
$data) {
147 $skill =
$data[
'skill'];
148 $skillKey =
$data[
'skill_base_id'] .
':' .
$data[
'skill_tref_id'];
149 $levels = $skill->getLevelData();
151 $thresholds_by_level = array();
153 foreach ($levels as $level) {
154 if (isset($threshold[$skillKey]) && isset($threshold[$skillKey][$level[
'id']])) {
157 $skillLevelThreshold->setTestId($this->
getTestId());
158 $skillLevelThreshold->setSkillBaseId(
$data[
'skill_base_id']);
159 $skillLevelThreshold->setSkillTrefId(
$data[
'skill_tref_id']);
160 $skillLevelThreshold->setSkillLevelId($level[
'id']);
162 $skillLevelThreshold->setThreshold($threshold[$skillKey][$level[
'id']]);
163 $skillLevelThresholds[] = $skillLevelThreshold;
164 $thresholds_by_level[] = $threshold[$skillKey][$level[
'id']];
168 $sorted_thresholds_by_level = $thresholds_by_level = array_values($thresholds_by_level);
169 sort($sorted_thresholds_by_level);
171 $sorted_thresholds_by_level != $thresholds_by_level ||
172 count($thresholds_by_level) != count(array_unique($thresholds_by_level))
179 foreach ($skillLevelThresholds as $skillLevelThreshold) {
180 $skillLevelThreshold->saveToDb();
183 ilUtil::sendSuccess($this->lng->txt(
'tst_msg_skl_lvl_thresholds_saved'),
true);
186 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_THRESHOLDS);
198 $this->tpl->setContent($this->ctrl->getHTML(
$table));
209 $skillLevelThresholdList->loadFromDb();
210 $table->setSkillLevelThresholdList($skillLevelThresholdList);
213 $assignmentList->loadFromDb();
216 $assignmentList->getUniqueAssignedSkills()
223 require_once
'Modules/Test/classes/tables/class.ilTestSkillLevelThresholdsTableGUI.php';
227 self::CMD_SHOW_SKILL_THRESHOLDS,
239 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
243 return $assignmentList;
248 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
250 $thresholdList->setTestId($this->
getTestId());
252 return $thresholdList;
This class provides processing control methods.
$questionAssignmentColumnsEnabled
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
areQuestionAssignmentColumnsEnabled()
setQuestionContainerId($questionContainerId)
buildSkillQuestionAssignmentList()
showSkillThresholdsCmd(ilTestSkillLevelThresholdsTableGUI $table=null)
special template class to simplify handling of ITX/PEAR
setQuestionAssignmentColumnsEnabled($questionAssignmentColumnsEnabled)
const CMD_SHOW_SKILL_THRESHOLDS
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
buildSkillLevelThresholdList()
__construct(ilCtrl $ctrl, ilTemplate $tpl, ilLanguage $lng, ilDBInterface $db, $testId)
const CMD_SAVE_SKILL_THRESHOLDS
if(empty($password)) $table