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

Public Member Functions

 __construct ($qId=-1)
 
 removeImage ()
 
 downkprim_answers ()
 
 upkprim_answers ()
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 
 getSpecificFeedbackOutput ($active_id, $pass)
 
 getTestOutput ( $active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $showInlineFeedback=FALSE)
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 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)
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
 renderAggregateView ($aggregate)
 
 aggregateAnswers ($rawSolutionData, $answers)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getOutputMode ()
 
 setOutputMode ($outputMode)
 
 isPdfOutputMode ()
 
 isContentEditingOutputMode ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
_getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 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)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form parts to a question property form gui. More...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 

Data Fields

 $object
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const OUTPUT_MODE_SCREEN = 'outModeScreen'
 
const OUTPUT_MODE_PDF = 'outModePdf'
 
const OUTPUT_MODE_CONTENT_EDITING = 'outModeUsrSol'
 

Protected Member Functions

 getAdditionalEditQuestionCommands ()
 
 editQuestion (ilPropertyFormGUI $form=null)
 
 uploadImage ()
 
 writePostData ($upload=false)
 
 getParticipantsAnswerKeySequence ()
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 getPreviousSolutionProvidedMessage ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 isLastSolutionSubmitAuthorized ($active_id, $pass)
 fetches solutions from database and prefers intermediate solutions, but falls back to authorized solutions. More...
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_QuestionPreview (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 getTestOutputSolutions ($activeId, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 

Private Member Functions

 buildEditForm ()
 
 handleAnswerTextsSubmit ($answers)
 
 populateSpecificFeedbackInline ($user_solution, $answer_id, $template)
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 

Detailed Description

Definition at line 16 of file class.assKprimChoiceGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assKprimChoiceGUI::__construct (   $qId = -1)
Parameters
$qId

Definition at line 26 of file class.assKprimChoiceGUI.php.

27 {
28 parent::__construct();
29
30 require_once 'Modules/TestQuestionPool/classes/class.assKprimChoice.php';
31 $this->object = new assKprimChoice();
32
33 if ($qId > 0)
34 {
35 $this->object->loadFromDb($qId);
36 }
37 }

Member Function Documentation

◆ aggregateAnswers()

assKprimChoiceGUI::aggregateAnswers (   $rawSolutionData,
  $answers 
)

Definition at line 884 of file class.assKprimChoiceGUI.php.

885 {
886 $aggregate = array();
887
888 foreach( $answers as $answer )
889 {
890 $answerAgg = array(
891 'answertext' => $answer->getAnswerText(), 'count_true' => 0, 'count_false' => 0
892 );
893
894 foreach( $rawSolutionData as $solutionRecord )
895 {
896 if( $solutionRecord['value1'] == $answer->getPosition() )
897 {
898 if( $solutionRecord['value2'] )
899 {
900 $answerAgg['count_true']++;
901 }
902 else
903 {
904 $answerAgg['count_false']++;
905 }
906 }
907
908 }
909
910 $aggregate[] = $answerAgg;
911 }
912
913 return $aggregate;
914 }

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ buildEditForm()

assKprimChoiceGUI::buildEditForm ( )
private
Returns
ilPropertyFormGUI

Definition at line 137 of file class.assKprimChoiceGUI.php.

138 {
139 $form = $this->buildBasicEditFormObject();
140
141 $this->addQuestionFormCommandButtons($form);
142
143 $this->addBasicQuestionFormProperties($form);
144
146 $this->populateAnswerSpecificFormPart($form);
147
148 $this->populateTaxonomyFormSection($form);
149
150 return $form;
151 }
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...

References assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), assQuestionGUI\buildBasicEditFormObject(), populateAnswerSpecificFormPart(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by editQuestion(), and writePostData().

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

◆ downkprim_answers()

assKprimChoiceGUI::downkprim_answers ( )

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

78 {
79 if( isset($_POST['cmd'][__FUNCTION__]) && count($_POST['cmd'][__FUNCTION__]) )
80 {
81 $this->object->moveAnswerDown( key($_POST['cmd'][__FUNCTION__]) );
82 $this->object->saveToDb();
83 }
84
85 $this->editQuestion();
86 }
editQuestion(ilPropertyFormGUI $form=null)
$_POST['username']
Definition: cron.php:12

References $_POST, and editQuestion().

+ Here is the call graph for this function:

◆ editQuestion()

assKprimChoiceGUI::editQuestion ( ilPropertyFormGUI  $form = null)
protected

Definition at line 44 of file class.assKprimChoiceGUI.php.

45 {
46 if( $form === null )
47 {
48 $form = $this->buildEditForm();
49 }
50
51 $this->getQuestionTemplate();
52 $this->tpl->addCss('Modules/Test/templates/default/ta.css');
53
54 $this->tpl->setVariable("QUESTION_DATA", $this->ctrl->getHTML($form));
55 }
getQuestionTemplate()
get question template

References buildEditForm(), and assQuestionGUI\getQuestionTemplate().

Referenced by downkprim_answers(), removeImage(), upkprim_answers(), uploadImage(), and writePostData().

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

◆ getAdditionalEditQuestionCommands()

assKprimChoiceGUI::getAdditionalEditQuestionCommands ( )
protected

Reimplemented from assQuestionGUI.

Definition at line 39 of file class.assKprimChoiceGUI.php.

40 {
41 return array('uploadImage', 'removeImage');
42 }

◆ getAfterParticipationSuppressionAnswerPostVars()

assKprimChoiceGUI::getAfterParticipationSuppressionAnswerPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiAnswerScoringAdjustable.

Definition at line 826 of file class.assKprimChoiceGUI.php.

827 {
828 return array();
829 }

◆ getAfterParticipationSuppressionQuestionPostVars()

assKprimChoiceGUI::getAfterParticipationSuppressionQuestionPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiQuestionScoringAdjustable.

Definition at line 840 of file class.assKprimChoiceGUI.php.

841 {
842 return array();
843 }

◆ getAggregatedAnswersView()

assKprimChoiceGUI::getAggregatedAnswersView (   $relevant_answers)

Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface.

Parameters
array$relevant_answers
Returns
string

Implements ilGuiQuestionScoringAdjustable.

Definition at line 853 of file class.assKprimChoiceGUI.php.

854 {
855 return $this->renderAggregateView(
856 $this->aggregateAnswers( $relevant_answers, $this->object->getAnswers() ) )->get();
857
858 return '<pre>'.print_r($relevant_answers, 1).'</pre>';
859 }
aggregateAnswers($rawSolutionData, $answers)

References aggregateAnswers(), and renderAggregateView().

+ Here is the call graph for this function:

◆ getParticipantsAnswerKeySequence()

assKprimChoiceGUI::getParticipantsAnswerKeySequence ( )
protected

Definition at line 759 of file class.assKprimChoiceGUI.php.

760 {
761 $choiceKeys = array_keys($this->object->getAnswers());
762
763 if( $this->object->isShuffleAnswersEnabled() )
764 {
765 $choiceKeys = $this->object->getShuffler()->shuffle($choiceKeys);
766 }
767
768 return $choiceKeys;
769 }

Referenced by getPreview(), getSolutionOutput(), and getTestOutput().

+ Here is the caller graph for this function:

◆ getPreview()

assKprimChoiceGUI::getPreview (   $show_question_only = FALSE,
  $showInlineFeedback = false 
)
Parameters
bool$show_question_only
bool$showInlineFeedback

Reimplemented from assQuestionGUI.

Definition at line 468 of file class.assKprimChoiceGUI.php.

469 {
470 $user_solution = is_object($this->getPreviewSession()) ? (array)$this->getPreviewSession()->getParticipantsSolution() : array();
471 // shuffle output
472 $keys = $this->getParticipantsAnswerKeySequence();
473
474 // generate the question output
475 include_once "./Services/UICore/classes/class.ilTemplate.php";
476 $template = new ilTemplate("tpl.il_as_qpl_mc_kprim_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
477
478 foreach ($keys as $answer_id)
479 {
480 $answer = $this->object->getAnswer($answer_id);
481 if (strlen($answer->getImageFile()))
482 {
483 if ($this->object->getThumbSize())
484 {
485 $template->setCurrentBlock("preview");
486 $template->setVariable("URL_PREVIEW", $answer->getImageWebPath());
487 $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
488 $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
489 $template->setVariable("ANSWER_IMAGE_URL", $answer->getThumbWebPath());
490 list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
491 $alt = $answer->getImageFile();
492 if (strlen($answer->getAnswertext()))
493 {
494 $alt = $answer->getAnswertext();
495 }
496 $alt = preg_replace("/<[^>]*?>/", "", $alt);
497 $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
498 $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
499 $template->parseCurrentBlock();
500 }
501 else
502 {
503 $template->setCurrentBlock("answer_image");
504 $template->setVariable("ANSWER_IMAGE_URL", $answer->getImageWebPath());
505 list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
506 $alt = $answer->getImageFile();
507 if (strlen($answer->getAnswertext()))
508 {
509 $alt = $answer->getAnswertext();
510 }
511 $alt = preg_replace("/<[^>]*?>/", "", $alt);
512 $template->setVariable("ATTR", $attr);
513 $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
514 $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
515 $template->parseCurrentBlock();
516 }
517 }
518
519 if( $showInlineFeedback )
520 {
521 $this->populateSpecificFeedbackInline($user_solution, $answer_id, $template);
522 }
523
524 $template->setCurrentBlock("answer_row");
525 $template->setVariable("ANSWER_ID", $answer_id);
526 $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
527 $template->setVariable('VALUE_TRUE', 1);
528 $template->setVariable('VALUE_FALSE', 0);
529
530 if( isset($user_solution[$answer->getPosition()]) )
531 {
532 $tplVar = $user_solution[$answer->getPosition()] ? 'CHECKED_ANSWER_TRUE' : 'CHECKED_ANSWER_FALSE';
533 $template->setVariable($tplVar, " checked=\"checked\"");
534 }
535
536 $template->parseCurrentBlock();
537 }
538 $questiontext = $this->object->getQuestion();
539 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
540
541 $template->setVariable("INSTRUCTIONTEXT", $this->object->getInstructionTextTranslation(
542 $this->lng, $this->object->getOptionLabel()
543 ));
544
545 $template->setVariable("OPTION_LABEL_TRUE", $this->object->getTrueOptionLabelTranslation(
546 $this->lng, $this->object->getOptionLabel()
547 ));
548
549 $template->setVariable("OPTION_LABEL_FALSE", $this->object->getFalseOptionLabelTranslation(
550 $this->lng, $this->object->getOptionLabel()
551 ));
552
553 $questionoutput = $template->get();
554 if (!$show_question_only)
555 {
556 // get page object output
557 $questionoutput = $this->getILIASPage($questionoutput);
558 }
559 return $questionoutput;
560 }
populateSpecificFeedbackInline($user_solution, $answer_id, $template)
getILIASPage($html="")
Returns the ILIAS Page around a question.
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)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getParticipantsAnswerKeySequence(), assQuestionGUI\getPreviewSession(), populateSpecificFeedbackInline(), and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ getSolutionOutput()

assKprimChoiceGUI::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 
)
Parameters
$active_id
null$pass
bool$graphicalOutput
bool$result_output
bool$show_question_only
bool$show_feedback
bool$show_correct_solution
bool$show_manual_scoring
bool$show_question_text

Reimplemented from assQuestionGUI.

Definition at line 573 of file class.assKprimChoiceGUI.php.

584 {
585 // shuffle output
586 $keys = $this->getParticipantsAnswerKeySequence();
587
588 // get the solution of the user for the active pass or from the last pass if allowed
589 $user_solution = array();
590 if (($active_id > 0) && (!$show_correct_solution))
591 {
592 $solutions =& $this->object->getSolutionValues($active_id, $pass);
593 foreach ($solutions as $idx => $solution_value)
594 {
595 $user_solution[$solution_value['value1']] = $solution_value['value2'];
596 }
597 }
598 else
599 {
600 // take the correct solution instead of the user solution
601 foreach ($this->object->getAnswers() as $answer)
602 {
603 $user_solution[$answer->getPosition()] = $answer->getCorrectness();
604 }
605 }
606
607 // generate the question output
608 $template = new ilTemplate("tpl.il_as_qpl_mc_kprim_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
609
610 foreach ($keys as $answer_id)
611 {
612 $answer = $this->object->getAnswer($answer_id);
613
614 if (($active_id > 0) && (!$show_correct_solution))
615 {
616 if ($graphicalOutput)
617 {
618 // output of ok/not ok icons for user entered solutions
619
620 if( $user_solution[$answer->getPosition()] == $answer->getCorrectness() )
621 {
622 $template->setCurrentBlock("icon_ok");
623 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
624 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
625 $template->parseCurrentBlock();
626 }
627 else
628 {
629 $template->setCurrentBlock("icon_ok");
630 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
631 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
632 $template->parseCurrentBlock();
633 }
634 }
635 }
636 if (strlen($answer->getImageFile()))
637 {
638 $template->setCurrentBlock("answer_image");
639 if ($this->object->getThumbSize())
640 {
641 $template->setVariable("ANSWER_IMAGE_URL", $answer->getThumbWebPath());
642 }
643 else
644 {
645 $template->setVariable("ANSWER_IMAGE_URL", $answer->getImageWebPath());
646 }
647
648 $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($answer->getImageFile()));
649 $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($answer->getImageFile()));
650 $template->parseCurrentBlock();
651 }
652
653 if ($show_feedback)
654 {
655 $this->populateSpecificFeedbackInline($user_solution, $answer_id, $template);
656 }
657
658 $template->setCurrentBlock("answer_row");
659 $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
660
661 if( $this->isPdfOutputMode() || $this->isContentEditingOutputMode() )
662 {
663 if( isset($user_solution[$answer->getPosition()]) )
664 {
665 if( $user_solution[$answer->getPosition()] )
666 {
667 $template->setVariable("SOLUTION_IMAGE_TRUE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_checked.png")));
668 $template->setVariable("SOLUTION_ALT_TRUE", $this->lng->txt("checked"));
669 $template->setVariable("SOLUTION_IMAGE_FALSE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
670 $template->setVariable("SOLUTION_ALT_FALSE", $this->lng->txt("unchecked"));
671 }
672 else
673 {
674 $template->setVariable("SOLUTION_IMAGE_TRUE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
675 $template->setVariable("SOLUTION_ALT_TRUE", $this->lng->txt("unchecked"));
676 $template->setVariable("SOLUTION_IMAGE_FALSE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_checked.png")));
677 $template->setVariable("SOLUTION_ALT_FALSE", $this->lng->txt("checked"));
678 }
679 }
680 else
681 {
682 $template->setVariable("SOLUTION_IMAGE_TRUE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
683 $template->setVariable("SOLUTION_ALT_TRUE", $this->lng->txt("unchecked"));
684 $template->setVariable("SOLUTION_IMAGE_FALSE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
685 $template->setVariable("SOLUTION_ALT_FALSE", $this->lng->txt("unchecked"));
686 }
687 }
688 else
689 {
690 $template->setVariable('SOL_QID', $this->object->getId());
691 $template->setVariable('SOL_SUFFIX', $show_correct_solution ? 'bestsolution' : 'usersolution');
692 $template->setVariable('SOL_POSITION', $answer->getPosition());
693
694 $template->setVariable('SOL_TRUE_VALUE', 1);
695 $template->setVariable('SOL_FALSE_VALUE', 0);
696
697 if( isset($user_solution[$answer->getPosition()]) )
698 {
699 if( $user_solution[$answer->getPosition()] )
700 {
701 $template->setVariable('SOL_TRUE_CHECKED', 'checked');
702 }
703 else
704 {
705 $template->setVariable('SOL_FALSE_CHECKED', 'checked');
706 }
707 }
708 }
709
710 $template->parseCurrentBlock();
711 }
712
713 if ($show_question_text==true)
714 {
715 $questiontext = $this->object->getQuestion();
716 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
717
718 $template->setVariable("INSTRUCTIONTEXT", $this->object->getInstructionTextTranslation(
719 $this->lng, $this->object->getOptionLabel()
720 ));
721 }
722
723 $template->setVariable("OPTION_LABEL_TRUE", $this->object->getTrueOptionLabelTranslation(
724 $this->lng, $this->object->getOptionLabel()
725 ));
726
727 $template->setVariable("OPTION_LABEL_FALSE", $this->object->getFalseOptionLabelTranslation(
728 $this->lng, $this->object->getOptionLabel()
729 ));
730
731
732 $questionoutput = $template->get();
733 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getGenericFeedbackOutput($active_id, $pass) : "";
734
735 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
736
737 if (strlen($feedback))
738 {
739 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
741 );
742
743 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
744 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
745 }
746
747 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
748
749 $solutionoutput = $solutiontemplate->get();
750
751 if (!$show_question_only)
752 {
753 // get page object output
754 $solutionoutput = $this->getILIASPage($solutionoutput);
755 }
756 return $solutionoutput;
757 }
hasCorrectSolution($activeId, $passIndex)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
static getHtmlPath($relative_path)
get url of path

References $pass, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), ilUtil\getHtmlPath(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getParticipantsAnswerKeySequence(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isContentEditingOutputMode(), assQuestionGUI\isPdfOutputMode(), assQuestionGUI\isTestPresentationContext(), populateSpecificFeedbackInline(), and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assKprimChoiceGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)
Parameters
integer$active_id
integer$pass
Returns
string

Reimplemented from assQuestionGUI.

Definition at line 333 of file class.assKprimChoiceGUI.php.

334 {
335 return ''; // question type supports inline answer specific feedback
336 }

◆ getTestOutput()

assKprimChoiceGUI::getTestOutput (   $active_id,
  $pass,
  $is_postponed = FALSE,
  $use_post_solutions = FALSE,
  $showInlineFeedback = FALSE 
)
Parameters
integer$active_id
integer | null$pass
bool$is_postponed
bool$use_post_solutions
bool$show_feedback
Returns
string

Reimplemented from assQuestionGUI.

Definition at line 347 of file class.assKprimChoiceGUI.php.

356 {
357 // shuffle output
358 $keys = $this->getParticipantsAnswerKeySequence();
359
360 // get the solution of the user for the active pass or from the last pass if allowed
361 $user_solution = array();
362 if ($active_id)
363 {
364 // hey: prevPassSolutions - obsolete due to central check
365 #$solutions = NULL;
366 #include_once "./Modules/Test/classes/class.ilObjTest.php";
367 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
368 #{
369 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
370 #}
371 $solutions = $this->getTestOutputSolutions($active_id, $pass);
372 // hey.
373 foreach ($solutions as $idx => $solution_value)
374 {
375 $user_solution[$solution_value["value1"]] = $solution_value["value2"];
376 }
377 }
378
379 // generate the question output
380 include_once "./Services/UICore/classes/class.ilTemplate.php";
381 $template = new ilTemplate("tpl.il_as_qpl_mc_kprim_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
382
383 foreach ($keys as $answer_id)
384 {
385 $answer = $this->object->getAnswer($answer_id);
386 if (strlen($answer->getImageFile()))
387 {
388 if ($this->object->getThumbSize())
389 {
390 $template->setCurrentBlock("preview");
391 $template->setVariable("URL_PREVIEW", $answer->getImageWebPath());
392 $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
393 $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
394 $template->setVariable("ANSWER_IMAGE_URL", $answer->getThumbWebPath());
395 list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
396 $alt = $answer->getImageFile();
397 if (strlen($answer->getAnswertext()))
398 {
399 $alt = $answer->getAnswertext();
400 }
401 $alt = preg_replace("/<[^>]*?>/", "", $alt);
402 $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
403 $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
404 $template->parseCurrentBlock();
405 }
406 else
407 {
408 $template->setCurrentBlock("answer_image");
409 $template->setVariable("ANSWER_IMAGE_URL", $answer->getImageWebPath());
410 list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
411 $alt = $answer->getImageFile();
412 if (strlen($answer->getAnswertext()))
413 {
414 $alt = $answer->getAnswertext();
415 }
416 $alt = preg_replace("/<[^>]*?>/", "", $alt);
417 $template->setVariable("ATTR", $attr);
418 $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
419 $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
420 $template->parseCurrentBlock();
421 }
422 }
423
424 if( $showInlineFeedback )
425 {
426 $this->populateSpecificFeedbackInline($user_solution, $answer_id, $template);
427 }
428
429 $template->setCurrentBlock("answer_row");
430 $template->setVariable("ANSWER_ID", $answer_id);
431 $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
432 $template->setVariable('VALUE_TRUE', 1);
433 $template->setVariable('VALUE_FALSE', 0);
434
435 if( isset($user_solution[$answer->getPosition()]) )
436 {
437 $tplVar = $user_solution[$answer->getPosition()] ? 'CHECKED_ANSWER_TRUE' : 'CHECKED_ANSWER_FALSE';
438 $template->setVariable($tplVar, " checked=\"checked\"");
439 }
440
441 $template->parseCurrentBlock();
442 }
443
444 $questiontext = $this->object->getQuestion();
445 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
446
447 $template->setVariable("INSTRUCTIONTEXT", $this->object->getInstructionTextTranslation(
448 $this->lng, $this->object->getOptionLabel()
449 ));
450
451 $template->setVariable("OPTION_LABEL_TRUE", $this->object->getTrueOptionLabelTranslation(
452 $this->lng, $this->object->getOptionLabel()
453 ));
454
455 $template->setVariable("OPTION_LABEL_FALSE", $this->object->getFalseOptionLabelTranslation(
456 $this->lng, $this->object->getOptionLabel()
457 ));
458
459 $questionoutput = $template->get();
460 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
461 return $pageoutput;
462 }
getTestOutputSolutions($activeId, $pass)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page

References $pass, ilUtil\getImagePath(), getParticipantsAnswerKeySequence(), assQuestionGUI\getTestOutputSolutions(), assQuestionGUI\outQuestionPage(), populateSpecificFeedbackInline(), and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ handleAnswerTextsSubmit()

assKprimChoiceGUI::handleAnswerTextsSubmit (   $answers)
private

Definition at line 313 of file class.assKprimChoiceGUI.php.

314 {
315 if( $this->object->getAnswerType() == assKprimChoice::ANSWER_TYPE_MULTI_LINE )
316 {
317 return $answers;
318 }
319
320 foreach($answers as $key => $answer)
321 {
322 $answer->setAnswerText(ilUtil::secureString($answer->getAnswerText()));
323 }
324
325 return $answers;
326 }
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.

References assKprimChoice\ANSWER_TYPE_MULTI_LINE, and ilUtil\secureString().

Referenced by writeAnswerSpecificPostData().

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

◆ populateAnswerSpecificFormPart()

assKprimChoiceGUI::populateAnswerSpecificFormPart ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Implements ilGuiAnswerScoringAdjustable.

Definition at line 276 of file class.assKprimChoiceGUI.php.

277 {
278 require_once 'Modules/TestQuestionPool/classes/class.ilKprimChoiceWizardInputGUI.php';
279 $kprimAnswers = new ilKprimChoiceWizardInputGUI($this->lng->txt('answers'), 'kprim_answers');
280 $kprimAnswers->setInfo($this->lng->txt('kprim_answers_info'));
281 $kprimAnswers->setSize(64);
282 $kprimAnswers->setMaxLength(1000);
283 $kprimAnswers->setRequired(true);
284 $kprimAnswers->setAllowMove(true);
285 $kprimAnswers->setQuestionObject($this->object);
286 if( !$this->object->getSelfAssessmentEditingMode() )
287 {
288 $kprimAnswers->setSingleline($this->object->isSingleLineAnswerType($this->object->getAnswerType()));
289 }
290 else
291 {
292 $kprimAnswers->setSingleline(false);
293 }
294 $kprimAnswers->setValues($this->object->getAnswers());
295 $form->addItem($kprimAnswers);
296
297 return $form;
298 }
addItem($a_item)
Add Item (Property, SectionHeader).

References ilPropertyFormGUI\addItem().

Referenced by buildEditForm().

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

◆ populateQuestionSpecificFormPart()

assKprimChoiceGUI::populateQuestionSpecificFormPart ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Implements ilGuiQuestionScoringAdjustable.

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

158 {
159 // shuffle answers
160 $shuffleAnswers = new ilCheckboxInputGUI($this->lng->txt( "shuffle_answers" ), "shuffle_answers_enabled");
161 $shuffleAnswers->setChecked( $this->object->isShuffleAnswersEnabled() );
162 $form->addItem($shuffleAnswers);
163
164 if( !$this->object->getSelfAssessmentEditingMode() )
165 {
166 // answer mode (single-/multi-line)
167 $answerType = new ilSelectInputGUI($this->lng->txt('answer_types'), 'answer_type');
168 $answerType->setOptions($this->object->getAnswerTypeSelectOptions($this->lng));
169 $answerType->setValue( $this->object->getAnswerType() );
170 $form->addItem($answerType);
171 }
172
173 if( !$this->object->getSelfAssessmentEditingMode() && $this->object->isSingleLineAnswerType($this->object->getAnswerType()) )
174 {
175 // thumb size
176 $thumbSize = new ilNumberInputGUI($this->lng->txt('thumb_size'), 'thumb_size');
177 $thumbSize->setSuffix($this->lng->txt("thumb_size_unit_pixel"));
178 $thumbSize->setInfo( $this->lng->txt('thumb_size_info') );
179 $thumbSize->setDecimals(false);
180 $thumbSize->setMinValue(20);
181 $thumbSize->setSize(6);
182 $thumbSize->setValue( $this->object->getThumbSize() );
183 $form->addItem($thumbSize);
184 }
185
186 // option label
187 $optionLabel = new ilRadioGroupInputGUI($this->lng->txt('option_label'), 'option_label');
188 $optionLabel->setInfo($this->lng->txt('option_label_info'));
189 $optionLabel->setRequired(true);
190 $optionLabel->setValue($this->object->getOptionLabel());
191 foreach($this->object->getValidOptionLabelsTranslated($this->lng) as $labelValue => $labelText)
192 {
193 $option = new ilRadioOption($labelText, $labelValue);
194 $optionLabel->addOption($option);
195
196 if( $this->object->isCustomOptionLabel($labelValue) )
197 {
198 $customLabelTrue = new ilTextInputGUI(
199 $this->lng->txt('option_label_custom_true'), 'option_label_custom_true'
200 );
201 $customLabelTrue->setValue($this->object->getCustomTrueOptionLabel());
202 $option->addSubItem($customLabelTrue);
203
204 $customLabelFalse = new ilTextInputGUI(
205 $this->lng->txt('option_label_custom_false'), 'option_label_custom_false'
206 );
207 $customLabelFalse->setValue($this->object->getCustomFalseOptionLabel());
208 $option->addSubItem($customLabelFalse);
209 }
210 }
211 $form->addItem($optionLabel);
212
213 // points
214 $points = new ilNumberInputGUI($this->lng->txt('points'), 'points');
215 $points->setRequired(true);
216 $points->setSize(3);
217 $points->allowDecimals(true);
218 $points->setMinValue(0);
219 $points->setMinvalueShouldBeGreater(true);
220 $points->setValue($this->object->getPoints());
221 $form->addItem($points);
222
223 // score partial solution
224 $scorePartialSolution = new ilCheckboxInputGUI($this->lng->txt('score_partsol_enabled'), 'score_partsol_enabled');
225 $scorePartialSolution->setInfo($this->lng->txt('score_partsol_enabled_info'));
226 $scorePartialSolution->setChecked( $this->object->isScorePartialSolutionEnabled() );
227 $form->addItem($scorePartialSolution);
228
229 return $form;
230 }
This class represents a checkbox property in a property form.
This class represents a number property in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
This class represents a text property in a property form.

References ilPropertyFormGUI\addItem().

Referenced by buildEditForm().

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

◆ populateSpecificFeedbackInline()

assKprimChoiceGUI::populateSpecificFeedbackInline (   $user_solution,
  $answer_id,
  $template 
)
private

Definition at line 771 of file class.assKprimChoiceGUI.php.

772 {
773 require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssConfigurableMultiOptionQuestionFeedback.php';
774
775 if($this->object->getSpecificFeedbackSetting() == ilAssConfigurableMultiOptionQuestionFeedback::FEEDBACK_SETTING_CHECKED)
776 {
777 if($user_solution[$answer_id])
778 {
779 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
780 if(strlen($fb))
781 {
782 $template->setCurrentBlock("feedback");
783 $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
784 $template->parseCurrentBlock();
785 }
786 }
787 }
788
789 if($this->object->getSpecificFeedbackSetting() == ilAssConfigurableMultiOptionQuestionFeedback::FEEDBACK_SETTING_ALL)
790 {
791 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
792 if(strlen($fb))
793 {
794 $template->setCurrentBlock("feedback");
795 $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
796 $template->parseCurrentBlock();
797 }
798 }
799
800 if($this->object->getSpecificFeedbackSetting() == ilAssConfigurableMultiOptionQuestionFeedback::FEEDBACK_SETTING_CORRECT)
801 {
802 $answer = $this->object->getAnswer($answer_id);
803
804 if($answer->getCorrectness())
805 {
806 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
807 if(strlen($fb))
808 {
809 $template->setCurrentBlock("feedback");
810 $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
811 $template->parseCurrentBlock();
812 }
813 }
814 }
815 }

References ilAssConfigurableMultiOptionQuestionFeedback\FEEDBACK_SETTING_ALL, ilAssConfigurableMultiOptionQuestionFeedback\FEEDBACK_SETTING_CHECKED, and ilAssConfigurableMultiOptionQuestionFeedback\FEEDBACK_SETTING_CORRECT.

Referenced by getPreview(), getSolutionOutput(), and getTestOutput().

+ Here is the caller graph for this function:

◆ removeImage()

assKprimChoiceGUI::removeImage ( )

Definition at line 68 of file class.assKprimChoiceGUI.php.

69 {
70 $position = key($_POST['cmd']['removeImage']);
71 $this->object->removeAnswerImage($position);
72
73 $this->object->saveToDb();
74 $this->editQuestion();
75 }

References $_POST, and editQuestion().

+ Here is the call graph for this function:

◆ renderAggregateView()

assKprimChoiceGUI::renderAggregateView (   $aggregate)

Definition at line 861 of file class.assKprimChoiceGUI.php.

862 {
863 $trueOptionLabel = $this->object->getTrueOptionLabelTranslation($this->lng, $this->object->getOptionLabel());
864 $falseOptionLabel = $this->object->getFalseOptionLabelTranslation($this->lng, $this->object->getOptionLabel());
865
866 $tpl = new ilTemplate('tpl.il_as_aggregated_kprim_answers_table.html', true, true, "Modules/TestQuestionPool");
867
868 foreach( $aggregate as $lineData )
869 {
870 $tpl->setCurrentBlock('aggregaterow');
871 $tpl->setVariable('OPTION', $lineData['answertext']);
872 $tpl->setVariable('COUNT_TRUE', $lineData['count_true']);
873 $tpl->setVariable('COUNT_FALSE', $lineData['count_false']);
874 $tpl->parseCurrentBlock();
875 }
876
877 $tpl->setVariable('OPTION_HEAD', $this->lng->txt('answers'));
878 $tpl->setVariable('COUNT_TRUE_HEAD', $trueOptionLabel);
879 $tpl->setVariable('COUNT_FALSE_HEAD', $falseOptionLabel);
880
881 return $tpl;
882 }

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ upkprim_answers()

assKprimChoiceGUI::upkprim_answers ( )

Definition at line 88 of file class.assKprimChoiceGUI.php.

89 {
90 if( isset($_POST['cmd'][__FUNCTION__]) && count($_POST['cmd'][__FUNCTION__]) )
91 {
92 $this->object->moveAnswerUp( key($_POST['cmd'][__FUNCTION__]) );
93 $this->object->saveToDb();
94 }
95
96 $this->editQuestion();
97 }

References $_POST, and editQuestion().

+ Here is the call graph for this function:

◆ uploadImage()

assKprimChoiceGUI::uploadImage ( )
protected

Definition at line 57 of file class.assKprimChoiceGUI.php.

58 {
59 $result = $this->writePostData(true);
60
61 if( $result == 0 )
62 {
63 $this->object->saveToDb();
64 $this->editQuestion();
65 }
66 }
$result
writePostData()
Evaluates a posted edit form and writes the form data in the question object.

References $result, editQuestion(), and assQuestionGUI\writePostData().

+ Here is the call graph for this function:

◆ writeAnswerSpecificPostData()

assKprimChoiceGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

Implements ilGuiAnswerScoringAdjustable.

Definition at line 303 of file class.assKprimChoiceGUI.php.

304 {
305 $answers = $form->getItemByPostVar('kprim_answers')->getValues();
306 $answers = $this->handleAnswerTextsSubmit($answers);
307 $files = $form->getItemByPostVar('kprim_answers')->getFiles();
308
309 $this->object->handleFileUploads($answers, $files);
310 $this->object->setAnswers($answers);
311 }
getItemByPostVar($a_post_var)
Get Item by POST variable.

References ilPropertyFormGUI\getItemByPostVar(), and handleAnswerTextsSubmit().

Referenced by writePostData().

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

◆ writePostData()

assKprimChoiceGUI::writePostData (   $upload = false)
protected

Definition at line 99 of file class.assKprimChoiceGUI.php.

100 {
101 $form = $this->buildEditForm();
102 $form->setValuesByPost();
103
104 if( $upload )
105 {
106 $answersInput = $form->getItemByPostVar('kprim_answers');
107 $answersInput->setIgnoreMissingUploadsEnabled(true);
108
109 if( !$answersInput->checkUploads($_POST[$answersInput->getPostVar()]) )
110 {
111 ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
112 $this->editQuestion($form);
113 return 1;
114 }
115
116 $answersInput->collectValidFiles();
117 }
118 elseif( !$form->checkInput() )
119 {
120 $this->editQuestion($form);
121 return 1;
122 }
123
125
126 $this->writeQuestionSpecificPostData($form);
127 $this->writeAnswerSpecificPostData($form);
128
130
131 return 0;
132 }
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_POST, buildEditForm(), editQuestion(), assQuestionGUI\saveTaxonomyAssignments(), ilUtil\sendFailure(), writeAnswerSpecificPostData(), assQuestionGUI\writeQuestionGenericPostData(), and writeQuestionSpecificPostData().

+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assKprimChoiceGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

Implements ilGuiQuestionScoringAdjustable.

Definition at line 235 of file class.assKprimChoiceGUI.php.

236 {
237 $oldAnswerType = $this->object->getAnswerType();
238
239 $this->object->setShuffleAnswersEnabled($form->getItemByPostVar('shuffle_answers_enabled')->getChecked());
240
241 if( !$this->object->getSelfAssessmentEditingMode() )
242 {
243 $this->object->setAnswerType($form->getItemByPostVar('answer_type')->getValue());
244 }
245 else
246 {
247 $this->object->setAnswerType(assKprimChoice::ANSWER_TYPE_MULTI_LINE);
248 }
249
250 if( !$this->object->getSelfAssessmentEditingMode() && $this->object->isSingleLineAnswerType($oldAnswerType) )
251 {
252 $this->object->setThumbSize($form->getItemByPostVar('thumb_size')->getValue());
253 }
254
255 $this->object->setOptionLabel($form->getItemByPostVar('option_label')->getValue());
256
257 if( $this->object->isCustomOptionLabel($this->object->getOptionLabel()) )
258 {
259 $this->object->setCustomTrueOptionLabel( strip_tags(
260 $form->getItemByPostVar('option_label_custom_true')->getValue()
261 ));
262 $this->object->setCustomFalseOptionLabel( strip_tags(
263 $form->getItemByPostVar('option_label_custom_false')->getValue()
264 ));
265 }
266
267 $this->object->setPoints($form->getItemByPostVar('points')->getValue());
268
269 $this->object->setScorePartialSolutionEnabled($form->getItemByPostVar('score_partsol_enabled')->getChecked());
270 }

References assKprimChoice\ANSWER_TYPE_MULTI_LINE, and ilPropertyFormGUI\getItemByPostVar().

Referenced by writePostData().

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

Field Documentation

◆ $object

assKprimChoiceGUI::$object

Definition at line 21 of file class.assKprimChoiceGUI.php.


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