ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 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 ($active_id, $pass)
 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)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilTemplate $tpl)
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
- 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)
 
 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
 

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 {
40 $this->object->loadFromDb($id);
41 }
42 }
Class for horizontal ordering questions.
setErrorMessage($errormessage)

References 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 554 of file class.assOrderingHorizontalGUI.php.

555 {
556 $aggregate = array();
557 foreach($relevant_answers_chosen as $answer)
558 {
559 $answer = str_replace($this->object->getAnswerSeparator(), '  -  ', $answer);
560 if (in_array($answer['value1'], $aggregate))
561 {
562 $aggregate[$answer['value1']] = $aggregate[$answer['value1']]+1;
563 }
564 else
565 {
566 $aggregate[$answer['value1']] = 1;
567 }
568 }
569
570 return $aggregate;
571 }

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

72 {
73 $save = $this->isSaveCommand();
74 $this->getQuestionTemplate();
75
76 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
77 $form = new ilPropertyFormGUI();
78 $this->editForm = $form;
79
80 $form->setFormAction($this->ctrl->getFormAction($this));
81 $form->setTitle($this->outQuestionType());
82 $form->setMultipart(FALSE);
83 $form->setTableWidth("100%");
84 $form->setId("orderinghorizontal");
85
86 $this->addBasicQuestionFormProperties( $form );
88
89
90 $this->populateTaxonomyFormSection($form);
91
93
94 $errors = false;
95
96 if ($save)
97 {
98 $form->setValuesByPost();
99 $errors = !$form->checkInput();
100 $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
101 if ($errors) $checkonly = false;
102 }
103
104 if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
105 return $errors;
106 }
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

References $errors, 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 496 of file class.assOrderingHorizontalGUI.php.

497 {
498 return array();
499 }

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

549 {
550 return $this->renderAggregateView(
551 $this->aggregateAnswers( $relevant_answers, $this->object->getOrderText() ) )->get();
552 }
aggregateAnswers($relevant_answers_chosen, $answer_defined_on_question)

References aggregateAnswers(), and renderAggregateView().

+ Here is the call graph for this function:

◆ getCommand()

assOrderingHorizontalGUI::getCommand (   $cmd)

Reimplemented from assQuestionGUI.

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

45 {
46 return $cmd;
47 }
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

263 {
264 if( is_object($this->getPreviewSession()) && strlen((string)$this->getPreviewSession()->getParticipantsSolution()) )
265 {
266 $elements = (string)$this->getPreviewSession()->getParticipantsSolution();
267 $elements = $this->object->splitAndTrimOrderElementText($elements, $this->object->getAnswerSeparator());
268 }
269 else
270 {
271 $elements = $this->object->getRandomOrderingElements();
272 }
273
274 $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_preview.html",TRUE, TRUE, "Modules/TestQuestionPool");
275 foreach ($elements as $id => $element)
276 {
277 $template->setCurrentBlock("element");
278 $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
279 $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
280 $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
281 $template->parseCurrentBlock();
282 }
283 $template->setVariable("QUESTION_ID", $this->object->getId());
284 $template->setVariable("VALUE_ORDERRESULT", ' value="' . join($elements, '{::}') . '"');
285 if ($this->object->textsize >= 10) $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
286 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
287 $questionoutput = $template->get();
288 if (!$show_question_only)
289 {
290 // get page object output
291 $questionoutput = $this->getILIASPage($questionoutput);
292 }
293 $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
294 return $questionoutput;
295 }
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

References 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 121 of file class.assOrderingHorizontalGUI.php.

132 {
133 // get the solution of the user for the active pass or from the last pass if allowed
134 $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
135
136 //$solutionvalue = "";
137 if (($active_id > 0) && (!$show_correct_solution))
138 {
139 $solutions =& $this->object->getSolutionValues($active_id, $pass);
140 if (strlen($solutions[0]["value1"]))
141 {
142 $elements = explode("{::}", $solutions[0]["value1"]);
143 }
144
145 if( !count($elements) )
146 {
147 $elements = $this->object->getRandomOrderingElements();
148 }
149
150 foreach ($elements as $id => $element)
151 {
152 $template->setCurrentBlock("element");
153 $template->setVariable("ELEMENT_ID", "sol_e_" . $this->object->getId() . "_$id");
154 $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
155 $template->parseCurrentBlock();
156 }
157
158 //$solutionvalue = str_replace("{::}", " ", $solutions[0]["value1"]);
159 }
160 else
161 {
162 $elements = $this->object->getOrderingElements();
163 foreach ($elements as $id => $element)
164 {
165 $template->setCurrentBlock("element");
166 $template->setVariable("ELEMENT_ID", "sol_e_" . $this->object->getId() . "_$id");
167 $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
168 $template->parseCurrentBlock();
169 }
170 //$solutionvalue = join($this->object->getOrderingElements(), " ");
171 }
172
173 if (($active_id > 0) && (!$show_correct_solution))
174 {
175 if($this->object->getStep() === NULL)
176 {
177 $reached_points = $this->object->getReachedPoints($active_id, $pass);
178 }
179 else
180 {
181 $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
182 }
183 if ($graphicalOutput)
184 {
185 // output of ok/not ok icons for user entered solutions
186 if ($reached_points == $this->object->getMaximumPoints())
187 {
188 $template->setCurrentBlock("icon_ok");
189 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
190 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
191 $template->parseCurrentBlock();
192 }
193 else
194 {
195 $template->setCurrentBlock("icon_ok");
196 if ($reached_points > 0)
197 {
198 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
199 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
200 }
201 else
202 {
203 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
204 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
205 }
206 $template->parseCurrentBlock();
207 }
208 }
209 }
210 else
211 {
212 $reached_points = $this->object->getPoints();
213 }
214
215 if ($result_output)
216 {
217 $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
218 $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
219 }
220 if($show_question_text==true)
221 {
222 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
223 }
224// $template->setVariable("SOLUTION_TEXT", ilUtil::prepareFormOutput($solutionvalue));
225 if ($this->object->textsize >= 10) $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
226
227 $questionoutput = $template->get();
228 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
229 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
230
231
232 $feedback = '';
233 if($show_feedback)
234 {
235 if( !$this->isTestPresentationContext() )
236 {
237 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
238 $feedback .= strlen($fb) ? $fb : '';
239 }
240
241 $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
242 $feedback .= strlen($fb) ? $fb : '';
243 }
244 if (strlen($feedback))
245 {
246 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
248 );
249
250 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
251 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
252 }
253 $solutionoutput = $solutiontemplate->get();
254 if (!$show_question_only)
255 {
256 // get page object output
257 $solutionoutput = $this->getILIASPage($solutionoutput);
258 }
259 return $solutionoutput;
260 }
sprintf('%.4f', $callTime)
getSpecificFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
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 $pass, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getSpecificFeedbackOutput(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), ilUtil\prepareFormOutput(), and sprintf.

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assOrderingHorizontalGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

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

451 {
452 if(strpos($this->object->getOrderText(),'::'))
453 {
454 $answers = explode('::', $this->object->getOrderText());
455 } else {
456 $answers = explode(' ', $this->object->getOrderText());
457 }
458
459 if( !$this->object->feedbackOBJ->specificAnswerFeedbackExists(array_values($answers)) )
460 {
461 return '';
462 }
463
464 $output = '<table class="test_specific_feedback"><tbody>';
465
466 foreach($answers as $idx => $answer)
467 {
468 $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
469 $this->object->getId(), $idx
470 );
471
472 $output .= "<tr><td>{$answer}</td><td>{$feedback}</td></tr>";
473 }
474
475 $output .= '</tbody></table>';
476
477 return $this->object->prepareTextareaOutput($output, TRUE);
478 }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output

References $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 298 of file class.assOrderingHorizontalGUI.php.

300 {
301 // generate the question output
302 $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
303 $elements = $this->object->getRandomOrderingElements();
304
305 if ($active_id)
306 {
307 // hey: prevPassSolutions - obsolete due to central check
308 #$solutions = NULL;
309 #include_once "./Modules/Test/classes/class.ilObjTest.php";
310 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
311 #{
312 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
313 #}
314 $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
315 // hey.
316 if (count($solutions) == 1)
317 {
318 $elements = explode("{::}", $solutions[0]["value1"]);
319 }
320 }
321 if (count($solutions) == 0)
322 {
323 $_SESSION['qst_ordering_horizontal_elements'] = $elements;
324 }
325 else
326 {
327 unset($_SESSION['qst_ordering_horizontal_elements']);
328 }
329 foreach ($elements as $id => $element)
330 {
331 $template->setCurrentBlock("element");
332 $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
333 $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
334 $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
335 $template->parseCurrentBlock();
336 }
337 $template->setVariable("QUESTION_ID", $this->object->getId());
338 if ($this->object->textsize >= 10) $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
339 $template->setVariable("VALUE_ORDERRESULT", ' value="' . join($elements, '{::}') . '"');
340 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
341 $questionoutput = $template->get();
342 if (!$show_question_only)
343 {
344 // get page object output
345 $questionoutput = $this->getILIASPage($questionoutput);
346 }
347 $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
348 $questionoutput = $template->get();
349 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
350 return $pageoutput;
351 }
$_SESSION["AccountId"]
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page

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

+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assOrderingHorizontalGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

References ilPropertyFormGUI\addItem(), and sprintf.

Referenced by editQuestion().

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

579 {
580 $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
581
582 foreach ($aggregate as $key => $line_data)
583 {
584 $tpl->setCurrentBlock( 'aggregaterow' );
585 $tpl->setVariable( 'COUNT', $line_data );
586 $tpl->setVariable( 'OPTION', $key );
587 $tpl->parseCurrentBlock();
588 }
589 return $tpl;
590 }

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

+ Here is the caller graph for this function:

◆ saveFeedback()

assOrderingHorizontalGUI::saveFeedback ( )

Saves the feedback for a single choice question.

@access public

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

359 {
360 include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
361 $errors = $this->feedback(true);
362 $this->object->saveFeedbackGeneric(0, $_POST["feedback_incomplete"]);
363 $this->object->saveFeedbackGeneric(1, $_POST["feedback_complete"]);
364 $this->object->cleanupMediaObjectUsage();
365 parent::saveFeedback();
366 }
$_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 375 of file class.assOrderingHorizontalGUI.php.

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

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

+ Here is the call graph for this function:

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

53 {
54 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
55 if (!$hasErrors)
56 {
57 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
61 return 0;
62 }
63 return 1;
64 }
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.

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

481 {
482 $this->object->setTextSize( $_POST["textsize"] );
483 $this->object->setOrderText( $_POST["ordertext"] );
484 $this->object->setPoints( $_POST["points"] );
485 }

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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