ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
assKprimChoiceGUI Class Reference
+ Inheritance diagram for assKprimChoiceGUI:
+ Collaboration diagram for assKprimChoiceGUI:

Public Member Functions

 __construct ($qId=-1)
 
 hasInlineFeedback ()
 
 removeImage ()
 
 downkprim_answers ()
 
 upkprim_answers ()
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 
 getSpecificFeedbackOutput ($userSolution)
 
 getTestOutput ( $active_id, $pass, $is_postponed=false, $use_post_solutions=false, $showInlineFeedback=false)
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 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)
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilTemplate $tpl)
 
 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="", $inlineFeedbackEnabled=false)
 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 ($userSolution)
 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)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 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 ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 

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 RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 

Protected Member Functions

 getAdditionalEditQuestionCommands ()
 
 editQuestion (ilPropertyFormGUI $form=null)
 
 uploadImage ()
 
 writePostData ($upload=false)
 {} More...
 
 buildEditForm ()
 
 getParticipantsAnswerKeySequence ()
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 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)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 buildEditForm ()
 

Private Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _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...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
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...
 
- Protected Attributes inherited from assQuestionGUI
 $editForm
 
 $use_intermediate_solution = false
 

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  $this->object->loadFromDb($qId);
35  }
36  }

Member Function Documentation

◆ aggregateAnswers()

assKprimChoiceGUI::aggregateAnswers (   $rawSolutionData,
  $answers 
)

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

Referenced by getAggregatedAnswersView(), and getAnswersFrequency().

838  {
839  $aggregate = array();
840 
841  foreach ($answers as $answer) {
842  $answerAgg = array(
843  'answertext' => $answer->getAnswerText(), 'count_true' => 0, 'count_false' => 0
844  );
845 
846  foreach ($rawSolutionData as $solutionRecord) {
847  if ($solutionRecord['value1'] == $answer->getPosition()) {
848  if ($solutionRecord['value2']) {
849  $answerAgg['count_true']++;
850  } else {
851  $answerAgg['count_false']++;
852  }
853  }
854  }
855 
856  $aggregate[] = $answerAgg;
857  }
858 
859  return $aggregate;
860  }
+ Here is the caller graph for this function:

◆ buildEditForm()

assKprimChoiceGUI::buildEditForm ( )
protected
Returns
ilPropertyFormGUI

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

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

Referenced by editQuestion(), and writePostData().

140  {
141  $form = $this->buildBasicEditFormObject();
142 
144 
146 
149 
151 
152  return $form;
153  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
if(isset($_POST['submit'])) $form
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ downkprim_answers()

assKprimChoiceGUI::downkprim_answers ( )

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

References $_POST, and editQuestion().

83  {
84  if (isset($_POST['cmd'][__FUNCTION__]) && count($_POST['cmd'][__FUNCTION__])) {
85  $this->object->moveAnswerDown(key($_POST['cmd'][__FUNCTION__]));
86  $this->object->saveToDb();
87  }
88 
89  $this->editQuestion();
90  }
editQuestion(ilPropertyFormGUI $form=null)
$_POST["username"]
+ Here is the call graph for this function:

◆ editQuestion()

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

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

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

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

52  {
53  if ($form === null) {
54  $form = $this->buildEditForm();
55  }
56 
57  $this->getQuestionTemplate();
58  $this->tpl->addCss('Modules/Test/templates/default/ta.css');
59 
60  $this->tpl->setVariable("QUESTION_DATA", $this->ctrl->getHTML($form));
61  }
getQuestionTemplate()
get question template
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalEditQuestionCommands()

assKprimChoiceGUI::getAdditionalEditQuestionCommands ( )
protected

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

47  {
48  return array('uploadImage', 'removeImage');
49  }

◆ 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 779 of file class.assKprimChoiceGUI.php.

780  {
781  return array();
782  }

◆ 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 793 of file class.assKprimChoiceGUI.php.

794  {
795  return array();
796  }

◆ 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 806 of file class.assKprimChoiceGUI.php.

References aggregateAnswers(), and renderAggregateView().

807  {
808  return $this->renderAggregateView(
809  $this->aggregateAnswers($relevant_answers, $this->object->getAnswers())
810  )->get();
811 
812  return '<pre>' . print_r($relevant_answers, 1) . '</pre>';
813  }
aggregateAnswers($rawSolutionData, $answers)
+ Here is the call graph for this function:

◆ getAnswerFrequencyTableGUI()

assKprimChoiceGUI::getAnswerFrequencyTableGUI (   $parentGui,
  $parentCmd,
  $relevantAnswers,
  $questionIndex 
)
Parameters
$parentGui
$parentCmd
$relevantAnswers
$questionIndex
Returns
ilKprimChoiceAnswerFreqStatTableGUI

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

References $table, and getAnswersFrequency().

887  {
888  require_once 'Modules/TestQuestionPool/classes/tables/class.ilKprimChoiceAnswerFreqStatTableGUI.php';
889 
890  $table = new ilKprimChoiceAnswerFreqStatTableGUI($parentGui, $parentCmd, $this->object);
891  $table->setQuestionIndex($questionIndex);
892  $table->setData($this->getAnswersFrequency($relevantAnswers, $questionIndex));
893  $table->initColumns();
894 
895  return $table;
896  }
if(empty($password)) $table
Definition: pwgen.php:24
getAnswersFrequency($relevantAnswers, $questionIndex)
+ Here is the call graph for this function:

◆ getAnswersFrequency()

assKprimChoiceGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

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

References aggregateAnswers().

Referenced by getAnswerFrequencyTableGUI().

863  {
864  $agg = $this->aggregateAnswers($relevantAnswers, $this->object->getAnswers());
865 
866  $answers = array();
867 
868  foreach ($agg as $ans) {
869  $answers[] = array(
870  'answer' => $ans['answertext'],
871  'frequency_true' => $ans['count_true'],
872  'frequency_false' => $ans['count_false']
873  );
874  }
875 
876  return $answers;
877  }
aggregateAnswers($rawSolutionData, $answers)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParticipantsAnswerKeySequence()

assKprimChoiceGUI::getParticipantsAnswerKeySequence ( )
protected

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

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

722  {
723  $choiceKeys = array_keys($this->object->getAnswers());
724 
725  if ($this->object->isShuffleAnswersEnabled()) {
726  $choiceKeys = $this->object->getShuffler()->shuffle($choiceKeys);
727  }
728 
729  return $choiceKeys;
730  }
+ Here is the caller graph for this function:

◆ getPreview()

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

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

References $keys, $template, $type, assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getParticipantsAnswerKeySequence(), assQuestionGUI\getPreviewSession(), populateSpecificFeedbackInline(), and ilUtil\prepareFormOutput().

452  {
453  $user_solution = is_object($this->getPreviewSession()) ? (array) $this->getPreviewSession()->getParticipantsSolution() : array();
454  // shuffle output
456 
457  // generate the question output
458  include_once "./Services/UICore/classes/class.ilTemplate.php";
459  $template = new ilTemplate("tpl.il_as_qpl_mc_kprim_output.html", true, true, "Modules/TestQuestionPool");
460 
461  foreach ($keys as $answer_id) {
462  $answer = $this->object->getAnswer($answer_id);
463  if (strlen($answer->getImageFile())) {
464  if ($this->object->getThumbSize()) {
465  $template->setCurrentBlock("preview");
466  $template->setVariable("URL_PREVIEW", $answer->getImageWebPath());
467  $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
468  $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
469  $template->setVariable("ANSWER_IMAGE_URL", $answer->getThumbWebPath());
470  list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
471  $alt = $answer->getImageFile();
472  if (strlen($answer->getAnswertext())) {
473  $alt = $answer->getAnswertext();
474  }
475  $alt = preg_replace("/<[^>]*?>/", "", $alt);
476  $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
477  $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
478  $template->parseCurrentBlock();
479  } else {
480  $template->setCurrentBlock("answer_image");
481  $template->setVariable("ANSWER_IMAGE_URL", $answer->getImageWebPath());
482  list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
483  $alt = $answer->getImageFile();
484  if (strlen($answer->getAnswertext())) {
485  $alt = $answer->getAnswertext();
486  }
487  $alt = preg_replace("/<[^>]*?>/", "", $alt);
488  $template->setVariable("ATTR", $attr);
489  $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
490  $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
491  $template->parseCurrentBlock();
492  }
493  }
494 
495  if ($showInlineFeedback) {
496  $this->populateSpecificFeedbackInline($user_solution, $answer_id, $template);
497  }
498 
499  $template->setCurrentBlock("answer_row");
500  $template->setVariable("ANSWER_ID", $answer_id);
501  $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), true));
502  $template->setVariable('VALUE_TRUE', 1);
503  $template->setVariable('VALUE_FALSE', 0);
504 
505  if (isset($user_solution[$answer->getPosition()])) {
506  $tplVar = $user_solution[$answer->getPosition()] ? 'CHECKED_ANSWER_TRUE' : 'CHECKED_ANSWER_FALSE';
507  $template->setVariable($tplVar, " checked=\"checked\"");
508  }
509 
510  $template->parseCurrentBlock();
511  }
512  $questiontext = $this->object->getQuestion();
513  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
514 
515  $template->setVariable("INSTRUCTIONTEXT", $this->object->getInstructionTextTranslation(
516  $this->lng,
517  $this->object->getOptionLabel()
518  ));
519 
520  $template->setVariable("OPTION_LABEL_TRUE", $this->object->getTrueOptionLabelTranslation(
521  $this->lng,
522  $this->object->getOptionLabel()
523  ));
524 
525  $template->setVariable("OPTION_LABEL_FALSE", $this->object->getFalseOptionLabelTranslation(
526  $this->lng,
527  $this->object->getOptionLabel()
528  ));
529 
530  $questionoutput = $template->get();
531  if (!$show_question_only) {
532  // get page object output
533  $questionoutput = $this->getILIASPage($questionoutput);
534  }
535  return $questionoutput;
536  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$template
$type
$keys
getILIASPage($html="")
Returns the ILIAS Page around a question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
populateSpecificFeedbackInline($user_solution, $answer_id, $template)
+ 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

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

References $keys, $pass, $template, assQuestionGUI\buildFocusAnchorHtml(), ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), ilUtil\getHtmlPath(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getParticipantsAnswerKeySequence(), assQuestionGUI\getUseIntermediateSolution(), assQuestionGUI\hasCorrectSolution(), hasInlineFeedback(), assQuestionGUI\isRenderPurposePrintPdf(), assQuestionGUI\isTestPresentationContext(), populateSpecificFeedbackInline(), ilUtil\prepareFormOutput(), and assQuestionGUI\renderPurposeSupportsFormHtml().

570  {
571  // shuffle output
573 
574  // get the solution of the user for the active pass or from the last pass if allowed
575  $user_solution = array();
576  if (($active_id > 0) && (!$show_correct_solution)) {
577  $solutions = $this->object->getSolutionValues($active_id, $pass, !$this->getUseIntermediateSolution());
578  foreach ($solutions as $idx => $solution_value) {
579  $user_solution[$solution_value['value1']] = $solution_value['value2'];
580  }
581  } else {
582  // take the correct solution instead of the user solution
583  foreach ($this->object->getAnswers() as $answer) {
584  $user_solution[$answer->getPosition()] = $answer->getCorrectness();
585  }
586  }
587 
588  // generate the question output
589  $template = new ilTemplate("tpl.il_as_qpl_mc_kprim_output_solution.html", true, true, "Modules/TestQuestionPool");
590 
591  foreach ($keys as $answer_id) {
592  $answer = $this->object->getAnswer($answer_id);
593 
594  if (($active_id > 0) && (!$show_correct_solution)) {
595  if ($graphicalOutput) {
596  // output of ok/not ok icons for user entered solutions
597 
598  if ($user_solution[$answer->getPosition()] == $answer->getCorrectness()) {
599  $template->setCurrentBlock("icon_ok");
600  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
601  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
602  $template->parseCurrentBlock();
603  } else {
604  $template->setCurrentBlock("icon_ok");
605  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
606  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
607  $template->parseCurrentBlock();
608  }
609  }
610  }
611  if (strlen($answer->getImageFile())) {
612  $template->setCurrentBlock("answer_image");
613  if ($this->object->getThumbSize()) {
614  $template->setVariable("ANSWER_IMAGE_URL", $answer->getThumbWebPath());
615  } else {
616  $template->setVariable("ANSWER_IMAGE_URL", $answer->getImageWebPath());
617  }
618 
619  $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($answer->getImageFile()));
620  $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($answer->getImageFile()));
621  $template->parseCurrentBlock();
622  }
623 
624  if ($show_feedback) {
625  $this->populateSpecificFeedbackInline($user_solution, $answer_id, $template);
626  }
627 
628  $template->setCurrentBlock("answer_row");
629  $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), true));
630 
631  if ($this->renderPurposeSupportsFormHtml() || $this->isRenderPurposePrintPdf()) {
632  if (isset($user_solution[$answer->getPosition()])) {
633  if ($user_solution[$answer->getPosition()]) {
634  $template->setVariable("SOLUTION_IMAGE_TRUE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_checked.png")));
635  $template->setVariable("SOLUTION_ALT_TRUE", $this->lng->txt("checked"));
636  $template->setVariable("SOLUTION_IMAGE_FALSE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
637  $template->setVariable("SOLUTION_ALT_FALSE", $this->lng->txt("unchecked"));
638  } else {
639  $template->setVariable("SOLUTION_IMAGE_TRUE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
640  $template->setVariable("SOLUTION_ALT_TRUE", $this->lng->txt("unchecked"));
641  $template->setVariable("SOLUTION_IMAGE_FALSE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_checked.png")));
642  $template->setVariable("SOLUTION_ALT_FALSE", $this->lng->txt("checked"));
643  }
644  } else {
645  $template->setVariable("SOLUTION_IMAGE_TRUE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
646  $template->setVariable("SOLUTION_ALT_TRUE", $this->lng->txt("unchecked"));
647  $template->setVariable("SOLUTION_IMAGE_FALSE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
648  $template->setVariable("SOLUTION_ALT_FALSE", $this->lng->txt("unchecked"));
649  }
650  } else {
651  $template->setVariable('SOL_QID', $this->object->getId());
652  $template->setVariable('SOL_SUFFIX', $show_correct_solution ? 'bestsolution' : 'usersolution');
653  $template->setVariable('SOL_POSITION', $answer->getPosition());
654 
655  $template->setVariable('SOL_TRUE_VALUE', 1);
656  $template->setVariable('SOL_FALSE_VALUE', 0);
657 
658  if (isset($user_solution[$answer->getPosition()])) {
659  if ($user_solution[$answer->getPosition()]) {
660  $template->setVariable('SOL_TRUE_CHECKED', 'checked');
661  } else {
662  $template->setVariable('SOL_FALSE_CHECKED', 'checked');
663  }
664  }
665  }
666 
667  $template->parseCurrentBlock();
668  }
669 
670  if ($show_question_text == true) {
671  $questiontext = $this->object->getQuestion();
672  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
673 
674  $template->setVariable("INSTRUCTIONTEXT", $this->object->getInstructionTextTranslation(
675  $this->lng,
676  $this->object->getOptionLabel()
677  ));
678  }
679 
680  $template->setVariable("OPTION_LABEL_TRUE", $this->object->getTrueOptionLabelTranslation(
681  $this->lng,
682  $this->object->getOptionLabel()
683  ));
684 
685  $template->setVariable("OPTION_LABEL_FALSE", $this->object->getFalseOptionLabelTranslation(
686  $this->lng,
687  $this->object->getOptionLabel()
688  ));
689 
690 
691  $questionoutput = $template->get();
692  $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getGenericFeedbackOutput($active_id, $pass) : "";
693 
694  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
695 
696  if (strlen($feedback)) {
697  $cssClass = (
698  $this->hasCorrectSolution($active_id, $pass) ?
700  );
701 
702  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
703  $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
704  }
705 
706  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
707 
708  $solutionoutput = $solutiontemplate->get();
709 
710  if ($show_feedback && $this->hasInlineFeedback()) {
711  $solutionoutput = $this->buildFocusAnchorHtml() . $solutionoutput;
712  }
713 
714  if (!$show_question_only) {
715  // get page object output
716  $solutionoutput = $this->getILIASPage($solutionoutput);
717  }
718  return $solutionoutput;
719  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
hasCorrectSolution($activeId, $passIndex)
$template
$keys
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.
getILIASPage($html="")
Returns the ILIAS Page around a question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static getHtmlPath($relative_path)
get url of path
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
populateSpecificFeedbackInline($user_solution, $answer_id, $template)
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

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

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

326  {
327  return ''; // question type supports inline answer specific feedback
328  }

◆ 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

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

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

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

◆ handleAnswerTextsSubmit()

assKprimChoiceGUI::handleAnswerTextsSubmit (   $answers)
private

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

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

Referenced by writeAnswerSpecificPostData().

308  {
309  if ($this->object->getAnswerType() == assKprimChoice::ANSWER_TYPE_MULTI_LINE) {
310  return $answers;
311  }
312 
313  foreach ($answers as $key => $answer) {
314  $answer->setAnswerText(ilUtil::secureString($answer->getAnswerText()));
315  }
316 
317  return $answers;
318  }
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasInlineFeedback()

assKprimChoiceGUI::hasInlineFeedback ( )
Returns
bool

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

Referenced by getSolutionOutput().

42  {
43  return $this->object->feedbackOBJ->isSpecificAnswerFeedbackAvailable($this->object->getId());
44  }
+ Here is the caller graph for this function:

◆ populateAnswerSpecificFormPart()

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

Implements ilGuiAnswerScoringAdjustable.

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

References $form, ilPropertyFormGUI\addItem(), and ilFormPropertyGUI\setInfo().

Referenced by buildEditForm().

274  {
275  require_once 'Modules/TestQuestionPool/classes/class.ilKprimChoiceWizardInputGUI.php';
276  $kprimAnswers = new ilKprimChoiceWizardInputGUI($this->lng->txt('answers'), 'kprim_answers');
277  $kprimAnswers->setInfo($this->lng->txt('kprim_answers_info'));
278  $kprimAnswers->setSize(64);
279  $kprimAnswers->setMaxLength(1000);
280  $kprimAnswers->setRequired(true);
281  $kprimAnswers->setAllowMove(true);
282  $kprimAnswers->setQuestionObject($this->object);
283  if (!$this->object->getSelfAssessmentEditingMode()) {
284  $kprimAnswers->setSingleline($this->object->isSingleLineAnswerType($this->object->getAnswerType()));
285  } else {
286  $kprimAnswers->setSingleline(false);
287  }
288  $kprimAnswers->setValues($this->object->getAnswers());
289  $form->addItem($kprimAnswers);
290 
291  return $form;
292  }
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateCorrectionsFormProperties()

assKprimChoiceGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

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

References $form, ilPropertyFormGUI\addItem(), ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

899  {
900  // points
901  $points = new ilNumberInputGUI($this->lng->txt('points'), 'points');
902  $points->setRequired(true);
903  $points->setSize(3);
904  $points->allowDecimals(true);
905  $points->setMinValue(0);
906  $points->setMinvalueShouldBeGreater(true);
907  $points->setValue($this->object->getPoints());
908  $form->addItem($points);
909 
910  // score partial solution
911  $scorePartialSolution = new ilCheckboxInputGUI($this->lng->txt('score_partsol_enabled'), 'score_partsol_enabled');
912  $scorePartialSolution->setInfo($this->lng->txt('score_partsol_enabled_info'));
913  $scorePartialSolution->setChecked($this->object->isScorePartialSolutionEnabled());
914  $form->addItem($scorePartialSolution);
915 
916  // answers
917  require_once 'Modules/TestQuestionPool/classes/forms/class.ilKprimChoiceCorrectionsInputGUI.php';
918  $kprimAnswers = new ilKprimChoiceCorrectionsInputGUI($this->lng->txt('answers'), 'kprim_answers');
919  $kprimAnswers->setInfo($this->lng->txt('kprim_answers_info'));
920  $kprimAnswers->setSize(64);
921  $kprimAnswers->setMaxLength(1000);
922  $kprimAnswers->setRequired(true);
923  $kprimAnswers->setQuestionObject($this->object);
924  $kprimAnswers->setValues($this->object->getAnswers());
925  $form->addItem($kprimAnswers);
926 
927  return $form;
928  }
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
if(isset($_POST['submit'])) $form
This class represents a number property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

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

Implements ilGuiQuestionScoringAdjustable.

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

References $form, ilPropertyFormGUI\addItem(), ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilNumberInputGUI\setSuffix(), and ilTextInputGUI\setValue().

Referenced by buildEditForm().

160  {
161  // shuffle answers
162  $shuffleAnswers = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle_answers_enabled");
163  $shuffleAnswers->setChecked($this->object->isShuffleAnswersEnabled());
164  $form->addItem($shuffleAnswers);
165 
166  if (!$this->object->getSelfAssessmentEditingMode()) {
167  // answer mode (single-/multi-line)
168  $answerType = new ilSelectInputGUI($this->lng->txt('answer_types'), 'answer_type');
169  $answerType->setOptions($this->object->getAnswerTypeSelectOptions($this->lng));
170  $answerType->setValue($this->object->getAnswerType());
171  $form->addItem($answerType);
172  }
173 
174  if (!$this->object->getSelfAssessmentEditingMode() && $this->object->isSingleLineAnswerType($this->object->getAnswerType())) {
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  if ($this->object->getThumbSize() > 0) {
183  $thumbSize->setValue($this->object->getThumbSize());
184  }
185  $form->addItem($thumbSize);
186  }
187 
188  // option label
189  $optionLabel = new ilRadioGroupInputGUI($this->lng->txt('option_label'), 'option_label');
190  $optionLabel->setInfo($this->lng->txt('option_label_info'));
191  $optionLabel->setRequired(true);
192  $optionLabel->setValue($this->object->getOptionLabel());
193  foreach ($this->object->getValidOptionLabelsTranslated($this->lng) as $labelValue => $labelText) {
194  $option = new ilRadioOption($labelText, $labelValue);
195  $optionLabel->addOption($option);
196 
197  if ($this->object->isCustomOptionLabel($labelValue)) {
198  $customLabelTrue = new ilTextInputGUI(
199  $this->lng->txt('option_label_custom_true'),
200  'option_label_custom_true'
201  );
202  $customLabelTrue->setValue($this->object->getCustomTrueOptionLabel());
203  $option->addSubItem($customLabelTrue);
204 
205  $customLabelFalse = new ilTextInputGUI(
206  $this->lng->txt('option_label_custom_false'),
207  'option_label_custom_false'
208  );
209  $customLabelFalse->setValue($this->object->getCustomFalseOptionLabel());
210  $option->addSubItem($customLabelFalse);
211  }
212  }
213  $form->addItem($optionLabel);
214 
215  // points
216  $points = new ilNumberInputGUI($this->lng->txt('points'), 'points');
217  $points->setRequired(true);
218  $points->setSize(3);
219  $points->allowDecimals(true);
220  $points->setMinValue(0);
221  $points->setMinvalueShouldBeGreater(true);
222  $points->setValue($this->object->getPoints());
223  $form->addItem($points);
224 
225  // score partial solution
226  $scorePartialSolution = new ilCheckboxInputGUI($this->lng->txt('score_partsol_enabled'), 'score_partsol_enabled');
227  $scorePartialSolution->setInfo($this->lng->txt('score_partsol_enabled_info'));
228  $scorePartialSolution->setChecked($this->object->isScorePartialSolutionEnabled());
229  $form->addItem($scorePartialSolution);
230 
231  return $form;
232  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
setChecked($a_checked)
Set Checked.
This class represents a property in a property form.
setSuffix($a_value)
Set suffix.
if(isset($_POST['submit'])) $form
This class represents a number property in a property form.
This class represents a text property in a property form.
setOptions($a_options)
Set Options.
setValue($a_value)
Set Value.
setRequired($a_required)
Set Required.
+ 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 732 of file class.assKprimChoiceGUI.php.

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

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

733  {
734  require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssConfigurableMultiOptionQuestionFeedback.php';
735 
736  if ($this->object->getSpecificFeedbackSetting() == ilAssConfigurableMultiOptionQuestionFeedback::FEEDBACK_SETTING_CHECKED) {
737  if ($user_solution[$answer_id]) {
738  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0, $answer_id);
739  if (strlen($fb)) {
740  $template->setCurrentBlock("feedback");
741  $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
742  $template->parseCurrentBlock();
743  }
744  }
745  }
746 
747  if ($this->object->getSpecificFeedbackSetting() == ilAssConfigurableMultiOptionQuestionFeedback::FEEDBACK_SETTING_ALL) {
748  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0, $answer_id);
749  if (strlen($fb)) {
750  $template->setCurrentBlock("feedback");
751  $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
752  $template->parseCurrentBlock();
753  }
754  }
755 
756  if ($this->object->getSpecificFeedbackSetting() == ilAssConfigurableMultiOptionQuestionFeedback::FEEDBACK_SETTING_CORRECT) {
757  $answer = $this->object->getAnswer($answer_id);
758 
759  if ($answer->getCorrectness()) {
760  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), 0, $answer_id);
761  if (strlen($fb)) {
762  $template->setCurrentBlock("feedback");
763  $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
764  $template->parseCurrentBlock();
765  }
766  }
767  }
768  }
$template
+ Here is the caller graph for this function:

◆ removeImage()

assKprimChoiceGUI::removeImage ( )

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

References $_POST, and editQuestion().

74  {
75  $position = key($_POST['cmd']['removeImage']);
76  $this->object->removeAnswerImage($position);
77 
78  $this->object->saveToDb();
79  $this->editQuestion();
80  }
editQuestion(ilPropertyFormGUI $form=null)
$_POST["username"]
+ Here is the call graph for this function:

◆ renderAggregateView()

assKprimChoiceGUI::renderAggregateView (   $aggregate)

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

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

816  {
817  $trueOptionLabel = $this->object->getTrueOptionLabelTranslation($this->lng, $this->object->getOptionLabel());
818  $falseOptionLabel = $this->object->getFalseOptionLabelTranslation($this->lng, $this->object->getOptionLabel());
819 
820  $tpl = new ilTemplate('tpl.il_as_aggregated_kprim_answers_table.html', true, true, "Modules/TestQuestionPool");
821 
822  foreach ($aggregate as $lineData) {
823  $tpl->setCurrentBlock('aggregaterow');
824  $tpl->setVariable('OPTION', $lineData['answertext']);
825  $tpl->setVariable('COUNT_TRUE', $lineData['count_true']);
826  $tpl->setVariable('COUNT_FALSE', $lineData['count_false']);
827  $tpl->parseCurrentBlock();
828  }
829 
830  $tpl->setVariable('OPTION_HEAD', $this->lng->txt('answers'));
831  $tpl->setVariable('COUNT_TRUE_HEAD', $trueOptionLabel);
832  $tpl->setVariable('COUNT_FALSE_HEAD', $falseOptionLabel);
833 
834  return $tpl;
835  }
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

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

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

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

934  {
935  $this->object->setPoints(
936  (float) $form->getInput('points')
937  );
938 
939  $this->object->setScorePartialSolutionEnabled(
940  (bool) $form->getInput('score_partsol_enabled')
941  );
942 
943  $this->object->setAnswers(
944  $form->getItemByPostVar('kprim_answers')->getValues()
945  );
946  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ supportsIntermediateSolutionOutput()

assKprimChoiceGUI::supportsIntermediateSolutionOutput ( )

Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution()

Returns
bool

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

544  {
545  return true;
546  }

◆ upkprim_answers()

assKprimChoiceGUI::upkprim_answers ( )

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

References $_POST, and editQuestion().

93  {
94  if (isset($_POST['cmd'][__FUNCTION__]) && count($_POST['cmd'][__FUNCTION__])) {
95  $this->object->moveAnswerUp(key($_POST['cmd'][__FUNCTION__]));
96  $this->object->saveToDb();
97  }
98 
99  $this->editQuestion();
100  }
editQuestion(ilPropertyFormGUI $form=null)
$_POST["username"]
+ Here is the call graph for this function:

◆ uploadImage()

assKprimChoiceGUI::uploadImage ( )
protected

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

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

64  {
65  $result = $this->writePostData(true);
66 
67  if ($result == 0) {
68  $this->object->saveToDb();
69  $this->editQuestion();
70  }
71  }
$result
writePostData($upload=false)
{}
editQuestion(ilPropertyFormGUI $form=null)
+ Here is the call graph for this function:

◆ writeAnswerSpecificPostData()

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

Implements ilGuiAnswerScoringAdjustable.

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

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

Referenced by writePostData().

298  {
299  $answers = $form->getItemByPostVar('kprim_answers')->getValues();
300  $answers = $this->handleAnswerTextsSubmit($answers);
301  $files = $form->getItemByPostVar('kprim_answers')->getFiles();
302 
303  $this->object->handleFileUploads($answers, $files);
304  $this->object->setAnswers($answers);
305  }
$files
Definition: metarefresh.php:49
getItemByPostVar($a_post_var)
Get Item by POST variable.
+ 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 105 of file class.assKprimChoiceGUI.php.

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

Referenced by uploadImage().

106  {
107  $form = $this->buildEditForm();
108  $form->setValuesByPost();
109 
110  if ($upload) {
111  $answersInput = $form->getItemByPostVar('kprim_answers');
112  $answersInput->setIgnoreMissingUploadsEnabled(true);
113 
114  if (!$answersInput->checkUploads($_POST[$answersInput->getPostVar()])) {
115  ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
116  $this->editQuestion($form);
117  return 1;
118  }
119 
120  $answersInput->collectValidFiles();
121  } elseif (!$form->checkInput()) {
122  $this->editQuestion($form);
123  return 1;
124  }
125 
127 
130 
131  $this->saveTaxonomyAssignments();
132 
133  return 0;
134  }
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
if(isset($_POST['submit'])) $form
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
editQuestion(ilPropertyFormGUI $form=null)
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeQuestionSpecificPostData()

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

Implements ilGuiQuestionScoringAdjustable.

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

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

Referenced by writePostData().

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