ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
assOrderingHorizontalGUI Class Reference

The assOrderingHorizontalGUI class encapsulates the GUI representation for horizontal ordering questions. More...

+ Inheritance diagram for assOrderingHorizontalGUI:
+ Collaboration diagram for assOrderingHorizontalGUI:

Public Member Functions

 __construct ($id=-1)
 assOrderingHorizontalGUI constructor More...
 
 getCommand ($cmd)
 
 editQuestion ($checkonly=false)
 Creates an output of the edit form for the question. More...
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 Get the question solution output. More...
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 getTestOutput ($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
 
 saveFeedback ()
 Saves the feedback for a single choice question. More...
 
 getPresentationJavascripts ()
 
 getSpecificFeedbackOutput ($userSolution)
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 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...
 
 aggregateAnswers ($relevant_answers_chosen, $answer_defined_on_question)
 
 renderAggregateView ($aggregate)
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 execute command More...
 
 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 (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=false, $user_post_solutions=false, $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 

Protected Member Functions

 writePostData ($always=false)
 {} More...
 
- Protected Member Functions inherited from assQuestionGUI
 hasSpecialQuestionCommands ()
 
 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)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 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_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 addSaveOnEnterOnLoadCode ()
 

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...
 
- 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
 
 $request
 
 $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 Attributes inherited from assQuestionGUI
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
 $ctrl
 
 $editForm
 
 $use_intermediate_solution = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

assOrderingHorizontalGUI::__construct (   $id = -1)

assOrderingHorizontalGUI constructor

The constructor takes possible arguments an creates an instance of the assOrderingHorizontalGUI object.

Parameters
integer$idThe database id of a single choice question object public

Definition at line 32 of file class.assOrderingHorizontalGUI.php.

References ILIAS\GlobalScreen\Provider\__construct(), and assQuestionGUI\setErrorMessage().

33  {
35  include_once "./Modules/TestQuestionPool/classes/class.assOrderingHorizontal.php";
36  $this->object = new assOrderingHorizontal();
37  $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
38  if ($id >= 0) {
39  $this->object->loadFromDb($id);
40  }
41  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setErrorMessage($errormessage)
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ aggregateAnswers()

assOrderingHorizontalGUI::aggregateAnswers (   $relevant_answers_chosen,
  $answer_defined_on_question 
)

Definition at line 472 of file class.assOrderingHorizontalGUI.php.

Referenced by getAggregatedAnswersView().

473  {
474  $aggregate = array();
475  foreach ($relevant_answers_chosen as $answer) {
476  $answer = str_replace($this->object->getAnswerSeparator(), '  -  ', $answer);
477  if (in_array($answer['value1'], $aggregate)) {
478  $aggregate[$answer['value1']] = $aggregate[$answer['value1']] + 1;
479  } else {
480  $aggregate[$answer['value1']] = 1;
481  }
482  }
483 
484  return $aggregate;
485  }
+ Here is the caller graph for this function:

◆ editQuestion()

assOrderingHorizontalGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

public

Definition at line 69 of file class.assOrderingHorizontalGUI.php.

References $errors, assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), assQuestionGUI\getQuestionTemplate(), assQuestionGUI\isSaveCommand(), assQuestionGUI\outQuestionType(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by writePostData().

70  {
71  $save = $this->isSaveCommand();
72  $this->getQuestionTemplate();
73 
74  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
75  $form = new ilPropertyFormGUI();
76  $this->editForm = $form;
77 
78  $form->setFormAction($this->ctrl->getFormAction($this));
79  $form->setTitle($this->outQuestionType());
80  $form->setMultipart(false);
81  $form->setTableWidth("100%");
82  $form->setId("orderinghorizontal");
83 
84  $this->addBasicQuestionFormProperties($form);
86 
87 
88  $this->populateTaxonomyFormSection($form);
89 
90  $this->addQuestionFormCommandButtons($form);
91 
92  $errors = false;
93 
94  if ($save) {
95  $form->setValuesByPost();
96  $errors = !$form->checkInput();
97  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
98  if ($errors) {
99  $checkonly = false;
100  }
101  }
102 
103  if (!$checkonly) {
104  $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
105  }
106  return $errors;
107  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
$errors
Definition: imgupload.php:49
This class represents a property form user interface.
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionQuestionPostVars()

assOrderingHorizontalGUI::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 416 of file class.assOrderingHorizontalGUI.php.

417  {
418  return array();
419  }

◆ getAggregatedAnswersView()

assOrderingHorizontalGUI::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 465 of file class.assOrderingHorizontalGUI.php.

References aggregateAnswers(), and renderAggregateView().

466  {
467  return $this->renderAggregateView(
468  $this->aggregateAnswers($relevant_answers, $this->object->getOrderText())
469  )->get();
470  }
aggregateAnswers($relevant_answers_chosen, $answer_defined_on_question)
+ Here is the call graph for this function:

◆ getAnswersFrequency()

assOrderingHorizontalGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Definition at line 505 of file class.assOrderingHorizontalGUI.php.

506  {
507  $answers = array();
508 
509  foreach ($relevantAnswers as $ans) {
510  $md5 = md5($ans['value1']);
511 
512  if (!isset($answers[$md5])) {
513  $answer = str_replace(
514  $this->object->getAnswerSeparator(),
515  '  -  ',
516  $ans['value1']
517  );
518 
519  $answers[$md5] = array(
520  'answer' => $answer, 'frequency' => 0
521  );
522  }
523 
524  $answers[$md5]['frequency']++;
525  }
526 
527  return $answers;
528  }

◆ getCommand()

assOrderingHorizontalGUI::getCommand (   $cmd)

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

44  {
45  return $cmd;
46  }

◆ getPresentationJavascripts()

assOrderingHorizontalGUI::getPresentationJavascripts ( )

Definition at line 358 of file class.assOrderingHorizontalGUI.php.

References $DIC.

359  {
360  global $DIC; /* @var ILIAS\DI\Container $DIC */
361 
362  $files = array();
363 
364  if ($DIC['ilBrowser']->isMobile() || $DIC['ilBrowser']->isIpad()) {
365  $files[] = './node_modules/@andxor/jquery-ui-touch-punch-fix/jquery.ui.touch-punch.js';
366  }
367 
368  return $files;
369  }
global $DIC
Definition: goto.php:24

◆ getPreview()

assOrderingHorizontalGUI::getPreview (   $show_question_only = false,
  $showInlineFeedback = false 
)

Definition at line 246 of file class.assOrderingHorizontalGUI.php.

References $DIC, assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), iljQueryUtil\initjQuery(), iljQueryUtil\initjQueryUI(), and ilUtil\prepareFormOutput().

247  {
248  if (is_object($this->getPreviewSession()) && strlen((string) $this->getPreviewSession()->getParticipantsSolution())) {
249  $elements = (string) $this->getPreviewSession()->getParticipantsSolution();
250  $elements = $this->object->splitAndTrimOrderElementText($elements, $this->object->getAnswerSeparator());
251  } else {
252  $elements = $this->object->getRandomOrderingElements();
253  }
254 
255  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_preview.html", true, true, "Modules/TestQuestionPool");
256  foreach ($elements as $id => $element) {
257  $template->setCurrentBlock("element");
258  $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
259  $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
260  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
261  $template->parseCurrentBlock();
262  }
263  $template->setVariable("QUESTION_ID", $this->object->getId());
264  $template->setVariable("VALUE_ORDERRESULT", ' value="' . join('{::}', $elements) . '"');
265  if ($this->object->textsize >= 10) {
266  $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
267  }
268  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
269  $questionoutput = $template->get();
270  if (!$show_question_only) {
271  // get page object output
272  $questionoutput = $this->getILIASPage($questionoutput);
273  }
274  global $DIC; /* @var ILIAS\DI\Container $DIC */
275  if ($DIC['ilBrowser']->isMobile() || $DIC['ilBrowser']->isIpad()) {
276  require_once 'Services/jQuery/classes/class.iljQueryUtil.php';
279  $this->tpl->addJavaScript('./node_modules/@andxor/jquery-ui-touch-punch-fix/jquery.ui.touch-punch.js');
280  }
281  $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
282  return $questionoutput;
283  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getILIASPage($html="")
Returns the ILIAS Page around a question.
global $DIC
Definition: goto.php:24
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
+ Here is the call graph for this function:

◆ getSolutionOutput()

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

Get the question solution output.

Parameters
integer$active_idThe active user id
integer$passThe test pass
boolean$graphicalOutputShow visual feedback for right/wrong answers
boolean$result_outputShow the reached points for parts of the question
boolean$show_question_onlyShow the question without the ILIAS content around
boolean$show_feedbackShow the question feedback
boolean$show_correct_solutionShow the correct solution instead of the user solution
boolean$show_manual_scoringShow specific information for the manual scoring output
Returns
The solution output of the question as HTML code

Definition at line 132 of file class.assOrderingHorizontalGUI.php.

References $pass, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getSpecificFeedbackOutput(), assQuestionGUI\getUseIntermediateSolution(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), and ilUtil\prepareFormOutput().

142  {
143  // get the solution of the user for the active pass or from the last pass if allowed
144  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output_solution.html", true, true, "Modules/TestQuestionPool");
145 
146  if (($active_id > 0) && (!$show_correct_solution)) {
147  $elements = [];
148  $solutions = $this->object->getSolutionValues($active_id, $pass, !$this->getUseIntermediateSolution());
149  if (strlen($solutions[0]["value1"])) {
150  $elements = explode("{::}", $solutions[0]["value1"]);
151  }
152 
153  if (!count($elements)) {
154  $elements = $this->object->getRandomOrderingElements();
155  }
156 
157  foreach ($elements as $id => $element) {
158  $template->setCurrentBlock("element");
159  $template->setVariable("ELEMENT_ID", "sol_e_" . $this->object->getId() . "_$id");
160  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
161  $template->parseCurrentBlock();
162  }
163  } else {
164  $elements = $this->object->getOrderingElements();
165  foreach ($elements as $id => $element) {
166  $template->setCurrentBlock("element");
167  $template->setVariable("ELEMENT_ID", "sol_e_" . $this->object->getId() . "_$id");
168  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
169  $template->parseCurrentBlock();
170  }
171  }
172 
173  if (($active_id > 0) && (!$show_correct_solution)) {
174  if ($this->object->getStep() === null) {
175  $reached_points = $this->object->getReachedPoints($active_id, $pass);
176  } else {
177  $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
178  }
179  if ($graphicalOutput) {
180  // output of ok/not ok icons for user entered solutions
181  if ($reached_points == $this->object->getMaximumPoints()) {
182  $template->setCurrentBlock("icon_ok");
183  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
184  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
185  $template->parseCurrentBlock();
186  } else {
187  $template->setCurrentBlock("icon_ok");
188  if ($reached_points > 0) {
189  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
190  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
191  } else {
192  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
193  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
194  }
195  $template->parseCurrentBlock();
196  }
197  }
198  } else {
199  $reached_points = $this->object->getPoints();
200  }
201 
202  if ($result_output) {
203  $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
204  $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
205  }
206  if ($show_question_text == true) {
207  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
208  }
209  // $template->setVariable("SOLUTION_TEXT", ilUtil::prepareFormOutput($solutionvalue));
210  if ($this->object->textsize >= 10) {
211  $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
212  }
213 
214  $questionoutput = $template->get();
215  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
216  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
217 
218 
219  $feedback = '';
220  if ($show_feedback) {
221  if (!$this->isTestPresentationContext()) {
222  $fb = $this->getGenericFeedbackOutput($active_id, $pass);
223  $feedback .= strlen($fb) ? $fb : '';
224  }
225 
226  $fb = $this->getSpecificFeedbackOutput(array());
227  $feedback .= strlen($fb) ? $fb : '';
228  }
229  if (strlen($feedback)) {
230  $cssClass = (
231  $this->hasCorrectSolution($active_id, $pass) ?
233  );
234 
235  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
236  $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
237  }
238  $solutionoutput = $solutiontemplate->get();
239  if (!$show_question_only) {
240  // get page object output
241  $solutionoutput = $this->getILIASPage($solutionoutput);
242  }
243  return $solutionoutput;
244  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
hasCorrectSolution($activeId, $passIndex)
getUseIntermediateSolution()
Get if intermediate solution should be used for solution output.
getILIASPage($html="")
Returns the ILIAS Page around a question.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assOrderingHorizontalGUI::getSpecificFeedbackOutput (   $userSolution)

Definition at line 371 of file class.assOrderingHorizontalGUI.php.

Referenced by getSolutionOutput().

372  {
373  if (strpos($this->object->getOrderText(), '::')) {
374  $answers = explode('::', $this->object->getOrderText());
375  } else {
376  $answers = explode(' ', $this->object->getOrderText());
377  }
378 
379  if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
380  return '';
381  }
382 
383  $output = '<table class="test_specific_feedback"><tbody>';
384 
385  foreach ($answers as $idx => $answer) {
386  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
387  $this->object->getId(),
388  0,
389  $idx
390  );
391 
392  $output .= "<tr><td>{$answer}</td><td>{$feedback}</td></tr>";
393  }
394 
395  $output .= '</tbody></table>';
396 
397  return $this->object->prepareTextareaOutput($output, true);
398  }
+ Here is the caller graph for this function:

◆ getTestOutput()

assOrderingHorizontalGUI::getTestOutput (   $active_id,
  $pass,
  $is_postponed = false,
  $use_post_solutions = false,
  $show_feedback = false 
)

Definition at line 286 of file class.assOrderingHorizontalGUI.php.

References $_SESSION, $DIC, $pass, assQuestionGUI\getILIASPage(), iljQueryUtil\initjQuery(), iljQueryUtil\initjQueryUI(), assQuestionGUI\outQuestionPage(), and ilUtil\prepareFormOutput().

288  {
289  // generate the question output
290  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output.html", true, true, "Modules/TestQuestionPool");
291  $elements = $this->object->getRandomOrderingElements();
292 
293  if ($active_id) {
294  // hey: prevPassSolutions - obsolete due to central check
295  #$solutions = NULL;
296  #include_once "./Modules/Test/classes/class.ilObjTest.php";
297  #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
298  #{
299  # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
300  #}
301  $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
302  // hey.
303  if (is_array($solutions) && count($solutions) == 1) {
304  $elements = explode("{::}", $solutions[0]["value1"]);
305  }
306  }
307  if (!is_array($solutions) || count($solutions) == 0) {
308  $_SESSION['qst_ordering_horizontal_elements'] = $elements;
309  } else {
310  unset($_SESSION['qst_ordering_horizontal_elements']);
311  }
312  foreach ($elements as $id => $element) {
313  $template->setCurrentBlock("element");
314  $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
315  $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
316  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
317  $template->parseCurrentBlock();
318  }
319  $template->setVariable("QUESTION_ID", $this->object->getId());
320  if ($this->object->textsize >= 10) {
321  $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
322  }
323  $template->setVariable("VALUE_ORDERRESULT", ' value="' . join('{::}', $elements) . '"');
324  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
325  $questionoutput = $template->get();
326  if (!$show_question_only) {
327  // get page object output
328  $questionoutput = $this->getILIASPage($questionoutput);
329  }
330  global $DIC; /* @var ILIAS\DI\Container $DIC */
331  if ($DIC['ilBrowser']->isMobile() || $DIC['ilBrowser']->isIpad()) {
332  require_once 'Services/jQuery/classes/class.iljQueryUtil.php';
335  $this->tpl->addJavaScript('./node_modules/@andxor/jquery-ui-touch-punch-fix/jquery.ui.touch-punch.js');
336  }
337  $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
338  $questionoutput = $template->get();
339  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
340  return $pageoutput;
341  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$_SESSION["AccountId"]
getILIASPage($html="")
Returns the ILIAS Page around a question.
global $DIC
Definition: goto.php:24
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
+ Here is the call graph for this function:

◆ populateCorrectionsFormProperties()

assOrderingHorizontalGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

Definition at line 530 of file class.assOrderingHorizontalGUI.php.

References ilPropertyFormGUI\addItem(), and ilNumberInputGUI\allowDecimals().

531  {
532  // points
533  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
534 
535  $points->allowDecimals(true);
536  $points->setValue($this->object->getPoints());
537  $points->setRequired(true);
538  $points->setSize(3);
539  $points->setMinValue(0.0);
540  $points->setMinvalueShouldBeGreater(true);
541  $form->addItem($points);
542  }
addItem($a_item)
Add Item (Property, SectionHeader).
allowDecimals($a_value)
Toggle Decimals.
This class represents a number property in a property form.
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assOrderingHorizontalGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 421 of file class.assOrderingHorizontalGUI.php.

References ilPropertyFormGUI\addItem(), ilNumberInputGUI\allowDecimals(), ilNumberInputGUI\setValue(), and ilTextAreaInputGUI\setValue().

Referenced by editQuestion().

422  {
423  // ordertext
424  $ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext");
425  $ordertext->setValue($this->object->prepareTextareaOutput($this->object->getOrderText()));
426  $ordertext->setRequired(true);
427  $ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->separator));
428  $ordertext->setRows(10);
429  $ordertext->setCols(80);
430  $form->addItem($ordertext);
431  // textsize
432  $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
433  $textsize->setValue($this->object->getTextSize());
434  $textsize->setInfo($this->lng->txt("textsize_info"));
435  $textsize->setSize(6);
436  $textsize->setMinValue(10);
437  $textsize->setRequired(false);
438  $form->addItem($textsize);
439  // points
440  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
441 
442  $points->allowDecimals(true);
443  // mbecker: Fix for mantis bug 7866: Predefined values schould make sense.
444  // This implements a default value of "1" for this question type.
445  if ($this->object->getPoints() == null) {
446  $points->setValue("1");
447  } else {
448  $points->setValue($this->object->getPoints());
449  }
450  $points->setRequired(true);
451  $points->setSize(3);
452  $points->setMinValue(0.0);
453  $points->setMinvalueShouldBeGreater(true);
454  $form->addItem($points);
455  }
setValue($a_value)
Set Value.
setValue($a_value)
Set Value.
allowDecimals($a_value)
Toggle Decimals.
This class represents a number property in a property form.
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderAggregateView()

assOrderingHorizontalGUI::renderAggregateView (   $aggregate)
Parameters
$aggregate
Returns
ilTemplate

Definition at line 492 of file class.assOrderingHorizontalGUI.php.

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

493  {
494  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
495 
496  foreach ($aggregate as $key => $line_data) {
497  $tpl->setCurrentBlock('aggregaterow');
498  $tpl->setVariable('COUNT', $line_data);
499  $tpl->setVariable('OPTION', $key);
500  $tpl->parseCurrentBlock();
501  }
502  return $tpl;
503  }
+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

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

Definition at line 547 of file class.assOrderingHorizontalGUI.php.

References ilPropertyFormGUI\getInput().

548  {
549  $this->object->setPoints((float) $form->getInput('points'));
550  }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ saveFeedback()

assOrderingHorizontalGUI::saveFeedback ( )

Saves the feedback for a single choice question.

public

Definition at line 348 of file class.assOrderingHorizontalGUI.php.

References $_POST, and $errors.

349  {
350  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
351  $errors = $this->feedback(true);
352  $this->object->saveFeedbackGeneric(0, $_POST["feedback_incomplete"]);
353  $this->object->saveFeedbackGeneric(1, $_POST["feedback_complete"]);
354  $this->object->cleanupMediaObjectUsage();
355  parent::saveFeedback();
356  }
$errors
Definition: imgupload.php:49
$_POST["username"]

◆ supportsIntermediateSolutionOutput()

assOrderingHorizontalGUI::supportsIntermediateSolutionOutput ( )

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

Returns
bool

Definition at line 114 of file class.assOrderingHorizontalGUI.php.

115  {
116  return true;
117  }

◆ writePostData()

assOrderingHorizontalGUI::writePostData (   $always = false)
protected

{}

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

References editQuestion(), assQuestionGUI\saveTaxonomyAssignments(), assQuestionGUI\writeQuestionGenericPostData(), and writeQuestionSpecificPostData().

52  {
53  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
54  if (!$hasErrors) {
55  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
58  $this->saveTaxonomyAssignments();
59  return 0;
60  }
61  return 1;
62  }
This class represents a property form user interface.
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assOrderingHorizontalGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

Extracts the question specific values from $_POST and applies them to the data object.

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiQuestionScoringAdjustable.

Definition at line 400 of file class.assOrderingHorizontalGUI.php.

References $_POST.

Referenced by writePostData().

401  {
402  $this->object->setTextSize($_POST["textsize"]);
403  $this->object->setOrderText($_POST["ordertext"]);
404  $this->object->setPoints($_POST["points"]);
405  }
$_POST["username"]
+ Here is the caller graph for this function:

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