ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 
 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)
 
 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...
 

Protected Member Functions

 writePostData ($always=false)
 {} More...
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_QuestionPreview (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 buildEditForm ()
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const RENDER_PURPOSE_PLAYBACK = 'renderPurposePlayback'
 
const RENDER_PURPOSE_DEMOPLAY = 'renderPurposeDemoplay'
 
const RENDER_PURPOSE_PREVIEW = 'renderPurposePreview'
 
const RENDER_PURPOSE_PRINT_PDF = 'renderPurposePrintPdf'
 
const RENDER_PURPOSE_INPUT_VALUE = 'renderPurposeInputValue'
 
const EDIT_CONTEXT_AUTHORING = 'authoring'
 
const EDIT_CONTEXT_ADJUSTMENT = 'adjustment'
 
- Protected Attributes inherited from assQuestionGUI
 $editForm
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

assOrderingHorizontalGUI::__construct (   $id = -1)

assOrderingHorizontalGUI constructor

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

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

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

References $id, and assQuestionGUI\setErrorMessage().

33  {
34  parent::__construct();
35  include_once "./Modules/TestQuestionPool/classes/class.assOrderingHorizontal.php";
36  $this->object = new assOrderingHorizontal();
37  $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
38  if ($id >= 0) {
39  $this->object->loadFromDb($id);
40  }
41  }
Class for horizontal ordering questions.
if(!array_key_exists('StateId', $_REQUEST)) $id
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 524 of file class.assOrderingHorizontalGUI.php.

References array, and object.

Referenced by getAggregatedAnswersView().

525  {
526  $aggregate = array();
527  foreach ($relevant_answers_chosen as $answer) {
528  $answer = str_replace($this->object->getAnswerSeparator(), '  -  ', $answer);
529  if (in_array($answer['value1'], $aggregate)) {
530  $aggregate[$answer['value1']] = $aggregate[$answer['value1']]+1;
531  } else {
532  $aggregate[$answer['value1']] = 1;
533  }
534  }
535 
536  return $aggregate;
537  }
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the caller graph for this function:

◆ editQuestion()

assOrderingHorizontalGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

public

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

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

Referenced by writePostData().

70  {
71  $save = $this->isSaveCommand();
72  $this->getQuestionTemplate();
73 
74  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
75  $form = new ilPropertyFormGUI();
76  $this->editForm = $form;
77 
78  $form->setFormAction($this->ctrl->getFormAction($this));
79  $form->setTitle($this->outQuestionType());
80  $form->setMultipart(false);
81  $form->setTableWidth("100%");
82  $form->setId("orderinghorizontal");
83 
86 
87 
89 
91 
92  $errors = false;
93 
94  if ($save) {
95  $form->setValuesByPost();
96  $errors = !$form->checkInput();
97  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
98  if ($errors) {
99  $checkonly = false;
100  }
101  }
102 
103  if (!$checkonly) {
104  $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
105  }
106  return $errors;
107  }
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)
if(isset($_POST['submit'])) $form
$errors
Definition: index.php:6
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 468 of file class.assOrderingHorizontalGUI.php.

References array.

469  {
470  return array();
471  }
Create styles array
The data for the language used.

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

References aggregateAnswers(), object, and renderAggregateView().

518  {
519  return $this->renderAggregateView(
520  $this->aggregateAnswers($relevant_answers, $this->object->getOrderText())
521  )->get();
522  }
aggregateAnswers($relevant_answers_chosen, $answer_defined_on_question)
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ getCommand()

assOrderingHorizontalGUI::getCommand (   $cmd)

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

44  {
45  return $cmd;
46  }

◆ getPreview()

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

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

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

240  {
241  if (is_object($this->getPreviewSession()) && strlen((string) $this->getPreviewSession()->getParticipantsSolution())) {
242  $elements = (string) $this->getPreviewSession()->getParticipantsSolution();
243  $elements = $this->object->splitAndTrimOrderElementText($elements, $this->object->getAnswerSeparator());
244  } else {
245  $elements = $this->object->getRandomOrderingElements();
246  }
247 
248  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_preview.html", true, true, "Modules/TestQuestionPool");
249  foreach ($elements as $id => $element) {
250  $template->setCurrentBlock("element");
251  $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
252  $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
253  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
254  $template->parseCurrentBlock();
255  }
256  $template->setVariable("QUESTION_ID", $this->object->getId());
257  $template->setVariable("VALUE_ORDERRESULT", ' value="' . join($elements, '{::}') . '"');
258  if ($this->object->textsize >= 10) {
259  $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
260  }
261  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
262  $questionoutput = $template->get();
263  if (!$show_question_only) {
264  // get page object output
265  $questionoutput = $this->getILIASPage($questionoutput);
266  }
267  $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
268  return $questionoutput;
269  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
Add rich text string
$template
if(!array_key_exists('StateId', $_REQUEST)) $id
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
Create new PHPExcel object
obj_idprivate
+ 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 $id, $pass, $template, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), getSpecificFeedbackOutput(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), object, and ilUtil\prepareFormOutput().

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  $solutions =&$this->object->getSolutionValues($active_id, $pass);
139  if (strlen($solutions[0]["value1"])) {
140  $elements = explode("{::}", $solutions[0]["value1"]);
141  }
142 
143  if (!count($elements)) {
144  $elements = $this->object->getRandomOrderingElements();
145  }
146 
147  foreach ($elements as $id => $element) {
148  $template->setCurrentBlock("element");
149  $template->setVariable("ELEMENT_ID", "sol_e_" . $this->object->getId() . "_$id");
150  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
151  $template->parseCurrentBlock();
152  }
153 
154  //$solutionvalue = str_replace("{::}", " ", $solutions[0]["value1"]);
155  } else {
156  $elements = $this->object->getOrderingElements();
157  foreach ($elements as $id => $element) {
158  $template->setCurrentBlock("element");
159  $template->setVariable("ELEMENT_ID", "sol_e_" . $this->object->getId() . "_$id");
160  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
161  $template->parseCurrentBlock();
162  }
163  //$solutionvalue = join($this->object->getOrderingElements(), " ");
164  }
165 
166  if (($active_id > 0) && (!$show_correct_solution)) {
167  if ($this->object->getStep() === null) {
168  $reached_points = $this->object->getReachedPoints($active_id, $pass);
169  } else {
170  $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
171  }
172  if ($graphicalOutput) {
173  // output of ok/not ok icons for user entered solutions
174  if ($reached_points == $this->object->getMaximumPoints()) {
175  $template->setCurrentBlock("icon_ok");
176  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
177  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
178  $template->parseCurrentBlock();
179  } else {
180  $template->setCurrentBlock("icon_ok");
181  if ($reached_points > 0) {
182  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
183  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
184  } else {
185  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
186  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
187  }
188  $template->parseCurrentBlock();
189  }
190  }
191  } else {
192  $reached_points = $this->object->getPoints();
193  }
194 
195  if ($result_output) {
196  $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
197  $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
198  }
199  if ($show_question_text==true) {
200  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
201  }
202  // $template->setVariable("SOLUTION_TEXT", ilUtil::prepareFormOutput($solutionvalue));
203  if ($this->object->textsize >= 10) {
204  $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
205  }
206 
207  $questionoutput = $template->get();
208  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
209  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
210 
211 
212  $feedback = '';
213  if ($show_feedback) {
214  if (!$this->isTestPresentationContext()) {
215  $fb = $this->getGenericFeedbackOutput($active_id, $pass);
216  $feedback .= strlen($fb) ? $fb : '';
217  }
218 
219  $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
220  $feedback .= strlen($fb) ? $fb : '';
221  }
222  if (strlen($feedback)) {
223  $cssClass = (
224  $this->hasCorrectSolution($active_id, $pass) ?
226  );
227 
228  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
229  $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
230  }
231  $solutionoutput = $solutiontemplate->get();
232  if (!$show_question_only) {
233  // get page object output
234  $solutionoutput = $this->getILIASPage($solutionoutput);
235  }
236  return $solutionoutput;
237  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
hasCorrectSolution($activeId, $passIndex)
$template
if(!array_key_exists('StateId', $_REQUEST)) $id
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
Create new PHPExcel object
obj_idprivate
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 424 of file class.assOrderingHorizontalGUI.php.

References $output, and object.

Referenced by getSolutionOutput().

425  {
426  if (strpos($this->object->getOrderText(), '::')) {
427  $answers = explode('::', $this->object->getOrderText());
428  } else {
429  $answers = explode(' ', $this->object->getOrderText());
430  }
431 
432  if (!$this->object->feedbackOBJ->specificAnswerFeedbackExists(array_values($answers))) {
433  return '';
434  }
435 
436  $output = '<table class="test_specific_feedback"><tbody>';
437 
438  foreach ($answers as $idx => $answer) {
439  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
440  $this->object->getId(),
441  $idx
442  );
443 
444  $output .= "<tr><td>{$answer}</td><td>{$feedback}</td></tr>";
445  }
446 
447  $output .= '</tbody></table>';
448 
449  return $this->object->prepareTextareaOutput($output, true);
450  }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
Create new PHPExcel object
obj_idprivate
+ 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 272 of file class.assOrderingHorizontalGUI.php.

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

274  {
275  // generate the question output
276  $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output.html", true, true, "Modules/TestQuestionPool");
277  $elements = $this->object->getRandomOrderingElements();
278 
279  if ($active_id) {
280  // hey: prevPassSolutions - obsolete due to central check
281  #$solutions = NULL;
282  #include_once "./Modules/Test/classes/class.ilObjTest.php";
283  #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
284  #{
285  # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
286  #}
287  $solutions = $this->object->getTestOutputSolutions($active_id, $pass);
288  // hey.
289  if (count($solutions) == 1) {
290  $elements = explode("{::}", $solutions[0]["value1"]);
291  }
292  }
293  if (count($solutions) == 0) {
294  $_SESSION['qst_ordering_horizontal_elements'] = $elements;
295  } else {
296  unset($_SESSION['qst_ordering_horizontal_elements']);
297  }
298  foreach ($elements as $id => $element) {
299  $template->setCurrentBlock("element");
300  $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_$id");
301  $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
302  $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
303  $template->parseCurrentBlock();
304  }
305  $template->setVariable("QUESTION_ID", $this->object->getId());
306  if ($this->object->textsize >= 10) {
307  $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
308  }
309  $template->setVariable("VALUE_ORDERRESULT", ' value="' . join($elements, '{::}') . '"');
310  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), true));
311  $questionoutput = $template->get();
312  if (!$show_question_only) {
313  // get page object output
314  $questionoutput = $this->getILIASPage($questionoutput);
315  }
316  $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
317  $questionoutput = $template->get();
318  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
319  return $pageoutput;
320  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$_SESSION["AccountId"]
$template
if(!array_key_exists('StateId', $_REQUEST)) $id
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
Create new PHPExcel object
obj_idprivate
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 473 of file class.assOrderingHorizontalGUI.php.

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

Referenced by editQuestion().

474  {
475  // ordertext
476  $ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext");
477  $ordertext->setValue($this->object->prepareTextareaOutput($this->object->getOrderText()));
478  $ordertext->setRequired(true);
479  $ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->separator));
480  $ordertext->setRows(10);
481  $ordertext->setCols(80);
482  $form->addItem($ordertext);
483  // textsize
484  $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
485  $textsize->setValue($this->object->getTextSize());
486  $textsize->setInfo($this->lng->txt("textsize_info"));
487  $textsize->setSize(6);
488  $textsize->setMinValue(10);
489  $textsize->setRequired(false);
490  $form->addItem($textsize);
491  // points
492  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
493 
494  $points->allowDecimals(true);
495  // mbecker: Fix for mantis bug 7866: Predefined values schould make sense.
496  // This implements a default value of "1" for this question type.
497  if ($this->object->getPoints() == null) {
498  $points->setValue("1");
499  } else {
500  $points->setValue($this->object->getPoints());
501  }
502  $points->setRequired(true);
503  $points->setSize(3);
504  $points->setMinValue(0.0);
505  $points->setMinvalueShouldBeGreater(true);
506  $form->addItem($points);
507  }
setValue($a_value)
Set Value.
setValue($a_value)
Set Value.
allowDecimals($a_value)
Toggle Decimals.
if(isset($_POST['submit'])) $form
This class represents a number property in a property form.
Create new PHPExcel object
obj_idprivate
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 544 of file class.assOrderingHorizontalGUI.php.

References $key, and assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

545  {
546  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
547 
548  foreach ($aggregate as $key => $line_data) {
549  $tpl->setCurrentBlock('aggregaterow');
550  $tpl->setVariable('COUNT', $line_data);
551  $tpl->setVariable('OPTION', $key);
552  $tpl->parseCurrentBlock();
553  }
554  return $tpl;
555  }
special template class to simplify handling of ITX/PEAR
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ saveFeedback()

assOrderingHorizontalGUI::saveFeedback ( )

Saves the feedback for a single choice question.

public

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

References $_POST, and $errors.

328  {
329  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
330  $errors = $this->feedback(true);
331  $this->object->saveFeedbackGeneric(0, $_POST["feedback_incomplete"]);
332  $this->object->saveFeedbackGeneric(1, $_POST["feedback_complete"]);
333  $this->object->cleanupMediaObjectUsage();
334  parent::saveFeedback();
335  }
$errors
Definition: index.php:6
$_POST["username"]

◆ setQuestionTabs()

assOrderingHorizontalGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

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

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

345  {
346  global $rbacsystem, $ilTabs;
347 
348  $ilTabs->clearTargets();
349 
350  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
351  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
352  $q_type = $this->object->getQuestionType();
353 
354  if (strlen($q_type)) {
355  $classname = $q_type . "GUI";
356  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
357  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
358  }
359 
360  if ($_GET["q_id"]) {
361  if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
362  // edit page
363  $ilTabs->addTarget(
364  "edit_page",
365  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
366  array("edit", "insert", "exec_pg"),
367  "",
368  "",
369  $force_active
370  );
371  }
372 
373  $this->addTab_QuestionPreview($ilTabs);
374  }
375 
376  $force_active = false;
377  if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
378  $url = "";
379  if ($classname) {
380  $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
381  }
382  $commands = $_POST["cmd"];
383  if (is_array($commands)) {
384  foreach ($commands as $key => $value) {
385  if (preg_match("/^suggestrange_.*/", $key, $matches)) {
386  $force_active = true;
387  }
388  }
389  }
390  // edit question properties
391  $ilTabs->addTarget(
392  "edit_question",
393  $url,
394  array("editQuestion", "save", "saveEdit", "originalSyncForm"),
395  $classname,
396  "",
397  $force_active
398  );
399  }
400 
401  // add tab for question feedback within common class assQuestionGUI
402  $this->addTab_QuestionFeedback($ilTabs);
403 
404  // add tab for question hint within common class assQuestionGUI
405  $this->addTab_QuestionHints($ilTabs);
406 
407  // add tab for question's suggested solution within common class assQuestionGUI
408  $this->addTab_SuggestedSolution($ilTabs, $classname);
409 
410  // Assessment of questions sub menu entry
411  if ($_GET["q_id"]) {
412  $ilTabs->addTarget(
413  "statistics",
414  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
415  array("assessment"),
416  $classname,
417  ""
418  );
419  }
420 
421  $this->addBackTab($ilTabs);
422  }
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
$_GET["client_id"]
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
Create styles array
The data for the language used.
addBackTab(ilTabsGUI $ilTabs)
$url
$key
Definition: croninfo.php:18
$_POST["username"]
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
+ Here is the call graph for this function:

◆ writePostData()

assOrderingHorizontalGUI::writePostData (   $always = false)
protected

{}

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

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

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

◆ writeQuestionSpecificPostData()

assOrderingHorizontalGUI::writeQuestionSpecificPostData ( ilPropertyFormGUI  $form)

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

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

Implements ilGuiQuestionScoringAdjustable.

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

References $_POST.

Referenced by writePostData().

453  {
454  $this->object->setTextSize($_POST["textsize"]);
455  $this->object->setOrderText($_POST["ordertext"]);
456  $this->object->setPoints($_POST["points"]);
457  }
$_POST["username"]
+ Here is the caller graph for this function:

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