ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
 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="")
 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 ()
 

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)
 
 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
 

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

References array.

Referenced by getAggregatedAnswersView().

888  {
889  $aggregate = array();
890 
891  foreach( $answers as $answer )
892  {
893  $answerAgg = array(
894  'answertext' => $answer->getAnswerText(), 'count_true' => 0, 'count_false' => 0
895  );
896 
897  foreach( $rawSolutionData as $solutionRecord )
898  {
899  if( $solutionRecord['value1'] == $answer->getPosition() )
900  {
901  if( $solutionRecord['value2'] )
902  {
903  $answerAgg['count_true']++;
904  }
905  else
906  {
907  $answerAgg['count_false']++;
908  }
909  }
910 
911  }
912 
913  $aggregate[] = $answerAgg;
914  }
915 
916  return $aggregate;
917  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ buildEditForm()

assKprimChoiceGUI::buildEditForm ( )
protected
Returns
ilPropertyFormGUI

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

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

Referenced by editQuestion(), and writePostData().

141  {
142  $form = $this->buildBasicEditFormObject();
143 
144  $this->addQuestionFormCommandButtons($form);
145 
146  $this->addBasicQuestionFormProperties($form);
147 
148  $this->populateQuestionSpecificFormPart($form);
149  $this->populateAnswerSpecificFormPart($form);
150 
151  $this->populateTaxonomyFormSection($form);
152 
153  return $form;
154  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $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 77 of file class.assKprimChoiceGUI.php.

References $_POST, and editQuestion().

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"]
+ Here is the call graph for this function:

◆ editQuestion()

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

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

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

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

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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalEditQuestionCommands()

assKprimChoiceGUI::getAdditionalEditQuestionCommands ( )
protected

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

References array.

40  {
41  return array('uploadImage', 'removeImage');
42  }
Create styles array
The data for the language used.

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

References array.

830  {
831  return array();
832  }
Create styles array
The data for the language used.

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

References array.

844  {
845  return array();
846  }
Create styles array
The data for the language used.

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

References aggregateAnswers(), object, and renderAggregateView().

857  {
858  return $this->renderAggregateView(
859  $this->aggregateAnswers( $relevant_answers, $this->object->getAnswers() ) )->get();
860 
861  return '<pre>'.print_r($relevant_answers, 1).'</pre>';
862  }
Create new PHPExcel object
obj_idprivate
aggregateAnswers($rawSolutionData, $answers)
+ Here is the call graph for this function:

◆ getParticipantsAnswerKeySequence()

assKprimChoiceGUI::getParticipantsAnswerKeySequence ( )
protected

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

References object.

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

763  {
764  $choiceKeys = array_keys($this->object->getAnswers());
765 
766  if( $this->object->isShuffleAnswersEnabled() )
767  {
768  $choiceKeys = $this->object->getShuffler()->shuffle($choiceKeys);
769  }
770 
771  return $choiceKeys;
772  }
Create new PHPExcel object
obj_idprivate
+ 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 471 of file class.assKprimChoiceGUI.php.

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

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

References $pass, array, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), ilUtil\getHtmlPath(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getParticipantsAnswerKeySequence(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isRenderPurposePrintPdf(), assQuestionGUI\isTestPresentationContext(), object, populateSpecificFeedbackInline(), ilUtil\prepareFormOutput(), and assQuestionGUI\renderPurposeSupportsFormHtml().

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

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

337  {
338  return ''; // question type supports inline answer specific feedback
339  }

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

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

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

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

Referenced by writeAnswerSpecificPostData().

317  {
318  if( $this->object->getAnswerType() == assKprimChoice::ANSWER_TYPE_MULTI_LINE )
319  {
320  return $answers;
321  }
322 
323  foreach($answers as $key => $answer)
324  {
325  $answer->setAnswerText(ilUtil::secureString($answer->getAnswerText()));
326  }
327 
328  return $answers;
329  }
Create new PHPExcel object
obj_idprivate
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
+ 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 279 of file class.assKprimChoiceGUI.php.

References ilPropertyFormGUI\addItem(), object, and ilFormPropertyGUI\setInfo().

Referenced by buildEditForm().

280  {
281  require_once 'Modules/TestQuestionPool/classes/class.ilKprimChoiceWizardInputGUI.php';
282  $kprimAnswers = new ilKprimChoiceWizardInputGUI($this->lng->txt('answers'), 'kprim_answers');
283  $kprimAnswers->setInfo($this->lng->txt('kprim_answers_info'));
284  $kprimAnswers->setSize(64);
285  $kprimAnswers->setMaxLength(1000);
286  $kprimAnswers->setRequired(true);
287  $kprimAnswers->setAllowMove(true);
288  $kprimAnswers->setQuestionObject($this->object);
289  if( !$this->object->getSelfAssessmentEditingMode() )
290  {
291  $kprimAnswers->setSingleline($this->object->isSingleLineAnswerType($this->object->getAnswerType()));
292  }
293  else
294  {
295  $kprimAnswers->setSingleline(false);
296  }
297  $kprimAnswers->setValues($this->object->getAnswers());
298  $form->addItem($kprimAnswers);
299 
300  return $form;
301  }
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
Create new PHPExcel object
obj_idprivate
+ 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 160 of file class.assKprimChoiceGUI.php.

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

Referenced by buildEditForm().

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

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

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

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

◆ removeImage()

assKprimChoiceGUI::removeImage ( )

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

References $_POST, and editQuestion().

69  {
70  $position = key($_POST['cmd']['removeImage']);
71  $this->object->removeAnswerImage($position);
72 
73  $this->object->saveToDb();
74  $this->editQuestion();
75  }
editQuestion(ilPropertyFormGUI $form=null)
$_POST["username"]
+ Here is the call graph for this function:

◆ renderAggregateView()

assKprimChoiceGUI::renderAggregateView (   $aggregate)

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

References assQuestionGUI\$tpl, and object.

Referenced by getAggregatedAnswersView().

865  {
866  $trueOptionLabel = $this->object->getTrueOptionLabelTranslation($this->lng, $this->object->getOptionLabel());
867  $falseOptionLabel = $this->object->getFalseOptionLabelTranslation($this->lng, $this->object->getOptionLabel());
868 
869  $tpl = new ilTemplate('tpl.il_as_aggregated_kprim_answers_table.html', true, true, "Modules/TestQuestionPool");
870 
871  foreach( $aggregate as $lineData )
872  {
873  $tpl->setCurrentBlock('aggregaterow');
874  $tpl->setVariable('OPTION', $lineData['answertext']);
875  $tpl->setVariable('COUNT_TRUE', $lineData['count_true']);
876  $tpl->setVariable('COUNT_FALSE', $lineData['count_false']);
877  $tpl->parseCurrentBlock();
878  }
879 
880  $tpl->setVariable('OPTION_HEAD', $this->lng->txt('answers'));
881  $tpl->setVariable('COUNT_TRUE_HEAD', $trueOptionLabel);
882  $tpl->setVariable('COUNT_FALSE_HEAD', $falseOptionLabel);
883 
884  return $tpl;
885  }
special template class to simplify handling of ITX/PEAR
Create new PHPExcel object
obj_idprivate
+ Here is the caller graph for this function:

◆ upkprim_answers()

assKprimChoiceGUI::upkprim_answers ( )

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

References $_POST, and editQuestion().

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  }
editQuestion(ilPropertyFormGUI $form=null)
$_POST["username"]
+ Here is the call graph for this function:

◆ uploadImage()

assKprimChoiceGUI::uploadImage ( )
protected

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

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

58  {
59  $result = $this->writePostData(true);
60 
61  if( $result == 0 )
62  {
63  $this->object->saveToDb();
64  $this->editQuestion();
65  }
66  }
$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 306 of file class.assKprimChoiceGUI.php.

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

Referenced by writePostData().

307  {
308  $answers = $form->getItemByPostVar('kprim_answers')->getValues();
309  $answers = $this->handleAnswerTextsSubmit($answers);
310  $files = $form->getItemByPostVar('kprim_answers')->getFiles();
311 
312  $this->object->handleFileUploads($answers, $files);
313  $this->object->setAnswers($answers);
314  }
$files
Definition: add-vimline.php:18
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 102 of file class.assKprimChoiceGUI.php.

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

Referenced by uploadImage().

103  {
104  $form = $this->buildEditForm();
105  $form->setValuesByPost();
106 
107  if( $upload )
108  {
109  $answersInput = $form->getItemByPostVar('kprim_answers');
110  $answersInput->setIgnoreMissingUploadsEnabled(true);
111 
112  if( !$answersInput->checkUploads($_POST[$answersInput->getPostVar()]) )
113  {
114  ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
115  $this->editQuestion($form);
116  return 1;
117  }
118 
119  $answersInput->collectValidFiles();
120  }
121  elseif( !$form->checkInput() )
122  {
123  $this->editQuestion($form);
124  return 1;
125  }
126 
128 
129  $this->writeQuestionSpecificPostData($form);
130  $this->writeAnswerSpecificPostData($form);
131 
132  $this->saveTaxonomyAssignments();
133 
134  return 0;
135  }
writeQuestionSpecificPostData(ilPropertyFormGUI $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 238 of file class.assKprimChoiceGUI.php.

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

Referenced by writePostData().

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