ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 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)
 
 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 ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getOutputMode ()
 
 setOutputMode ($outputMode)
 
 isPdfOutputMode ()
 
 isContentEditingOutputMode ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
_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...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
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 OUTPUT_MODE_SCREEN = 'outModeScreen'
 
const OUTPUT_MODE_PDF = 'outModePdf'
 
const OUTPUT_MODE_CONTENT_EDITING = 'outModeUsrSol'
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 getPreviousSolutionProvidedMessage ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 isLastSolutionSubmitAuthorized ($active_id, $pass)
 fetches solutions from database and prefers intermediate solutions, but falls back to authorized solutions. More...
 
 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)
 
 getTestOutputSolutions ($activeId, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 

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$

assOrderingHorizontalGUI: ilObjQuestionPoolGUI

Definition at line 21 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 public

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

References assQuestionGUI\setErrorMessage().

32  {
33  parent::__construct();
34  include_once "./Modules/TestQuestionPool/classes/class.assOrderingHorizontal.php";
35  $this->object = new assOrderingHorizontal();
36  $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
37  if ($id >= 0)
38  {
39  $this->object->loadFromDb($id);
40  }
41  }
Class for horizontal ordering questions.
setErrorMessage($errormessage)
+ Here is the call graph for this function:

Member Function Documentation

◆ aggregateAnswers()

assOrderingHorizontalGUI::aggregateAnswers (   $relevant_answers_chosen,
  $answer_defined_on_question 
)

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

Referenced by getAggregatedAnswersView().

556  {
557  $aggregate = array();
558  foreach($relevant_answers_chosen as $answer)
559  {
560  $answer = str_replace($this->object->getAnswerSeparator(), '  -  ', $answer);
561  if (in_array($answer['value1'], $aggregate))
562  {
563  $aggregate[$answer['value1']] = $aggregate[$answer['value1']]+1;
564  }
565  else
566  {
567  $aggregate[$answer['value1']] = 1;
568  }
569  }
570 
571  return $aggregate;
572  }
+ 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 74 of file class.assOrderingHorizontalGUI.php.

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

Referenced by writePostData().

75  {
76  $save = $this->isSaveCommand();
77  $this->getQuestionTemplate();
78 
79  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
80  $form = new ilPropertyFormGUI();
81  $form->setFormAction($this->ctrl->getFormAction($this));
82  $form->setTitle($this->outQuestionType());
83  $form->setMultipart(FALSE);
84  $form->setTableWidth("100%");
85  $form->setId("orderinghorizontal");
86 
87  $this->addBasicQuestionFormProperties( $form );
88  $this->populateQuestionSpecificFormPart( $form );
89 
90 
91  $this->populateTaxonomyFormSection($form);
92 
93  $this->addQuestionFormCommandButtons($form);
94 
95  $errors = false;
96 
97  if ($save)
98  {
99  $form->setValuesByPost();
100  $errors = !$form->checkInput();
101  $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
102  if ($errors) $checkonly = false;
103  }
104 
105  if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
106  return $errors;
107  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
$errors
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 497 of file class.assOrderingHorizontalGUI.php.

498  {
499  return array();
500  }

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

References aggregateAnswers(), and renderAggregateView().

550  {
551  return $this->renderAggregateView(
552  $this->aggregateAnswers( $relevant_answers, $this->object->getOrderText() ) )->get();
553  }
aggregateAnswers($relevant_answers_chosen, $answer_defined_on_question)
+ Here is the call graph for this function:

◆ getCommand()

assOrderingHorizontalGUI::getCommand (   $cmd)

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

References $cmd.

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

◆ getPreview()

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

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

References assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), and ilUtil\prepareFormOutput().

264  {
265  if( is_object($this->getPreviewSession()) && strlen((string)$this->getPreviewSession()->getParticipantsSolution()) )
266  {
267  $elements = (string)$this->getPreviewSession()->getParticipantsSolution();
268  $elements = $this->object->splitAndTrimOrderElementText($elements, $this->object->getAnswerSeparator());
269  }
270  else
271  {
272  $elements = $this->object->getRandomOrderingElements();
273  }
274 
275  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_preview.html",TRUE, TRUE, "Modules/TestQuestionPool");
276  foreach ($elements as $id => $element)
277  {
278  $template->setCurrentBlock("element");
279  $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
280  $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
281  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
282  $template->parseCurrentBlock();
283  }
284  $template->setVariable("QUESTION_ID", $this->object->getId());
285  $template->setVariable("VALUE_ORDERRESULT", ' value="' . join($elements, '{::}') . '"');
286  if ($this->object->textsize >= 10) $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
287  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
288  $questionoutput = $template->get();
289  if (!$show_question_only)
290  {
291  // get page object output
292  $questionoutput = $this->getILIASPage($questionoutput);
293  }
294  $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
295  return $questionoutput;
296  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
+ 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 122 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\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), and ilUtil\prepareFormOutput().

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

◆ getSpecificFeedbackOutput()

assOrderingHorizontalGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

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

Referenced by getSolutionOutput().

452  {
453  if(strpos($this->object->getOrderText(),'::'))
454  {
455  $answers = explode('::', $this->object->getOrderText());
456  } else {
457  $answers = explode(' ', $this->object->getOrderText());
458  }
459 
460  if( !$this->object->feedbackOBJ->specificAnswerFeedbackExists(array_values($answers)) )
461  {
462  return '';
463  }
464 
465  $output = '<table class="test_specific_feedback"><tbody>';
466 
467  foreach($answers as $idx => $answer)
468  {
469  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
470  $this->object->getId(), $idx
471  );
472 
473  $output .= "<tr><td>{$answer}</td><td>{$feedback}</td></tr>";
474  }
475 
476  $output .= '</tbody></table>';
477 
478  return $this->object->prepareTextareaOutput($output, TRUE);
479  }
+ 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 299 of file class.assOrderingHorizontalGUI.php.

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

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

◆ populateQuestionSpecificFormPart()

assOrderingHorizontalGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

Referenced by editQuestion().

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

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

580  {
581  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
582 
583  foreach ($aggregate as $key => $line_data)
584  {
585  $tpl->setCurrentBlock( 'aggregaterow' );
586  $tpl->setVariable( 'COUNT', $line_data );
587  $tpl->setVariable( 'OPTION', $key );
588  $tpl->parseCurrentBlock();
589  }
590  return $tpl;
591  }
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ saveFeedback()

assOrderingHorizontalGUI::saveFeedback ( )

Saves the feedback for a single choice question.

public

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

References $_POST, and $errors.

360  {
361  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
362  $errors = $this->feedback(true);
363  $this->object->saveFeedbackGeneric(0, $_POST["feedback_incomplete"]);
364  $this->object->saveFeedbackGeneric(1, $_POST["feedback_complete"]);
365  $this->object->cleanupMediaObjectUsage();
366  parent::saveFeedback();
367  }
$_POST['username']
Definition: cron.php:12
$errors

◆ setQuestionTabs()

assOrderingHorizontalGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

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

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

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

◆ writePostData()

assOrderingHorizontalGUI::writePostData (   $always = false)

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

Parameters
bool$always
Returns
integer A positive value, if one of the required fields wasn't set, else 0

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

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

56  {
57  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
58  if (!$hasErrors)
59  {
60  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
63  $this->saveTaxonomyAssignments();
64  return 0;
65  }
66  return 1;
67  }
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
This class represents a property form user interface.
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 481 of file class.assOrderingHorizontalGUI.php.

References $_POST.

Referenced by writePostData().

482  {
483  $this->object->setTextSize( $_POST["textsize"] );
484  $this->object->setOrderText( $_POST["ordertext"] );
485  $this->object->setPoints( $_POST["points"] );
486  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

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