private function incrementMaxPointsBySkill(ilAssQuestionSkillAssignment $assignment)
 {
     $key = $this->buildSkillKey($assignment->getSkillBaseId(), $assignment->getSkillTrefId());
     if (!isset($this->maxPointsBySkill[$key])) {
         $this->maxPointsBySkill[$key] = 0;
     }
     $this->maxPointsBySkill[$key] += $assignment->getMaxSkillPoints();
 }
 private function buildSkillPointsInput(ilAssQuestionSkillAssignment $assignment)
 {
     $assignmentKey = implode(':', array($assignment->getSkillBaseId(), $assignment->getSkillTrefId(), $assignment->getQuestionId()));
     return "<input type\"text\" size=\"2\" name=\"skill_points[{$assignmentKey}]\" value=\"{$assignment->getSkillPoints()}\" />";
 }
 private function updateSkillQuestionAssignmentsCmd()
 {
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
     $questionId = (int) $_GET['question_id'];
     if ($this->isTestQuestion($questionId)) {
         $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
         $assignmentList->setParentObjId($this->getQuestionContainerId());
         $assignmentList->loadFromDb();
         $handledSkills = array();
         //$skillIds = (array)$_POST['skill_ids'];
         $sgui = $this->buildSkillSelectorExplorerGUI(array());
         $skillIds = $sgui->getSelectedSkills();
         foreach ($skillIds as $skillId) {
             $skill = explode(':', $skillId);
             $skillBaseId = (int) $skill[0];
             $skillTrefId = (int) $skill[1];
             if ($skillBaseId) {
                 if (!$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId)) {
                     $assignment = new ilAssQuestionSkillAssignment($this->db);
                     $assignment->setParentObjId($this->getQuestionContainerId());
                     $assignment->setQuestionId($questionId);
                     $assignment->setSkillBaseId($skillBaseId);
                     $assignment->setSkillTrefId($skillTrefId);
                     $assignment->setSkillPoints(ilAssQuestionSkillAssignment::DEFAULT_COMPETENCE_POINTS);
                     $assignment->setEvalMode(ilAssQuestionSkillAssignment::EVAL_MODE_BY_QUESTION_RESULT);
                     $assignment->saveToDb();
                 }
                 $handledSkills[$skillId] = $skill;
             }
         }
         foreach ($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment) {
             if (isset($handledSkills["{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"])) {
                 continue;
             }
             $assignment->deleteFromDb();
         }
         ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assigns_updated'), true);
         if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
             $this->keepAssignmentParameters();
             $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
         }
     }
     $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
 }