ILIAS  release_8 Revision v8.24
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 ($input, assQuestion $question)
 
 validateSolutionCompareExpression (ilAssQuestionSolutionComparisonExpression $expression, $question)
 
 keepAssignmentParameters ()
 
 orderQuestionData ($questionData)
 
 handleAssignmentConfigurationHintMessage ()
 
 getSkillSelectorHeader ($questionId)
 
 sortAlphabetically ($array)
 

Private Attributes

ilCtrl $ctrl
 
ilAccessHandler $access
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilDBInterface $db
 
 $questionList
 
 $questionContainerId
 
 $assignmentEditingEnabled
 
 $questionOrderSequence
 
 $assignmentConfigurationHintMessage
 
ILIAS TestQuestionPool InternalRequestService $request
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignmentsGUI::__construct ( ilCtrl  $ctrl,
ilAccessHandler  $access,
ilGlobalTemplateInterface  $tpl,
ilLanguage  $lng,
ilDBInterface  $db 
)

Member Function Documentation

◆ buildQuestionPage()

ilAssQuestionSkillAssignmentsGUI::buildQuestionPage ( assQuestionGUI  $questionGUI)
private

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

614 {
615 $this->tpl->addCss('Services/COPage/css/content.css');
616
617 $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
618
619 $pageGUI->setOutputMode("presentation");
620 $pageGUI->setRenderPageContainer(true);
621
622 $pageGUI->setPresentationTitle($questionGUI->object->getTitleForHTMLOutput());
623
624 $questionGUI->object->setShuffle(false); // dirty, but works ^^
625 $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
626 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
627
628 $pageHTML = $pageGUI->presentation();
629 $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
630
631 return $pageHTML;
632 }
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References assQuestionGUI\getSolutionOutput().

+ Here is the call graph for this function:

◆ buildQuestionSkillAssignment()

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

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

638 {
639 $assignment = new ilAssQuestionSkillAssignment($this->db);
640
641 $assignment->setParentObjId($this->getQuestionContainerId());
642 $assignment->setQuestionId($questionId);
643 $assignment->setSkillBaseId($skillBaseId);
644 $assignment->setSkillTrefId($skillTrefId);
645
646 $assignment->loadFromDb();
647 $assignment->loadAdditionalSkillData();
648
649 return $assignment;
650 }

◆ buildSkillQuestionAssignmentList()

ilAssQuestionSkillAssignmentsGUI::buildSkillQuestionAssignmentList ( )
private

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

564 {
565 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
566 $assignmentList->setParentObjId($this->getQuestionContainerId());
567
568 return $assignmentList;
569 }

◆ buildSkillQuestionAssignmentPropertiesForm()

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

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

467 {
468 $form = new ilAssQuestionSkillAssignmentPropertyFormGUI($this->tpl, $this->ctrl, $this->lng, $this);
469
470 $form->setQuestion($question);
471 $form->setAssignment($assignment);
472 $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
473
474 $form->build();
475
476 return $form;
477 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildSkillSelectorExplorerGUI()

ilAssQuestionSkillAssignmentsGUI::buildSkillSelectorExplorerGUI (   $assignments)
private
Returns
ilSkillSelectorGUI

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

575 {
576 $skillSelectorExplorerGUI = new ilSkillSelectorGUI(
577 $this,
578 self::CMD_SHOW_SKILL_SELECT,
579 $this,
580 self::CMD_UPDATE_SKILL_QUEST_ASSIGNS,
581 self::PARAM_SKILL_SELECTION
582 );
583
584 $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION, true);
585 //$skillSelectorExplorerGUI->setNodeOnclickEnabled(false);
586
587 // parameter name for skill selection is actually taken from value passed to constructor,
588 // but passing a non empty name to setSelectMode is neccessary to keep input fields enabled
589
590 foreach ($assignments as $assignment) {
591 $id = "{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
592 //$skillSelectorExplorerGUI->setNodeSelected($id);
593 $skillSelectorExplorerGUI->setSkillSelected($id);
594 }
595
596 return $skillSelectorExplorerGUI;
597 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Explorer class that works on tree objects (Services/Tree)

References $id.

Referenced by showSkillSelectionCmd(), and updateSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ buildSkillSelectorToolbarGUI()

ilAssQuestionSkillAssignmentsGUI::buildSkillSelectorToolbarGUI ( )
private
Returns
ilToolbarGUI

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

603 {
604 $skillSelectorToolbarGUI = new ilToolbarGUI();
605
606 $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
607 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
608 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
609
610 return $skillSelectorToolbarGUI;
611 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by showSkillSelectionCmd().

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

◆ buildTableGUI()

ilAssQuestionSkillAssignmentsGUI::buildTableGUI ( )
private

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

555 {
556 $table = new ilAssQuestionSkillAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
557 $table->setManipulationsEnabled($this->isAssignmentEditingEnabled());
558 $table->init();
559
560 return $table;
561 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ checkSolutionCompareExpressionInput()

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

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

657 : bool
658 {
659 $errors = array();
660
661 foreach ($input->getValues() as $expression) {
662 $result = $this->validateSolutionCompareExpression($expression, $question);
663
664 if ($result !== true) {
665 $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
666 }
667 }
668
669 if (count($errors)) {
670 $alert = $this->lng->txt('ass_lac_validation_error');
671 $alert .= '<br />' . implode('<br />', $errors);
672 $input->setAlert($alert);
673 return false;
674 }
675
676 return true;
677 }
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, $question)
$errors
Definition: imgupload.php:65

References $errors, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ doesObjectTypeMatch()

ilAssQuestionSkillAssignmentsGUI::doesObjectTypeMatch (   $objectId)
protected

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

764 : bool
765 {
766 return ilObject::_lookupType($objectId) == 'qpl';
767 }
static _lookupType(int $id, bool $reference=false)

References ilObject\_lookupType().

+ Here is the call graph for this function:

◆ executeCommand()

ilAssQuestionSkillAssignmentsGUI::executeCommand ( )

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

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

References ILIAS\Repository\ctrl(), and isAvoidManipulationRedirectRequired().

+ Here is the call graph for this function:

◆ getAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::getAssignmentConfigurationHintMessage ( )

◆ getQuestionContainerId()

ilAssQuestionSkillAssignmentsGUI::getQuestionContainerId ( )
Returns
int

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

References $questionContainerId.

Referenced by saveSkillPointsCmd(), showSkillSelectionCmd(), and updateSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ getQuestionList()

ilAssQuestionSkillAssignmentsGUI::getQuestionList ( )

◆ getQuestionOrderSequence()

ilAssQuestionSkillAssignmentsGUI::getQuestionOrderSequence ( )

◆ getSkillSelectorHeader()

ilAssQuestionSkillAssignmentsGUI::getSkillSelectorHeader (   $questionId)
private

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

738 : string
739 {
740 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
741
742 return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
743 }

References ILIAS\Repository\lng().

Referenced by showSkillSelectionCmd().

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

◆ handleAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::handleAssignmentConfigurationHintMessage ( )
private

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

731 : void
732 {
734 $this->tpl->setOnScreenMessage('info', $this->getAssignmentConfigurationHintMessage());
735 }
736 }

◆ isAssignmentEditingEnabled()

ilAssQuestionSkillAssignmentsGUI::isAssignmentEditingEnabled ( )
Returns
bool

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

References $assignmentEditingEnabled.

Referenced by isAvoidManipulationRedirectRequired().

+ Here is the caller graph for this function:

◆ isAvoidManipulationRedirectRequired()

ilAssQuestionSkillAssignmentsGUI::isAvoidManipulationRedirectRequired (   $command)
private

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

195 : bool
196 {
197 if ($this->isAssignmentEditingEnabled()) {
198 return false;
199 }
200
201 switch ($command) {
204
205 return true;
206 }
207
208 return false;
209 }

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 495 of file class.ilAssQuestionSkillAssignmentsGUI.php.

495 : bool
496 {
497 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
498
499 if (!$questionData['original_id']) {
500 return false;
501 }
502
503 $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
504
505 if (!$this->doesObjectTypeMatch($parentObjId)) {
506 return false;
507 }
508
509 foreach (ilObject::_getAllReferences($parentObjId) as $parentRefId) {
510 if ($this->access->checkAccess('write', '', $parentRefId)) {
511 return true;
512 }
513 }
514
515 return false;
516 }
static lookupParentObjId(int $questionId)
static _getAllReferences(int $id)
get all reference ids for object ID

References ilObject\_getAllReferences(), ILIAS\Repository\access(), and assQuestion\lookupParentObjId().

Referenced by 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 652 of file class.ilAssQuestionSkillAssignmentsGUI.php.

652 : bool
653 {
654 return $this->questionList->isInList($questionId);
655 }

Referenced by saveSkillPointsCmd(), and updateSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ keepAssignmentParameters()

ilAssQuestionSkillAssignmentsGUI::keepAssignmentParameters ( )
private

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

699 : void
700 {
701 $this->ctrl->saveParameter($this, 'question_id');
702 $this->ctrl->saveParameter($this, 'skill_base_id');
703 $this->ctrl->saveParameter($this, 'skill_tref_id');
704 }

References ILIAS\Repository\ctrl().

Referenced by updateSkillQuestionAssignmentsCmd().

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

◆ orderQuestionData()

ilAssQuestionSkillAssignmentsGUI::orderQuestionData (   $questionData)
private

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

707 {
708 $orderedQuestionsData = array();
709
710 if ($this->getQuestionOrderSequence()) {
711 foreach ($this->getQuestionOrderSequence() as $questionId) {
712 $orderedQuestionsData[$questionId] = $questionData[$questionId];
713 }
714
715 return $orderedQuestionsData;
716 }
717
718 foreach ($questionData as $questionId => $data) {
719 $orderedQuestionsData[$questionId] = $data['title'];
720 }
721
722 $orderedQuestionsData = $this->sortAlphabetically($orderedQuestionsData);
723
724 foreach ($orderedQuestionsData as $questionId => $questionTitle) {
725 $orderedQuestionsData[$questionId] = $questionData[$questionId];
726 }
727
728 return $orderedQuestionsData;
729 }

References $data.

◆ saveSkillPointsCmd()

ilAssQuestionSkillAssignmentsGUI::saveSkillPointsCmd ( )
private

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

211 : void
212 {
213 $success = true;
214
215 if (is_array($_POST['skill_points'])) {
216 for ($i = 0; $i < 2; $i++) {
217 foreach ($_POST['skill_points'] as $assignmentKey => $skillPoints) {
218 $assignmentKey = explode(':', $assignmentKey);
219 $skillBaseId = (int) $assignmentKey[0];
220 $skillTrefId = (int) $assignmentKey[1];
221 $questionId = (int) $assignmentKey[2];
222
223 if ($this->isTestQuestion($questionId)) {
224 $assignment = new ilAssQuestionSkillAssignment($this->db);
225
226 if ($i == 0) {
227 if (!$assignment->isValidSkillPoint($skillPoints)) {
228 $success = false;
229 break 2;
230 }
231 continue;
232 }
233
234 $assignment->setParentObjId($this->getQuestionContainerId());
235 $assignment->setQuestionId($questionId);
236 $assignment->setSkillBaseId($skillBaseId);
237 $assignment->setSkillTrefId($skillTrefId);
238
239 if ($assignment->dbRecordExists()) {
240 $assignment->loadFromDb();
241
242 if (!$assignment->hasEvalModeBySolution()) {
243 $assignment->setSkillPoints((int) $skillPoints);
244 $assignment->saveToDb();
245
246 // add skill usage
247 ilSkillUsage::setUsage($this->getQuestionContainerId(), $skillBaseId, $skillTrefId);
248 }
249 }
250 }
251 }
252 }
253 }
254
255 if ($success) {
256 $this->tpl->setOnScreenMessage('success', $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 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('tst_msg_skl_qst_assign_points_not_saved'));
261 }
262 }
showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest=false)
static setUsage(int $a_obj_id, int $a_skill_id, int $a_tref_id, bool $a_use=true)
$i
Definition: metadata.php:41

References $i, ILIAS\Repository\ctrl(), getQuestionContainerId(), ILIAS\Repository\int(), isTestQuestion(), ILIAS\Repository\lng(), ilSkillUsage\setUsage(), and showSkillQuestionAssignmentsCmd().

+ Here is the call graph for this function:

◆ saveSkillQuestionAssignmentPropertiesFormCmd()

ilAssQuestionSkillAssignmentsGUI::saveSkillQuestionAssignmentPropertiesFormCmd ( )
private

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

400 : void
401 {
402 $questionId = (int) $this->request->raw('question_id');
403
404 if ($this->isTestQuestion($questionId)) {
405 $questionGUI = assQuestionGUI::_getQuestionGUI('', $questionId);
406
407 $assignment = $this->buildQuestionSkillAssignment(
408 (int) $this->request->raw('question_id'),
409 (int) $this->request->raw('skill_base_id'),
410 (int) $this->request->raw('skill_tref_id')
411 );
412
414 $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
415 if (!$form->checkInput()) {
416 $form->setValuesByPost();
417 $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
418 return;
419 }
420 $form->setValuesByPost();
421
422 if ($form->getItemByPostVar('eval_mode')) {
423 $assignment->setEvalMode($form->getItemByPostVar('eval_mode')->getValue());
424 } else {
426 }
427
428 if ($assignment->hasEvalModeBySolution()) {
429 $solCmpExprInput = $form->getItemByPostVar('solution_compare_expressions');
430
431 if (!$this->checkSolutionCompareExpressionInput($solCmpExprInput, $questionGUI->object)) {
432 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("form_input_not_valid"));
433 $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
434 return;
435 }
436
437 $assignment->initSolutionComparisonExpressionList();
438 $assignment->getSolutionComparisonExpressionList()->reset();
439
440 foreach ($solCmpExprInput->getValues() as $expression) {
441 $assignment->getSolutionComparisonExpressionList()->add($expression);
442 }
443 } else {
444 $assignment->setSkillPoints($form->getItemByPostVar('q_res_skill_points')->getValue());
445 }
446
447 $assignment->saveToDb();
448
449 // add skill usage
451 $this->getQuestionContainerId(),
452 (int) $this->request->raw('skill_base_id'),
453 (int) $this->request->raw('skill_tref_id')
454 );
455
456 $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_qst_skl_assign_properties_modified'), true);
457
458 if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
459 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
460 }
461 }
462
463 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
464 }
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
checkSolutionCompareExpressionInput($input, assQuestion $question)
showSkillQuestionAssignmentPropertiesFormCmd(assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
buildSkillQuestionAssignmentPropertiesForm(assQuestion $question, ilAssQuestionSkillAssignment $assignment)

References assQuestionGUI\_getQuestionGUI(), ILIAS\Repository\ctrl(), ilAssQuestionSkillAssignment\EVAL_MODE_BY_QUESTION_RESULT, ILIAS\Repository\int(), ILIAS\Repository\lng(), and ilSkillUsage\setUsage().

+ Here is the call graph for this function:

◆ setAssignmentConfigurationHintMessage()

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

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

110 : void
111 {
112 $this->assignmentConfigurationHintMessage = $assignmentConfigurationHintMessage;
113 }

References $assignmentConfigurationHintMessage.

◆ setAssignmentEditingEnabled()

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

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

166 : void
167 {
168 $this->assignmentEditingEnabled = $assignmentEditingEnabled;
169 }

References $assignmentEditingEnabled.

◆ setQuestionContainerId()

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

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

150 : void
151 {
152 $this->questionContainerId = $questionContainerId;
153 }

References $questionContainerId.

◆ setQuestionList()

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

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

134 : void
135 {
136 $this->questionList = $questionList;
137 }

References $questionList.

◆ setQuestionOrderSequence()

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

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

118 : void
119 {
120 $this->questionOrderSequence = $questionOrderSequence;
121 }

References $questionOrderSequence.

◆ showSkillQuestionAssignmentPropertiesFormCmd()

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

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

374 : void {
376
378
379 if ($questionGUI === null) {
380 $questionGUI = assQuestionGUI::_getQuestionGUI('', (int) $this->request->raw('question_id'));
381 }
382
383 if ($assignment === null) {
384 $assignment = $this->buildQuestionSkillAssignment(
385 (int) $this->request->raw('question_id'),
386 (int) $this->request->raw('skill_base_id'),
387 (int) $this->request->raw('skill_tref_id')
388 );
389 }
390
391 if ($form === null) {
392 $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
393 }
394
395 $questionPageHTML = $this->buildQuestionPage($questionGUI);
396
397 $this->tpl->setContent($this->ctrl->getHTML($form) . '<br />' . $questionPageHTML);
398 }

◆ showSkillQuestionAssignmentsCmd()

ilAssQuestionSkillAssignmentsGUI::showSkillQuestionAssignmentsCmd (   $loadSkillPointsFromRequest = false)
private

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

479 : void
480 {
482
483 $table = $this->buildTableGUI();
484 $table->loadSkillPointsFromRequest($loadSkillPointsFromRequest);
485
486 $assignmentList = $this->buildSkillQuestionAssignmentList();
487 $assignmentList->loadFromDb();
488 $assignmentList->loadAdditionalSkillData();
489 $table->setSkillQuestionAssignmentList($assignmentList);
490 $table->setData($this->orderQuestionData($this->questionList->getQuestionDataArray()));
491
492 $this->tpl->setContent($this->ctrl->getHTML($table));
493 }

References ILIAS\Repository\ctrl().

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 334 of file class.ilAssQuestionSkillAssignmentsGUI.php.

334 : void
335 {
336 $this->ctrl->saveParameter($this, 'question_id');
337 $questionId = (int) $this->request->raw('question_id');
338
339 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
340 $assignmentList->setParentObjId($this->getQuestionContainerId());
341 $assignmentList->loadFromDb();
342
343 $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI(
344 $assignmentList->getAssignmentsByQuestionId($questionId)
345 );
346
347 if (!$skillSelectorExplorerGUI->handleCommand()) {
348 $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'Modules/TestQuestionPool');
349
350 $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($questionId));
351
352 $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
353
354 $skillSelectorToolbarGUI->setOpenFormTag(true);
355 $skillSelectorToolbarGUI->setCloseFormTag(false);
356 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
357 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
358
359 $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
360
361 $skillSelectorToolbarGUI->setOpenFormTag(false);
362 $skillSelectorToolbarGUI->setCloseFormTag(true);
363 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
364 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
365
366 $this->tpl->setContent($tpl->get());
367 }
368 }
special template class to simplify handling of ITX/PEAR
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References $tpl, buildSkillSelectorExplorerGUI(), buildSkillSelectorToolbarGUI(), ILIAS\Repository\ctrl(), ilGlobalTemplateInterface\get(), ilUtil\getImagePath(), getQuestionContainerId(), getSkillSelectorHeader(), ILIAS\Repository\int(), and ilGlobalTemplateInterface\setVariable().

+ Here is the call graph for this function:

◆ showSyncOriginalConfirmationCmd()

ilAssQuestionSkillAssignmentsGUI::showSyncOriginalConfirmationCmd ( )
private

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

518 : void
519 {
520 $questionId = (int) $this->request->raw('question_id');
521
522 $confirmation = new ilConfirmationGUI();
523
524 $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
525
526 $confirmation->setFormAction($this->ctrl->getFormAction($this));
527 $confirmation->addHiddenItem('question_id', $questionId);
528 $confirmation->setConfirm($this->lng->txt('yes'), self::CMD_SYNC_ORIGINAL);
529 $confirmation->setCancel($this->lng->txt('no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
530
531 $this->tpl->setContent($this->ctrl->getHTML($confirmation));
532 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ sortAlphabetically()

ilAssQuestionSkillAssignmentsGUI::sortAlphabetically (   $array)
private

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

746 {
747 $flags = SORT_REGULAR;
748
749 if (defined('SORT_NATURAL')) {
750 $flags = SORT_NATURAL;
751 } elseif (defined('SORT_STRING')) {
752 $flags = SORT_STRING;
753 }
754
755 if (defined('SORT_FLAG_CASE')) {
756 $flags = $flags | SORT_FLAG_CASE;
757 }
758
759 asort($array, $flags);
760
761 return $array;
762 }

◆ syncOriginalCmd()

ilAssQuestionSkillAssignmentsGUI::syncOriginalCmd ( )
private

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

534 : void
535 {
536 $questionId = (int) $_POST['question_id'];
537
538 if ($this->isTestQuestion($questionId) && $this->isSyncOriginalPossibleAndAllowed($questionId)) {
539 $question = assQuestion::_instantiateQuestion($questionId);
540
541 $question->syncSkillAssignments(
542 $question->getObjId(),
543 $question->getId(),
544 $question->lookupParentObjId($question->getOriginalId()),
545 $question->getOriginalId()
546 );
547
548 $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_qst_skl_assign_synced_to_orig'), true);
549 }
550
551 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
552 }
static _instantiateQuestion(int $question_id)

References assQuestion\_instantiateQuestion(), ILIAS\Repository\ctrl(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ updateSkillQuestionAssignmentsCmd()

ilAssQuestionSkillAssignmentsGUI::updateSkillQuestionAssignmentsCmd ( )
private

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

264 : void
265 {
266 $questionId = (int) $this->request->raw('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 // add skill usage
298 ilSkillUsage::setUsage($this->getQuestionContainerId(), $skillBaseId, $skillTrefId);
299 }
300
301 $handledSkills[$skillId] = $skill;
302 }
303 }
304
305 foreach ($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment) {
306 if (isset($handledSkills["{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"])) {
307 continue;
308 }
309
310 $assignment->deleteFromDb();
311
312 // remove skill usage
313 if (!$assignment->isSkillUsed()) {
315 $assignment->getParentObjId(),
316 $assignment->getSkillBaseId(),
317 $assignment->getSkillTrefId(),
318 false
319 );
320 }
321 }
322
323 $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_qst_skl_assigns_updated'), true);
324
325 if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
327 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
328 }
329 }
330
331 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
332 }

References buildSkillSelectorExplorerGUI(), ILIAS\Repository\ctrl(), ilAssQuestionSkillAssignment\DEFAULT_COMPETENCE_POINTS, ilAssQuestionSkillAssignment\EVAL_MODE_BY_QUESTION_RESULT, getQuestionContainerId(), ILIAS\Repository\int(), isSyncOriginalPossibleAndAllowed(), isTestQuestion(), keepAssignmentParameters(), ILIAS\Repository\lng(), and ilSkillUsage\setUsage().

+ Here is the call graph for this function:

◆ validateSolutionCompareExpression()

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

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

679 : bool
680 {
681 try {
682 $conditionParser = new ilAssLacConditionParser();
683 $conditionComposite = $conditionParser->parse($expression->getExpression());
684 $questionProvider = new ilAssLacQuestionProvider();
685 $questionProvider->setQuestion($question);
686 $conditionValidator = new ilAssLacCompositeValidator($questionProvider);
687 $conditionValidator->validate($conditionComposite);
688 } catch (ilAssLacException $e) {
689 if ($e instanceof ilAssLacFormAlertProvider) {
690 return $e->getFormAlert($this->lng);
691 }
692
693 throw $e;
694 }
695
696 return true;
697 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilAssQuestionSkillAssignmentsGUI::$access
private

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

Referenced by __construct().

◆ $assignmentConfigurationHintMessage

ilAssQuestionSkillAssignmentsGUI::$assignmentConfigurationHintMessage
private

◆ $assignmentEditingEnabled

ilAssQuestionSkillAssignmentsGUI::$assignmentEditingEnabled
private

◆ $ctrl

ilCtrl ilAssQuestionSkillAssignmentsGUI::$ctrl
private

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

Referenced by __construct().

◆ $db

ilDBInterface ilAssQuestionSkillAssignmentsGUI::$db
private

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

Referenced by __construct().

◆ $lng

ilLanguage ilAssQuestionSkillAssignmentsGUI::$lng
private

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

Referenced by __construct().

◆ $questionContainerId

ilAssQuestionSkillAssignmentsGUI::$questionContainerId
private

◆ $questionList

ilAssQuestionSkillAssignmentsGUI::$questionList
private

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

Referenced by getQuestionList(), and setQuestionList().

◆ $questionOrderSequence

ilAssQuestionSkillAssignmentsGUI::$questionOrderSequence
private

◆ $request

ILIAS TestQuestionPool InternalRequestService ilAssQuestionSkillAssignmentsGUI::$request
private

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

◆ $tpl

ilGlobalTemplateInterface 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 41 of file class.ilAssQuestionSkillAssignmentsGUI.php.

◆ CMD_SYNC_ORIGINAL

const ilAssQuestionSkillAssignmentsGUI::CMD_SYNC_ORIGINAL = 'syncOriginal'

Definition at line 42 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 44 of file class.ilAssQuestionSkillAssignmentsGUI.php.


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