ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilAssQuestionSkillAssignmentsGUI Class Reference
+ Collaboration diagram for ilAssQuestionSkillAssignmentsGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilAccessHandler $access, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilDBInterface $db)
 
 getQuestionOrderSequence ()
 
 getAssignmentConfigurationHintMessage ()
 
 setAssignmentConfigurationHintMessage ($assignmentConfigurationHintMessage)
 
 setQuestionOrderSequence ($questionOrderSequence)
 
 getQuestionList ()
 
 setQuestionList ($questionList)
 
 getQuestionContainerId ()
 
 setQuestionContainerId ($questionContainerId)
 
 isAssignmentEditingEnabled ()
 
 setAssignmentEditingEnabled ($assignmentEditingEnabled)
 
 executeCommand ()
 

Data Fields

const CMD_SHOW_SKILL_QUEST_ASSIGNS = 'showSkillQuestionAssignments'
 
const CMD_SHOW_SKILL_SELECT = 'showSkillSelection'
 
const CMD_UPDATE_SKILL_QUEST_ASSIGNS = 'updateSkillQuestionAssignments'
 
const CMD_SHOW_SKILL_QUEST_ASSIGN_PROPERTIES_FORM = 'showSkillQuestionAssignmentPropertiesForm'
 
const CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM = 'saveSkillQuestionAssignmentPropertiesForm'
 
const CMD_SAVE_SKILL_POINTS = 'saveSkillPoints'
 
const CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION = 'showSyncOriginalConfirmation'
 
const CMD_SYNC_ORIGINAL = 'syncOriginal'
 
const PARAM_SKILL_SELECTION = 'skill_ids'
 

Protected Member Functions

 doesObjectTypeMatch ($objectId)
 

Private Member Functions

 isAvoidManipulationRedirectRequired ($command)
 
 saveSkillPointsCmd ()
 
 updateSkillQuestionAssignmentsCmd ()
 
 showSkillSelectionCmd ()
 
 showSkillQuestionAssignmentPropertiesFormCmd (assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
 
 saveSkillQuestionAssignmentPropertiesFormCmd ()
 
 buildSkillQuestionAssignmentPropertiesForm (assQuestion $question, ilAssQuestionSkillAssignment $assignment)
 
 showSkillQuestionAssignmentsCmd ($loadSkillPointsFromRequest=false)
 
 isSyncOriginalPossibleAndAllowed ($questionId)
 
 showSyncOriginalConfirmationCmd ()
 
 syncOriginalCmd ()
 
 buildTableGUI ()
 
 buildSkillQuestionAssignmentList ()
 
 buildSkillSelectorExplorerGUI ($assignments)
 
 buildSkillSelectorToolbarGUI ()
 
 buildQuestionPage (assQuestionGUI $questionGUI)
 
 buildQuestionSkillAssignment ($questionId, $skillBaseId, $skillTrefId)
 
 isTestQuestion ($questionId)
 
 checkSolutionCompareExpressionInput (ilLogicalAnswerComparisonExpressionInputGUI $input, assQuestion $question)
 
 validateSolutionCompareExpression (ilAssQuestionSolutionComparisonExpression $expression, iQuestionCondition $question)
 
 keepAssignmentParameters ()
 
 orderQuestionData ($questionData)
 
 handleAssignmentConfigurationHintMessage ()
 
 getSkillSelectorHeader ($questionId)
 
 sortAlphabetically ($array)
 

Private Attributes

 $ctrl
 
 $access
 
 $tpl
 
 $lng
 
 $db
 
 $questionList
 
 $questionContainerId
 
 $assignmentEditingEnabled
 
 $questionOrderSequence
 
 $assignmentConfigurationHintMessage
 

Detailed Description

Definition at line 15 of file class.ilAssQuestionSkillAssignmentsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ buildQuestionPage()

ilAssQuestionSkillAssignmentsGUI::buildQuestionPage ( assQuestionGUI  $questionGUI)
private

Definition at line 593 of file class.ilAssQuestionSkillAssignmentsGUI.php.

594 {
595 $this->tpl->addCss('Services/COPage/css/content.css');
596
597 $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
598
599 $pageGUI->setOutputMode("presentation");
600 $pageGUI->setRenderPageContainer(true);
601
602 $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
603
604 $questionGUI->object->setShuffle(false); // dirty, but works ^^
605 $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
606 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
607
608 $pageHTML = $pageGUI->presentation();
609 $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
610
611 return $pageHTML;
612 }
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)
Question page GUI class.

References assQuestionGUI\getSolutionOutput(), and ILIAS_HTTP_PATH.

Referenced by showSkillQuestionAssignmentPropertiesFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionSkillAssignment()

ilAssQuestionSkillAssignmentsGUI::buildQuestionSkillAssignment (   $questionId,
  $skillBaseId,
  $skillTrefId 
)
private
Returns
ilAssQuestionSkillAssignment

Definition at line 617 of file class.ilAssQuestionSkillAssignmentsGUI.php.

618 {
619 $assignment = new ilAssQuestionSkillAssignment($this->db);
620
621 $assignment->setParentObjId($this->getQuestionContainerId());
622 $assignment->setQuestionId($questionId);
623 $assignment->setSkillBaseId($skillBaseId);
624 $assignment->setSkillTrefId($skillTrefId);
625
626 $assignment->loadFromDb();
627 $assignment->loadAdditionalSkillData();
628
629 return $assignment;
630 }

References getQuestionContainerId().

Referenced by saveSkillQuestionAssignmentPropertiesFormCmd(), and showSkillQuestionAssignmentPropertiesFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildSkillQuestionAssignmentList()

ilAssQuestionSkillAssignmentsGUI::buildSkillQuestionAssignmentList ( )
private

Definition at line 543 of file class.ilAssQuestionSkillAssignmentsGUI.php.

544 {
545 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
546 $assignmentList->setParentObjId($this->getQuestionContainerId());
547
548 return $assignmentList;
549 }

References getQuestionContainerId().

Referenced by showSkillQuestionAssignmentsCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildSkillQuestionAssignmentPropertiesForm()

ilAssQuestionSkillAssignmentsGUI::buildSkillQuestionAssignmentPropertiesForm ( assQuestion  $question,
ilAssQuestionSkillAssignment  $assignment 
)
private

Definition at line 446 of file class.ilAssQuestionSkillAssignmentsGUI.php.

447 {
448 $form = new ilAssQuestionSkillAssignmentPropertyFormGUI($this->tpl, $this->ctrl, $this->lng, $this);
449
450 $form->setQuestion($question);
451 $form->setAssignment($assignment);
452 $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
453
454 $form->build();
455
456 return $form;
457 }

References isAssignmentEditingEnabled().

Referenced by saveSkillQuestionAssignmentPropertiesFormCmd(), and showSkillQuestionAssignmentPropertiesFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildSkillSelectorExplorerGUI()

ilAssQuestionSkillAssignmentsGUI::buildSkillSelectorExplorerGUI (   $assignments)
private
Returns
ilSkillSelectorGUI

Definition at line 554 of file class.ilAssQuestionSkillAssignmentsGUI.php.

555 {
556 $skillSelectorExplorerGUI = new ilSkillSelectorGUI(
557 $this,
558 self::CMD_SHOW_SKILL_SELECT,
559 $this,
560 self::CMD_UPDATE_SKILL_QUEST_ASSIGNS,
561 self::PARAM_SKILL_SELECTION
562 );
563
564 $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION, true);
565 //$skillSelectorExplorerGUI->setNodeOnclickEnabled(false);
566
567 // parameter name for skill selection is actually taken from value passed to constructor,
568 // but passing a non empty name to setSelectMode is neccessary to keep input fields enabled
569
570 foreach ($assignments as $assignment) {
571 $id = "{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
572 //$skillSelectorExplorerGUI->setNodeSelected($id);
573 $skillSelectorExplorerGUI->setSkillSelected($id);
574 }
575
576 return $skillSelectorExplorerGUI;
577 }
Explorer class that works on tree objects (Services/Tree)

Referenced by showSkillSelectionCmd(), and updateSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ buildSkillSelectorToolbarGUI()

ilAssQuestionSkillAssignmentsGUI::buildSkillSelectorToolbarGUI ( )
private
Returns
ilToolbarGUI

Definition at line 582 of file class.ilAssQuestionSkillAssignmentsGUI.php.

583 {
584 $skillSelectorToolbarGUI = new ilToolbarGUI();
585
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);
589
590 return $skillSelectorToolbarGUI;
591 }

Referenced by showSkillSelectionCmd().

+ Here is the caller graph for this function:

◆ buildTableGUI()

ilAssQuestionSkillAssignmentsGUI::buildTableGUI ( )
private

Definition at line 534 of file class.ilAssQuestionSkillAssignmentsGUI.php.

535 {
536 $table = new ilAssQuestionSkillAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
537 $table->setManipulationsEnabled($this->isAssignmentEditingEnabled());
538 $table->init();
539
540 return $table;
541 }

References isAssignmentEditingEnabled().

Referenced by showSkillQuestionAssignmentsCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkSolutionCompareExpressionInput()

ilAssQuestionSkillAssignmentsGUI::checkSolutionCompareExpressionInput ( ilLogicalAnswerComparisonExpressionInputGUI  $input,
assQuestion  $question 
)
private

Definition at line 637 of file class.ilAssQuestionSkillAssignmentsGUI.php.

638 {
639 $errors = array();
640
641 foreach ($input->getValues() as $expression) {
642 $result = $this->validateSolutionCompareExpression($expression, $question);
643
644 if ($result !== true) {
645 $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
646 }
647 }
648
649 if (count($errors)) {
650 $alert = $this->lng->txt('ass_lac_validation_error');
651 $alert .= '<br />' . implode('<br />', $errors);
652 $input->setAlert($alert);
653 return false;
654 }
655
656 return true;
657 }
$result
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, iQuestionCondition $question)
setAlert($a_alert)
Set Alert Text.
$errors

References $errors, $result, ilLogicalAnswerComparisonExpressionInputGUI\getValues(), ilFormPropertyGUI\setAlert(), and validateSolutionCompareExpression().

Referenced by saveSkillQuestionAssignmentPropertiesFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doesObjectTypeMatch()

ilAssQuestionSkillAssignmentsGUI::doesObjectTypeMatch (   $objectId)
protected

Definition at line 745 of file class.ilAssQuestionSkillAssignmentsGUI.php.

746 {
747 return ilObject::_lookupType($objectId) == 'qpl';
748 }
static _lookupType($a_id, $a_reference=false)
lookup object type

References ilObject\_lookupType().

Referenced by isSyncOriginalPossibleAndAllowed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilAssQuestionSkillAssignmentsGUI::executeCommand ( )

Definition at line 174 of file class.ilAssQuestionSkillAssignmentsGUI.php.

175 {
176 $nextClass = $this->ctrl->getNextClass();
177
178 $command = $this->ctrl->getCmd(self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
179
180 if ($this->isAvoidManipulationRedirectRequired($command)) {
181 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
182 }
183
184 switch ($nextClass) {
185 case strtolower(__CLASS__):
186 case '':
187
188 $command .= 'Cmd';
189 $this->$command();
190 break;
191
192 default:
193
194 throw new ilTestQuestionPoolException('unsupported next class in ctrl flow');
195 }
196 }

References isAvoidManipulationRedirectRequired().

+ Here is the call graph for this function:

◆ getAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::getAssignmentConfigurationHintMessage ( )
Returns
string

Definition at line 105 of file class.ilAssQuestionSkillAssignmentsGUI.php.

References $assignmentConfigurationHintMessage.

Referenced by handleAssignmentConfigurationHintMessage().

+ Here is the caller graph for this function:

◆ getQuestionContainerId()

ilAssQuestionSkillAssignmentsGUI::getQuestionContainerId ( )

◆ getQuestionList()

ilAssQuestionSkillAssignmentsGUI::getQuestionList ( )

◆ getQuestionOrderSequence()

ilAssQuestionSkillAssignmentsGUI::getQuestionOrderSequence ( )
Returns
array

Definition at line 97 of file class.ilAssQuestionSkillAssignmentsGUI.php.

References $questionOrderSequence.

Referenced by orderQuestionData().

+ Here is the caller graph for this function:

◆ getSkillSelectorHeader()

ilAssQuestionSkillAssignmentsGUI::getSkillSelectorHeader (   $questionId)
private

Definition at line 719 of file class.ilAssQuestionSkillAssignmentsGUI.php.

720 {
721 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
722
723 return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
724 }

Referenced by showSkillSelectionCmd().

+ Here is the caller graph for this function:

◆ handleAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::handleAssignmentConfigurationHintMessage ( )
private

Definition at line 712 of file class.ilAssQuestionSkillAssignmentsGUI.php.

713 {
716 }
717 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References getAssignmentConfigurationHintMessage(), and ilUtil\sendInfo().

Referenced by showSkillQuestionAssignmentPropertiesFormCmd(), and showSkillQuestionAssignmentsCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAssignmentEditingEnabled()

ilAssQuestionSkillAssignmentsGUI::isAssignmentEditingEnabled ( )

◆ isAvoidManipulationRedirectRequired()

ilAssQuestionSkillAssignmentsGUI::isAvoidManipulationRedirectRequired (   $command)
private

Definition at line 198 of file class.ilAssQuestionSkillAssignmentsGUI.php.

199 {
200 if ($this->isAssignmentEditingEnabled()) {
201 return false;
202 }
203
204 switch ($command) {
207
208 return true;
209 }
210
211 return false;
212 }

References CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM, CMD_UPDATE_SKILL_QUEST_ASSIGNS, and isAssignmentEditingEnabled().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSyncOriginalPossibleAndAllowed()

ilAssQuestionSkillAssignmentsGUI::isSyncOriginalPossibleAndAllowed (   $questionId)
private

Definition at line 475 of file class.ilAssQuestionSkillAssignmentsGUI.php.

476 {
477 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
478
479 if (!$questionData['original_id']) {
480 return false;
481 }
482
483 $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
484
485 if (!$this->doesObjectTypeMatch($parentObjId)) {
486 return false;
487 }
488
489 foreach (ilObject::_getAllReferences($parentObjId) as $parentRefId) {
490 if ($this->access->checkAccess('write', '', $parentRefId)) {
491 return true;
492 }
493 }
494
495 return false;
496 }
static lookupParentObjId($questionId)
@global ilDBInterface $ilDB
static _getAllReferences($a_id)
get all reference ids of object

References ilObject\_getAllReferences(), doesObjectTypeMatch(), and assQuestion\lookupParentObjId().

Referenced by saveSkillQuestionAssignmentPropertiesFormCmd(), syncOriginalCmd(), and updateSkillQuestionAssignmentsCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTestQuestion()

ilAssQuestionSkillAssignmentsGUI::isTestQuestion (   $questionId)
private

Definition at line 632 of file class.ilAssQuestionSkillAssignmentsGUI.php.

633 {
634 return $this->questionList->isInList($questionId);
635 }

Referenced by saveSkillPointsCmd(), saveSkillQuestionAssignmentPropertiesFormCmd(), syncOriginalCmd(), and updateSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ keepAssignmentParameters()

ilAssQuestionSkillAssignmentsGUI::keepAssignmentParameters ( )
private

Definition at line 680 of file class.ilAssQuestionSkillAssignmentsGUI.php.

681 {
682 $this->ctrl->saveParameter($this, 'question_id');
683 $this->ctrl->saveParameter($this, 'skill_base_id');
684 $this->ctrl->saveParameter($this, 'skill_tref_id');
685 }

Referenced by saveSkillQuestionAssignmentPropertiesFormCmd(), showSkillQuestionAssignmentPropertiesFormCmd(), and updateSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ orderQuestionData()

ilAssQuestionSkillAssignmentsGUI::orderQuestionData (   $questionData)
private

Definition at line 687 of file class.ilAssQuestionSkillAssignmentsGUI.php.

688 {
689 $orderedQuestionsData = array();
690
691 if ($this->getQuestionOrderSequence()) {
692 foreach ($this->getQuestionOrderSequence() as $questionId) {
693 $orderedQuestionsData[$questionId] = $questionData[$questionId];
694 }
695
696 return $orderedQuestionsData;
697 }
698
699 foreach ($questionData as $questionId => $data) {
700 $orderedQuestionsData[$questionId] = $data['title'];
701 }
702
703 $orderedQuestionsData = $this->sortAlphabetically($orderedQuestionsData);
704
705 foreach ($orderedQuestionsData as $questionId => $questionTitle) {
706 $orderedQuestionsData[$questionId] = $questionData[$questionId];
707 }
708
709 return $orderedQuestionsData;
710 }
$data
Definition: storeScorm.php:23

References $data, getQuestionOrderSequence(), and sortAlphabetically().

Referenced by showSkillQuestionAssignmentsCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSkillPointsCmd()

ilAssQuestionSkillAssignmentsGUI::saveSkillPointsCmd ( )
private

Definition at line 214 of file class.ilAssQuestionSkillAssignmentsGUI.php.

215 {
216 $success = true;
217
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];
225
226 if ($this->isTestQuestion($questionId)) {
227 $assignment = new ilAssQuestionSkillAssignment($this->db);
228
229 if ($i == 0) {
230 if (!$assignment->isValidSkillPoint($skillPoints)) {
231 $success = false;
232 break 2;
233 }
234 continue;
235 }
236
237 $assignment->setParentObjId($this->getQuestionContainerId());
238 $assignment->setQuestionId($questionId);
239 $assignment->setSkillBaseId($skillBaseId);
240 $assignment->setSkillTrefId($skillTrefId);
241
242 if ($assignment->dbRecordExists()) {
243 $assignment->loadFromDb();
244
245 if (!$assignment->hasEvalModeBySolution()) {
246 $assignment->setSkillPoints((int) $skillPoints);
247 $assignment->saveToDb();
248 }
249 }
250 }
251 }
252 }
253 }
254
255 if ($success) {
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);
258 } else {
259 ilUtil::sendFailure($this->lng->txt('tst_msg_skl_qst_assign_points_not_saved'));
261 }
262 }
$success
Definition: Utf8Test.php:86
$_POST["username"]
showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest=false)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$i
Definition: metadata.php:24

References $_POST, $i, $success, getQuestionContainerId(), isTestQuestion(), ilUtil\sendFailure(), and showSkillQuestionAssignmentsCmd().

+ Here is the call graph for this function:

◆ saveSkillQuestionAssignmentPropertiesFormCmd()

ilAssQuestionSkillAssignmentsGUI::saveSkillQuestionAssignmentPropertiesFormCmd ( )
private

Definition at line 387 of file class.ilAssQuestionSkillAssignmentsGUI.php.

388 {
389 $questionId = (int) $_GET['question_id'];
390
391 if ($this->isTestQuestion($questionId)) {
392 $questionGUI = assQuestionGUI::_getQuestionGUI('', $questionId);
393
394 $assignment = $this->buildQuestionSkillAssignment(
395 (int) $_GET['question_id'],
396 (int) $_GET['skill_base_id'],
397 (int) $_GET['skill_tref_id']
398 );
399
401 $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
402 if (!$form->checkInput()) {
403 $form->setValuesByPost();
404 $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
405 return;
406 }
407 $form->setValuesByPost();
408
409 if ($form->getItemByPostVar('eval_mode')) {
410 $assignment->setEvalMode($form->getItemByPostVar('eval_mode')->getValue());
411 } else {
413 }
414
415 if ($assignment->hasEvalModeBySolution()) {
416 $solCmpExprInput = $form->getItemByPostVar('solution_compare_expressions');
417
418 if (!$this->checkSolutionCompareExpressionInput($solCmpExprInput, $questionGUI->object)) {
419 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
420 $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
421 return;
422 }
423
424 $assignment->initSolutionComparisonExpressionList();
425 $assignment->getSolutionComparisonExpressionList()->reset();
426
427 foreach ($solCmpExprInput->getValues() as $expression) {
428 $assignment->getSolutionComparisonExpressionList()->add($expression);
429 }
430 } else {
431 $assignment->setSkillPoints($form->getItemByPostVar('q_res_skill_points')->getValue());
432 }
433
434 $assignment->saveToDb();
435
436 ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_properties_modified'), true);
437
438 if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
439 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
440 }
441 }
442
443 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
444 }
$_GET["client_id"]
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...
buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
checkSolutionCompareExpressionInput(ilLogicalAnswerComparisonExpressionInputGUI $input, assQuestion $question)
showSkillQuestionAssignmentPropertiesFormCmd(assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
buildSkillQuestionAssignmentPropertiesForm(assQuestion $question, ilAssQuestionSkillAssignment $assignment)

References $_GET, assQuestionGUI\_getQuestionGUI(), buildQuestionSkillAssignment(), buildSkillQuestionAssignmentPropertiesForm(), checkSolutionCompareExpressionInput(), ilAssQuestionSkillAssignment\EVAL_MODE_BY_QUESTION_RESULT, isSyncOriginalPossibleAndAllowed(), isTestQuestion(), keepAssignmentParameters(), ilUtil\sendFailure(), and showSkillQuestionAssignmentPropertiesFormCmd().

+ Here is the call graph for this function:

◆ setAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::setAssignmentConfigurationHintMessage (   $assignmentConfigurationHintMessage)
Parameters
string$assignmentConfigurationHintMessage

Definition at line 113 of file class.ilAssQuestionSkillAssignmentsGUI.php.

114 {
115 $this->assignmentConfigurationHintMessage = $assignmentConfigurationHintMessage;
116 }

References $assignmentConfigurationHintMessage.

◆ setAssignmentEditingEnabled()

ilAssQuestionSkillAssignmentsGUI::setAssignmentEditingEnabled (   $assignmentEditingEnabled)
Parameters
bool$assignmentEditingEnabled

Definition at line 169 of file class.ilAssQuestionSkillAssignmentsGUI.php.

170 {
171 $this->assignmentEditingEnabled = $assignmentEditingEnabled;
172 }

References $assignmentEditingEnabled.

◆ setQuestionContainerId()

ilAssQuestionSkillAssignmentsGUI::setQuestionContainerId (   $questionContainerId)
Parameters
int$questionContainerId

Definition at line 153 of file class.ilAssQuestionSkillAssignmentsGUI.php.

154 {
155 $this->questionContainerId = $questionContainerId;
156 }

References $questionContainerId.

◆ setQuestionList()

ilAssQuestionSkillAssignmentsGUI::setQuestionList (   $questionList)
Parameters
ilAssQuestionList$questionList

Definition at line 137 of file class.ilAssQuestionSkillAssignmentsGUI.php.

138 {
139 $this->questionList = $questionList;
140 }

References $questionList.

◆ setQuestionOrderSequence()

ilAssQuestionSkillAssignmentsGUI::setQuestionOrderSequence (   $questionOrderSequence)
Parameters
array$questionOrderSequence

Definition at line 121 of file class.ilAssQuestionSkillAssignmentsGUI.php.

122 {
123 $this->questionOrderSequence = $questionOrderSequence;
124 }

References $questionOrderSequence.

◆ showSkillQuestionAssignmentPropertiesFormCmd()

ilAssQuestionSkillAssignmentsGUI::showSkillQuestionAssignmentPropertiesFormCmd ( assQuestionGUI  $questionGUI = null,
ilAssQuestionSkillAssignment  $assignment = null,
ilPropertyFormGUI  $form = null 
)
private

Definition at line 357 of file class.ilAssQuestionSkillAssignmentsGUI.php.

361 {
363
365
366 if ($questionGUI === null) {
367 $questionGUI = assQuestionGUI::_getQuestionGUI('', (int) $_GET['question_id']);
368 }
369
370 if ($assignment === null) {
371 $assignment = $this->buildQuestionSkillAssignment(
372 (int) $_GET['question_id'],
373 (int) $_GET['skill_base_id'],
374 (int) $_GET['skill_tref_id']
375 );
376 }
377
378 if ($form === null) {
379 $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
380 }
381
382 $questionPageHTML = $this->buildQuestionPage($questionGUI);
383
384 $this->tpl->setContent($this->ctrl->getHTML($form) . '<br />' . $questionPageHTML);
385 }

References $_GET, assQuestionGUI\_getQuestionGUI(), buildQuestionPage(), buildQuestionSkillAssignment(), buildSkillQuestionAssignmentPropertiesForm(), handleAssignmentConfigurationHintMessage(), and keepAssignmentParameters().

Referenced by saveSkillQuestionAssignmentPropertiesFormCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSkillQuestionAssignmentsCmd()

ilAssQuestionSkillAssignmentsGUI::showSkillQuestionAssignmentsCmd (   $loadSkillPointsFromRequest = false)
private

Definition at line 459 of file class.ilAssQuestionSkillAssignmentsGUI.php.

460 {
462
463 $table = $this->buildTableGUI();
464 $table->loadSkillPointsFromRequest($loadSkillPointsFromRequest);
465
466 $assignmentList = $this->buildSkillQuestionAssignmentList();
467 $assignmentList->loadFromDb();
468 $assignmentList->loadAdditionalSkillData();
469 $table->setSkillQuestionAssignmentList($assignmentList);
470 $table->setData($this->orderQuestionData($this->questionList->getQuestionDataArray()));
471
472 $this->tpl->setContent($this->ctrl->getHTML($table));
473 }

References buildSkillQuestionAssignmentList(), buildTableGUI(), handleAssignmentConfigurationHintMessage(), and orderQuestionData().

Referenced by saveSkillPointsCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSkillSelectionCmd()

ilAssQuestionSkillAssignmentsGUI::showSkillSelectionCmd ( )
private

Definition at line 321 of file class.ilAssQuestionSkillAssignmentsGUI.php.

322 {
323 $this->ctrl->saveParameter($this, 'question_id');
324 $questionId = (int) $_GET['question_id'];
325
326 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
327 $assignmentList->setParentObjId($this->getQuestionContainerId());
328 $assignmentList->loadFromDb();
329
330 $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI(
331 $assignmentList->getAssignmentsByQuestionId($questionId)
332 );
333
334 if (!$skillSelectorExplorerGUI->handleCommand()) {
335 $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'Modules/TestQuestionPool');
336
337 $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($questionId));
338
339 $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
340
341 $skillSelectorToolbarGUI->setOpenFormTag(true);
342 $skillSelectorToolbarGUI->setCloseFormTag(false);
343 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
344 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
345
346 $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
347
348 $skillSelectorToolbarGUI->setOpenFormTag(false);
349 $skillSelectorToolbarGUI->setCloseFormTag(true);
350 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
351 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
352
353 $this->tpl->setContent($tpl->get());
354 }
355 }
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $_GET, $tpl, buildSkillSelectorExplorerGUI(), buildSkillSelectorToolbarGUI(), ilUtil\getImagePath(), getQuestionContainerId(), and getSkillSelectorHeader().

+ Here is the call graph for this function:

◆ showSyncOriginalConfirmationCmd()

ilAssQuestionSkillAssignmentsGUI::showSyncOriginalConfirmationCmd ( )
private

Definition at line 498 of file class.ilAssQuestionSkillAssignmentsGUI.php.

499 {
500 $questionId = (int) $_GET['question_id'];
501
502 $confirmation = new ilConfirmationGUI();
503
504 $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
505
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);
510
511 $this->tpl->setContent($this->ctrl->getHTML($confirmation));
512 }
Confirmation screen class.

References $_GET.

◆ sortAlphabetically()

ilAssQuestionSkillAssignmentsGUI::sortAlphabetically (   $array)
private

Definition at line 726 of file class.ilAssQuestionSkillAssignmentsGUI.php.

727 {
728 $flags = SORT_REGULAR;
729
730 if (defined('SORT_NATURAL')) {
731 $flags = SORT_NATURAL;
732 } elseif (defined('SORT_STRING')) {
733 $flags = SORT_STRING;
734 }
735
736 if (defined('SORT_FLAG_CASE')) {
737 $flags = $flags | SORT_FLAG_CASE;
738 }
739
740 asort($array, $flags);
741
742 return $array;
743 }

Referenced by orderQuestionData().

+ Here is the caller graph for this function:

◆ syncOriginalCmd()

ilAssQuestionSkillAssignmentsGUI::syncOriginalCmd ( )
private

Definition at line 514 of file class.ilAssQuestionSkillAssignmentsGUI.php.

515 {
516 $questionId = (int) $_POST['question_id'];
517
518 if ($this->isTestQuestion($questionId) && $this->isSyncOriginalPossibleAndAllowed($questionId)) {
519 $question = assQuestion::_instantiateQuestion($questionId);
520
521 $question->syncSkillAssignments(
522 $question->getObjId(),
523 $question->getId(),
524 $question->lookupParentObjId($question->getOriginalId()),
525 $question->getOriginalId()
526 );
527
528 ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_synced_to_orig'), true);
529 }
530
531 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
532 }
static _instantiateQuestion($question_id)

References $_POST, assQuestion\_instantiateQuestion(), isSyncOriginalPossibleAndAllowed(), and isTestQuestion().

+ Here is the call graph for this function:

◆ updateSkillQuestionAssignmentsCmd()

ilAssQuestionSkillAssignmentsGUI::updateSkillQuestionAssignmentsCmd ( )
private

Definition at line 264 of file class.ilAssQuestionSkillAssignmentsGUI.php.

265 {
266 $questionId = (int) $_GET['question_id'];
267
268 if ($this->isTestQuestion($questionId)) {
269 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
270 $assignmentList->setParentObjId($this->getQuestionContainerId());
271 $assignmentList->loadFromDb();
272
273 $handledSkills = array();
274
275 //$skillIds = (array)$_POST['skill_ids'];
276 $sgui = $this->buildSkillSelectorExplorerGUI(array());
277 $skillIds = $sgui->getSelectedSkills();
278
279 foreach ($skillIds as $skillId) {
280 $skill = explode(':', $skillId);
281 $skillBaseId = (int) $skill[0];
282 $skillTrefId = (int) $skill[1];
283
284 if ($skillBaseId) {
285 if (!$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId)) {
286 $assignment = new ilAssQuestionSkillAssignment($this->db);
287
288 $assignment->setParentObjId($this->getQuestionContainerId());
289 $assignment->setQuestionId($questionId);
290 $assignment->setSkillBaseId($skillBaseId);
291 $assignment->setSkillTrefId($skillTrefId);
292
295 $assignment->saveToDb();
296 }
297
298 $handledSkills[$skillId] = $skill;
299 }
300 }
301
302 foreach ($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment) {
303 if (isset($handledSkills["{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"])) {
304 continue;
305 }
306
307 $assignment->deleteFromDb();
308 }
309
310 ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assigns_updated'), true);
311
312 if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
314 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
315 }
316 }
317
318 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
319 }

References $_GET, buildSkillSelectorExplorerGUI(), ilAssQuestionSkillAssignment\DEFAULT_COMPETENCE_POINTS, ilAssQuestionSkillAssignment\EVAL_MODE_BY_QUESTION_RESULT, getQuestionContainerId(), isSyncOriginalPossibleAndAllowed(), isTestQuestion(), and keepAssignmentParameters().

+ Here is the call graph for this function:

◆ validateSolutionCompareExpression()

ilAssQuestionSkillAssignmentsGUI::validateSolutionCompareExpression ( ilAssQuestionSolutionComparisonExpression  $expression,
iQuestionCondition  $question 
)
private

Definition at line 659 of file class.ilAssQuestionSkillAssignmentsGUI.php.

660 {
661 try {
662 $conditionParser = new ilAssLacConditionParser();
663 $conditionComposite = $conditionParser->parse($expression->getExpression());
664 $questionProvider = new ilAssLacQuestionProvider();
665 $questionProvider->setQuestion($question);
666 $conditionValidator = new ilAssLacCompositeValidator($questionProvider);
667
668 $conditionValidator->validate($conditionComposite);
669 } catch (ilAssLacException $e) {
670 if ($e instanceof ilAssLacFormAlertProvider) {
671 return $e->getFormAlert($this->lng);
672 }
673
674 throw $e;
675 }
676
677 return true;
678 }
Class ilParserQuestionProvider.

References Vendor\Package\$e, and ilAssQuestionSolutionComparisonExpression\getExpression().

Referenced by checkSolutionCompareExpressionInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAssQuestionSkillAssignmentsGUI::$access
private

Definition at line 36 of file class.ilAssQuestionSkillAssignmentsGUI.php.

Referenced by __construct().

◆ $assignmentConfigurationHintMessage

ilAssQuestionSkillAssignmentsGUI::$assignmentConfigurationHintMessage
private

◆ $assignmentEditingEnabled

ilAssQuestionSkillAssignmentsGUI::$assignmentEditingEnabled
private

◆ $ctrl

ilAssQuestionSkillAssignmentsGUI::$ctrl
private

Definition at line 31 of file class.ilAssQuestionSkillAssignmentsGUI.php.

Referenced by __construct().

◆ $db

ilAssQuestionSkillAssignmentsGUI::$db
private

Definition at line 51 of file class.ilAssQuestionSkillAssignmentsGUI.php.

Referenced by __construct().

◆ $lng

ilAssQuestionSkillAssignmentsGUI::$lng
private

Definition at line 46 of file class.ilAssQuestionSkillAssignmentsGUI.php.

Referenced by __construct().

◆ $questionContainerId

ilAssQuestionSkillAssignmentsGUI::$questionContainerId
private

◆ $questionList

ilAssQuestionSkillAssignmentsGUI::$questionList
private

Definition at line 56 of file class.ilAssQuestionSkillAssignmentsGUI.php.

Referenced by getQuestionList(), and setQuestionList().

◆ $questionOrderSequence

ilAssQuestionSkillAssignmentsGUI::$questionOrderSequence
private

◆ $tpl

ilAssQuestionSkillAssignmentsGUI::$tpl
private

◆ CMD_SAVE_SKILL_POINTS

const ilAssQuestionSkillAssignmentsGUI::CMD_SAVE_SKILL_POINTS = 'saveSkillPoints'

◆ CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM

const ilAssQuestionSkillAssignmentsGUI::CMD_SAVE_SKILL_QUEST_ASSIGN_PROPERTIES_FORM = 'saveSkillQuestionAssignmentPropertiesForm'

◆ CMD_SHOW_SKILL_QUEST_ASSIGN_PROPERTIES_FORM

const ilAssQuestionSkillAssignmentsGUI::CMD_SHOW_SKILL_QUEST_ASSIGN_PROPERTIES_FORM = 'showSkillQuestionAssignmentPropertiesForm'

◆ CMD_SHOW_SKILL_QUEST_ASSIGNS

◆ CMD_SHOW_SKILL_SELECT

const ilAssQuestionSkillAssignmentsGUI::CMD_SHOW_SKILL_SELECT = 'showSkillSelection'

◆ CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION

const ilAssQuestionSkillAssignmentsGUI::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION = 'showSyncOriginalConfirmation'

Definition at line 23 of file class.ilAssQuestionSkillAssignmentsGUI.php.

◆ CMD_SYNC_ORIGINAL

const ilAssQuestionSkillAssignmentsGUI::CMD_SYNC_ORIGINAL = 'syncOriginal'

Definition at line 24 of file class.ilAssQuestionSkillAssignmentsGUI.php.

◆ CMD_UPDATE_SKILL_QUEST_ASSIGNS

const ilAssQuestionSkillAssignmentsGUI::CMD_UPDATE_SKILL_QUEST_ASSIGNS = 'updateSkillQuestionAssignments'

◆ PARAM_SKILL_SELECTION

const ilAssQuestionSkillAssignmentsGUI::PARAM_SKILL_SELECTION = 'skill_ids'

Definition at line 26 of file class.ilAssQuestionSkillAssignmentsGUI.php.


The documentation for this class was generated from the following file: