ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAssQuestionSkillAssignmentsGUI Class Reference
+ Collaboration diagram for ilAssQuestionSkillAssignmentsGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilAccessHandler $access, ilTemplate $tpl, ilLanguage $lng, ilDB $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 ()
 
 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 816 of file class.ilAssQuestionSkillAssignmentsGUI.php.

817 {
818 if( $questionOBJ instanceof iQuestionCondition )
819 {
820 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/class.ilAssLacLegendGUI.php';
821 $legend = new ilAssLacLegendGUI($this->lng, $this->tpl);
822 $legend->setQuestionOBJ($questionOBJ);
823 $legend->setInitialVisibilityEnabled($assignment->hasEvalModeBySolution());
824 $lacLegendHTML = $this->ctrl->getHTML($legend);
825 return $lacLegendHTML;
826 }
827
828 return '';
829 }
$legend
Class iQuestionCondition.

References $legend, and ilAssQuestionSkillAssignment\hasEvalModeBySolution().

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

631 {
632 $this->tpl->addCss('Services/COPage/css/content.css');
633
634 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
635 $pageGUI = new ilAssQuestionPageGUI($questionGUI->object->getId());
636
637 $pageGUI->setOutputMode("presentation");
638 $pageGUI->setRenderPageContainer(true);
639
640 $pageGUI->setPresentationTitle($questionGUI->object->getTitle());
641
642 $questionGUI->object->setShuffle(false); // dirty, but works ^^
643 $questionHTML = $questionGUI->getSolutionOutput(0, 0, false, false, true, false, true, false, true);
644 $pageGUI->setQuestionHTML(array($questionGUI->object->getId() => $questionHTML));
645
646 $pageHTML = $pageGUI->presentation();
647 $pageHTML = preg_replace("/src=\"\\.\\//ims", "src=\"" . ILIAS_HTTP_PATH . "/", $pageHTML);
648
649 return $pageHTML;
650 }
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 655 of file class.ilAssQuestionSkillAssignmentsGUI.php.

656 {
657 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
658
659 $assignment = new ilAssQuestionSkillAssignment($this->db);
660
661 $assignment->setParentObjId($this->getQuestionContainerId());
662 $assignment->setQuestionId($questionId);
663 $assignment->setSkillBaseId($skillBaseId);
664 $assignment->setSkillTrefId($skillTrefId);
665
666 $assignment->loadFromDb();
667 $assignment->loadAdditionalSkillData();
668
669 return $assignment;
670 }

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

579 {
580 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
581 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
582 $assignmentList->setParentObjId($this->getQuestionContainerId());
583
584 return $assignmentList;
585 }

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

474 {
475 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssQuestionSkillAssignmentPropertyFormGUI.php';
476 $form = new ilAssQuestionSkillAssignmentPropertyFormGUI($this->ctrl, $this->lng, $this);
477
478 $form->setQuestion($question);
479 $form->setAssignment($assignment);
480 $form->setManipulationEnabled($this->isAssignmentEditingEnabled());
481
482 $form->build();
483
484 return $form;
485 }

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

591 {
592 require_once 'Services/Skill/classes/class.ilSkillSelectorGUI.php';
593
594 $skillSelectorExplorerGUI = new ilSkillSelectorGUI(
595 $this, self::CMD_SHOW_SKILL_SELECT, $this, self::CMD_UPDATE_SKILL_QUEST_ASSIGNS, self::PARAM_SKILL_SELECTION
596 );
597
598 $skillSelectorExplorerGUI->setSelectMode(self::PARAM_SKILL_SELECTION, true);
599 $skillSelectorExplorerGUI->setNodeOnclickEnabled(false);
600
601 // parameter name for skill selection is actually taken from value passed to constructor,
602 // but passing a non empty name to setSelectMode is neccessary to keep input fields enabled
603
604 foreach($assignments as $assignment)
605 {
606 $id = "{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}";
607 //$skillSelectorExplorerGUI->setNodeSelected($id);
608 $skillSelectorExplorerGUI->setSkillSelected($id);
609 }
610
611 return $skillSelectorExplorerGUI;
612 }
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 617 of file class.ilAssQuestionSkillAssignmentsGUI.php.

618 {
619 require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
620
621 $skillSelectorToolbarGUI = new ilToolbarGUI();
622
623 $skillSelectorToolbarGUI->setFormAction($this->ctrl->getFormAction($this));
624 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_save_skill_assigns_update'), self::CMD_UPDATE_SKILL_QUEST_ASSIGNS);
625 $skillSelectorToolbarGUI->addFormButton($this->lng->txt('qpl_cancel_skill_assigns_update'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
626
627 return $skillSelectorToolbarGUI;
628 }

Referenced by showSkillSelectionCmd().

+ Here is the caller graph for this function:

◆ buildTableGUI()

ilAssQuestionSkillAssignmentsGUI::buildTableGUI ( )
private

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

569 {
570 require_once 'Modules/TestQuestionPool/classes/tables/class.ilAssQuestionSkillAssignmentsTableGUI.php';
571 $table = new ilAssQuestionSkillAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
572 $table->setManipulationsEnabled($this->isAssignmentEditingEnabled());
573 $table->init();
574
575 return $table;
576 }

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

678 {
679 $errors = array();
680
681 foreach($input->getValues() as $expression)
682 {
683 $result = $this->validateSolutionCompareExpression($expression, $question);
684
685 if( $result !== true )
686 {
687 $errors[] = "{$this->lng->txt('ass_lac_expression')} {$expression->getOrderIndex()}: {$result}";
688 }
689 }
690
691 if( count($errors) )
692 {
693 $alert = $this->lng->txt('ass_lac_validation_error');
694 $alert .= '<br />'.implode('<br />', $errors);
695 $input->setAlert($alert);
696 return false;
697 }
698
699 return true;
700 }
$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 805 of file class.ilAssQuestionSkillAssignmentsGUI.php.

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

776 {
777 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
778
779 return sprintf($this->lng->txt('qpl_qst_skl_selection_for_question_header'), $questionData['title']);
780 }

Referenced by showSkillSelectionCmd().

+ Here is the caller graph for this function:

◆ handleAssignmentConfigurationHintMessage()

ilAssQuestionSkillAssignmentsGUI::handleAssignmentConfigurationHintMessage ( )
private

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

768 {
770 {
772 }
773 }
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 505 of file class.ilAssQuestionSkillAssignmentsGUI.php.

506 {
507 $questionData = $this->questionList->getDataArrayForQuestionId($questionId);
508
509 if( !$questionData['original_id'] )
510 {
511 return false;
512 }
513
514 require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
515 $parentObjId = assQuestion::lookupParentObjId($questionData['original_id']);
516
517 if( !$this->doesObjectTypeMatch($parentObjId) )
518 {
519 return false;
520 }
521
522 foreach( ilObject::_getAllReferences($parentObjId) as $parentRefId )
523 {
524 if( $this->access->checkAccess('write', '', $parentRefId) )
525 {
526 return true;
527 }
528 }
529
530 return false;
531 }
static lookupParentObjId($questionId)
@global ilDB $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 672 of file class.ilAssQuestionSkillAssignmentsGUI.php.

673 {
674 return $this->questionList->isInList($questionId);
675 }

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

+ Here is the caller graph for this function:

◆ keepAssignmentParameters()

ilAssQuestionSkillAssignmentsGUI::keepAssignmentParameters ( )
private

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

732 {
733 $this->ctrl->saveParameter($this, 'question_id');
734 $this->ctrl->saveParameter($this, 'skill_base_id');
735 $this->ctrl->saveParameter($this, 'skill_tref_id');
736 }

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

+ Here is the caller graph for this function:

◆ orderQuestionData()

ilAssQuestionSkillAssignmentsGUI::orderQuestionData (   $questionData)
private

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

739 {
740 $orderedQuestionsData = array();
741
742 if( $this->getQuestionOrderSequence() )
743 {
744 foreach($this->getQuestionOrderSequence() as $questionId)
745 {
746 $orderedQuestionsData[$questionId] = $questionData[$questionId];
747 }
748
749 return $orderedQuestionsData;
750 }
751
752 foreach($questionData as $questionId => $data)
753 {
754 $orderedQuestionsData[$questionId] = $data['title'];
755 }
756
757 $orderedQuestionsData = $this->sortAlphabetically($orderedQuestionsData);
758
759 foreach($orderedQuestionsData as $questionId => $questionTitle)
760 {
761 $orderedQuestionsData[$questionId] = $questionData[$questionId];
762 }
763
764 return $orderedQuestionsData;
765 }
$data

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 if( is_array($_POST['skill_points']) )
225 {
226 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignment.php';
227
228 $success = false;
229
230 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) && (int)$skillPoints > 0 )
238 {
239 $assignment = new ilAssQuestionSkillAssignment($this->db);
240
241 $assignment->setParentObjId($this->getQuestionContainerId());
242 $assignment->setQuestionId($questionId);
243 $assignment->setSkillBaseId($skillBaseId);
244 $assignment->setSkillTrefId($skillTrefId);
245
246 if( $assignment->dbRecordExists() )
247 {
248 $assignment->loadFromDb();
249
250 if( !$assignment->hasEvalModeBySolution() )
251 {
252 $assignment->setSkillPoints((int)$skillPoints);
253 $assignment->saveToDb();
254 }
255 }
256 }
257 }
258 }
259
260 ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
261 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
262 }
$success
Definition: Utf8Test.php:87
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12

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

+ Here is the call graph for this function:

◆ saveSkillQuestionAssignmentPropertiesFormCmd()

ilAssQuestionSkillAssignmentsGUI::saveSkillQuestionAssignmentPropertiesFormCmd ( )
private

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

402 {
403 $questionId = (int)$_GET['question_id'];
404
405 if( $this->isTestQuestion($questionId) )
406 {
407 require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
408 $questionGUI = assQuestionGUI::_getQuestionGUI('', $questionId);
409
410 $assignment = $this->buildQuestionSkillAssignment(
411 (int)$_GET['question_id'], (int)$_GET['skill_base_id'], (int)$_GET['skill_tref_id']
412 );
413
414 $form = $this->buildSkillQuestionAssignmentPropertiesForm($questionGUI->object, $assignment);
415
416 $form->setValuesByPost();
417
418 if( !$form->checkInput() )
419 {
421 $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
422 return;
423 }
424
425 if($form->getItemByPostVar('eval_mode'))
426 {
427 $assignment->setEvalMode($form->getItemByPostVar('eval_mode')->getValue());
428 }
429 else
430 {
432 }
433
434 if($assignment->hasEvalModeBySolution())
435 {
436 $solCmpExprInput = $form->getItemByPostVar('solution_compare_expressions');
437
438 if( !$this->checkSolutionCompareExpressionInput($solCmpExprInput, $questionGUI->object) )
439 {
440 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
442 $this->showSkillQuestionAssignmentPropertiesFormCmd($questionGUI, $assignment, $form);
443 return;
444 }
445
446 $assignment->initSolutionComparisonExpressionList();
447 $assignment->getSolutionComparisonExpressionList()->reset();
448
449 foreach($solCmpExprInput->getValues() as $expression)
450 {
451 $assignment->getSolutionComparisonExpressionList()->add($expression);
452 }
453 }
454 else
455 {
456 $assignment->setSkillPoints($form->getItemByPostVar('q_res_skill_points')->getValue());
457 }
458
459 $assignment->saveToDb();
460
461 ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_properties_modified'), true);
462
463 if( $this->isSyncOriginalPossibleAndAllowed($questionId) )
464 {
466 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
467 }
468 }
469
470 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
471 }
$_GET["client_id"]
& _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)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

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

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

488 {
490
491 $table = $this->buildTableGUI();
492
493 $assignmentList = $this->buildSkillQuestionAssignmentList();
494 $assignmentList->loadFromDb();
495 $assignmentList->loadAdditionalSkillData();
496 $table->setSkillQuestionAssignmentList($assignmentList);
497
498 $table->setData($this->orderQuestionData(
499 $this->questionList->getQuestionDataArray()
500 ));
501
502 $this->tpl->setContent($this->ctrl->getHTML($table));
503 }

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

+ Here is the call graph for this function:

◆ showSkillSelectionCmd()

ilAssQuestionSkillAssignmentsGUI::showSkillSelectionCmd ( )
private

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

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

534 {
535 $questionId = (int)$_GET['question_id'];
536
537 require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
538 $confirmation = new ilConfirmationGUI();
539
540 $confirmation->setHeaderText($this->lng->txt('qpl_sync_quest_skl_assigns_confirmation'));
541
542 $confirmation->setFormAction($this->ctrl->getFormAction($this));
543 $confirmation->addHiddenItem('question_id', $questionId);
544 $confirmation->setConfirm($this->lng->txt('yes'), self::CMD_SYNC_ORIGINAL);
545 $confirmation->setCancel($this->lng->txt('no'), self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
546
547 $this->tpl->setContent($this->ctrl->getHTML($confirmation));
548 }
Confirmation screen class.

References $_GET.

◆ sortAlphabetically()

ilAssQuestionSkillAssignmentsGUI::sortAlphabetically (   $array)
private

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

783 {
784 $flags = SORT_REGULAR;
785
786 if( defined('SORT_NATURAL') )
787 {
788 $flags = SORT_NATURAL;
789 }
790 elseif( defined('SORT_STRING') )
791 {
792 $flags = SORT_STRING;
793 }
794
795 if( defined('SORT_FLAG_CASE') )
796 {
797 $flags = $flags | SORT_FLAG_CASE;
798 }
799
800 asort($array, $flags);
801
802 return $array;
803 }

Referenced by orderQuestionData().

+ Here is the caller graph for this function:

◆ syncOriginalCmd()

ilAssQuestionSkillAssignmentsGUI::syncOriginalCmd ( )
private

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

551 {
552 $questionId = (int)$_POST['question_id'];
553
554 if( $this->isTestQuestion($questionId) && $this->isSyncOriginalPossibleAndAllowed($questionId) )
555 {
556 $question = assQuestion::_instantiateQuestion($questionId);
557
558 $question->syncSkillAssignments($question->getObjId(), $question->getId(),
559 $question->lookupParentObjId($question->getOriginalId()), $question->getOriginalId()
560 );
561
562 ilUtil::sendSuccess($this->lng->txt('qpl_qst_skl_assign_synced_to_orig'), true);
563 }
564
565 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
566 }
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 264 of file class.ilAssQuestionSkillAssignmentsGUI.php.

265 {
266 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
267
268 $questionId = (int)$_GET['question_id'];
269
270 if( $this->isTestQuestion($questionId) )
271 {
272 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
273 $assignmentList->setParentObjId($this->getQuestionContainerId());
274 $assignmentList->loadFromDb();
275
276 $handledSkills = array();
277
278 //$skillIds = (array)$_POST['skill_ids'];
279 $sgui = $this->buildSkillSelectorExplorerGUI(array());
280 $skillIds = $sgui->getSelectedSkills();
281
282 foreach($skillIds as $skillId)
283 {
284 $skill = explode(':',$skillId);
285 $skillBaseId = (int)$skill[0];
286 $skillTrefId = (int)$skill[1];
287
288 if( $skillBaseId )
289 {
290 if( !$assignmentList->isAssignedToQuestionId($skillBaseId, $skillTrefId, $questionId) )
291 {
292 $assignment = new ilAssQuestionSkillAssignment($this->db);
293
294 $assignment->setParentObjId($this->getQuestionContainerId());
295 $assignment->setQuestionId($questionId);
296 $assignment->setSkillBaseId($skillBaseId);
297 $assignment->setSkillTrefId($skillTrefId);
298
301 $assignment->saveToDb();
302 }
303
304 $handledSkills[$skillId] = $skill;
305 }
306 }
307
308 foreach($assignmentList->getAssignmentsByQuestionId($questionId) as $assignment)
309 {
310 if( isset($handledSkills["{$assignment->getSkillBaseId()}:{$assignment->getSkillTrefId()}"]) )
311 {
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) )
321 {
323 $this->ctrl->redirect($this, self::CMD_SHOW_SYNC_ORIGINAL_CONFIRMATION);
324 }
325 }
326
327 $this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
328 }

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

703 {
704 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacConditionParser.php';
705 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacQuestionProvider.php';
706 require_once 'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/ilAssLacCompositeValidator.php';
707
708 try
709 {
710 $conditionParser = new ilAssLacConditionParser();
711 $conditionComposite = $conditionParser->parse($expression->getExpression());
712 $questionProvider = new ilAssLacQuestionProvider();
713 $questionProvider->setQuestion($question);
714 $conditionValidator = new ilAssLacCompositeValidator($questionProvider);
715
716 $conditionValidator->validate($conditionComposite);
717 }
718 catch (ilAssLacException $e)
719 {
720 if( $e instanceof ilAssLacFormAlertProvider )
721 {
722 return $e->getFormAlert($this->lng);
723 }
724
725 throw $e;
726 }
727
728 return true;
729 }
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: