176 $nextClass = $this->ctrl->getNextClass();
178 $command = $this->ctrl->getCmd(self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
181 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
184 switch ($nextClass) {
185 case strtolower(__CLASS__):
205 case self::CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM:
206 case self::CMD_UPDATE_SKILL_QUEST_ASSIGNS:
218 if (is_array(
$_POST[
'skill_points'])) {
219 for (
$i = 0;
$i < 2;
$i++) {
220 foreach (
$_POST[
'skill_points'] as $assignmentKey => $skillPoints) {
221 $assignmentKey = explode(
':', $assignmentKey);
222 $skillBaseId = (int) $assignmentKey[0];
223 $skillTrefId = (int) $assignmentKey[1];
224 $questionId = (int) $assignmentKey[2];
230 if (!$assignment->isValidSkillPoint($skillPoints)) {
238 $assignment->setQuestionId($questionId);
239 $assignment->setSkillBaseId($skillBaseId);
240 $assignment->setSkillTrefId($skillTrefId);
242 if ($assignment->dbRecordExists()) {
243 $assignment->loadFromDb();
245 if (!$assignment->hasEvalModeBySolution()) {
246 $assignment->setSkillPoints((
int) $skillPoints);
247 $assignment->saveToDb();
256 ilUtil::sendSuccess($this->lng->txt(
'tst_msg_skl_qst_assign_points_saved'),
true);
257 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
266 $questionId = (int)
$_GET[
'question_id'];
271 $assignmentList->loadFromDb();
273 $handledSkills = array();
277 $skillIds = $sgui->getSelectedSkills();
279 foreach ($skillIds as $skillId) {
280 $skill = explode(
':', $skillId);
281 $skillBaseId = (int) $skill[0];
282 $skillTrefId = (int) $skill[1];
285 if (!$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId)) {
289 $assignment->setQuestionId($questionId);
290 $assignment->setSkillBaseId($skillBaseId);
291 $assignment->setSkillTrefId($skillTrefId);
295 $assignment->saveToDb();
298 $handledSkills[$skillId] = $skill;
302 foreach ($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment) {
303 if (isset($handledSkills[
"{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"])) {
307 $assignment->deleteFromDb();
310 ilUtil::sendSuccess($this->lng->txt(
'qpl_qst_skl_assigns_updated'),
true);
314 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
318 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
323 $this->ctrl->saveParameter($this,
'question_id');
324 $questionId = (int)
$_GET[
'question_id'];
328 $assignmentList->loadFromDb();
331 $assignmentList->getAssignmentsByQuestionId($questionId)
334 if (!$skillSelectorExplorerGUI->handleCommand()) {
335 $tpl =
new ilTemplate(
'tpl.qpl_qst_skl_assign_selection.html',
false,
false,
'Modules/TestQuestionPool');
341 $skillSelectorToolbarGUI->setOpenFormTag(
true);
342 $skillSelectorToolbarGUI->setCloseFormTag(
false);
344 $tpl->setVariable(
'SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
346 $tpl->setVariable(
'SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
348 $skillSelectorToolbarGUI->setOpenFormTag(
false);
349 $skillSelectorToolbarGUI->setCloseFormTag(
true);
351 $tpl->setVariable(
'SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
353 $this->tpl->setContent(
$tpl->get());
366 if ($questionGUI === null) {
370 if ($assignment === null) {
372 (
int)
$_GET[
'question_id'],
373 (
int) $_GET[
'skill_base_id'],
374 (
int) $_GET[
'skill_tref_id']
378 if ($form === null) {
384 $this->tpl->setContent($this->ctrl->getHTML($form) .
'<br />' . $questionPageHTML);
389 $questionId = (int)
$_GET[
'question_id'];
395 (
int)
$_GET[
'question_id'],
396 (
int) $_GET[
'skill_base_id'],
397 (
int) $_GET[
'skill_tref_id']
402 if (!$form->checkInput()) {
403 $form->setValuesByPost();
407 $form->setValuesByPost();
409 if ($form->getItemByPostVar(
'eval_mode')) {
410 $assignment->setEvalMode($form->getItemByPostVar(
'eval_mode')->getValue());
415 if ($assignment->hasEvalModeBySolution()) {
416 $solCmpExprInput = $form->getItemByPostVar(
'solution_compare_expressions');
424 $assignment->initSolutionComparisonExpressionList();
425 $assignment->getSolutionComparisonExpressionList()->reset();
427 foreach ($solCmpExprInput->getValues() as $expression) {
428 $assignment->getSolutionComparisonExpressionList()->add($expression);
431 $assignment->setSkillPoints($form->getItemByPostVar(
'q_res_skill_points')->getValue());
434 $assignment->saveToDb();
436 ilUtil::sendSuccess($this->lng->txt(
'qpl_qst_skl_assign_properties_modified'),
true);
439 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
443 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
450 $form->setQuestion($question);
451 $form->setAssignment($assignment);
464 $table->loadSkillPointsFromRequest($loadSkillPointsFromRequest);
467 $assignmentList->loadFromDb();
468 $assignmentList->loadAdditionalSkillData();
469 $table->setSkillQuestionAssignmentList($assignmentList);
470 $table->setData($this->
orderQuestionData($this->questionList->getQuestionDataArray()));
472 $this->tpl->setContent($this->ctrl->getHTML($table));
477 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
479 if (!$questionData[
'original_id']) {
490 if ($this->access->checkAccess(
'write',
'', $parentRefId)) {
500 $questionId = (int)
$_GET[
'question_id'];
504 $confirmation->setHeaderText($this->lng->txt(
'qpl_sync_quest_skl_assigns_confirmation'));
506 $confirmation->setFormAction($this->ctrl->getFormAction($this));
507 $confirmation->addHiddenItem(
'question_id', $questionId);
508 $confirmation->setConfirm($this->lng->txt(
'yes'), self::CMD_SYNC_ORIGINAL);
509 $confirmation->setCancel($this->lng->txt(
'no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
511 $this->tpl->setContent($this->ctrl->getHTML($confirmation));
516 $questionId = (int)
$_POST[
'question_id'];
521 $question->syncSkillAssignments(
522 $question->getObjId(),
524 $question->lookupParentObjId($question->getOriginalId()),
525 $question->getOriginalId()
528 ilUtil::sendSuccess($this->lng->txt(
'qpl_qst_skl_assign_synced_to_orig'),
true);
531 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
548 return $assignmentList;
558 self::CMD_SHOW_SKILL_SELECT,
560 self::CMD_UPDATE_SKILL_QUEST_ASSIGNS,
561 self::PARAM_SKILL_SELECTION
564 $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION,
true);
570 foreach ($assignments as $assignment) {
571 $id =
"{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
573 $skillSelectorExplorerGUI->setSkillSelected($id);
576 return $skillSelectorExplorerGUI;
586 $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
587 $skillSelectorToolbarGUI->addFormButton($this->lng->txt(
'qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
588 $skillSelectorToolbarGUI->addFormButton($this->lng->txt(
'qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
590 return $skillSelectorToolbarGUI;
595 $this->tpl->addCss(
'Services/COPage/css/content.css');
600 $pageGUI->setRenderPageContainer(
true);
602 $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
604 $questionGUI->object->setShuffle(
false);
605 $questionHTML = $questionGUI->
getSolutionOutput(0, 0,
false,
false,
true,
false,
true,
false,
true);
606 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
608 $pageHTML = $pageGUI->presentation();
609 $pageHTML = preg_replace(
"/src=\"\\.\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $pageHTML);
622 $assignment->setQuestionId($questionId);
623 $assignment->setSkillBaseId($skillBaseId);
624 $assignment->setSkillTrefId($skillTrefId);
626 $assignment->loadFromDb();
627 $assignment->loadAdditionalSkillData();
634 return $this->questionList->isInList($questionId);
641 foreach ($input->
getValues() as $expression) {
645 $errors[] =
"{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
650 $alert = $this->lng->txt(
'ass_lac_validation_error');
651 $alert .=
'<br />' . implode(
'<br />',
$errors);
663 $conditionComposite = $conditionParser->parse($expression->
getExpression());
665 $questionProvider->setQuestion($question);
668 $conditionValidator->validate($conditionComposite);
671 return $e->getFormAlert($this->lng);
682 $this->ctrl->saveParameter($this,
'question_id');
683 $this->ctrl->saveParameter($this,
'skill_base_id');
684 $this->ctrl->saveParameter($this,
'skill_tref_id');
689 $orderedQuestionsData = array();
693 $orderedQuestionsData[$questionId] = $questionData[$questionId];
696 return $orderedQuestionsData;
699 foreach ($questionData as $questionId =>
$data) {
700 $orderedQuestionsData[$questionId] =
$data[
'title'];
705 foreach ($orderedQuestionsData as $questionId => $questionTitle) {
706 $orderedQuestionsData[$questionId] = $questionData[$questionId];
709 return $orderedQuestionsData;
721 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
723 return sprintf($this->lng->txt(
'qpl_qst_skl_selection_for_question_header'), $questionData[
'title']);
728 $flags = SORT_REGULAR;
730 if (defined(
'SORT_NATURAL')) {
731 $flags = SORT_NATURAL;
732 } elseif (defined(
'SORT_STRING')) {
733 $flags = SORT_STRING;
736 if (defined(
'SORT_FLAG_CASE')) {
737 $flags = $flags | SORT_FLAG_CASE;
740 asort($array, $flags);
This class provides processing control methods.
const CMD_UPDATE_SKILL_QUEST_ASSIGNS
Class iQuestionCondition.
const CMD_SHOW_SKILL_SELECT
setAssignmentConfigurationHintMessage($assignmentConfigurationHintMessage)
sortAlphabetically($array)
setQuestionContainerId($questionContainerId)
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, iQuestionCondition $question)
const PARAM_SKILL_SELECTION
saveSkillQuestionAssignmentPropertiesFormCmd()
keepAssignmentParameters()
Abstract basic class which is to be extended by the concrete assessment question type classes...
isSyncOriginalPossibleAndAllowed($questionId)
doesObjectTypeMatch($objectId)
isAssignmentEditingEnabled()
setAssignmentEditingEnabled($assignmentEditingEnabled)
getSkillSelectorHeader($questionId)
$assignmentConfigurationHintMessage
showSyncOriginalConfirmationCmd()
const CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM
$assignmentEditingEnabled
const CMD_SAVE_SKILL_POINTS
static lookupParentObjId($questionId)
ilDBInterface $ilDB
static _getAllReferences($a_id)
get all reference ids of object
buildSkillQuestionAssignmentPropertiesForm(assQuestion $question, ilAssQuestionSkillAssignment $assignment)
showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest=false)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class CompositeValidator.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
setQuestionList($questionList)
setQuestionOrderSequence($questionOrderSequence)
Basic GUI class for assessment questions.
static _lookupType($a_id, $a_reference=false)
lookup object type
__construct(ilCtrl $ctrl, ilAccessHandler $access, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilDBInterface $db)
static _instantiateQuestion($question_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getAssignmentConfigurationHintMessage()
checkSolutionCompareExpressionInput(ilLogicalAnswerComparisonExpressionInputGUI $input, assQuestion $question)
getQuestionOrderSequence()
isAvoidManipulationRedirectRequired($command)
Explorer class that works on tree objects (Services/Tree)
const DEFAULT_COMPETENCE_POINTS
getSolutionOutput( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
Class ilParserQuestionProvider.
buildSkillSelectorExplorerGUI($assignments)
buildSkillSelectorToolbarGUI()
isTestQuestion($questionId)
showSkillQuestionAssignmentPropertiesFormCmd(assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
setOutputMode($a_mode=self::PRESENTATION)
Set Output Mode.
const CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION
buildSkillQuestionAssignmentList()
const EVAL_MODE_BY_QUESTION_RESULT
handleAssignmentConfigurationHintMessage()
updateSkillQuestionAssignmentsCmd()
const CMD_SHOW_SKILL_QUEST_ASSIGNS
orderQuestionData($questionData)
buildQuestionPage(assQuestionGUI $questionGUI)
const CMD_SHOW_SKILL_QUEST_ASSIGN_PROPERTIES_FORM
Confirmation screen class.