ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
assKprimChoiceGUI Class Reference
+ Inheritance diagram for assKprimChoiceGUI:
+ Collaboration diagram for assKprimChoiceGUI:

Public Member Functions

 __construct ($qId=-1)
 
 removeImage ()
 
 downkprim_answers ()
 
 upkprim_answers ()
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 
 getSpecificFeedbackOutput ($active_id, $pass)
 
 getTestOutput ( $active_id, $pass, $is_postponed=false, $use_post_solutions=false, $showInlineFeedback=false)
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
 renderAggregateView ($aggregate)
 
 aggregateAnswers ($rawSolutionData, $answers)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 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)
 
 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
 

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

References array.

Referenced by getAggregatedAnswersView().

813  {
814  $aggregate = array();
815 
816  foreach ($answers as $answer) {
817  $answerAgg = array(
818  'answertext' => $answer->getAnswerText(), 'count_true' => 0, 'count_false' => 0
819  );
820 
821  foreach ($rawSolutionData as $solutionRecord) {
822  if ($solutionRecord['value1'] == $answer->getPosition()) {
823  if ($solutionRecord['value2']) {
824  $answerAgg['count_true']++;
825  } else {
826  $answerAgg['count_false']++;
827  }
828  }
829  }
830 
831  $aggregate[] = $answerAgg;
832  }
833 
834  return $aggregate;
835  }
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 131 of file class.assKprimChoiceGUI.php.

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

Referenced by editQuestion(), and writePostData().

132  {
133  $form = $this->buildBasicEditFormObject();
134 
136 
138 
141 
143 
144  return $form;
145  }
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 74 of file class.assKprimChoiceGUI.php.

References $_POST, and editQuestion().

75  {
76  if (isset($_POST['cmd'][__FUNCTION__]) && count($_POST['cmd'][__FUNCTION__])) {
77  $this->object->moveAnswerDown(key($_POST['cmd'][__FUNCTION__]));
78  $this->object->saveToDb();
79  }
80 
81  $this->editQuestion();
82  }
editQuestion(ilPropertyFormGUI $form=null)
$_POST["username"]
+ Here is the call graph for this function:

◆ editQuestion()

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

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

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

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

44  {
45  if ($form === null) {
46  $form = $this->buildEditForm();
47  }
48 
49  $this->getQuestionTemplate();
50  $this->tpl->addCss('Modules/Test/templates/default/ta.css');
51 
52  $this->tpl->setVariable("QUESTION_DATA", $this->ctrl->getHTML($form));
53  }
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 38 of file class.assKprimChoiceGUI.php.

References array.

39  {
40  return array('uploadImage', 'removeImage');
41  }
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 754 of file class.assKprimChoiceGUI.php.

References array.

755  {
756  return array();
757  }
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 768 of file class.assKprimChoiceGUI.php.

References array.

769  {
770  return array();
771  }
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 781 of file class.assKprimChoiceGUI.php.

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

782  {
783  return $this->renderAggregateView(
784  $this->aggregateAnswers($relevant_answers, $this->object->getAnswers())
785  )->get();
786 
787  return '<pre>' . print_r($relevant_answers, 1) . '</pre>';
788  }
Create new PHPExcel object
obj_idprivate
aggregateAnswers($rawSolutionData, $answers)
+ Here is the call graph for this function:

◆ getParticipantsAnswerKeySequence()

assKprimChoiceGUI::getParticipantsAnswerKeySequence ( )
protected

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

References object.

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

697  {
698  $choiceKeys = array_keys($this->object->getAnswers());
699 
700  if ($this->object->isShuffleAnswersEnabled()) {
701  $choiceKeys = $this->object->getShuffler()->shuffle($choiceKeys);
702  }
703 
704  return $choiceKeys;
705  }
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 441 of file class.assKprimChoiceGUI.php.

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

442  {
443  $user_solution = is_object($this->getPreviewSession()) ? (array) $this->getPreviewSession()->getParticipantsSolution() : array();
444  // shuffle output
446 
447  // generate the question output
448  include_once "./Services/UICore/classes/class.ilTemplate.php";
449  $template = new ilTemplate("tpl.il_as_qpl_mc_kprim_output.html", true, true, "Modules/TestQuestionPool");
450 
451  foreach ($keys as $answer_id) {
452  $answer = $this->object->getAnswer($answer_id);
453  if (strlen($answer->getImageFile())) {
454  if ($this->object->getThumbSize()) {
455  $template->setCurrentBlock("preview");
456  $template->setVariable("URL_PREVIEW", $answer->getImageWebPath());
457  $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
458  $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
459  $template->setVariable("ANSWER_IMAGE_URL", $answer->getThumbWebPath());
460  list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
461  $alt = $answer->getImageFile();
462  if (strlen($answer->getAnswertext())) {
463  $alt = $answer->getAnswertext();
464  }
465  $alt = preg_replace("/<[^>]*?>/", "", $alt);
466  $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
467  $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
468  $template->parseCurrentBlock();
469  } else {
470  $template->setCurrentBlock("answer_image");
471  $template->setVariable("ANSWER_IMAGE_URL", $answer->getImageWebPath());
472  list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
473  $alt = $answer->getImageFile();
474  if (strlen($answer->getAnswertext())) {
475  $alt = $answer->getAnswertext();
476  }
477  $alt = preg_replace("/<[^>]*?>/", "", $alt);
478  $template->setVariable("ATTR", $attr);
479  $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
480  $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
481  $template->parseCurrentBlock();
482  }
483  }
484 
485  if ($showInlineFeedback) {
486  $this->populateSpecificFeedbackInline($user_solution, $answer_id, $template);
487  }
488 
489  $template->setCurrentBlock("answer_row");
490  $template->setVariable("ANSWER_ID", $answer_id);
491  $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), true));
492  $template->setVariable('VALUE_TRUE', 1);
493  $template->setVariable('VALUE_FALSE', 0);
494 
495  if (isset($user_solution[$answer->getPosition()])) {
496  $tplVar = $user_solution[$answer->getPosition()] ? 'CHECKED_ANSWER_TRUE' : 'CHECKED_ANSWER_FALSE';
497  $template->setVariable($tplVar, " checked=\"checked\"");
498  }
499 
500  $template->parseCurrentBlock();
501  }
502  $questiontext = $this->object->getQuestion();
503  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
504 
505  $template->setVariable("INSTRUCTIONTEXT", $this->object->getInstructionTextTranslation(
506  $this->lng,
507  $this->object->getOptionLabel()
508  ));
509 
510  $template->setVariable("OPTION_LABEL_TRUE", $this->object->getTrueOptionLabelTranslation(
511  $this->lng,
512  $this->object->getOptionLabel()
513  ));
514 
515  $template->setVariable("OPTION_LABEL_FALSE", $this->object->getFalseOptionLabelTranslation(
516  $this->lng,
517  $this->object->getOptionLabel()
518  ));
519 
520  $questionoutput = $template->get();
521  if (!$show_question_only) {
522  // get page object output
523  $questionoutput = $this->getILIASPage($questionoutput);
524  }
525  return $questionoutput;
526  }
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
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 539 of file class.assKprimChoiceGUI.php.

References $keys, $pass, $template, 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().

549  {
550  // shuffle output
552 
553  // get the solution of the user for the active pass or from the last pass if allowed
554  $user_solution = array();
555  if (($active_id > 0) && (!$show_correct_solution)) {
556  $solutions =&$this->object->getSolutionValues($active_id, $pass);
557  foreach ($solutions as $idx => $solution_value) {
558  $user_solution[$solution_value['value1']] = $solution_value['value2'];
559  }
560  } else {
561  // take the correct solution instead of the user solution
562  foreach ($this->object->getAnswers() as $answer) {
563  $user_solution[$answer->getPosition()] = $answer->getCorrectness();
564  }
565  }
566 
567  // generate the question output
568  $template = new ilTemplate("tpl.il_as_qpl_mc_kprim_output_solution.html", true, true, "Modules/TestQuestionPool");
569 
570  foreach ($keys as $answer_id) {
571  $answer = $this->object->getAnswer($answer_id);
572 
573  if (($active_id > 0) && (!$show_correct_solution)) {
574  if ($graphicalOutput) {
575  // output of ok/not ok icons for user entered solutions
576 
577  if ($user_solution[$answer->getPosition()] == $answer->getCorrectness()) {
578  $template->setCurrentBlock("icon_ok");
579  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
580  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
581  $template->parseCurrentBlock();
582  } else {
583  $template->setCurrentBlock("icon_ok");
584  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
585  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
586  $template->parseCurrentBlock();
587  }
588  }
589  }
590  if (strlen($answer->getImageFile())) {
591  $template->setCurrentBlock("answer_image");
592  if ($this->object->getThumbSize()) {
593  $template->setVariable("ANSWER_IMAGE_URL", $answer->getThumbWebPath());
594  } else {
595  $template->setVariable("ANSWER_IMAGE_URL", $answer->getImageWebPath());
596  }
597 
598  $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($answer->getImageFile()));
599  $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($answer->getImageFile()));
600  $template->parseCurrentBlock();
601  }
602 
603  if ($show_feedback) {
604  $this->populateSpecificFeedbackInline($user_solution, $answer_id, $template);
605  }
606 
607  $template->setCurrentBlock("answer_row");
608  $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), true));
609 
610  if ($this->renderPurposeSupportsFormHtml() || $this->isRenderPurposePrintPdf()) {
611  if (isset($user_solution[$answer->getPosition()])) {
612  if ($user_solution[$answer->getPosition()]) {
613  $template->setVariable("SOLUTION_IMAGE_TRUE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_checked.png")));
614  $template->setVariable("SOLUTION_ALT_TRUE", $this->lng->txt("checked"));
615  $template->setVariable("SOLUTION_IMAGE_FALSE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
616  $template->setVariable("SOLUTION_ALT_FALSE", $this->lng->txt("unchecked"));
617  } else {
618  $template->setVariable("SOLUTION_IMAGE_TRUE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
619  $template->setVariable("SOLUTION_ALT_TRUE", $this->lng->txt("unchecked"));
620  $template->setVariable("SOLUTION_IMAGE_FALSE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_checked.png")));
621  $template->setVariable("SOLUTION_ALT_FALSE", $this->lng->txt("checked"));
622  }
623  } else {
624  $template->setVariable("SOLUTION_IMAGE_TRUE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
625  $template->setVariable("SOLUTION_ALT_TRUE", $this->lng->txt("unchecked"));
626  $template->setVariable("SOLUTION_IMAGE_FALSE", ilUtil::getHtmlPath(ilUtil::getImagePath("radiobutton_unchecked.png")));
627  $template->setVariable("SOLUTION_ALT_FALSE", $this->lng->txt("unchecked"));
628  }
629  } else {
630  $template->setVariable('SOL_QID', $this->object->getId());
631  $template->setVariable('SOL_SUFFIX', $show_correct_solution ? 'bestsolution' : 'usersolution');
632  $template->setVariable('SOL_POSITION', $answer->getPosition());
633 
634  $template->setVariable('SOL_TRUE_VALUE', 1);
635  $template->setVariable('SOL_FALSE_VALUE', 0);
636 
637  if (isset($user_solution[$answer->getPosition()])) {
638  if ($user_solution[$answer->getPosition()]) {
639  $template->setVariable('SOL_TRUE_CHECKED', 'checked');
640  } else {
641  $template->setVariable('SOL_FALSE_CHECKED', 'checked');
642  }
643  }
644  }
645 
646  $template->parseCurrentBlock();
647  }
648 
649  if ($show_question_text==true) {
650  $questiontext = $this->object->getQuestion();
651  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
652 
653  $template->setVariable("INSTRUCTIONTEXT", $this->object->getInstructionTextTranslation(
654  $this->lng,
655  $this->object->getOptionLabel()
656  ));
657  }
658 
659  $template->setVariable("OPTION_LABEL_TRUE", $this->object->getTrueOptionLabelTranslation(
660  $this->lng,
661  $this->object->getOptionLabel()
662  ));
663 
664  $template->setVariable("OPTION_LABEL_FALSE", $this->object->getFalseOptionLabelTranslation(
665  $this->lng,
666  $this->object->getOptionLabel()
667  ));
668 
669 
670  $questionoutput = $template->get();
671  $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getGenericFeedbackOutput($active_id, $pass) : "";
672 
673  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
674 
675  if (strlen($feedback)) {
676  $cssClass = (
677  $this->hasCorrectSolution($active_id, $pass) ?
679  );
680 
681  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
682  $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
683  }
684 
685  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
686 
687  $solutionoutput = $solutiontemplate->get();
688 
689  if (!$show_question_only) {
690  // get page object output
691  $solutionoutput = $this->getILIASPage($solutionoutput);
692  }
693  return $solutionoutput;
694  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
hasCorrectSolution($activeId, $passIndex)
$template
$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
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 315 of file class.assKprimChoiceGUI.php.

316  {
317  return ''; // question type supports inline answer specific feedback
318  }

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

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

337  {
338  // shuffle output
340 
341  // get the solution of the user for the active pass or from the last pass if allowed
342  $user_solution = array();
343  if ($active_id) {
344  // hey: prevPassSolutions - obsolete due to central check
345  #$solutions = NULL;
346  #include_once "./Modules/Test/classes/class.ilObjTest.php";
347  #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
348  #{
349  # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
350  #}
351  $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
352  // hey.
353  foreach ($solutions as $idx => $solution_value) {
354  $user_solution[$solution_value["value1"]] = $solution_value["value2"];
355  }
356  }
357 
358  // generate the question output
359  include_once "./Services/UICore/classes/class.ilTemplate.php";
360  $template = new ilTemplate("tpl.il_as_qpl_mc_kprim_output.html", true, true, "Modules/TestQuestionPool");
361 
362  foreach ($keys as $answer_id) {
363  $answer = $this->object->getAnswer($answer_id);
364  if (strlen($answer->getImageFile())) {
365  if ($this->object->getThumbSize()) {
366  $template->setCurrentBlock("preview");
367  $template->setVariable("URL_PREVIEW", $answer->getImageWebPath());
368  $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
369  $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
370  $template->setVariable("ANSWER_IMAGE_URL", $answer->getThumbWebPath());
371  list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
372  $alt = $answer->getImageFile();
373  if (strlen($answer->getAnswertext())) {
374  $alt = $answer->getAnswertext();
375  }
376  $alt = preg_replace("/<[^>]*?>/", "", $alt);
377  $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
378  $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
379  $template->parseCurrentBlock();
380  } else {
381  $template->setCurrentBlock("answer_image");
382  $template->setVariable("ANSWER_IMAGE_URL", $answer->getImageWebPath());
383  list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
384  $alt = $answer->getImageFile();
385  if (strlen($answer->getAnswertext())) {
386  $alt = $answer->getAnswertext();
387  }
388  $alt = preg_replace("/<[^>]*?>/", "", $alt);
389  $template->setVariable("ATTR", $attr);
390  $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
391  $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
392  $template->parseCurrentBlock();
393  }
394  }
395 
396  if ($showInlineFeedback) {
397  $this->populateSpecificFeedbackInline($user_solution, $answer_id, $template);
398  }
399 
400  $template->setCurrentBlock("answer_row");
401  $template->setVariable("ANSWER_ID", $answer_id);
402  $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), true));
403  $template->setVariable('VALUE_TRUE', 1);
404  $template->setVariable('VALUE_FALSE', 0);
405 
406  if (isset($user_solution[$answer->getPosition()])) {
407  $tplVar = $user_solution[$answer->getPosition()] ? 'CHECKED_ANSWER_TRUE' : 'CHECKED_ANSWER_FALSE';
408  $template->setVariable($tplVar, " checked=\"checked\"");
409  }
410 
411  $template->parseCurrentBlock();
412  }
413 
414  $questiontext = $this->object->getQuestion();
415  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
416 
417  $template->setVariable("INSTRUCTIONTEXT", $this->object->getInstructionTextTranslation(
418  $this->lng,
419  $this->object->getOptionLabel()
420  ));
421 
422  $template->setVariable("OPTION_LABEL_TRUE", $this->object->getTrueOptionLabelTranslation(
423  $this->lng,
424  $this->object->getOptionLabel()
425  ));
426 
427  $template->setVariable("OPTION_LABEL_FALSE", $this->object->getFalseOptionLabelTranslation(
428  $this->lng,
429  $this->object->getOptionLabel()
430  ));
431 
432  $questionoutput = $template->get();
433  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
434  return $pageoutput;
435  }
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
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 297 of file class.assKprimChoiceGUI.php.

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

Referenced by writeAnswerSpecificPostData().

298  {
299  if ($this->object->getAnswerType() == assKprimChoice::ANSWER_TYPE_MULTI_LINE) {
300  return $answers;
301  }
302 
303  foreach ($answers as $key => $answer) {
304  $answer->setAnswerText(ilUtil::secureString($answer->getAnswerText()));
305  }
306 
307  return $answers;
308  }
Create new PHPExcel object
obj_idprivate
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:

◆ populateAnswerSpecificFormPart()

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

Implements ilGuiAnswerScoringAdjustable.

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

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

Referenced by buildEditForm().

264  {
265  require_once 'Modules/TestQuestionPool/classes/class.ilKprimChoiceWizardInputGUI.php';
266  $kprimAnswers = new ilKprimChoiceWizardInputGUI($this->lng->txt('answers'), 'kprim_answers');
267  $kprimAnswers->setInfo($this->lng->txt('kprim_answers_info'));
268  $kprimAnswers->setSize(64);
269  $kprimAnswers->setMaxLength(1000);
270  $kprimAnswers->setRequired(true);
271  $kprimAnswers->setAllowMove(true);
272  $kprimAnswers->setQuestionObject($this->object);
273  if (!$this->object->getSelfAssessmentEditingMode()) {
274  $kprimAnswers->setSingleline($this->object->isSingleLineAnswerType($this->object->getAnswerType()));
275  } else {
276  $kprimAnswers->setSingleline(false);
277  }
278  $kprimAnswers->setValues($this->object->getAnswers());
279  $form->addItem($kprimAnswers);
280 
281  return $form;
282  }
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
if(isset($_POST['submit'])) $form
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 151 of file class.assKprimChoiceGUI.php.

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

Referenced by buildEditForm().

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

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

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

708  {
709  require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssConfigurableMultiOptionQuestionFeedback.php';
710 
711  if ($this->object->getSpecificFeedbackSetting() == ilAssConfigurableMultiOptionQuestionFeedback::FEEDBACK_SETTING_CHECKED) {
712  if ($user_solution[$answer_id]) {
713  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
714  if (strlen($fb)) {
715  $template->setCurrentBlock("feedback");
716  $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
717  $template->parseCurrentBlock();
718  }
719  }
720  }
721 
722  if ($this->object->getSpecificFeedbackSetting() == ilAssConfigurableMultiOptionQuestionFeedback::FEEDBACK_SETTING_ALL) {
723  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
724  if (strlen($fb)) {
725  $template->setCurrentBlock("feedback");
726  $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
727  $template->parseCurrentBlock();
728  }
729  }
730 
731  if ($this->object->getSpecificFeedbackSetting() == ilAssConfigurableMultiOptionQuestionFeedback::FEEDBACK_SETTING_CORRECT) {
732  $answer = $this->object->getAnswer($answer_id);
733 
734  if ($answer->getCorrectness()) {
735  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
736  if (strlen($fb)) {
737  $template->setCurrentBlock("feedback");
738  $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
739  $template->parseCurrentBlock();
740  }
741  }
742  }
743  }
$template
Create new PHPExcel object
obj_idprivate
+ Here is the caller graph for this function:

◆ removeImage()

assKprimChoiceGUI::removeImage ( )

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

References $_POST, and editQuestion().

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

◆ renderAggregateView()

assKprimChoiceGUI::renderAggregateView (   $aggregate)

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

References assQuestionGUI\$tpl, and object.

Referenced by getAggregatedAnswersView().

791  {
792  $trueOptionLabel = $this->object->getTrueOptionLabelTranslation($this->lng, $this->object->getOptionLabel());
793  $falseOptionLabel = $this->object->getFalseOptionLabelTranslation($this->lng, $this->object->getOptionLabel());
794 
795  $tpl = new ilTemplate('tpl.il_as_aggregated_kprim_answers_table.html', true, true, "Modules/TestQuestionPool");
796 
797  foreach ($aggregate as $lineData) {
798  $tpl->setCurrentBlock('aggregaterow');
799  $tpl->setVariable('OPTION', $lineData['answertext']);
800  $tpl->setVariable('COUNT_TRUE', $lineData['count_true']);
801  $tpl->setVariable('COUNT_FALSE', $lineData['count_false']);
802  $tpl->parseCurrentBlock();
803  }
804 
805  $tpl->setVariable('OPTION_HEAD', $this->lng->txt('answers'));
806  $tpl->setVariable('COUNT_TRUE_HEAD', $trueOptionLabel);
807  $tpl->setVariable('COUNT_FALSE_HEAD', $falseOptionLabel);
808 
809  return $tpl;
810  }
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 84 of file class.assKprimChoiceGUI.php.

References $_POST, and editQuestion().

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

◆ uploadImage()

assKprimChoiceGUI::uploadImage ( )
protected

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

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

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

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

Referenced by writePostData().

288  {
289  $answers = $form->getItemByPostVar('kprim_answers')->getValues();
290  $answers = $this->handleAnswerTextsSubmit($answers);
291  $files = $form->getItemByPostVar('kprim_answers')->getFiles();
292 
293  $this->object->handleFileUploads($answers, $files);
294  $this->object->setAnswers($answers);
295  }
$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 97 of file class.assKprimChoiceGUI.php.

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

Referenced by uploadImage().

98  {
99  $form = $this->buildEditForm();
100  $form->setValuesByPost();
101 
102  if ($upload) {
103  $answersInput = $form->getItemByPostVar('kprim_answers');
104  $answersInput->setIgnoreMissingUploadsEnabled(true);
105 
106  if (!$answersInput->checkUploads($_POST[$answersInput->getPostVar()])) {
107  ilUtil::sendFailure($this->lng->txt("form_input_not_valid"));
108  $this->editQuestion($form);
109  return 1;
110  }
111 
112  $answersInput->collectValidFiles();
113  } elseif (!$form->checkInput()) {
114  $this->editQuestion($form);
115  return 1;
116  }
117 
119 
122 
123  $this->saveTaxonomyAssignments();
124 
125  return 0;
126  }
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 227 of file class.assKprimChoiceGUI.php.

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

Referenced by writePostData().

228  {
229  $oldAnswerType = $this->object->getAnswerType();
230 
231  $this->object->setShuffleAnswersEnabled($form->getItemByPostVar('shuffle_answers_enabled')->getChecked());
232 
233  if (!$this->object->getSelfAssessmentEditingMode()) {
234  $this->object->setAnswerType($form->getItemByPostVar('answer_type')->getValue());
235  } else {
236  $this->object->setAnswerType(assKprimChoice::ANSWER_TYPE_MULTI_LINE);
237  }
238 
239  if (!$this->object->getSelfAssessmentEditingMode() && $this->object->isSingleLineAnswerType($oldAnswerType)) {
240  $this->object->setThumbSize($form->getItemByPostVar('thumb_size')->getValue());
241  }
242 
243  $this->object->setOptionLabel($form->getItemByPostVar('option_label')->getValue());
244 
245  if ($this->object->isCustomOptionLabel($this->object->getOptionLabel())) {
246  $this->object->setCustomTrueOptionLabel(strip_tags(
247  $form->getItemByPostVar('option_label_custom_true')->getValue()
248  ));
249  $this->object->setCustomFalseOptionLabel(strip_tags(
250  $form->getItemByPostVar('option_label_custom_false')->getValue()
251  ));
252  }
253 
254  $this->object->setPoints($form->getItemByPostVar('points')->getValue());
255 
256  $this->object->setScorePartialSolutionEnabled($form->getItemByPostVar('score_partsol_enabled')->getChecked());
257  }
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: