ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
assTextSubsetGUI Class Reference

Multiple choice question GUI representation. More...

+ Inheritance diagram for assTextSubsetGUI:
+ Collaboration diagram for assTextSubsetGUI:

Public Member Functions

 __construct ($id=-1)
 assTextSubsetGUI constructor More...
 
 editQuestion ($checkonly=FALSE)
 Creates an output of the edit form for the question. More...
 
 addanswers ()
 Add a new answer. More...
 
 removeanswers ()
 Remove an answer. 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=NULL, $is_postponed=FALSE, $use_post_solutions=FALSE, $inlineFeedback=false)
 
 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...
 
 writeAnswerSpecificPostData (ilPropertyFormGUI $form)
 Extracts the answer specific values from $_POST and applies them to the data object. More...
 
 populateQuestionSpecificFormPart (\ilPropertyFormGUI $form)
 
 populateAnswerSpecificFormPart (\ilPropertyFormGUI $form)
 
 getAfterParticipationSuppressionAnswerPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAfterParticipationSuppressionQuestionPostVars ()
 Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment. More...
 
 getAggregatedAnswersView ($relevant_answers)
 Returns an html string containing a question specific representation of the answers so far given in the test for use in the right column in the scoring adjustment user interface. More...
 
 aggregateAnswers ($relevant_answers_chosen)
 
 renderAggregateView ($aggregate)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 getRenderPurpose ()
 
 setRenderPurpose ($renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext ($editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 populateJavascriptFilesRequiredForWorkForm (ilTemplate $tpl)
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
- Public Member Functions inherited from ilGuiQuestionScoringAdjustable
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
- Public Member Functions inherited from ilGuiAnswerScoringAdjustable
 populateAnswerSpecificFormPart (ilPropertyFormGUI $form)
 Adds the answer specific form 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)
 
 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

Multiple choice question GUI representation.

The assTextSubsetGUI class encapsulates the GUI representation for multiple choice 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$

assTextSubsetGUI: ilFormPropertyDispatchGUI

Definition at line 24 of file class.assTextSubsetGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assTextSubsetGUI::__construct (   $id = -1)

assTextSubsetGUI constructor

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

Parameters
integer$idThe database id of a text subset question object

Definition at line 33 of file class.assTextSubsetGUI.php.

34  {
35  parent::__construct();
36  require_once './Modules/TestQuestionPool/classes/class.assTextSubset.php';
37  $this->object = new assTextSubset();
38  if ($id >= 0)
39  {
40  $this->object->loadFromDb($id);
41  }
42  }
Class for TextSubset questions.

Member Function Documentation

◆ addanswers()

assTextSubsetGUI::addanswers ( )

Add a new answer.

Definition at line 104 of file class.assTextSubsetGUI.php.

References $_POST, editQuestion(), and writePostData().

105  {
106  $this->writePostData(true);
107  $position = key($_POST['cmd']['addanswers']);
108  $this->object->addAnswer("", 0, $position+1);
109  $this->editQuestion();
110  }
writePostData($always=false)
{}
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
$_POST["username"]
+ Here is the call graph for this function:

◆ aggregateAnswers()

assTextSubsetGUI::aggregateAnswers (   $relevant_answers_chosen)

Definition at line 526 of file class.assTextSubsetGUI.php.

References array.

Referenced by getAggregatedAnswersView().

527  {
528  $aggregate = array();
529 
530  foreach ($relevant_answers_chosen as $relevant_answer)
531  {
532  if ( array_key_exists($relevant_answer['value1'], $aggregate) )
533  {
534  $aggregate[$relevant_answer['value1']]++;
535  }
536  else
537  {
538  $aggregate[$relevant_answer['value1']] = 1;
539  }
540  }
541  return $aggregate;
542  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ editQuestion()

assTextSubsetGUI::editQuestion (   $checkonly = FALSE)

Creates an output of the edit form for the question.

Definition at line 65 of file class.assTextSubsetGUI.php.

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

Referenced by addanswers(), removeanswers(), and writePostData().

66  {
67  $save = $this->isSaveCommand();
68  $this->getQuestionTemplate();
69 
70  require_once './Services/Form/classes/class.ilPropertyFormGUI.php';
71  $form = new ilPropertyFormGUI();
72  $this->editForm = $form;
73 
74  $form->setFormAction($this->ctrl->getFormAction($this));
75  $form->setTitle($this->outQuestionType());
76  $form->setMultipart(FALSE);
77  $form->setTableWidth("100%");
78  $form->setId("asstextsubset");
79 
80  $this->addBasicQuestionFormProperties($form);
81  $this->populateQuestionSpecificFormPart( $form );
82  $this->populateAnswerSpecificFormPart( $form );
83  $this->populateTaxonomyFormSection($form);
84  $this->addQuestionFormCommandButtons($form);
85 
86  $errors = false;
87  if ($save)
88  {
89  $form->setValuesByPost();
90  $points = $form->getItemByPostVar('points');
91  $points->setValue($this->object->getMaximumPoints());
92  $errors = !$form->checkInput();
93  $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
94  if ($errors) $checkonly = false;
95  }
96 
97  if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
98  return $errors;
99  }
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
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
$errors
Create new PHPExcel object
obj_idprivate
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:

◆ getAfterParticipationSuppressionAnswerPostVars()

assTextSubsetGUI::getAfterParticipationSuppressionAnswerPostVars ( )

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 ilGuiAnswerScoringAdjustable.

Definition at line 493 of file class.assTextSubsetGUI.php.

References array.

494  {
495  return array();
496  }
Create styles array
The data for the language used.

◆ getAfterParticipationSuppressionQuestionPostVars()

assTextSubsetGUI::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.assTextSubsetGUI.php.

References array.

508  {
509  return array();
510  }
Create styles array
The data for the language used.

◆ getAggregatedAnswersView()

assTextSubsetGUI::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 520 of file class.assTextSubsetGUI.php.

References aggregateAnswers(), and renderAggregateView().

521  {
522  return $this->renderAggregateView(
523  $this->aggregateAnswers( $relevant_answers ) )->get();
524  }
aggregateAnswers($relevant_answers_chosen)
+ Here is the call graph for this function:

◆ getPreview()

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

Definition at line 254 of file class.assTextSubsetGUI.php.

References array, assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), and object.

255  {
256  $solutions = is_object($this->getPreviewSession()) ? (array)$this->getPreviewSession()->getParticipantsSolution() : array();
257  // generate the question output
258  include_once "./Services/UICore/classes/class.ilTemplate.php";
259  $template = new ilTemplate("tpl.il_as_qpl_textsubset_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
260  $width = $this->object->getMaxTextboxWidth();
261  for ($i = 0; $i < $this->object->getCorrectAnswers(); $i++)
262  {
263  $template->setCurrentBlock("textsubset_row");
264  foreach ($solutions as $idx => $solution_value)
265  {
266  if ($idx == $i)
267  {
268  $template->setVariable("TEXTFIELD_VALUE", " value=\"" . $solution_value."\"");
269  }
270  }
271  $template->setVariable("COUNTER", $i+1);
272  $template->setVariable("TEXTFIELD_ID", sprintf("%02d", $i+1));
273  $template->setVariable("TEXTFIELD_SIZE", $width);
274  $template->parseCurrentBlock();
275  }
276  $questiontext = $this->object->getQuestion();
277  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
278  $questionoutput = $template->get();
279  if (!$show_question_only)
280  {
281  // get page object output
282  $questionoutput = $this->getILIASPage($questionoutput);
283  }
284  return $questionoutput;
285  }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ getSolutionOutput()

assTextSubsetGUI::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 136 of file class.assTextSubsetGUI.php.

References $pass, array, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getAnswerFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), and object.

147  {
148  // get the solution of the user for the active pass or from the last pass if allowed
149  $solutions = array();
150  if (($active_id > 0) && (!$show_correct_solution))
151  {
152  $solutions =& $this->object->getSolutionValues($active_id, $pass);
153  }
154  else
155  {
156  $rank = array();
157  foreach ($this->object->answers as $answer)
158  {
159  if ($answer->getPoints() > 0)
160  {
161  if (!is_array($rank[$answer->getPoints()]))
162  {
163  $rank[$answer->getPoints()] = array();
164  }
165  array_push($rank[$answer->getPoints()], $answer->getAnswertext());
166  }
167  }
168  krsort($rank, SORT_NUMERIC);
169  foreach ($rank as $index => $bestsolutions)
170  {
171  array_push($solutions, array("value1" => join(",", $bestsolutions), "points" => $index));
172  }
173  }
174 
175  // generate the question output
176  include_once "./Services/UICore/classes/class.ilTemplate.php";
177  $template = new ilTemplate("tpl.il_as_qpl_textsubset_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
178  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
179  $available_answers =& $this->object->getAvailableAnswers();
180  for ($i = 0; $i < $this->object->getCorrectAnswers(); $i++)
181  {
182  if ((!$test_id) && (strcmp($solutions[$i]["value1"], "") == 0))
183  {
184  }
185  else
186  {
187  if (($active_id > 0) && (!$show_correct_solution))
188  {
189  if ($graphicalOutput)
190  {
191  // output of ok/not ok icons for user entered solutions
192  $index = $this->object->isAnswerCorrect($available_answers, $solutions[$i]["value1"]);
193  $correct = FALSE;
194  if ($index !== FALSE)
195  {
196  unset($available_answers[$index]);
197  $correct = TRUE;
198  }
199  if ($correct)
200  {
201  $template->setCurrentBlock("icon_ok");
202  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
203  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
204  $template->parseCurrentBlock();
205  }
206  else
207  {
208  $template->setCurrentBlock("icon_ok");
209  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
210  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
211  $template->parseCurrentBlock();
212  }
213  }
214  }
215  $template->setCurrentBlock("textsubset_row");
216  $template->setVariable("SOLUTION", $solutions[$i]["value1"]);
217  $template->setVariable("COUNTER", $i+1);
218  if ($result_output)
219  {
220  $points = $solutions[$i]["points"];
221  $resulttext = ($points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
222  $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $points));
223  }
224  $template->parseCurrentBlock();
225  }
226  }
227  $questiontext = $this->object->getQuestion();
228  if ($show_question_text==true)
229  {
230  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
231  }
232  $questionoutput = $template->get();
233  $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
234  if (strlen($feedback))
235  {
236  $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
238  );
239 
240  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
241  $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
242  }
243  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
244 
245  $solutionoutput = $solutiontemplate->get();
246  if (!$show_question_only)
247  {
248  // get page object output
249  $solutionoutput = $this->getILIASPage($solutionoutput);
250  }
251  return $solutionoutput;
252  }
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
Create styles array
The data for the language used.
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assTextSubsetGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Definition at line 401 of file class.assTextSubsetGUI.php.

References $output.

402  {
403  $output = "";
404  return $this->object->prepareTextareaOutput($output, TRUE);
405  }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output

◆ getTestOutput()

assTextSubsetGUI::getTestOutput (   $active_id,
  $pass = NULL,
  $is_postponed = FALSE,
  $use_post_solutions = FALSE,
  $inlineFeedback = false 
)

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

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

288  {
289  // get the solution of the user for the active pass or from the last pass if allowed
290  $user_solution = "";
291  if ($active_id)
292  {
293  $solutions = NULL;
294  // hey: prevPassSolutions - obsolete due to central check
295  #include_once "./Modules/Test/classes/class.ilObjTest.php";
296  #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
297  #{
298  # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
299  #}
300  // hey.
301  $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
302  }
303 
304  // generate the question output
305  include_once "./Services/UICore/classes/class.ilTemplate.php";
306  $template = new ilTemplate("tpl.il_as_qpl_textsubset_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
307  $width = $this->object->getMaxTextboxWidth();
308  for ($i = 0; $i < $this->object->getCorrectAnswers(); $i++)
309  {
310  $template->setCurrentBlock("textsubset_row");
311  foreach ($solutions as $idx => $solution_value)
312  {
313  if ($idx == $i)
314  {
315  $template->setVariable("TEXTFIELD_VALUE", " value=\"" . ilUtil::prepareFormOutput($solution_value["value1"])."\"");
316  }
317  }
318  $template->setVariable("COUNTER", $i+1);
319  $template->setVariable("TEXTFIELD_ID", sprintf("%02d", $i+1));
320  $template->setVariable("TEXTFIELD_SIZE", $width);
321  $template->parseCurrentBlock();
322  }
323  $questiontext = $this->object->getQuestion();
324  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
325  $questionoutput = $template->get();
326  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
327  return $pageoutput;
328  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
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:

◆ populateAnswerSpecificFormPart()

assTextSubsetGUI::populateAnswerSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 466 of file class.assTextSubsetGUI.php.

References ilPropertyFormGUI\addItem(), object, and ilFormPropertyGUI\setRequired().

Referenced by editQuestion().

467  {
468  // Choices
469  include_once "./Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php";
470  $choices = new ilAnswerWizardInputGUI($this->lng->txt( "answers" ), "answers");
471  $choices->setRequired( true );
472  $choices->setQuestionObject( $this->object );
473  $choices->setSingleline( true );
474  $choices->setAllowMove( false );
475  $choices->setMinValue(0.0);
476  if ($this->object->getAnswerCount() == 0)
477  $this->object->addAnswer( "", 0, 0 );
478  $choices->setValues( $this->object->getAnswers() );
479  $form->addItem( $choices );
480  return $form;
481  }
This class represents a single choice wizard property in a property form.
Create new PHPExcel object
obj_idprivate
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateQuestionSpecificFormPart()

assTextSubsetGUI::populateQuestionSpecificFormPart ( \ilPropertyFormGUI  $form)

Definition at line 424 of file class.assTextSubsetGUI.php.

References ilPropertyFormGUI\addItem(), array, object, ilNumberInputGUI\setMinValue(), and ilSelectInputGUI\setOptions().

Referenced by editQuestion().

425  {
426  // number of requested answers
427  $correctanswers = new ilNumberInputGUI($this->lng->txt( "nr_of_correct_answers" ), "correctanswers");
428  $correctanswers->setMinValue( 1 );
429  $correctanswers->setDecimals( 0 );
430  $correctanswers->setSize( 3 );
431  $correctanswers->setValue( $this->object->getCorrectAnswers() );
432  $correctanswers->setRequired( true );
433  $form->addItem( $correctanswers );
434 
435  // maximum available points
436  $points = new ilNumberInputGUI($this->lng->txt( "maximum_points" ), "points");
437  $points->setMinValue(0.0);
438  $points->setMinvalueShouldBeGreater(true);
439  $points->setSize( 6 );
440  $points->setDisabled( true );
441  $points->allowDecimals(true);
442  $points->setValue( $this->object->getMaximumPoints() );
443  $points->setRequired( false );
444  $form->addItem( $points );
445 
446  // text rating
447  $textrating = new ilSelectInputGUI($this->lng->txt( "text_rating" ), "text_rating");
448  $text_options = array(
449  "ci" => $this->lng->txt( "cloze_textgap_case_insensitive" ),
450  "cs" => $this->lng->txt( "cloze_textgap_case_sensitive" )
451  );
452  if (!$this->object->getSelfAssessmentEditingMode())
453  {
454  $text_options["l1"] = sprintf( $this->lng->txt( "cloze_textgap_levenshtein_of" ), "1" );
455  $text_options["l2"] = sprintf( $this->lng->txt( "cloze_textgap_levenshtein_of" ), "2" );
456  $text_options["l3"] = sprintf( $this->lng->txt( "cloze_textgap_levenshtein_of" ), "3" );
457  $text_options["l4"] = sprintf( $this->lng->txt( "cloze_textgap_levenshtein_of" ), "4" );
458  $text_options["l5"] = sprintf( $this->lng->txt( "cloze_textgap_levenshtein_of" ), "5" );
459  }
460  $textrating->setOptions( $text_options );
461  $textrating->setValue( $this->object->getTextRating() );
462  $form->addItem( $textrating );
463  return $form;
464  }
This class represents a selection list property in a property form.
setMinValue($a_minvalue, $a_display_always=false)
Set Minimum Value.
This class represents a number property in a property form.
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeanswers()

assTextSubsetGUI::removeanswers ( )

Remove an answer.

Definition at line 115 of file class.assTextSubsetGUI.php.

References $_POST, editQuestion(), and writePostData().

116  {
117  $this->writePostData(true);
118  $position = key($_POST['cmd']['removeanswers']);
119  $this->object->deleteAnswer($position);
120  $this->editQuestion();
121  }
writePostData($always=false)
{}
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
$_POST["username"]
+ Here is the call graph for this function:

◆ renderAggregateView()

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

Definition at line 549 of file class.assTextSubsetGUI.php.

References assQuestionGUI\$tpl.

Referenced by getAggregatedAnswersView().

550  {
551  $tpl = new ilTemplate('tpl.il_as_aggregated_answers_table.html', true, true, "Modules/TestQuestionPool");
552 
553  foreach ($aggregate as $key => $value)
554  {
555  $tpl->setCurrentBlock( 'aggregaterow' );
556  $tpl->setVariable( 'OPTION', $key );
557  $tpl->setVariable( 'COUNT', $value );
558  $tpl->parseCurrentBlock();
559  }
560  return $tpl;
561  }
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ setQuestionTabs()

assTextSubsetGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Definition at line 337 of file class.assTextSubsetGUI.php.

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

338  {
339  global $rbacsystem, $ilTabs;
340 
341  $ilTabs->clearTargets();
342 
343  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
344  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
345  $q_type = $this->object->getQuestionType();
346 
347  if (strlen($q_type))
348  {
349  $classname = $q_type . "GUI";
350  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
351  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
352  }
353 
354  if ($_GET["q_id"])
355  {
356  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
357  {
358  // edit page
359  $ilTabs->addTarget("edit_page",
360  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
361  array("edit", "insert", "exec_pg"),
362  "", "", $force_active);
363  }
364 
365  $this->addTab_QuestionPreview($ilTabs);
366  }
367 
368  $force_active = false;
369  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
370  {
371  $url = "";
372  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
373  // edit question properties
374  $ilTabs->addTarget("edit_question",
375  $url,
376  array("editQuestion", "save", "saveEdit", "addanswers", "removeanswers", "originalSyncForm"),
377  $classname, "", $force_active);
378  }
379 
380  // add tab for question feedback within common class assQuestionGUI
381  $this->addTab_QuestionFeedback($ilTabs);
382 
383  // add tab for question hint within common class assQuestionGUI
384  $this->addTab_QuestionHints($ilTabs);
385 
386  // add tab for question's suggested solution within common class assQuestionGUI
387  $this->addTab_SuggestedSolution($ilTabs, $classname);
388 
389  // Assessment of questions sub menu entry
390  if ($_GET["q_id"])
391  {
392  $ilTabs->addTarget("statistics",
393  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
394  array("assessment"),
395  $classname, "");
396  }
397 
398  $this->addBackTab($ilTabs);
399  }
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
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
Create styles array
The data for the language used.
addBackTab(ilTabsGUI $ilTabs)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
+ Here is the call graph for this function:

◆ writeAnswerSpecificPostData()

assTextSubsetGUI::writeAnswerSpecificPostData ( ilPropertyFormGUI  $form)

Extracts the answer 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 ilGuiAnswerScoringAdjustable.

Definition at line 413 of file class.assTextSubsetGUI.php.

References $_POST.

Referenced by writePostData().

414  {
415  // Delete all existing answers and create new answers from the form data
416  $this->object->flushAnswers();
417  foreach ($_POST['answers']['answer'] as $index => $answer)
418  {
419  $answertext = $answer;
420  $this->object->addAnswer( $answertext, $_POST['answers']['points'][$index], $index );
421  }
422  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ writePostData()

assTextSubsetGUI::writePostData (   $always = false)
protected

{}

Definition at line 47 of file class.assTextSubsetGUI.php.

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

Referenced by addanswers(), and removeanswers().

48  {
49  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
50  if (!$hasErrors)
51  {
52  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
56  $this->saveTaxonomyAssignments();
57  return 0;
58  }
59  return 1;
60  }
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.
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeQuestionSpecificPostData()

assTextSubsetGUI::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 407 of file class.assTextSubsetGUI.php.

References $_POST.

Referenced by writePostData().

408  {
409  $this->object->setCorrectAnswers( $_POST["correctanswers"] );
410  $this->object->setTextRating( $_POST["text_rating"] );
411  }
$_POST["username"]
+ Here is the caller graph for this function:

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