private function getRemoveCompetenceActionLink(ilTestSkillQuestionAssignment $assignment) { $this->ctrl->setParameter($this->parent_obj, 'skill_base_id', $assignment->getSkillBaseId()); $this->ctrl->setParameter($this->parent_obj, 'skill_tref_id', $assignment->getSkillTrefId()); $href = $this->ctrl->getLinkTarget($this->parent_obj, ilTestSkillQuestionAssignmentsGUI::CMD_REMOVE_SKILL_QUEST_ASSIGN); $label = $this->lng->txt('tst_remove_competence'); $this->ctrl->setParameter($this->parent_obj, 'skill_base_id', null); $this->ctrl->setParameter($this->parent_obj, 'skill_tref_id', null); return $this->buildActionLink($href, $label); }
private function saveSkillPointsCmd() { if (is_array($_POST['quantifiers'])) { require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignment.php'; $success = false; foreach ($_POST['quantifiers'] as $assignmentKey => $quantifier) { $assignmentKey = explode(':', $assignmentKey); $skillBaseId = (int) $assignmentKey[0]; $skillTrefId = (int) $assignmentKey[1]; $questionId = (int) $assignmentKey[2]; if ($this->isTestQuestion($questionId) && (int) $quantifier > 0) { $assignment = new ilTestSkillQuestionAssignment($this->db); $assignment->setTestId($this->testOBJ->getTestId()); $assignment->setQuestionId($questionId); $assignment->setSkillBaseId($skillBaseId); $assignment->setSkillTrefId($skillTrefId); if ($assignment->dbRecordExists()) { $assignment->setSkillPoints((int) $quantifier); $assignment->saveToDb(); } } } } ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true); $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS); }
/** * @param array $data * @return ilTestSkillQuestionAssignment */ private function buildSkillQuestionAssignmentByArray($data) { $assignment = new ilTestSkillQuestionAssignment($this->db); $assignment->setTestId($data['test_fi']); $assignment->setQuestionId($data['question_fi']); $assignment->setSkillBaseId($data['skill_base_fi']); $assignment->setSkillTrefId($data['skill_tref_fi']); $assignment->setSkillPoints($data['skill_points']); return $assignment; }