ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
assOrderingHorizontalGUI Class Reference

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

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

Public Member Functions

 __construct ($id=-1)
 assOrderingHorizontalGUI constructor More...
 
 getCommand ($cmd)
 
 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...
 
 outQuestionForTest ($formaction, $active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
 
 getSolutionOutput ( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
 Get the question solution output. More...
 
 getPreview ($show_question_only=FALSE)
 
 getTestOutput ($active_id, $pass=NULL, $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 ($always=true)
 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...
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui (ilTestPlayerAbstractGUI $linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 assessment ()
 output assessment More...
 
_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...
 
 getSelfAssessmentTags ()
 Get tags allowed in question tags in self assessment mode. 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...
 
 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 ()
 
 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 ()
 
 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'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
- Protected Member Functions inherited from assQuestionGUI
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 writeQuestionGenericPostData ()
 

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

Referenced by getAggregatedAnswersView().

590  {
591  $aggregate = array();
592  foreach($relevant_answers_chosen as $answer)
593  {
594  $answer = str_replace($this->object->getAnswerSeparator(), '  -  ', $answer);
595  if (in_array($answer['value1'], $aggregate))
596  {
597  $aggregate[$answer['value1']] = $aggregate[$answer['value1']]+1;
598  }
599  else
600  {
601  $aggregate[$answer['value1']] = 1;
602  }
603  }
604 
605  return $aggregate;
606  }
+ 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 73 of file class.assOrderingHorizontalGUI.php.

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

Referenced by writePostData().

74  {
75  $save = $this->isSaveCommand();
76  $this->getQuestionTemplate();
77 
78  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
79  $form = new ilPropertyFormGUI();
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 );
87  $this->populateQuestionSpecificFormPart( $form );
88 
89 
90  $this->populateTaxonomyFormSection($form);
91 
92  $this->addQuestionFormCommandButtons($form);
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  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
$errors
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionQuestionPostVars()

assOrderingHorizontalGUI::getAfterParticipationSuppressionQuestionPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiQuestionScoringAdjustable.

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

508  {
509  return array('ordertext', 'textsize');
510  }

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

References $pass, assQuestionGUI\$tpl, aggregateAnswers(), and renderAggregateView().

560  {
561  $passes = array();
562  foreach($relevant_answers as $pass)
563  {
564  $passes[$pass['active_fi'].'-'.$pass['pass']] = '-';
565  }
566  $passcount = count($passes);
567 
568  foreach($relevant_answers as $pass)
569  {
570  $actives[$pass['active_fi']] = $pass['active_fi'];
571  }
572  $usercount = count($actives);
573  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_header.html', true, true, "Modules/TestQuestionPool");
574  $tpl->setVariable('HEADERTEXT', $this->lng->txt('overview'));
575  $tpl->setVariable('NUMBER_OF_USERS_INFO', $this->lng->txt('number_of_users'));
576  $tpl->setVariable('NUMBER_OF_USERS', $usercount);
577  $tpl->setVariable('NUMBER_OF_PASSES_INFO', $this->lng->txt('number_of_passes'));
578  $tpl->setVariable('NUMBER_OF_PASSES', $passcount);
579 
580  $header = $tpl->get();
581 
582  $variants = $this->renderAggregateView(
583  $this->aggregateAnswers($relevant_answers, $this->object->getOrderText())
584  )->get();
585 
586  return $header . $variants ;
587  }
special template class to simplify handling of ITX/PEAR
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)

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

References assQuestionGUI\getILIASPage(), ilYuiUtil\initDragDropAnimation(), and ilUtil\prepareFormOutput().

245  {
246  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_preview.html",TRUE, TRUE, "Modules/TestQuestionPool");
247  $elements = $this->object->getRandomOrderingElements();
248  foreach ($elements as $id => $element)
249  {
250  $template->setCurrentBlock("element");
251  $template->setVariable("ELEMENT_ID", "e$id");
252  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
253 
254  $template->parseCurrentBlock();
255  }
256  if ($this->object->textsize >= 10) echo $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
257  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
258  $questionoutput = $template->get();
259  if (!$show_question_only)
260  {
261  // get page object output
262  $questionoutput = $this->getILIASPage($questionoutput);
263  }
264  include_once "./Services/YUI/classes/class.ilYuiUtil.php";
266  $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
267  return $questionoutput;
268  }
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
static initDragDropAnimation()
init drag & drop and animation
+ 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 128 of file class.assOrderingHorizontalGUI.php.

References $pass, assQuestionGUI\getGenericFeedbackOutput(), ilUtil\getImagePath(), getSpecificFeedbackOutput(), and ilUtil\prepareFormOutput().

139  {
140  // get the solution of the user for the active pass or from the last pass if allowed
141  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
142 
143  $solutionvalue = "";
144  if (($active_id > 0) && (!$show_correct_solution))
145  {
146  $solutions =& $this->object->getSolutionValues($active_id, $pass);
147  if (strlen($solutions[0]["value1"]))
148  {
149  $elements = split("{::}", $solutions[0]["value1"]);
150  foreach ($elements as $id => $element)
151  {
152  $template->setCurrentBlock("element");
153  $template->setVariable("ELEMENT_ID", "e$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", "e$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  $reached_points = $this->object->getReachedPoints($active_id, $pass);
176  if ($graphicalOutput)
177  {
178  // output of ok/not ok icons for user entered solutions
179  if ($reached_points == $this->object->getMaximumPoints())
180  {
181  $template->setCurrentBlock("icon_ok");
182  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.png"));
183  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
184  $template->parseCurrentBlock();
185  }
186  else
187  {
188  $template->setCurrentBlock("icon_ok");
189  if ($reached_points > 0)
190  {
191  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.png"));
192  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
193  }
194  else
195  {
196  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.png"));
197  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
198  }
199  $template->parseCurrentBlock();
200  }
201  }
202  }
203  else
204  {
205  $reached_points = $this->object->getPoints();
206  }
207 
208  if ($result_output)
209  {
210  $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
211  $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
212  }
213  if($show_question_text==true)
214  {
215  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
216  }
217 // $template->setVariable("SOLUTION_TEXT", ilUtil::prepareFormOutput($solutionvalue));
218  if ($this->object->textsize >= 10) echo $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
219 
220  $questionoutput = $template->get();
221  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
222  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
223 
224 
225  $feedback = '';
226  if($show_feedback)
227  {
228  $fb = $this->getGenericFeedbackOutput($active_id, $pass);
229  $feedback .= strlen($fb) ? $fb : '';
230 
231  $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
232  $feedback .= strlen($fb) ? $fb : '';
233  }
234  if (strlen($feedback)) $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
235  $solutionoutput = $solutiontemplate->get();
236  if (!$show_question_only)
237  {
238  // get page object output
239  $solutionoutput = '<div class="ilc_question_Standard">'.$solutionoutput. $feedback."</div>" ;
240  }
241  return $solutionoutput;
242  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
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 466 of file class.assOrderingHorizontalGUI.php.

Referenced by getSolutionOutput().

467  {
468  $output = '<table class="ilTstSpecificFeedbackTable"><tbody>';
469 
470  if(strpos($this->object->getOrderText(),'::'))
471  {
472  $answers = explode('::', $this->object->getOrderText());
473  } else {
474  $answers = explode(' ', $this->object->getOrderText());
475  }
476 
477  foreach($answers as $idx => $answer)
478  {
479  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
480  $this->object->getId(), $idx
481  );
482 
483  $output .= "<tr><td><b><i>{$answer}</i></b></td><td>{$feedback}</td></tr>";
484  }
485 
486  $output .= '</tbody></table>';
487 
488  return $this->object->prepareTextareaOutput($output, TRUE);
489  }
+ Here is the caller graph for this function:

◆ getTestOutput()

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

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

References $_SESSION, $pass, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), ilYuiUtil\initDragDropAnimation(), assQuestionGUI\outQuestionPage(), and ilUtil\prepareFormOutput().

Referenced by outQuestionForTest().

271  {
272  // generate the question output
273  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
274  $elements = $this->object->getRandomOrderingElements();
275 
276  if ($active_id)
277  {
278  $solutions = NULL;
279  include_once "./Modules/Test/classes/class.ilObjTest.php";
280  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
281  {
282  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
283  }
284  $solutions =& $this->object->getSolutionValues($active_id, $pass);
285  if (count($solutions) == 1)
286  {
287  $elements = split("{::}", $solutions[0]["value1"]);
288  }
289  }
290  if (strlen($_SESSION['qst_selection']))
291  {
292  $this->object->moveRight($_SESSION['qst_selection'], $active_id, $pass);
293  unset($_SESSION['qst_selection']);
294  $solutions =& $this->object->getSolutionValues($active_id, $pass);
295  if (count($solutions) == 1)
296  {
297  $elements = split("{::}", $solutions[0]["value1"]);
298  }
299  }
300  if (count($solutions) == 0)
301  {
302  $_SESSION['qst_ordering_horizontal_elements'] = $elements;
303  }
304  else
305  {
306  unset($_SESSION['qst_ordering_horizontal_elements']);
307  }
308  $idx = 0;
309  foreach ($elements as $id => $element)
310  {
311  $template->setCurrentBlock("element");
312  $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
313  $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
314  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
315  $this->ctrl->setParameterByClass('iltestoutputgui', 'qst_selection', $idx);
316  $idx++;
317  $url = $this->ctrl->getLinkTargetByClass('iltestoutputgui', 'gotoQuestion');
318  $template->setVariable("MOVE_RIGHT", $url);
319  $template->setVariable("TEXT_MOVE_RIGHT", $this->lng->txt('move_right'));
320  $template->setVariable("RIGHT_IMAGE", ilUtil::getImagePath('nav_arr_R.png'));
321  $template->parseCurrentBlock();
322  }
323  if ($this->object->textsize >= 10) echo $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
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  {
329  // get page object output
330  $questionoutput = $this->getILIASPage($questionoutput);
331  }
332  include_once "./Services/YUI/classes/class.ilYuiUtil.php";
334  $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
335  $questionoutput = $template->get();
336  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
337  return $pageoutput;
338  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
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
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
static initDragDropAnimation()
init drag & drop and animation
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outQuestionForTest()

assOrderingHorizontalGUI::outQuestionForTest (   $formaction,
  $active_id,
  $pass = NULL,
  $is_postponed = FALSE,
  $use_post_solutions = FALSE,
  $show_feedback = FALSE 
)

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

References $pass, and getTestOutput().

109  {
110  $test_output = $this->getTestOutput($active_id, $pass, $is_postponed, $use_post_solutions, $show_feedback);
111  $this->tpl->setVariable("QUESTION_OUTPUT", $test_output);
112  $this->tpl->setVariable("FORMACTION", $formaction);
113  }
getTestOutput($active_id, $pass=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assOrderingHorizontalGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

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

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

Referenced by editQuestion().

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

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

614  {
615  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
616  $tpl->setVariable( 'OPTION_HEADER', $this->lng->txt( 'answer_variant' ) );
617  $tpl->setVariable( 'COUNT_HEADER', $this->lng->txt( 'count' ) );
618  $tpl->setVariable( 'AGGREGATION_HEADER', $this->lng->txt( 'aggregated_answers_variants' ) );
619  foreach ($aggregate as $key => $line_data)
620  {
621  $tpl->setCurrentBlock( 'aggregaterow' );
622  $tpl->setVariable( 'COUNT', $line_data );
623  $tpl->setVariable( 'OPTION', $key );
624  $tpl->parseCurrentBlock();
625  }
626  return $tpl;
627  }
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 345 of file class.assOrderingHorizontalGUI.php.

References $_POST, and $errors.

346  {
347  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
348  $errors = $this->feedback(true);
349  $this->object->saveFeedbackGeneric(0, $_POST["feedback_incomplete"]);
350  $this->object->saveFeedbackGeneric(1, $_POST["feedback_complete"]);
351  $this->object->cleanupMediaObjectUsage();
352  parent::saveFeedback();
353  }
$_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 362 of file class.assOrderingHorizontalGUI.php.

References $_GET, $_POST, $ref_id, assQuestionGUI\addTab_QuestionFeedback(), assQuestionGUI\addTab_QuestionHints(), and ilTestExpressPage\getReturnToPageLink().

363  {
364  global $rbacsystem, $ilTabs;
365 
366  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
367  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
368  $q_type = $this->object->getQuestionType();
369 
370  if (strlen($q_type))
371  {
372  $classname = $q_type . "GUI";
373  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
374  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
375  }
376 
377  if ($_GET["q_id"])
378  {
379  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
380  {
381  // edit page
382  $ilTabs->addTarget("edit_page",
383  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
384  array("edit", "insert", "exec_pg"),
385  "", "", $force_active);
386  }
387 
388  // edit page
389  $ilTabs->addTarget("preview",
390  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "preview"),
391  array("preview"),
392  "ilAssQuestionPageGUI", "", $force_active);
393  }
394 
395  $force_active = false;
396  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
397  {
398  $url = "";
399  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
400  $commands = $_POST["cmd"];
401  if (is_array($commands))
402  {
403  foreach ($commands as $key => $value)
404  {
405  if (preg_match("/^suggestrange_.*/", $key, $matches))
406  {
407  $force_active = true;
408  }
409  }
410  }
411  // edit question properties
412  $ilTabs->addTarget("edit_question",
413  $url,
414  array("editQuestion", "save", "saveEdit", "originalSyncForm"),
415  $classname, "", $force_active);
416  }
417 
418  // add tab for question feedback within common class assQuestionGUI
419  $this->addTab_QuestionFeedback($ilTabs);
420 
421  // add tab for question hint within common class assQuestionGUI
422  $this->addTab_QuestionHints($ilTabs);
423 
424  if ($_GET["q_id"])
425  {
426  $ilTabs->addTarget("solution_hint",
427  $this->ctrl->getLinkTargetByClass($classname, "suggestedsolution"),
428  array("suggestedsolution", "saveSuggestedSolution", "outSolutionExplorer", "cancel",
429  "addSuggestedSolution","cancelExplorer", "linkChilds", "removeSuggestedSolution"
430  ),
431  $classname,
432  ""
433  );
434  }
435 
436  // Assessment of questions sub menu entry
437  if ($_GET["q_id"])
438  {
439  $ilTabs->addTarget("statistics",
440  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
441  array("assessment"),
442  $classname, "");
443  }
444 
445  if (($_GET["calling_test"] > 0) || ($_GET["test_ref_id"] > 0))
446  {
447  $ref_id = $_GET["calling_test"];
448  if (strlen($ref_id) == 0) $ref_id = $_GET["test_ref_id"];
449 
450  global $___test_express_mode;
451 
452  if (!$_GET['test_express_mode'] && !$___test_express_mode) {
453  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
454  }
455  else {
457  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), $link);
458  }
459  }
460  else
461  {
462  $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
463  }
464  }
$_POST['username']
Definition: cron.php:12
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
$_GET["client_id"]
static getReturnToPageLink($q_id=null)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
$ref_id
Definition: sahs_server.php:39
+ 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  {
62  $this->saveTaxonomyAssignments();
63  return 0;
64  }
65  return 1;
66  }
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
writeQuestionSpecificPostData($always=true)
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 (   $always = true)

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

References $_POST.

Referenced by writePostData().

492  {
493  $this->object->setTextSize( $_POST["textsize"] );
494  $this->object->setOrderText( $_POST["ordertext"] );
495  $this->object->setPoints( $_POST["points"] );
496  }
$_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: