ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 829 of file class.ilAssQuestionSkillAssignmentsGUI.php.

830 {
831 // #19192
832 if( $questionOBJ instanceof iQuestionCondition && $this->isAssignmentEditingEnabled())
833 {
834 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/class.ilAssLacLegendGUI.php';
835 $legend = new ilAssLacLegendGUI($this->lng, $this->tpl);
836 $legend->setQuestionOBJ($questionOBJ);
837 $legend->setInitialVisibilityEnabled($assignment->hasEvalModeBySolution());
838 $lacLegendHTML = $this->ctrl->getHTML($legend);
839 return $lacLegendHTML;
840 }
841
842 return '';
843 }
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 643 of file class.ilAssQuestionSkillAssignmentsGUI.php.

644 {
645 $this->tpl->addCss('Services/COPage/css/content.css');
646
647 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
648 $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
649
650 $pageGUI->setOutputMode("presentation");
651 $pageGUI->setRenderPageContainer(true);
652
653 $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
654
655 $questionGUI->object->setShuffle(false); // dirty, but works ^^
656 $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
657 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
658
659 $pageHTML = $pageGUI->presentation();
660 $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
661
662 return $pageHTML;
663 }
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 668 of file class.ilAssQuestionSkillAssignmentsGUI.php.

669 {
670 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
671
672 $assignment = new ilAssQuestionSkillAssignment($this->db);
673
674 $assignment->setParentObjId($this->getQuestionContainerId());
675 $assignment->setQuestionId($questionId);
676 $assignment->setSkillBaseId($skillBaseId);
677 $assignment->setSkillTrefId($skillTrefId);
678
679 $assignment->loadFromDb();
680 $assignment->loadAdditionalSkillData();
681
682 return $assignment;
683 }

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

592 {
593 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
594 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
595 $assignmentList->setParentObjId($this->getQuestionContainerId());
596
597 return $assignmentList;
598 }

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

489 {
490 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssQuestionSkillAssignmentPropertyFormGUI.php';
491 $form = new ilAssQuestionSkillAssignmentPropertyFormGUI($this->ctrl, $this->lng, $this);
492
493 $form->setQuestion($question);
494 $form->setAssignment($assignment);
495 $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
496
497 $form->build();
498
499 return $form;
500 }

References isAssignmentEditingEnabled().

Referenced by saveSkillQuestionAssignmentPropertiesFormCmd(), and showSkillQuestionAssignmentPropertiesFormCmd().

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

◆ buildSkillSelectorExplorerGUI()

ilAssQuestionSkillAssignmentsGUI::buildSkillSelectorExplorerGUI (   $assignments)
private
Returns
ilSkillSelectorGUI

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

604 {
605 require_once 'Services/Skill/classes/class.ilSkillSelectorGUI.php';
606
607 $skillSelectorExplorerGUI = new ilSkillSelectorGUI(
608 $this, self::CMD_SHOW_SKILL_SELECT, $this, self::CMD_UPDATE_SKILL_QUEST_ASSIGNS, self::PARAM_SKILL_SELECTION
609 );
610
611 $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION, true);
612 $skillSelectorExplorerGUI->setNodeOnclickEnabled(false);
613
614 // parameter name for skill selection is actually taken from value passed to constructor,
615 // but passing a non empty name to setSelectMode is neccessary to keep input fields enabled
616
617 foreach($assignments as $assignment)
618 {
619 $id = "{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
620 //$skillSelectorExplorerGUI->setNodeSelected($id);
621 $skillSelectorExplorerGUI->setSkillSelected($id);
622 }
623
624 return $skillSelectorExplorerGUI;
625 }
Explorer class that works on tree objects (Services/Tree)

Referenced by showSkillSelectionCmd(), and updateSkillQuestionAssignmentsCmd().

+ Here is the caller graph for this function:

◆ buildSkillSelectorToolbarGUI()

ilAssQuestionSkillAssignmentsGUI::buildSkillSelectorToolbarGUI ( )
private
Returns
ilToolbarGUI

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

631 {
632 require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
633
634 $skillSelectorToolbarGUI = new ilToolbarGUI();
635
636 $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
637 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
638 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
639
640 return $skillSelectorToolbarGUI;
641 }

Referenced by showSkillSelectionCmd().

+ Here is the caller graph for this function:

◆ buildTableGUI()

ilAssQuestionSkillAssignmentsGUI::buildTableGUI ( )
private

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

582 {
583 require_once 'Modules/TestQuestionPool/classes/tables/class.ilAssQuestionSkillAssignmentsTableGUI.php';
584 $table = new ilAssQuestionSkillAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
585 $table->setManipulationsEnabled($this->isAssignmentEditingEnabled());
586 $table->init();
587
588 return $table;
589 }

References isAssignmentEditingEnabled().

Referenced by showSkillQuestionAssignmentsCmd().

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

◆ checkSolutionCompareExpressionInput()

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

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

691 {
692 $errors = array();
693
694 foreach($input->getValues() as $expression)
695 {
696 $result = $this->validateSolutionCompareExpression($expression, $question);
697
698 if( $result !== true )
699 {
700 $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
701 }
702 }
703
704 if( count($errors) )
705 {
706 $alert = $this->lng->txt('ass_lac_validation_error');
707 $alert .= '<br />'.implode('<br />', $errors);
708 $input->setAlert($alert);
709 return false;
710 }
711
712 return true;
713 }
$result
validateSolutionCompareExpression(ilAssQuestionSolutionComparisonExpression $expression, iQuestionCondition $question)
setAlert($a_alert)
Set Alert Text.
$errors

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

Referenced by saveSkillQuestionAssignmentPropertiesFormCmd().

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

◆ doesObjectTypeMatch()

ilAssQuestionSkillAssignmentsGUI::doesObjectTypeMatch (   $objectId)
protected

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

819 {
820 return ilObject::_lookupType($objectId) == 'qpl';
821 }
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 {
186 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
187 }
188
189 switch($nextClass)
190 {
191 case strtolower(__CLASS__):
192 case '':
193
194 $command .= 'Cmd';
195 $this->$command();
196 break;
197
198 default:
199
200 throw new ilTestQuestionPoolException('unsupported next class in ctrl flow');
201 }
202 }

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

789 {
790 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
791
792 return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
793 }
sprintf('%.4f', $callTime)

References sprintf.

Referenced by showSkillSelectionCmd().

+ Here is the caller graph for this function:

◆ handleAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::handleAssignmentConfigurationHintMessage ( )
private

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

781 {
783 {
785 }
786 }
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 204 of file class.ilAssQuestionSkillAssignmentsGUI.php.

205 {
206 if( $this->isAssignmentEditingEnabled() )
207 {
208 return false;
209 }
210
211 switch($command)
212 {
215
216 return true;
217 }
218
219 return false;
220 }

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

519 {
520 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
521
522 if( !$questionData['original_id'] )
523 {
524 return false;
525 }
526
527 require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
528 $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
529
530 if( !$this->doesObjectTypeMatch($parentObjId) )
531 {
532 return false;
533 }
534
535 foreach( ilObject::_getAllReferences($parentObjId) as $parentRefId )
536 {
537 if( $this->access->checkAccess('write', '', $parentRefId) )
538 {
539 return true;
540 }
541 }
542
543 return false;
544 }
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 685 of file class.ilAssQuestionSkillAssignmentsGUI.php.

686 {
687 return $this->questionList->isInList($questionId);
688 }

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

+ Here is the caller graph for this function:

◆ keepAssignmentParameters()

ilAssQuestionSkillAssignmentsGUI::keepAssignmentParameters ( )
private

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

745 {
746 $this->ctrl->saveParameter($this, 'question_id');
747 $this->ctrl->saveParameter($this, 'skill_base_id');
748 $this->ctrl->saveParameter($this, 'skill_tref_id');
749 }

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

+ Here is the caller graph for this function:

◆ orderQuestionData()

ilAssQuestionSkillAssignmentsGUI::orderQuestionData (   $questionData)
private

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

752 {
753 $orderedQuestionsData = array();
754
755 if( $this->getQuestionOrderSequence() )
756 {
757 foreach($this->getQuestionOrderSequence() as $questionId)
758 {
759 $orderedQuestionsData[$questionId] = $questionData[$questionId];
760 }
761
762 return $orderedQuestionsData;
763 }
764
765 foreach($questionData as $questionId => $data)
766 {
767 $orderedQuestionsData[$questionId] = $data['title'];
768 }
769
770 $orderedQuestionsData = $this->sortAlphabetically($orderedQuestionsData);
771
772 foreach($orderedQuestionsData as $questionId => $questionTitle)
773 {
774 $orderedQuestionsData[$questionId] = $questionData[$questionId];
775 }
776
777 return $orderedQuestionsData;
778 }

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

223 {
224 $success = true;
225
226 if( is_array($_POST['skill_points']) )
227 {
228 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
229
230 for($i = 0; $i < 2; $i++) foreach($_POST['skill_points'] as $assignmentKey => $skillPoints)
231 {
232 $assignmentKey = explode(':', $assignmentKey);
233 $skillBaseId = (int)$assignmentKey[0];
234 $skillTrefId = (int)$assignmentKey[1];
235 $questionId = (int)$assignmentKey[2];
236
237 if($this->isTestQuestion($questionId))
238 {
239 $assignment = new ilAssQuestionSkillAssignment($this->db);
240
241 if($i == 0)
242 {
243 if(!$assignment->isValidSkillPoint($skillPoints))
244 {
245 $success = false;
246 break 2;
247 }
248 continue;
249 }
250
251 $assignment->setParentObjId($this->getQuestionContainerId());
252 $assignment->setQuestionId($questionId);
253 $assignment->setSkillBaseId($skillBaseId);
254 $assignment->setSkillTrefId($skillTrefId);
255
256 if($assignment->dbRecordExists())
257 {
258 $assignment->loadFromDb();
259
260 if(!$assignment->hasEvalModeBySolution())
261 {
262 $assignment->setSkillPoints((int)$skillPoints);
263 $assignment->saveToDb();
264 }
265 }
266 }
267 }
268 }
269
270 if($success)
271 {
272 ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
273 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
274 }
275 else
276 {
277 ilUtil::sendFailure($this->lng->txt('tst_msg_skl_qst_assign_points_not_saved'));
279 }
280 }
$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.

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

+ Here is the call graph for this function:

◆ saveSkillQuestionAssignmentPropertiesFormCmd()

ilAssQuestionSkillAssignmentsGUI::saveSkillQuestionAssignmentPropertiesFormCmd ( )
private

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

420 {
421 $questionId = (int)$_GET['question_id'];
422
423 if( $this->isTestQuestion($questionId) )
424 {
425 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
426 $questionGUI = assQuestionGUI::_getQuestionGUI('', $questionId);
427
428 $assignment = $this->buildQuestionSkillAssignment(
429 (int)$_GET['question_id'], (int)$_GET['skill_base_id'], (int)$_GET['skill_tref_id']
430 );
431
433 $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
434 if( !$form->checkInput() )
435 {
436 $form->setValuesByPost();
437 $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
438 return;
439 }
440 $form->setValuesByPost();
441
442 if($form->getItemByPostVar('eval_mode'))
443 {
444 $assignment->setEvalMode($form->getItemByPostVar('eval_mode')->getValue());
445 }
446 else
447 {
449 }
450
451 if($assignment->hasEvalModeBySolution())
452 {
453 $solCmpExprInput = $form->getItemByPostVar('solution_compare_expressions');
454
455 if( !$this->checkSolutionCompareExpressionInput($solCmpExprInput, $questionGUI->object) )
456 {
457 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
458 $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
459 return;
460 }
461
462 $assignment->initSolutionComparisonExpressionList();
463 $assignment->getSolutionComparisonExpressionList()->reset();
464
465 foreach($solCmpExprInput->getValues() as $expression)
466 {
467 $assignment->getSolutionComparisonExpressionList()->add($expression);
468 }
469 }
470 else
471 {
472 $assignment->setSkillPoints($form->getItemByPostVar('q_res_skill_points')->getValue());
473 }
474
475 $assignment->saveToDb();
476
477 ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_properties_modified'), true);
478
479 if( $this->isSyncOriginalPossibleAndAllowed($questionId) )
480 {
481 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
482 }
483 }
484
485 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
486 }
$_GET["client_id"]
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
buildQuestionSkillAssignment($questionId, $skillBaseId, $skillTrefId)
checkSolutionCompareExpressionInput(ilLogicalAnswerComparisonExpressionInputGUI $input, assQuestion $question)
showSkillQuestionAssignmentPropertiesFormCmd(assQuestionGUI $questionGUI=null, ilAssQuestionSkillAssignment $assignment=null, ilPropertyFormGUI $form=null)
buildSkillQuestionAssignmentPropertiesForm(assQuestion $question, ilAssQuestionSkillAssignment $assignment)

References $_GET, assQuestionGUI\_getQuestionGUI(), buildQuestionSkillAssignment(), buildSkillQuestionAssignmentPropertiesForm(), checkSolutionCompareExpressionInput(), ilAssQuestionSkillAssignment\EVAL_MODE_BY_QUESTION_RESULT, isSyncOriginalPossibleAndAllowed(), isTestQuestion(), keepAssignmentParameters(), ilUtil\sendFailure(), 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 386 of file class.ilAssQuestionSkillAssignmentsGUI.php.

389 {
391
393
394 if( $questionGUI === null )
395 {
396 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
397 $questionGUI = assQuestionGUI::_getQuestionGUI('', (int)$_GET['question_id']);
398 }
399
400 if( $assignment === null )
401 {
402 $assignment = $this->buildQuestionSkillAssignment(
403 (int)$_GET['question_id'], (int)$_GET['skill_base_id'], (int)$_GET['skill_tref_id']
404 );
405 }
406
407 if( $form === null )
408 {
409 $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
410 }
411
412 $questionPageHTML = $this->buildQuestionPage($questionGUI);
413
414 $lacLegendHTML = $this->buildLacLegendHTML($questionGUI->object, $assignment);
415
416 $this->tpl->setContent( $this->ctrl->getHTML($form).'<br />'.$questionPageHTML.$lacLegendHTML );
417 }
buildLacLegendHTML(assQuestion $questionOBJ, ilAssQuestionSkillAssignment $assignment)

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

503 {
505
506 $table = $this->buildTableGUI();
507 $table->loadSkillPointsFromRequest($loadSkillPointsFromRequest);
508
509 $assignmentList = $this->buildSkillQuestionAssignmentList();
510 $assignmentList->loadFromDb();
511 $assignmentList->loadAdditionalSkillData();
512 $table->setSkillQuestionAssignmentList($assignmentList);
513 $table->setData($this->orderQuestionData($this->questionList->getQuestionDataArray()));
514
515 $this->tpl->setContent($this->ctrl->getHTML($table));
516 }

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

Referenced by saveSkillPointsCmd().

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

◆ showSkillSelectionCmd()

ilAssQuestionSkillAssignmentsGUI::showSkillSelectionCmd ( )
private

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

349 {
350 $this->ctrl->saveParameter($this, 'question_id');
351 $questionId = (int)$_GET['question_id'];
352
353 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
354 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
355 $assignmentList->setParentObjId($this->getQuestionContainerId());
356 $assignmentList->loadFromDb();
357
358 $skillSelectorExplorerGUI = $this->buildSkillSelectorExplorerGUI(
359 $assignmentList->getAssignmentsByQuestionId($questionId)
360 );
361
362 if( !$skillSelectorExplorerGUI->handleCommand() )
363 {
364 $tpl = new ilTemplate('tpl.qpl_qst_skl_assign_selection.html', false, false, 'Modules/TestQuestionPool');
365
366 $tpl->setVariable('SKILL_SELECTOR_HEADER', $this->getSkillSelectorHeader($questionId));
367
368 $skillSelectorToolbarGUI = $this->buildSkillSelectorToolbarGUI();
369
370 $skillSelectorToolbarGUI->setOpenFormTag(true);
371 $skillSelectorToolbarGUI->setCloseFormTag(false);
372 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
373 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_TOP', $this->ctrl->getHTML($skillSelectorToolbarGUI));
374
375 $tpl->setVariable('SKILL_SELECTOR_EXPLORER', $this->ctrl->getHTML($skillSelectorExplorerGUI));
376
377 $skillSelectorToolbarGUI->setOpenFormTag(false);
378 $skillSelectorToolbarGUI->setCloseFormTag(true);
379 $skillSelectorToolbarGUI->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
380 $tpl->setVariable('SKILL_SELECTOR_TOOLBAR_BOTTOM', $this->ctrl->getHTML($skillSelectorToolbarGUI));
381
382 $this->tpl->setContent($tpl->get());
383 }
384 }
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 546 of file class.ilAssQuestionSkillAssignmentsGUI.php.

547 {
548 $questionId = (int)$_GET['question_id'];
549
550 require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
551 $confirmation = new ilConfirmationGUI();
552
553 $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
554
555 $confirmation->setFormAction($this->ctrl->getFormAction($this));
556 $confirmation->addHiddenItem('question_id', $questionId);
557 $confirmation->setConfirm($this->lng->txt('yes'), self::CMD_SYNC_ORIGINAL);
558 $confirmation->setCancel($this->lng->txt('no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
559
560 $this->tpl->setContent($this->ctrl->getHTML($confirmation));
561 }
Confirmation screen class.

References $_GET.

◆ sortAlphabetically()

ilAssQuestionSkillAssignmentsGUI::sortAlphabetically (   $array)
private

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

796 {
797 $flags = SORT_REGULAR;
798
799 if( defined('SORT_NATURAL') )
800 {
801 $flags = SORT_NATURAL;
802 }
803 elseif( defined('SORT_STRING') )
804 {
805 $flags = SORT_STRING;
806 }
807
808 if( defined('SORT_FLAG_CASE') )
809 {
810 $flags = $flags | SORT_FLAG_CASE;
811 }
812
813 asort($array, $flags);
814
815 return $array;
816 }
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 563 of file class.ilAssQuestionSkillAssignmentsGUI.php.

564 {
565 $questionId = (int)$_POST['question_id'];
566
567 if( $this->isTestQuestion($questionId) && $this->isSyncOriginalPossibleAndAllowed($questionId) )
568 {
569 $question = assQuestion::_instantiateQuestion($questionId);
570
571 $question->syncSkillAssignments($question->getObjId(), $question->getId(),
572 $question->lookupParentObjId($question->getOriginalId()), $question->getOriginalId()
573 );
574
575 ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_synced_to_orig'), true);
576 }
577
578 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
579 }
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 282 of file class.ilAssQuestionSkillAssignmentsGUI.php.

283 {
284 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
285
286 $questionId = (int)$_GET['question_id'];
287
288 if( $this->isTestQuestion($questionId) )
289 {
290 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
291 $assignmentList->setParentObjId($this->getQuestionContainerId());
292 $assignmentList->loadFromDb();
293
294 $handledSkills = array();
295
296 //$skillIds = (array)$_POST['skill_ids'];
297 $sgui = $this->buildSkillSelectorExplorerGUI(array());
298 $skillIds = $sgui->getSelectedSkills();
299
300 foreach($skillIds as $skillId)
301 {
302 $skill = explode(':',$skillId);
303 $skillBaseId = (int)$skill[0];
304 $skillTrefId = (int)$skill[1];
305
306 if( $skillBaseId )
307 {
308 if( !$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId) )
309 {
310 $assignment = new ilAssQuestionSkillAssignment($this->db);
311
312 $assignment->setParentObjId($this->getQuestionContainerId());
313 $assignment->setQuestionId($questionId);
314 $assignment->setSkillBaseId($skillBaseId);
315 $assignment->setSkillTrefId($skillTrefId);
316
319 $assignment->saveToDb();
320 }
321
322 $handledSkills[$skillId] = $skill;
323 }
324 }
325
326 foreach($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment)
327 {
328 if( isset($handledSkills["{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"]) )
329 {
330 continue;
331 }
332
333 $assignment->deleteFromDb();
334 }
335
336 ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assigns_updated'), true);
337
338 if( $this->isSyncOriginalPossibleAndAllowed($questionId) )
339 {
341 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
342 }
343 }
344
345 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
346 }

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

716 {
717 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacConditionParser.php';
718 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacQuestionProvider.php';
719 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacCompositeValidator.php';
720
721 try
722 {
723 $conditionParser = new ilAssLacConditionParser();
724 $conditionComposite = $conditionParser->parse($expression->getExpression());
725 $questionProvider = new ilAssLacQuestionProvider();
726 $questionProvider->setQuestion($question);
727 $conditionValidator = new ilAssLacCompositeValidator($questionProvider);
728
729 $conditionValidator->validate($conditionComposite);
730 }
731 catch (ilAssLacException $e)
732 {
733 if( $e instanceof ilAssLacFormAlertProvider )
734 {
735 return $e->getFormAlert($this->lng);
736 }
737
738 throw $e;
739 }
740
741 return true;
742 }
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: