ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAssQuestionSkillAssignmentsGUI Class Reference
+ Collaboration diagram for ilAssQuestionSkillAssignmentsGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilAccessHandler $access, ilTemplate $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)
 
 buildLacLegendHTML (assQuestion $questionOBJ, ilAssQuestionSkillAssignment $assignment)
 

Private Attributes

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

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ buildLacLegendHTML()

ilAssQuestionSkillAssignmentsGUI::buildLacLegendHTML ( assQuestion  $questionOBJ,
ilAssQuestionSkillAssignment  $assignment 
)
private
Parameters
assQuestionGUI$questionGUI
ilAssQuestionSkillAssignment$assignment
Returns
string
Exceptions
ilCtrlException

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

786 {
787 // #19192
788 if ($questionOBJ instanceof iQuestionCondition && $this->isAssignmentEditingEnabled()) {
789 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/class.ilAssLacLegendGUI.php';
790 $legend = new ilAssLacLegendGUI($this->lng, $this->tpl);
791 $legend->setQuestionOBJ($questionOBJ);
792 $legend->setInitialVisibilityEnabled($assignment->hasEvalModeBySolution());
793 $lacLegendHTML = $this->ctrl->getHTML($legend);
794 return $lacLegendHTML;
795 }
796
797 return '';
798 }
Class iQuestionCondition.

References $legend, ilAssQuestionSkillAssignment\hasEvalModeBySolution(), and isAssignmentEditingEnabled().

Referenced by showSkillQuestionAssignmentPropertiesFormCmd().

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

◆ buildQuestionPage()

ilAssQuestionSkillAssignmentsGUI::buildQuestionPage ( assQuestionGUI  $questionGUI)
private

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

616 {
617 $this->tpl->addCss('Services/COPage/css/content.css');
618
619 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
620 $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
621
622 $pageGUI->setOutputMode("presentation");
623 $pageGUI->setRenderPageContainer(true);
624
625 $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
626
627 $questionGUI->object->setShuffle(false); // dirty, but works ^^
628 $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
629 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
630
631 $pageHTML = $pageGUI->presentation();
632 $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
633
634 return $pageHTML;
635 }
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().

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

641 {
642 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
643
644 $assignment = new ilAssQuestionSkillAssignment($this->db);
645
646 $assignment->setParentObjId($this->getQuestionContainerId());
647 $assignment->setQuestionId($questionId);
648 $assignment->setSkillBaseId($skillBaseId);
649 $assignment->setSkillTrefId($skillTrefId);
650
651 $assignment->loadFromDb();
652 $assignment->loadAdditionalSkillData();
653
654 return $assignment;
655 }

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

561 {
562 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
563 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
564 $assignmentList->setParentObjId($this->getQuestionContainerId());
565
566 return $assignmentList;
567 }

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

460 {
461 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssQuestionSkillAssignmentPropertyFormGUI.php';
462 $form = new ilAssQuestionSkillAssignmentPropertyFormGUI($this->ctrl, $this->lng, $this);
463
464 $form->setQuestion($question);
465 $form->setAssignment($assignment);
466 $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
467
468 $form->build();
469
470 return $form;
471 }
if(isset($_POST['submit'])) $form

References $form, and 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 572 of file class.ilAssQuestionSkillAssignmentsGUI.php.

573 {
574 require_once 'Services/Skill/classes/class.ilSkillSelectorGUI.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 }
Explorer class that works on tree objects (Services/Tree)
if(!array_key_exists('StateId', $_REQUEST)) $id

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 require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
605
606 $skillSelectorToolbarGUI = new ilToolbarGUI();
607
608 $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
609 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
610 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
611
612 return $skillSelectorToolbarGUI;
613 }

Referenced by showSkillSelectionCmd().

+ Here is the caller graph for this function:

◆ buildTableGUI()

ilAssQuestionSkillAssignmentsGUI::buildTableGUI ( )
private

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

551 {
552 require_once 'Modules/TestQuestionPool/classes/tables/class.ilAssQuestionSkillAssignmentsTableGUI.php';
553 $table = new ilAssQuestionSkillAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
554 $table->setManipulationsEnabled($this->isAssignmentEditingEnabled());
555 $table->init();
556
557 return $table;
558 }
if(empty($password)) $table
Definition: pwgen.php:24

References $table, and 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 662 of file class.ilAssQuestionSkillAssignmentsGUI.php.

663 {
664 $errors = array();
665
666 foreach ($input->getValues() as $expression) {
667 $result = $this->validateSolutionCompareExpression($expression, $question);
668
669 if ($result !== true) {
670 $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
671 }
672 }
673
674 if (count($errors)) {
675 $alert = $this->lng->txt('ass_lac_validation_error');
676 $alert .= '<br />' . implode('<br />', $errors);
677 $input->setAlert($alert);
678 return false;
679 }
680
681 return true;
682 }
$result
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, iQuestionCondition $question)
setAlert($a_alert)
Set Alert Text.
$errors
Definition: index.php:6

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

775 {
776 return ilObject::_lookupType($objectId) == 'qpl';
777 }
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 178 of file class.ilAssQuestionSkillAssignmentsGUI.php.

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

References isAvoidManipulationRedirectRequired().

+ Here is the call graph for this function:

◆ getAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::getAssignmentConfigurationHintMessage ( )
Returns
string

Definition at line 109 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 101 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 748 of file class.ilAssQuestionSkillAssignmentsGUI.php.

749 {
750 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
751
752 return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
753 }
sprintf('%.4f', $callTime)

References sprintf.

Referenced by showSkillSelectionCmd().

+ Here is the caller graph for this function:

◆ handleAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::handleAssignmentConfigurationHintMessage ( )
private

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

742 {
745 }
746 }
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 202 of file class.ilAssQuestionSkillAssignmentsGUI.php.

203 {
204 if ($this->isAssignmentEditingEnabled()) {
205 return false;
206 }
207
208 switch ($command) {
211
212 return true;
213 }
214
215 return false;
216 }

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

490 {
491 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
492
493 if (!$questionData['original_id']) {
494 return false;
495 }
496
497 require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
498 $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
499
500 if (!$this->doesObjectTypeMatch($parentObjId)) {
501 return false;
502 }
503
504 foreach (ilObject::_getAllReferences($parentObjId) as $parentRefId) {
505 if ($this->access->checkAccess('write', '', $parentRefId)) {
506 return true;
507 }
508 }
509
510 return false;
511 }
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 657 of file class.ilAssQuestionSkillAssignmentsGUI.php.

658 {
659 return $this->questionList->isInList($questionId);
660 }

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

+ Here is the caller graph for this function:

◆ keepAssignmentParameters()

ilAssQuestionSkillAssignmentsGUI::keepAssignmentParameters ( )
private

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

710 {
711 $this->ctrl->saveParameter($this, 'question_id');
712 $this->ctrl->saveParameter($this, 'skill_base_id');
713 $this->ctrl->saveParameter($this, 'skill_tref_id');
714 }

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

+ Here is the caller graph for this function:

◆ orderQuestionData()

ilAssQuestionSkillAssignmentsGUI::orderQuestionData (   $questionData)
private

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

717 {
718 $orderedQuestionsData = array();
719
720 if ($this->getQuestionOrderSequence()) {
721 foreach ($this->getQuestionOrderSequence() as $questionId) {
722 $orderedQuestionsData[$questionId] = $questionData[$questionId];
723 }
724
725 return $orderedQuestionsData;
726 }
727
728 foreach ($questionData as $questionId => $data) {
729 $orderedQuestionsData[$questionId] = $data['title'];
730 }
731
732 $orderedQuestionsData = $this->sortAlphabetically($orderedQuestionsData);
733
734 foreach ($orderedQuestionsData as $questionId => $questionTitle) {
735 $orderedQuestionsData[$questionId] = $questionData[$questionId];
736 }
737
738 return $orderedQuestionsData;
739 }

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

219 {
220 $success = true;
221
222 if (is_array($_POST['skill_points'])) {
223 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
224
225 for ($i = 0; $i < 2; $i++) {
226 foreach ($_POST['skill_points'] as $assignmentKey => $skillPoints) {
227 $assignmentKey = explode(':', $assignmentKey);
228 $skillBaseId = (int) $assignmentKey[0];
229 $skillTrefId = (int) $assignmentKey[1];
230 $questionId = (int) $assignmentKey[2];
231
232 if ($this->isTestQuestion($questionId)) {
233 $assignment = new ilAssQuestionSkillAssignment($this->db);
234
235 if ($i == 0) {
236 if (!$assignment->isValidSkillPoint($skillPoints)) {
237 $success = false;
238 break 2;
239 }
240 continue;
241 }
242
243 $assignment->setParentObjId($this->getQuestionContainerId());
244 $assignment->setQuestionId($questionId);
245 $assignment->setSkillBaseId($skillBaseId);
246 $assignment->setSkillTrefId($skillTrefId);
247
248 if ($assignment->dbRecordExists()) {
249 $assignment->loadFromDb();
250
251 if (!$assignment->hasEvalModeBySolution()) {
252 $assignment->setSkillPoints((int) $skillPoints);
253 $assignment->saveToDb();
254 }
255 }
256 }
257 }
258 }
259 }
260
261 if ($success) {
262 ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
263 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
264 } else {
265 ilUtil::sendFailure($this->lng->txt('tst_msg_skl_qst_assign_points_not_saved'));
267 }
268 }
$success
Definition: Utf8Test.php:86
$_POST["username"]
showSkillQuestionAssignmentsCmd($loadSkillPointsFromRequest=false)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$i
Definition: disco.tpl.php:19

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

+ Here is the call graph for this function:

◆ saveSkillQuestionAssignmentPropertiesFormCmd()

ilAssQuestionSkillAssignmentsGUI::saveSkillQuestionAssignmentPropertiesFormCmd ( )
private

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

400 {
401 $questionId = (int) $_GET['question_id'];
402
403 if ($this->isTestQuestion($questionId)) {
404 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
405 $questionGUI = assQuestionGUI::_getQuestionGUI('', $questionId);
406
407 $assignment = $this->buildQuestionSkillAssignment(
408 (int) $_GET['question_id'],
409 (int) $_GET['skill_base_id'],
410 (int) $_GET['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 ilUtil::sendFailure($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 ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_properties_modified'), true);
450
451 if ($this->isSyncOriginalPossibleAndAllowed($questionId)) {
452 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
453 }
454 }
455
456 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
457 }
$_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, $form, assQuestionGUI\_getQuestionGUI(), buildQuestionSkillAssignment(), buildSkillQuestionAssignmentPropertiesForm(), checkSolutionCompareExpressionInput(), ilAssQuestionSkillAssignment\EVAL_MODE_BY_QUESTION_RESULT, isSyncOriginalPossibleAndAllowed(), isTestQuestion(), keepAssignmentParameters(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showSkillQuestionAssignmentPropertiesFormCmd().

+ Here is the call graph for this function:

◆ setAssignmentConfigurationHintMessage()

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

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

118 {
119 $this->assignmentConfigurationHintMessage = $assignmentConfigurationHintMessage;
120 }

References $assignmentConfigurationHintMessage.

◆ setAssignmentEditingEnabled()

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

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

174 {
175 $this->assignmentEditingEnabled = $assignmentEditingEnabled;
176 }

References $assignmentEditingEnabled.

◆ setQuestionContainerId()

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

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

158 {
159 $this->questionContainerId = $questionContainerId;
160 }

References $questionContainerId.

◆ setQuestionList()

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

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

142 {
143 $this->questionList = $questionList;
144 }

References $questionList.

◆ setQuestionOrderSequence()

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

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

126 {
127 $this->questionOrderSequence = $questionOrderSequence;
128 }

References $questionOrderSequence.

◆ showSkillQuestionAssignmentPropertiesFormCmd()

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

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

370 {
372
374
375 if ($questionGUI === null) {
376 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
377 $questionGUI = assQuestionGUI::_getQuestionGUI('', (int) $_GET['question_id']);
378 }
379
380 if ($assignment === null) {
381 $assignment = $this->buildQuestionSkillAssignment(
382 (int) $_GET['question_id'],
383 (int) $_GET['skill_base_id'],
384 (int) $_GET['skill_tref_id']
385 );
386 }
387
388 if ($form === null) {
389 $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
390 }
391
392 $questionPageHTML = $this->buildQuestionPage($questionGUI);
393
394 $lacLegendHTML = $this->buildLacLegendHTML($questionGUI->object, $assignment);
395
396 $this->tpl->setContent($this->ctrl->getHTML($form) . '<br />' . $questionPageHTML . $lacLegendHTML);
397 }
buildLacLegendHTML(assQuestion $questionOBJ, ilAssQuestionSkillAssignment $assignment)

References $_GET, $form, assQuestionGUI\_getQuestionGUI(), buildLacLegendHTML(), 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 473 of file class.ilAssQuestionSkillAssignmentsGUI.php.

474 {
476
477 $table = $this->buildTableGUI();
478 $table->loadSkillPointsFromRequest($loadSkillPointsFromRequest);
479
480 $assignmentList = $this->buildSkillQuestionAssignmentList();
481 $assignmentList->loadFromDb();
482 $assignmentList->loadAdditionalSkillData();
483 $table->setSkillQuestionAssignmentList($assignmentList);
484 $table->setData($this->orderQuestionData($this->questionList->getQuestionDataArray()));
485
486 $this->tpl->setContent($this->ctrl->getHTML($table));
487 }

References $table, 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 329 of file class.ilAssQuestionSkillAssignmentsGUI.php.

330 {
331 $this->ctrl->saveParameter($this, 'question_id');
332 $questionId = (int) $_GET['question_id'];
333
334 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
335 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
336 $assignmentList->setParentObjId($this->getQuestionContainerId());
337 $assignmentList->loadFromDb();
338
339 $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI(
340 $assignmentList->getAssignmentsByQuestionId($questionId)
341 );
342
343 if (!$skillSelectorExplorerGUI->handleCommand()) {
344 $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'Modules/TestQuestionPool');
345
346 $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($questionId));
347
348 $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
349
350 $skillSelectorToolbarGUI->setOpenFormTag(true);
351 $skillSelectorToolbarGUI->setCloseFormTag(false);
352 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
353 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
354
355 $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
356
357 $skillSelectorToolbarGUI->setOpenFormTag(false);
358 $skillSelectorToolbarGUI->setCloseFormTag(true);
359 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
360 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
361
362 $this->tpl->setContent($tpl->get());
363 }
364 }
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 513 of file class.ilAssQuestionSkillAssignmentsGUI.php.

514 {
515 $questionId = (int) $_GET['question_id'];
516
517 require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
518 $confirmation = new ilConfirmationGUI();
519
520 $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
521
522 $confirmation->setFormAction($this->ctrl->getFormAction($this));
523 $confirmation->addHiddenItem('question_id', $questionId);
524 $confirmation->setConfirm($this->lng->txt('yes'), self::CMD_SYNC_ORIGINAL);
525 $confirmation->setCancel($this->lng->txt('no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
526
527 $this->tpl->setContent($this->ctrl->getHTML($confirmation));
528 }
Confirmation screen class.

References $_GET.

◆ sortAlphabetically()

ilAssQuestionSkillAssignmentsGUI::sortAlphabetically (   $array)
private

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

756 {
757 $flags = SORT_REGULAR;
758
759 if (defined('SORT_NATURAL')) {
760 $flags = SORT_NATURAL;
761 } elseif (defined('SORT_STRING')) {
762 $flags = SORT_STRING;
763 }
764
765 if (defined('SORT_FLAG_CASE')) {
766 $flags = $flags | SORT_FLAG_CASE;
767 }
768
769 asort($array, $flags);
770
771 return $array;
772 }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

References defined.

Referenced by orderQuestionData().

+ Here is the caller graph for this function:

◆ syncOriginalCmd()

ilAssQuestionSkillAssignmentsGUI::syncOriginalCmd ( )
private

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

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

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

+ Here is the call graph for this function:

◆ updateSkillQuestionAssignmentsCmd()

ilAssQuestionSkillAssignmentsGUI::updateSkillQuestionAssignmentsCmd ( )
private

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

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

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

+ Here is the call graph for this function:

◆ validateSolutionCompareExpression()

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

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

685 {
686 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacConditionParser.php';
687 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacQuestionProvider.php';
688 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacCompositeValidator.php';
689
690 try {
691 $conditionParser = new ilAssLacConditionParser();
692 $conditionComposite = $conditionParser->parse($expression->getExpression());
693 $questionProvider = new ilAssLacQuestionProvider();
694 $questionProvider->setQuestion($question);
695 $conditionValidator = new ilAssLacCompositeValidator($questionProvider);
696
697 $conditionValidator->validate($conditionComposite);
698 } catch (ilAssLacException $e) {
699 if ($e instanceof ilAssLacFormAlertProvider) {
700 return $e->getFormAlert($this->lng);
701 }
702
703 throw $e;
704 }
705
706 return true;
707 }
Class ilParserQuestionProvider.

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

Referenced by __construct().

◆ $assignmentConfigurationHintMessage

ilAssQuestionSkillAssignmentsGUI::$assignmentConfigurationHintMessage
private

◆ $assignmentEditingEnabled

ilAssQuestionSkillAssignmentsGUI::$assignmentEditingEnabled
private

◆ $ctrl

ilAssQuestionSkillAssignmentsGUI::$ctrl
private

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

Referenced by __construct().

◆ $db

ilAssQuestionSkillAssignmentsGUI::$db
private

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

Referenced by __construct().

◆ $lng

ilAssQuestionSkillAssignmentsGUI::$lng
private

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

Referenced by __construct().

◆ $questionContainerId

ilAssQuestionSkillAssignmentsGUI::$questionContainerId
private

◆ $questionList

ilAssQuestionSkillAssignmentsGUI::$questionList
private

Definition at line 60 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

const ilAssQuestionSkillAssignmentsGUI::CMD_SHOW_SKILL_QUEST_ASSIGNS = 'showSkillQuestionAssignments'

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

◆ CMD_SYNC_ORIGINAL

const ilAssQuestionSkillAssignmentsGUI::CMD_SYNC_ORIGINAL = 'syncOriginal'

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


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