ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($userSolution)
 Returns the answer specific feedback for the question. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 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...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilTemplate $tpl)
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 isAutosaveable ()
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=false, $user_post_solutions=false, $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 

Protected Member Functions

 writePostData ($always=false)
 {Evaluates a posted edit form and writes the form data in the question object.
Returns
integer A positive value, if one of the required fields wasn't set, else 0
} More...
 
- 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 ()
 

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
 
 $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
 $editForm
 
 $use_intermediate_solution = false
 

Detailed Description

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

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

@ilctrl_iscalledby assOrderingHorizontalGUI: ilObjQuestionPoolGUI @ilCtrl_Calls assOrderingHorizontalGUI: ilPropertyFormGUI, ilFormPropertyDispatchGUI

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

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 @access public

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

33 {
34 parent::__construct();
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 }
Class for horizontal ordering questions.
setErrorMessage($errormessage)
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id, and assQuestionGUI\setErrorMessage().

+ Here is the call graph for this function:

Member Function Documentation

◆ aggregateAnswers()

assOrderingHorizontalGUI::aggregateAnswers (   $relevant_answers_chosen,
  $answer_defined_on_question 
)

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

547 {
548 $aggregate = array();
549 foreach ($relevant_answers_chosen as $answer) {
550 $answer = str_replace($this->object->getAnswerSeparator(), '  -  ', $answer);
551 if (in_array($answer['value1'], $aggregate)) {
552 $aggregate[$answer['value1']] = $aggregate[$answer['value1']] + 1;
553 } else {
554 $aggregate[$answer['value1']] = 1;
555 }
556 }
557
558 return $aggregate;
559 }

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ editQuestion()

assOrderingHorizontalGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

@access public

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

70 {
71 $save = $this->isSaveCommand();
72 $this->getQuestionTemplate();
73
74 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
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
86
87
89
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 }
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getQuestionTemplate()
get question template
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
This class represents a property form user interface.
$errors
Definition: index.php:6
if(isset($_POST['submit'])) $form

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

Referenced by writePostData().

+ 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 490 of file class.assOrderingHorizontalGUI.php.

491 {
492 return array();
493 }

◆ 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 539 of file class.assOrderingHorizontalGUI.php.

540 {
541 return $this->renderAggregateView(
542 $this->aggregateAnswers($relevant_answers, $this->object->getOrderText())
543 )->get();
544 }
aggregateAnswers($relevant_answers_chosen, $answer_defined_on_question)

References aggregateAnswers(), and renderAggregateView().

+ Here is the call graph for this function:

◆ getAnswersFrequency()

assOrderingHorizontalGUI::getAnswersFrequency (   $relevantAnswers,
  $questionIndex 
)

Reimplemented from assQuestionGUI.

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

580 {
581 $answers = array();
582
583 foreach ($relevantAnswers as $ans) {
584 $md5 = md5($ans['value1']);
585
586 if (!isset($answers[$md5])) {
587 $answer = str_replace(
588 $this->object->getAnswerSeparator(),
589 '  -  ',
590 $ans['value1']
591 );
592
593 $answers[$md5] = array(
594 'answer' => $answer, 'frequency' => 0
595 );
596 }
597
598 $answers[$md5]['frequency']++;
599 }
600
601 return $answers;
602 }

◆ getCommand()

assOrderingHorizontalGUI::getCommand (   $cmd)

Reimplemented from assQuestionGUI.

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

44 {
45 return $cmd;
46 }

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

251 {
252 if (is_object($this->getPreviewSession()) && strlen((string) $this->getPreviewSession()->getParticipantsSolution())) {
253 $elements = (string) $this->getPreviewSession()->getParticipantsSolution();
254 $elements = $this->object->splitAndTrimOrderElementText($elements, $this->object->getAnswerSeparator());
255 } else {
256 $elements = $this->object->getRandomOrderingElements();
257 }
258
259 $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_preview.html", true, true, "Modules/TestQuestionPool");
260 foreach ($elements as $id => $element) {
261 $template->setCurrentBlock("element");
262 $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
263 $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
264 $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
265 $template->parseCurrentBlock();
266 }
267 $template->setVariable("QUESTION_ID", $this->object->getId());
268 $template->setVariable("VALUE_ORDERRESULT", ' value="' . join('{::}', $elements) . '"');
269 if ($this->object->textsize >= 10) {
270 $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
271 }
272 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
273 $questionoutput = $template->get();
274 if (!$show_question_only) {
275 // get page object output
276 $questionoutput = $this->getILIASPage($questionoutput);
277 }
278 global $DIC; /* @var ILIAS\DI\Container $DIC */
279 if ($DIC['ilBrowser']->isMobile() || $DIC['ilBrowser']->isIpad()) {
280 $this->tpl->addJavaScript('./libs/bower/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.min.js');
281 }
282 $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
283 return $questionoutput;
284 }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
$template
global $DIC
Definition: saml.php:7

References $DIC, $id, $template, assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), and ilUtil\prepareFormOutput().

+ 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

Reimplemented from assQuestionGUI.

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

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

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

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assOrderingHorizontalGUI::getSpecificFeedbackOutput (   $userSolution)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
array$userSolution($userSolution[<value1>] = <value2>)
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

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

446 {
447 if (strpos($this->object->getOrderText(), '::')) {
448 $answers = explode('::', $this->object->getOrderText());
449 } else {
450 $answers = explode(' ', $this->object->getOrderText());
451 }
452
453 if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists()) {
454 return '';
455 }
456
457 $output = '<table class="test_specific_feedback"><tbody>';
458
459 foreach ($answers as $idx => $answer) {
460 $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
461 $this->object->getId(),
462 0,
463 $idx
464 );
465
466 $output .= "<tr><td>{$answer}</td><td>{$feedback}</td></tr>";
467 }
468
469 $output .= '</tbody></table>';
470
471 return $this->object->prepareTextareaOutput($output, true);
472 }

References Sabre\VObject\$output.

Referenced by getSolutionOutput().

+ Here is the caller graph for this function:

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

289 {
290 // generate the question output
291 $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output.html", true, true, "Modules/TestQuestionPool");
292 $elements = $this->object->getRandomOrderingElements();
293
294 if ($active_id) {
295 // hey: prevPassSolutions - obsolete due to central check
296 #$solutions = NULL;
297 #include_once "./Modules/Test/classes/class.ilObjTest.php";
298 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
299 #{
300 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
301 #}
302 $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
303 // hey.
304 if (is_array($solutions) && count($solutions) == 1) {
305 $elements = explode("{::}", $solutions[0]["value1"]);
306 }
307 }
308 if (!is_array($solutions) || count($solutions) == 0) {
309 $_SESSION['qst_ordering_horizontal_elements'] = $elements;
310 } else {
311 unset($_SESSION['qst_ordering_horizontal_elements']);
312 }
313 foreach ($elements as $id => $element) {
314 $template->setCurrentBlock("element");
315 $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
316 $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
317 $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
318 $template->parseCurrentBlock();
319 }
320 $template->setVariable("QUESTION_ID", $this->object->getId());
321 if ($this->object->textsize >= 10) {
322 $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
323 }
324 $template->setVariable("VALUE_ORDERRESULT", ' value="' . join('{::}', $elements) . '"');
325 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
326 $questionoutput = $template->get();
327 if (!$show_question_only) {
328 // get page object output
329 $questionoutput = $this->getILIASPage($questionoutput);
330 }
331 global $DIC; /* @var ILIAS\DI\Container $DIC */
332 if ($DIC['ilBrowser']->isMobile() || $DIC['ilBrowser']->isIpad()) {
333 $this->tpl->addJavaScript('./libs/bower/bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.min.js');
334 }
335 $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
336 $questionoutput = $template->get();
337 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
338 return $pageoutput;
339 }
$_SESSION["AccountId"]
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page

References $_SESSION, $DIC, $id, $pass, $template, assQuestionGUI\getILIASPage(), assQuestionGUI\outQuestionPage(), and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ populateCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

605 {
606 // points
607 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
608
609 $points->allowDecimals(true);
610 $points->setValue($this->object->getPoints());
611 $points->setRequired(true);
612 $points->setSize(3);
613 $points->setMinValue(0.0);
614 $points->setMinvalueShouldBeGreater(true);
615 $form->addItem($points);
616 }
This class represents a number property in a property form.

References $form.

◆ populateQuestionSpecificFormPart()

assOrderingHorizontalGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

496 {
497 // ordertext
498 $ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext");
499 $ordertext->setValue($this->object->prepareTextareaOutput($this->object->getOrderText()));
500 $ordertext->setRequired(true);
501 $ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->separator));
502 $ordertext->setRows(10);
503 $ordertext->setCols(80);
504 $form->addItem($ordertext);
505 // textsize
506 $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
507 $textsize->setValue($this->object->getTextSize());
508 $textsize->setInfo($this->lng->txt("textsize_info"));
509 $textsize->setSize(6);
510 $textsize->setMinValue(10);
511 $textsize->setRequired(false);
512 $form->addItem($textsize);
513 // points
514 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
515
516 $points->allowDecimals(true);
517 // mbecker: Fix for mantis bug 7866: Predefined values schould make sense.
518 // This implements a default value of "1" for this question type.
519 if ($this->object->getPoints() == null) {
520 $points->setValue("1");
521 } else {
522 $points->setValue($this->object->getPoints());
523 }
524 $points->setRequired(true);
525 $points->setSize(3);
526 $points->setMinValue(0.0);
527 $points->setMinvalueShouldBeGreater(true);
528 $form->addItem($points);
529 }
This class represents a text area property in a property form.

References $form.

Referenced by editQuestion().

+ Here is the caller graph for this function:

◆ renderAggregateView()

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

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

567 {
568 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
569
570 foreach ($aggregate as $key => $line_data) {
571 $tpl->setCurrentBlock('aggregaterow');
572 $tpl->setVariable('COUNT', $line_data);
573 $tpl->setVariable('OPTION', $key);
574 $tpl->parseCurrentBlock();
575 }
576 return $tpl;
577 }
$key
Definition: croninfo.php:18

References $key, and assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ saveCorrectionsFormProperties()

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

Reimplemented from assQuestionGUI.

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

622 {
623 $this->object->setPoints((float) $form->getInput('points'));
624 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ saveFeedback()

assOrderingHorizontalGUI::saveFeedback ( )

Saves the feedback for a single choice question.

@access public

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

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

References $_POST, and $errors.

◆ setQuestionTabs()

assOrderingHorizontalGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

@access public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Reimplemented from assQuestionGUI.

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

364 {
365 global $DIC;
366 $rbacsystem = $DIC['rbacsystem'];
367 $ilTabs = $DIC['ilTabs'];
368
369 $ilTabs->clearTargets();
370
371 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
372 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
373 $q_type = $this->object->getQuestionType();
374
375 if (strlen($q_type)) {
376 $classname = $q_type . "GUI";
377 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
378 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
379 }
380
381 if ($_GET["q_id"]) {
382 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
383 // edit page
384 $ilTabs->addTarget(
385 "edit_page",
386 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
387 array("edit", "insert", "exec_pg"),
388 "",
389 "",
390 $force_active
391 );
392 }
393
394 $this->addTab_QuestionPreview($ilTabs);
395 }
396
397 $force_active = false;
398 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
399 $url = "";
400 if ($classname) {
401 $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
402 }
403 $commands = $_POST["cmd"];
404 if (is_array($commands)) {
405 foreach ($commands as $key => $value) {
406 if (preg_match("/^suggestrange_.*/", $key, $matches)) {
407 $force_active = true;
408 }
409 }
410 }
411 // edit question properties
412 $ilTabs->addTarget(
413 "edit_question",
414 $url,
415 array("editQuestion", "save", "saveEdit", "originalSyncForm"),
416 $classname,
417 "",
418 $force_active
419 );
420 }
421
422 // add tab for question feedback within common class assQuestionGUI
423 $this->addTab_QuestionFeedback($ilTabs);
424
425 // add tab for question hint within common class assQuestionGUI
426 $this->addTab_QuestionHints($ilTabs);
427
428 // add tab for question's suggested solution within common class assQuestionGUI
429 $this->addTab_SuggestedSolution($ilTabs, $classname);
430
431 // Assessment of questions sub menu entry
432 if ($_GET["q_id"]) {
433 $ilTabs->addTarget(
434 "statistics",
435 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
436 array("assessment"),
437 $classname,
438 ""
439 );
440 }
441
442 $this->addBackTab($ilTabs);
443 }
$_GET["client_id"]
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addBackTab(ilTabsGUI $ilTabs)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
$url

References $_GET, $_POST, $DIC, $key, $url, assQuestionGUI\addBackTab(), assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), assQuestionGUI\addTab_QuestionPreview(), and assQuestionGUI\addTab_SuggestedSolution().

+ Here is the call graph for this function:

◆ supportsIntermediateSolutionOutput()

assOrderingHorizontalGUI::supportsIntermediateSolutionOutput ( )

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

Returns
bool

Reimplemented from assQuestionGUI.

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

115 {
116 return true;
117 }

◆ writePostData()

assOrderingHorizontalGUI::writePostData (   $always = false)
protected

{Evaluates a posted edit form and writes the form data in the question object.

Returns
integer A positive value, if one of the required fields wasn't set, else 0
}

Reimplemented from assQuestionGUI.

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

52 {
53 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
54 if (!$hasErrors) {
55 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
59 return 0;
60 }
61 return 1;
62 }
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.

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

+ 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 474 of file class.assOrderingHorizontalGUI.php.

475 {
476 $this->object->setTextSize($_POST["textsize"]);
477 $this->object->setOrderText($_POST["ordertext"]);
478 $this->object->setPoints($_POST["points"]);
479 }

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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