ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
ilAssQuestionSkillAssignmentsGUI Class Reference
+ Collaboration diagram for ilAssQuestionSkillAssignmentsGUI:

Public Member Functions

 __construct (private readonly ilCtrl $ctrl, private readonly ilAccessHandler $access, private readonly ilGlobalTemplateInterface $tpl, private readonly ilLanguage $lng, private readonly ilDBInterface $db, private readonly RequestDataCollectorInterface $request_data_collector, private readonly SkillUsageService $skill_usage_service, private readonly UIFactory $ui_factory, private readonly UIRenderer $ui_renderer, private readonly Refinery $refinery, private readonly HTTP $http, private readonly ilToolbarGUI $toolbar, private readonly ilTabsGUI $tabs, private readonly ?ilObjTest $test_object=null)
 
 getQuestionOrderSequence ()
 
 getAssignmentConfigurationHintMessage ()
 
 setAssignmentConfigurationHintMessage (?string $assignmentConfigurationHintMessage)
 
 setQuestionOrderSequence ($questionOrderSequence)
 
 getQuestionList ()
 
 setQuestionList ($questionList)
 
 getQuestionContainerId ()
 
 setQuestionContainerId ($questionContainerId)
 
 isAssignmentEditingEnabled ()
 
 setAssignmentEditingEnabled ($assignmentEditingEnabled)
 
 executeCommand ()
 

Data Fields

const CMD_SHOW_SKILL_QUEST_ASSIGNS = 'showSkillQuestionAssignments'
 
const CMD_EDIT_SKILL_QUEST_ASSIGNS = 'editSkillQuestionAssignment'
 
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

 modifyTabs ()
 
 isAvoidManipulationRedirectRequired ($command)
 
 saveSkillPointsCmd ()
 
 updateSkillQuestionAssignmentsCmd ()
 
 showSkillSelectionCmd ()
 
 showSkillQuestionAssignmentPropertiesFormCmd (?assQuestionGUI $question_gui=null, ?ilAssQuestionSkillAssignment $assignment=null, ?ilPropertyFormGUI $form=null)
 
 buildSkillQuestionAssignmentPropertiesForm (assQuestion $question, ilAssQuestionSkillAssignment $assignment)
 
 hasFixedQuestionSetSkillAssignsLowerThanBarrier ()
 
 getSkillAssignBarrierInfo ()
 
 editSkillQuestionAssignmentCmd ()
 
 isSyncOriginalPossibleAndAllowed (int $questionId)
 
 showSyncOriginalConfirmationCmd ()
 
 syncOriginalCmd ()
 
 buildSkillQuestionAssignmentList ()
 
 buildSkillSelectorExplorerGUI ($assignments)
 
 buildSkillSelectorToolbarGUI ()
 
 buildQuestionPage (assQuestionGUI $question_gui)
 
 buildQuestionSkillAssignment (int $question_id, int $skill_base_id, int $skill_tref_id)
 
 isTestQuestion ($questionId)
 
 checkSolutionCompareExpressionInput (ilLogicalAnswerComparisonExpressionInputGUI $input, assQuestion $question)
 
 checkPointsAreInt (ilPropertyFormGUI $form)
 
 validateSolutionCompareExpression (ilAssQuestionSolutionComparisonExpression $expression, assQuestion $question)
 
 keepAssignmentParameters ()
 
 handleAssignmentConfigurationHintMessage ()
 
 getSkillSelectorHeader (int $questionId)
 
 sortAlphabetically ($array)
 

Private Attributes

ilAssQuestionList $question_list
 
int $question_container_id
 
bool $assignment_editing_enabled
 
string $assignment_configuration_hint_message = null
 
array $questionOrderSequence
 
DataFactory $data_factory
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignmentsGUI::__construct ( private readonly ilCtrl  $ctrl,
private readonly ilAccessHandler  $access,
private readonly ilGlobalTemplateInterface  $tpl,
private readonly ilLanguage  $lng,
private readonly ilDBInterface  $db,
private readonly RequestDataCollectorInterface  $request_data_collector,
private readonly SkillUsageService  $skill_usage_service,
private readonly UIFactory  $ui_factory,
private readonly UIRenderer  $ui_renderer,
private readonly Refinery  $refinery,
private readonly HTTP  $http,
private readonly ilToolbarGUI  $toolbar,
private readonly ilTabsGUI  $tabs,
private readonly ?ilObjTest  $test_object = null 
)

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

84 {
85 $this->data_factory = new DataFactory();
86 }

Member Function Documentation

◆ buildQuestionPage()

ilAssQuestionSkillAssignmentsGUI::buildQuestionPage ( assQuestionGUI  $question_gui)
private

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

715 {
716 $this->tpl->addCss('./assets/css/content.css');
717
718 $page_gui = new ilAssQuestionPageGUI($question_gui->getObject()->getId());
719 $page_gui->setFileDownloadLink($question_gui->buildFileDownloadLink());
720 $page_gui->setOutputMode("presentation");
721 $page_gui->setRenderPageContainer(true);
722
723 $page_gui->setPresentationTitle($question_gui->getObject()->getTitleForHTMLOutput());
724
725 $question = $question_gui->getObject();
726 $question->setShuffle(false); // dirty, but works ^^
727 $question_gui->setObject($question);
728 $page_gui->setQuestionHTML([
729 $question_gui->getObject()->getId() => $question_gui->getSolutionOutput(0, 0, false, false, true, false, true, false, true)
730 ]);
731
732 return preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $page_gui->presentation());
733
734 }
setObject(assQuestion $question)
getSolutionOutput(int $active_id, ?int $pass=null, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_inline_feedback=true)
Question page GUI class.

References assQuestionGUI\buildFileDownloadLink(), assQuestionGUI\getObject(), assQuestionGUI\getSolutionOutput(), assQuestionGUI\setObject(), and assQuestion\setShuffle().

+ Here is the call graph for this function:

◆ buildQuestionSkillAssignment()

ilAssQuestionSkillAssignmentsGUI::buildQuestionSkillAssignment ( int  $question_id,
int  $skill_base_id,
int  $skill_tref_id 
)
private
Returns
ilAssQuestionSkillAssignment

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

744 $assignment = new ilAssQuestionSkillAssignment($this->db);
745
746 $assignment->setParentObjId($this->getQuestionContainerId());
747 $assignment->setQuestionId($question_id);
748 $assignment->setSkillBaseId($skill_base_id);
749 $assignment->setSkillTrefId($skill_tref_id);
750
751 $assignment->loadFromDb();
752 $assignment->loadAdditionalSkillData();
753
754 return $assignment;
755 }

◆ buildSkillQuestionAssignmentList()

ilAssQuestionSkillAssignmentsGUI::buildSkillQuestionAssignmentList ( )
private

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

665 {
666 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
667 $assignmentList->setParentObjId($this->getQuestionContainerId());
668
669 return $assignmentList;
670 }

◆ buildSkillQuestionAssignmentPropertiesForm()

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

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

480 $form->setQuestion($question);
481 $form->setAssignment($assignment);
482 $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
483 $form->build();
484
485 return $form;
486 }

◆ buildSkillSelectorExplorerGUI()

ilAssQuestionSkillAssignmentsGUI::buildSkillSelectorExplorerGUI (   $assignments)
private
Returns
ilSkillSelectorGUI

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

676 {
677 $skillSelectorExplorerGUI = new ilSkillSelectorGUI(
678 $this,
679 self::CMD_SHOW_SKILL_SELECT,
680 $this,
681 self::CMD_UPDATE_SKILL_QUEST_ASSIGNS,
682 self::PARAM_SKILL_SELECTION
683 );
684
685 $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION, true);
686 //$skillSelectorExplorerGUI->setNodeOnclickEnabled(false);
687
688 // parameter name for skill selection is actually taken from value passed to constructor,
689 // but passing a non empty name to setSelectMode is neccessary to keep input fields enabled
690
691 foreach ($assignments as $assignment) {
692 $id = "{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
693 //$skillSelectorExplorerGUI->setNodeSelected($id);
694 $skillSelectorExplorerGUI->setSkillSelected($id);
695 }
696
697 return $skillSelectorExplorerGUI;
698 }
$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 703 of file class.ilAssQuestionSkillAssignmentsGUI.php.

704 {
705 $skillSelectorToolbarGUI = new ilToolbarGUI();
706
707 $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
708 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
709 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_cancel_skill_assigns_update'), self::CMD_EDIT_SKILL_QUEST_ASSIGNS);
710
711 return $skillSelectorToolbarGUI;
712 }
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:

◆ checkPointsAreInt()

ilAssQuestionSkillAssignmentsGUI::checkPointsAreInt ( ilPropertyFormGUI  $form)
private

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

784 : bool
785 {
786 $points_result = $form->getInput('q_res_skill_points');
787 $invalid_values_solution = array_filter(
788 $form->getInput('solution_compare_expressions')['points'],
789 fn(string $v): bool => $v != (int) $v
790 );
791 if ($points_result == (int) $points_result
792 && $invalid_values_solution === []) {
793 return true;
794 }
795 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('numeric_only'));
796 return false;
797 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...

References ilPropertyFormGUI\getInput(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ checkSolutionCompareExpressionInput()

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

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

765 : bool {
766 $errors = [];
767
768 foreach ($input->getValues() as $expression) {
769 $result = $this->validateSolutionCompareExpression($expression, $question);
770
771 if ($result !== true) {
772 $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
773 }
774 }
775
776 if ($errors !== []) {
777 $input->setAlert($this->lng->txt('ass_lac_validation_error') . '<br />' . implode('<br />', $errors));
778 return false;
779 }
780
781 return true;
782 }
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, assQuestion $question)

◆ doesObjectTypeMatch()

ilAssQuestionSkillAssignmentsGUI::doesObjectTypeMatch (   $objectId)
protected

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

860 : bool
861 {
862 return ilObject::_lookupType($objectId) == 'qpl';
863 }
static _lookupType(int $id, bool $reference=false)

References ilObject\_lookupType().

+ Here is the call graph for this function:

◆ editSkillQuestionAssignmentCmd()

ilAssQuestionSkillAssignmentsGUI::editSkillQuestionAssignmentCmd ( )
private

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

558 : void
559 {
560 $assignment_list = $this->buildSkillQuestionAssignmentList();
561 $assignment_list->loadFromDb();
562 $assignment_list->loadAdditionalSkillData();
563
565
566 $edit_uri = $this->data_factory->uri(
567 ILIAS_HTTP_PATH . '/' . $this->ctrl->getLinkTargetByClass(
568 self::class,
569 self::CMD_SHOW_SKILL_QUEST_ASSIGN_PROPERTIES_FORM
570 )
571 );
572
573 $this->ctrl->setParameterByClass(
574 ilAssQuestionSkillAssignmentsGUI::class,
575 'q_id',
576 $this->request_data_collector->getQuestionId()
577 );
578 $this->toolbar->addComponent(
579 $this->ui_factory->button()->standard(
580 $this->lng->txt('tst_manage_competence_select_skills'),
581 $this->ctrl->getLinkTargetByClass(
582 [ilAssQuestionSkillAssignmentsGUI::class],
583 self::CMD_SHOW_SKILL_SELECT
584 )
585 )->withUnavailableAction(!$this->isAssignmentEditingEnabled())
586 );
587 $this->ctrl->setParameterByClass(ilAssQuestionSkillAssignmentsGUI::class, 'q_id', null);
588
590 $this->request_data_collector,
591 $assignment_list,
592 $this->ui_factory,
593 $this->lng,
595 $this->tpl,
596 [
597 EditSkillsOfQuestionTableEditAction::ACTION_ID => new EditSkillsOfQuestionTableEditAction(
598 $this->ui_factory,
599 $this->lng,
601 )
602 ]
603 ))
604 ))->getComponents(new URLBuilder($edit_uri));
605
606 $this->tpl->setContent($this->ui_renderer->render($components));
607 }
$components

References $components, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by updateSkillQuestionAssignmentsCmd().

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

◆ executeCommand()

ilAssQuestionSkillAssignmentsGUI::executeCommand ( )

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

159 : void
160 {
161 $nextClass = $this->ctrl->getNextClass();
162
163 $command = $this->ctrl->getCmd(self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
164
165 if ($this->isAvoidManipulationRedirectRequired($command)) {
166 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
167 }
168
170
171 if (in_array($command, [self::CMD_EDIT_SKILL_QUEST_ASSIGNS])) {
172 $this->modifyTabs();
173 }
174
175 switch ($nextClass) {
176 case strtolower(__CLASS__):
177 case '':
178
179 $command .= 'Cmd';
180 $this->$command();
181 break;
182
183 default:
184
185 throw new ilTestQuestionPoolException('unsupported next class in ctrl flow');
186 }
187 }

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

+ Here is the call graph for this function:

◆ getAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::getAssignmentConfigurationHintMessage ( )

◆ getQuestionContainerId()

ilAssQuestionSkillAssignmentsGUI::getQuestionContainerId ( )
Returns
int

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

References $question_container_id.

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

+ Here is the caller graph for this function:

◆ getQuestionList()

ilAssQuestionSkillAssignmentsGUI::getQuestionList ( )

◆ getQuestionOrderSequence()

ilAssQuestionSkillAssignmentsGUI::getQuestionOrderSequence ( )

◆ getSkillAssignBarrierInfo()

ilAssQuestionSkillAssignmentsGUI::getSkillAssignBarrierInfo ( )
private

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

547 : string
548 {
549 return !$this->test_object instanceof ilObjTest
550 ? ''
551 : sprintf(
552 $this->lng->txt('tst_skill_triggerings_num_req_answers_not_reached_warn'),
553 $this->test_object->getGlobalSettings()->getSkillTriggeringNumberOfAnswers()
554 );
555
556 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getSkillSelectorHeader()

ilAssQuestionSkillAssignmentsGUI::getSkillSelectorHeader ( int  $questionId)
private

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

833 : string
834 {
835 return sprintf(
836 $this->lng->txt('qpl_qst_skl_selection_for_question_header'),
837 $this->question_list->getDataArrayForQuestionId($questionId)['title']
838 );
839 }

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

826 : void
827 {
829 $this->tpl->setOnScreenMessage('info', $this->getAssignmentConfigurationHintMessage());
830 }
831 }

◆ hasFixedQuestionSetSkillAssignsLowerThanBarrier()

ilAssQuestionSkillAssignmentsGUI::hasFixedQuestionSetSkillAssignsLowerThanBarrier ( )
private

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

534 : bool
535 {
536 if (!$this->test_object?->isFixedTest()) {
537 return false;
538 }
539
540 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
541 $assignmentList->setParentObjId($this->test_object->getId());
542 $assignmentList->loadFromDb();
543
544 return $assignmentList->hasSkillsAssignedLowerThanBarrier();
545 }

◆ isAssignmentEditingEnabled()

ilAssQuestionSkillAssignmentsGUI::isAssignmentEditingEnabled ( )
Returns
bool

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

References $assignment_editing_enabled.

Referenced by isAvoidManipulationRedirectRequired().

+ Here is the caller graph for this function:

◆ isAvoidManipulationRedirectRequired()

ilAssQuestionSkillAssignmentsGUI::isAvoidManipulationRedirectRequired (   $command)
private

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

210 : bool
211 {
212 if ($this->isAssignmentEditingEnabled()) {
213 return false;
214 }
215
216 switch ($command) {
219
220 return true;
221 }
222
223 return false;
224 }

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 ( int  $questionId)
private

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

609 : bool
610 {
611 $questionData = $this->question_list->getDataArrayForQuestionId($questionId);
612
613 if (!$questionData['original_id']) {
614 return false;
615 }
616
617 $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
618
619 if ($parentObjId === null || !$this->doesObjectTypeMatch($parentObjId)) {
620 return false;
621 }
622
623 foreach (ilObject::_getAllReferences($parentObjId) as $parentRefId) {
624 if ($this->access->checkAccess('write', '', $parentRefId)) {
625 return true;
626 }
627 }
628
629 return false;
630 }
static lookupParentObjId(int $question_id)
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 757 of file class.ilAssQuestionSkillAssignmentsGUI.php.

757 : bool
758 {
759 return $this->question_list->isInList($questionId);
760 }

Referenced by saveSkillPointsCmd(), and updateSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ keepAssignmentParameters()

ilAssQuestionSkillAssignmentsGUI::keepAssignmentParameters ( )
private

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

819 : void
820 {
821 $this->ctrl->saveParameter($this, 'q_id');
822 $this->ctrl->saveParameter($this, 'skill_base_id');
823 $this->ctrl->saveParameter($this, 'skill_tref_id');
824 }

References ILIAS\Repository\ctrl().

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

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

◆ modifyTabs()

ilAssQuestionSkillAssignmentsGUI::modifyTabs ( )
private

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

189 : void
190 {
191 $this->tabs->clearTargets();
192 $this->tabs->setBackTarget(
193 $this->lng->txt('back'),
194 $this->ctrl->getLinkTargetByClass(
195 ilAssQuestionSkillAssignmentsGUI::class,
197 )
198 );
199 $this->tabs->addTab(
200 strtolower(ilAssQuestionSkillAssignmentsGUI::class),
201 $this->lng->txt('qpl_skl_sub_tab_quest_assign'),
202 $this->ctrl->getLinkTargetByClass(
203 ilAssQuestionSkillAssignmentsGUI::class,
205 )
206 );
207 $this->tabs->activateTab(strtolower(ilAssQuestionSkillAssignmentsGUI::class));
208 }

References CMD_EDIT_SKILL_QUEST_ASSIGNS, CMD_SHOW_SKILL_QUEST_ASSIGNS, ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

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

◆ saveSkillPointsCmd()

ilAssQuestionSkillAssignmentsGUI::saveSkillPointsCmd ( )
private

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

226 : void
227 {
228 $success = true;
229 $skill_points = $this->request_data_collector->raw('skill_points');
230
231 for ($i = 0; $i < 2; $i++) {
232 foreach ($skill_points as $assignment_key => $skill_point) {
233 $assignment_key = explode(':', $assignment_key);
234 $skillBaseId = (int) $assignment_key[0];
235 $skillTrefId = (int) $assignment_key[1];
236 $questionId = (int) $assignment_key[2];
237
238 if ($this->isTestQuestion($questionId)) {
239 $assignment = new ilAssQuestionSkillAssignment($this->db);
240
241 if ($i === 0) {
242 if (!$assignment->isValidSkillPoint($skill_point)) {
243 $success = false;
244 break 2;
245 }
246 continue;
247 }
248
249 $assignment->setParentObjId($this->getQuestionContainerId());
250 $assignment->setQuestionId($questionId);
251 $assignment->setSkillBaseId($skillBaseId);
252 $assignment->setSkillTrefId($skillTrefId);
253
254 if ($assignment->dbRecordExists()) {
255 $assignment->loadFromDb();
256
257 if (!$assignment->hasEvalModeBySolution()) {
258 $assignment->setSkillPoints($skill_point);
259 $assignment->saveToDb();
260
261 // add skill usage
262 $this->skill_usage_service->addUsage($this->getQuestionContainerId(), $skillBaseId, $skillTrefId);
263 }
264 }
265 }
266
267 }
268 }
269
270 if ($success) {
271 $this->tpl->setOnScreenMessage('success', $this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
272 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
273 return;
274 }
275
276 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('tst_msg_skl_qst_assign_points_not_saved'));
277 $this->showSkillQuestionAssignmentsCmd(true);
278 }

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

+ Here is the call graph for this function:

◆ setAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::setAssignmentConfigurationHintMessage ( ?string  $assignmentConfigurationHintMessage)

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

98 : void
99 {
100 $this->assignment_configuration_hint_message = $assignmentConfigurationHintMessage;
101 }

◆ setAssignmentEditingEnabled()

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

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

154 : void
155 {
156 $this->assignment_editing_enabled = $assignmentEditingEnabled;
157 }

◆ setQuestionContainerId()

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

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

138 : void
139 {
140 $this->question_container_id = $questionContainerId;
141 }

◆ setQuestionList()

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

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

122 : void
123 {
124 $this->question_list = $questionList;
125 }

◆ setQuestionOrderSequence()

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

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

106 : void
107 {
108 $this->questionOrderSequence = $questionOrderSequence;
109 }

References $questionOrderSequence.

◆ showSkillQuestionAssignmentPropertiesFormCmd()

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

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

389 : void {
391
393
394 $question_id = $this->request_data_collector->getQuestionId();
395 $question_gui ??= assQuestionGUI::_getQuestionGUI('', $question_id);
396
397 $row_id_parameter = $this->request_data_collector->getRowIdParameter(EditSkillsOfQuestionTableActions::FULL_ROW_ID_PARAMETER);
398 [1 => $skill_base_id, 2 => $skill_tref_id] = explode('_', $row_id_parameter);
399 $assignment ??= $this->buildQuestionSkillAssignment($question_id, (int) $skill_base_id, (int) $skill_tref_id);
400
401 $form ??= $this->buildSkillQuestionAssignmentPropertiesForm($question_gui->getObject(), $assignment);
402
403 $this->tpl->setContent($form->getHTML() . '<br />' . $this->buildQuestionPage($question_gui));
404 }
static _getQuestionGUI(string $question_type='', int $question_id=-1)
Creates a question gui representation and returns the alias to the question gui.
buildQuestionSkillAssignment(int $question_id, int $skill_base_id, int $skill_tref_id)
buildSkillQuestionAssignmentPropertiesForm(assQuestion $question, ilAssQuestionSkillAssignment $assignment)

◆ showSkillSelectionCmd()

ilAssQuestionSkillAssignmentsGUI::showSkillSelectionCmd ( )
private

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

349 : void
350 {
352 $question_id = $this->request_data_collector->getQuestionId();
353
354 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
355 $assignmentList->setParentObjId($this->getQuestionContainerId());
356 $assignmentList->loadFromDb();
357
358 $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI(
359 $assignmentList->getAssignmentsByQuestionId($question_id)
360 );
361
362 if (!$skillSelectorExplorerGUI->handleCommand()) {
363 $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'components/ILIAS/TestQuestionPool');
364
365 $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($question_id));
366
367 $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
368
369 $skillSelectorToolbarGUI->setOpenFormTag(true);
370 $skillSelectorToolbarGUI->setCloseFormTag(false);
371 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("nav/arrow_upright.svg"), " ");
372 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
373
374 $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
375
376 $skillSelectorToolbarGUI->setOpenFormTag(false);
377 $skillSelectorToolbarGUI->setCloseFormTag(true);
378 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("nav/arrow_downright.svg"), " ");
379 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
380
381 $this->tpl->setContent($tpl->get());
382 }
383 }
special template class to simplify handling of ITX/PEAR
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References buildSkillSelectorExplorerGUI(), buildSkillSelectorToolbarGUI(), ILIAS\Repository\ctrl(), ilUtil\getImagePath(), getQuestionContainerId(), getSkillSelectorHeader(), and keepAssignmentParameters().

+ Here is the call graph for this function:

◆ showSyncOriginalConfirmationCmd()

ilAssQuestionSkillAssignmentsGUI::showSyncOriginalConfirmationCmd ( )
private

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

632 : void
633 {
634 $confirmation = new ilConfirmationGUI();
635 $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
636
637 $confirmation->setFormAction($this->ctrl->getFormAction($this));
638 $confirmation->addHiddenItem('q_id', $this->request_data_collector->getQuestionId());
639 $confirmation->setConfirm($this->lng->txt('yes'), self::CMD_SYNC_ORIGINAL);
640 $confirmation->setCancel($this->lng->txt('no'), self::CMD_EDIT_SKILL_QUEST_ASSIGNS);
641
642 $this->tpl->setContent($this->ctrl->getHTML($confirmation));
643 }
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().

+ Here is the call graph for this function:

◆ sortAlphabetically()

ilAssQuestionSkillAssignmentsGUI::sortAlphabetically (   $array)
private

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

842 {
843 $flags = SORT_REGULAR;
844
845 if (defined('SORT_NATURAL')) {
846 $flags = SORT_NATURAL;
847 } elseif (defined('SORT_STRING')) {
848 $flags = SORT_STRING;
849 }
850
851 if (defined('SORT_FLAG_CASE')) {
852 $flags = $flags | SORT_FLAG_CASE;
853 }
854
855 asort($array, $flags);
856
857 return $array;
858 }

◆ syncOriginalCmd()

ilAssQuestionSkillAssignmentsGUI::syncOriginalCmd ( )
private

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

645 : void
646 {
647 $question_id = $this->request_data_collector->getQuestionId();
648 if ($this->isTestQuestion($question_id) && $this->isSyncOriginalPossibleAndAllowed($question_id)) {
649 $question = assQuestion::instantiateQuestion($question_id);
650
651 $question->syncSkillAssignments(
652 $question->getObjId(),
653 $question->getId(),
654 $question->lookupParentObjId($question->getOriginalId()),
655 $question->getOriginalId()
656 );
657
658 $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_qst_skl_assign_synced_to_orig'), true);
659 }
660
661 $this->ctrl->redirect($this, self::CMD_EDIT_SKILL_QUEST_ASSIGNS);
662 }
static instantiateQuestion(int $question_id)

References ILIAS\Repository\ctrl(), assQuestion\getId(), assQuestion\getObjId(), assQuestion\getOriginalId(), assQuestion\instantiateQuestion(), ILIAS\Repository\lng(), assQuestion\lookupParentObjId(), and assQuestion\syncSkillAssignments().

+ Here is the call graph for this function:

◆ updateSkillQuestionAssignmentsCmd()

ilAssQuestionSkillAssignmentsGUI::updateSkillQuestionAssignmentsCmd ( )
private

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

280 : void
281 {
283 $question_id = $this->request_data_collector->getQuestionId();
284
285 if ($this->isTestQuestion($question_id)) {
286 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
287 $assignmentList->setParentObjId($this->getQuestionContainerId());
288 $assignmentList->loadFromDb();
289
290 $handledSkills = [];
291
292 $sgui = $this->buildSkillSelectorExplorerGUI([]);
293 $skillIds = $sgui->getSelectedSkills();
294
295 foreach ($skillIds as $skillId) {
296 $skill = explode(':', $skillId);
297 $skillBaseId = (int) $skill[0];
298 $skillTrefId = (int) $skill[1];
299
300 if ($skillBaseId) {
301 if (!$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $question_id)) {
302 $assignment = new ilAssQuestionSkillAssignment($this->db);
303
304 $assignment->setParentObjId($this->getQuestionContainerId());
305 $assignment->setQuestionId($question_id);
306 $assignment->setSkillBaseId($skillBaseId);
307 $assignment->setSkillTrefId($skillTrefId);
308
311 $assignment->saveToDb();
312
313 // add skill usage
314 $this->skill_usage_service->addUsage($this->getQuestionContainerId(), $skillBaseId, $skillTrefId);
315 }
316
317 $handledSkills[$skillId] = $skill;
318 }
319 }
320
321 foreach ($assignmentList->getAssignmentsByQuestionId($question_id) as $assignment) {
322 if (isset($handledSkills["{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"])) {
323 continue;
324 }
325
326 $assignment->deleteFromDb();
327
328 // remove skill usage
329 if (!$assignment->isSkillUsed()) {
330 $this->skill_usage_service->removeUsage(
331 $assignment->getParentObjId(),
332 $assignment->getSkillBaseId(),
333 $assignment->getSkillTrefId()
334 );
335 }
336 }
337
338 $this->tpl->setOnScreenMessage('success', $this->lng->txt('qpl_qst_skl_assigns_updated'), true);
339
340 if ($this->isSyncOriginalPossibleAndAllowed($question_id)) {
342 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
343 }
344 }
345
347 }

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

+ Here is the call graph for this function:

◆ validateSolutionCompareExpression()

ilAssQuestionSkillAssignmentsGUI::validateSolutionCompareExpression ( ilAssQuestionSolutionComparisonExpression  $expression,
assQuestion  $question 
)
private
Exceptions
ilAssLacException

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

805 : bool|string {
806 try {
807 $question_provider = new ilAssLacQuestionProvider();
808 $question_provider->setQuestion($question);
809 (new ilAssLacCompositeValidator($question_provider))->validate(
810 (new ilAssLacConditionParser())->parse($expression->getExpression())
811 );
812 } catch (ilAssLacException $e) {
813 return $e instanceof ilAssLacFormAlertProvider ? $e->getFormAlert($this->lng) : throw $e;
814 }
815
816 return true;
817 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilParserQuestionProvider.

Field Documentation

◆ $assignment_configuration_hint_message

string ilAssQuestionSkillAssignmentsGUI::$assignment_configuration_hint_message = null
private

◆ $assignment_editing_enabled

bool ilAssQuestionSkillAssignmentsGUI::$assignment_editing_enabled
private

◆ $data_factory

DataFactory ilAssQuestionSkillAssignmentsGUI::$data_factory
private

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

◆ $question_container_id

int ilAssQuestionSkillAssignmentsGUI::$question_container_id
private

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

Referenced by getQuestionContainerId().

◆ $question_list

ilAssQuestionList ilAssQuestionSkillAssignmentsGUI::$question_list
private

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

Referenced by getQuestionList().

◆ $questionOrderSequence

array ilAssQuestionSkillAssignmentsGUI::$questionOrderSequence
private

◆ CMD_EDIT_SKILL_QUEST_ASSIGNS

const ilAssQuestionSkillAssignmentsGUI::CMD_EDIT_SKILL_QUEST_ASSIGNS = 'editSkillQuestionAssignment'

◆ CMD_SAVE_SKILL_POINTS

const ilAssQuestionSkillAssignmentsGUI::CMD_SAVE_SKILL_POINTS = 'saveSkillPoints'

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

◆ 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'

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

◆ CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION

const ilAssQuestionSkillAssignmentsGUI::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION = 'showSyncOriginalConfirmation'

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

◆ CMD_SYNC_ORIGINAL

const ilAssQuestionSkillAssignmentsGUI::CMD_SYNC_ORIGINAL = 'syncOriginal'

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


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