private function areSkillLevelThresholdsMissing()
 {
     if ($this->object->isDynamicTest()) {
         $questionSetConfig = $this->testQuestionSetConfigFactory->getQuestionSetConfig();
         $questionContainerId = $questionSetConfig->getSourceQuestionPoolId();
     } else {
         $questionContainerId = $this->object->getId();
     }
     global $ilDB;
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
     require_once 'Modules/Test/classes/class.ilTestSkillLevelThreshold.php';
     $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
     $assignmentList->setParentObjId($questionContainerId);
     $assignmentList->loadFromDb();
     foreach ($assignmentList->getUniqueAssignedSkills() as $data) {
         foreach ($data['skill']->getLevelData() as $level) {
             $treshold = new ilTestSkillLevelThreshold($ilDB);
             $treshold->setTestId($this->object->getTestId());
             $treshold->setSkillBaseId($data['skill_base_id']);
             $treshold->setSkillTrefId($data['skill_tref_id']);
             $treshold->setSkillLevelId($level['id']);
             if (!$treshold->dbRecordExists()) {
                 return true;
             }
         }
     }
     return false;
 }
Exemple #2
0
 public function syncSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 {
     global $ilDB;
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
     $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
     $assignmentList->setParentObjId($trgParentId);
     $assignmentList->setQuestionIdFilter($trgQuestionId);
     $assignmentList->loadFromDb();
     foreach ($assignmentList->getAssignmentsByQuestionId($trgQuestionId) as $assignment) {
         /* @var ilAssQuestionSkillAssignment $assignment */
         $assignment->deleteFromDb();
     }
     $this->duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId);
 }
 private function showSkillSelectionCmd()
 {
     $this->ctrl->saveParameter($this, 'question_id');
     $questionId = (int) $_GET['question_id'];
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
     $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
     $assignmentList->setParentObjId($this->getQuestionContainerId());
     $assignmentList->loadFromDb();
     $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI($assignmentList->getAssignmentsByQuestionId($questionId));
     if (!$skillSelectorExplorerGUI->handleCommand()) {
         $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'Modules/TestQuestionPool');
         $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($questionId));
         $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
         $skillSelectorToolbarGUI->setOpenFormTag(true);
         $skillSelectorToolbarGUI->setCloseFormTag(false);
         $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_upright.png"), " ");
         $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
         $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
         $skillSelectorToolbarGUI->setOpenFormTag(false);
         $skillSelectorToolbarGUI->setCloseFormTag(true);
         $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_downright.png"), " ");
         $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
         $this->tpl->setContent($tpl->get());
     }
 }
 private function getUniqueAssignedSkillsStats()
 {
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
     $assignmentList = new ilAssQuestionSkillAssignmentList($this->myDb);
     $assignmentList->setParentObjId($this->poolId);
     $assignmentList->loadFromDb();
     $assignmentList->loadAdditionalSkillData();
     return $assignmentList->getUniqueAssignedSkills();
 }