ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
assFileUploadGUI Class Reference

The assFileUploadGUI class encapsulates the GUI representation for file upload questions. More...

+ Inheritance diagram for assFileUploadGUI:
+ Collaboration diagram for assFileUploadGUI:

Public Member Functions

 __construct ($id=-1)
 assFileUploadGUI constructor More...
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 editQuestion ($checkonly=FALSE)
 Creates an output of the edit form for the question. More...
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 determineMaxFilesize ()
 
 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, $show_feedback=FALSE)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 
 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...
 
- 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 ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
_getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 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...
 
 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=NULL, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 

Protected Member Functions

 getFormEncodingType ()
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 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)
 
 writeQuestionGenericPostData ()
 
 getFormEncodingType ()
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 

Detailed Description

The assFileUploadGUI class encapsulates the GUI representation for file upload 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$

assFileUploadGUI: ilObjQuestionPoolGUI

Definition at line 22 of file class.assFileUploadGUI.php.

Constructor & Destructor Documentation

◆ __construct()

assFileUploadGUI::__construct (   $id = -1)

assFileUploadGUI constructor

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

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

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

References assQuestionGUI\setErrorMessage().

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

Member Function Documentation

◆ determineMaxFilesize()

assFileUploadGUI::determineMaxFilesize ( )
Returns
mixed

Definition at line 155 of file class.assFileUploadGUI.php.

Referenced by populateQuestionSpecificFormPart().

156  {
157  //mbecker: Quick fix for mantis bug 8595: Change size file
158  $upload_max_filesize = get_cfg_var( "upload_max_filesize" );
159  // get the value for the maximal post data from the php.ini (if available)
160  $post_max_size = get_cfg_var( "post_max_size" );
161 
162  //convert from short-string representation to "real" bytes
163  $multiplier_a = array( "K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024 );
164  $umf_parts = preg_split( "/(\d+)([K|G|M])/",
165  $upload_max_filesize,
166  -1,
167  PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
168  );
169  $pms_parts = preg_split( "/(\d+)([K|G|M])/",
170  $post_max_size,
171  -1,
172  PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
173  );
174 
175  if (count( $umf_parts ) == 2)
176  {
177  $upload_max_filesize = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
178  }
179 
180  if (count( $pms_parts ) == 2)
181  {
182  $post_max_size = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
183  }
184 
185  // use the smaller one as limit
186  $max_filesize = min( $upload_max_filesize, $post_max_size );
187 
188  if (!$max_filesize)
189  {
190  $max_filesize = max( $upload_max_filesize, $post_max_size );
191  return $max_filesize;
192  }
193  return $max_filesize;
194  }
+ Here is the caller graph for this function:

◆ editQuestion()

assFileUploadGUI::editQuestion (   $checkonly = FALSE)

Creates an output of the edit form for the question.

public

Definition at line 78 of file class.assFileUploadGUI.php.

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

Referenced by writePostData().

79  {
80  $save = $this->isSaveCommand();
81  $this->getQuestionTemplate();
82 
83  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
84  $form = new ilPropertyFormGUI();
85  $form->setFormAction($this->ctrl->getFormAction($this));
86  $form->setTitle($this->outQuestionType());
87  $form->setMultipart(false);
88  $form->setTableWidth("100%");
89  $form->setId("assfileupload");
90 
91  $this->addBasicQuestionFormProperties($form);
92  $this->populateQuestionSpecificFormPart( $form );
93 
94  $this->populateTaxonomyFormSection($form);
95  $this->addQuestionFormCommandButtons($form);
96 
97  $errors = false;
98 
99  if ($save)
100  {
101  $form->setValuesByPost();
102  $errors = !$form->checkInput();
103  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and
104  // we need this if we don't want to have duplication of backslashes
105  if ($errors) $checkonly = false;
106  }
107 
108  if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
109  return $errors;
110  }
$errors
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)
Adds the question specific forms parts to a question property form gui.
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()

assFileUploadGUI::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 506 of file class.assFileUploadGUI.php.

507  {
508  return array();
509  }

◆ getAggregatedAnswersView()

assFileUploadGUI::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 519 of file class.assFileUploadGUI.php.

520  {
521  // Empty implementation here since a feasible way to aggregate answer is not known.
522  return ''; //print_r($relevant_answers,true);
523  }

◆ getFormEncodingType()

assFileUploadGUI::getFormEncodingType ( )
protected

Definition at line 525 of file class.assFileUploadGUI.php.

526  {
527  return self::FORM_ENCODING_MULTIPART;
528  }

◆ getPreview()

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

Definition at line 311 of file class.assFileUploadGUI.php.

References assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), and assQuestionGUI\getQuestionActionCmd().

312  {
313  $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
314 
315  if( is_object($this->getPreviewSession()) )
316  {
317  $files = $this->object->getPreviewFileUploads($this->getPreviewSession());
318  if (count($files))
319  {
320  include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
321  $table_gui = new assFileUploadFileTableGUI(null , $this->getQuestionActionCmd(), 'ilAssQuestionPreview');
322  $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
323  $table_gui->setData($files);
324  $template->setCurrentBlock("files");
325  $template->setVariable('FILES', $table_gui->getHTML());
326  $template->parseCurrentBlock();
327  }
328  }
329 
330  if (strlen($this->object->getAllowedExtensions()))
331  {
332  $template->setCurrentBlock("allowed_extensions");
333  $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
334  $template->parseCurrentBlock();
335  }
336  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->question, TRUE));
337  $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
338  $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
339  $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
340  $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
341 
342  $questionoutput = $template->get();
343  if (!$show_question_only)
344  {
345  // get page object output
346  $questionoutput = $this->getILIASPage($questionoutput);
347  }
348  return $questionoutput;
349  }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ getSolutionOutput()

assFileUploadGUI::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 209 of file class.assFileUploadGUI.php.

References $pass, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), assQuestionGUI\getAnswerFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), and assQuestionGUI\getTargetGuiClass().

220  {
221  // get the solution of the user for the active pass or from the last pass if allowed
222  $template = new ilTemplate("tpl.il_as_qpl_fileupload_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
223 
224  $solutionvalue = "";
225  if (($active_id > 0) && (!$show_correct_solution))
226  {
227  $solutions =& $this->object->getSolutionValues($active_id, $pass);
228  include_once "./Modules/Test/classes/class.ilObjTest.php";
229  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
230  {
231  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
232  }
233  $solutions =& $this->object->getSolutionValues($active_id, $pass);
234 
235  $files = ($show_manual_scoring) ? $this->object->getUploadedFilesForWeb($active_id, $pass) : $this->object->getUploadedFiles($active_id, $pass);
236  if (count($files))
237  {
238  include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
239  $table_gui = new assFileUploadFileTableGUI($this->getTargetGuiClass(), 'gotoquestion');
240  $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
241  $table_gui->setData($files);
242  $table_gui->setRowTemplate("tpl.il_as_qpl_fileupload_file_view_row.html", "Modules/TestQuestionPool");
243  $table_gui->setSelectAllCheckbox("");
244  $table_gui->clearCommandButtons();
245  $table_gui->disable('select_all');
246  $table_gui->disable('numinfo');
247  $template->setCurrentBlock("files");
248  $template->setVariable('FILES', $table_gui->getHTML());
249  $template->parseCurrentBlock();
250  }
251  }
252 
253  if (($active_id > 0) && (!$show_correct_solution))
254  {
255  $reached_points = $this->object->getReachedPoints($active_id, $pass);
256  if ($graphicalOutput)
257  {
258  // output of ok/not ok icons for user entered solutions
259  if ($reached_points == $this->object->getMaximumPoints())
260  {
261  $template->setCurrentBlock("icon_ok");
262  $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
263  $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
264  $template->parseCurrentBlock();
265  }
266  else
267  {
268  $template->setCurrentBlock("icon_ok");
269  if ($reached_points > 0)
270  {
271  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
272  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
273  }
274  else
275  {
276  $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
277  $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
278  }
279  $template->parseCurrentBlock();
280  }
281  }
282  }
283  else
284  {
285  $reached_points = $this->object->getPoints();
286  }
287 
288  if ($result_output)
289  {
290  $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
291  $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
292  }
293  if ($show_question_text==true)
294  {
295  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
296  }
297  $questionoutput = $template->get();
298  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
299  $feedback = ($show_feedback) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
300  if (strlen($feedback)) $solutiontemplate->setVariable("FEEDBACK", $feedback);
301  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
302  $solutionoutput = $solutiontemplate->get();
303  if (!$show_question_only)
304  {
305  // get page object output
306  $solutionoutput = $this->getILIASPage($solutionoutput);
307  }
308  return $solutionoutput;
309  }
_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.
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assFileUploadGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Definition at line 491 of file class.assFileUploadGUI.php.

492  {
493  $output = "";
494  return $this->object->prepareTextareaOutput($output, TRUE);
495  }

◆ getTestOutput()

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

Definition at line 351 of file class.assFileUploadGUI.php.

References $pass, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), assQuestionGUI\getILIASPage(), assQuestionGUI\getQuestionActionCmd(), and assQuestionGUI\outQuestionPage().

352  {
353  // generate the question output
354  $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
355 
356  if ($active_id)
357  {
358  $solutions = NULL;
359  include_once "./Modules/Test/classes/class.ilObjTest.php";
360  if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
361  {
362  if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
363  }
364  $solutions =& $this->object->getSolutionValues($active_id, $pass);
365 
366  $files = $this->object->getUploadedFiles($active_id, $pass);
367  if (count($files))
368  {
369  include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
370  $table_gui = new assFileUploadFileTableGUI(null , $this->getQuestionActionCmd());
371  $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
372  $table_gui->setData($files);
373  $template->setCurrentBlock("files");
374  $template->setVariable('FILES', $table_gui->getHTML());
375  $template->parseCurrentBlock();
376  }
377  }
378 
379  if (strlen($this->object->getAllowedExtensions()))
380  {
381  $template->setCurrentBlock("allowed_extensions");
382  $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
383  $template->parseCurrentBlock();
384  }
385  $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->question, TRUE));
386  $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
387  $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
388  $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
389  $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
390 
391  $questionoutput = $template->get();
392  if (!$show_question_only)
393  {
394  // get page object output
395  $questionoutput = $this->getILIASPage($questionoutput);
396  }
397  $questionoutput = $template->get();
398  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
399  return $pageoutput;
400  }
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
getILIASPage($html="")
Returns the ILIAS Page around a question.
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.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assFileUploadGUI::populateQuestionSpecificFormPart ( ilPropertyFormGUI  $form)

Adds the question specific forms parts to a question property form gui.

Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Implements ilGuiQuestionScoringAdjustable.

Definition at line 112 of file class.assFileUploadGUI.php.

References ilPropertyFormGUI\addItem(), ilNumberInputGUI\allowDecimals(), determineMaxFilesize(), ilFormPropertyGUI\setInfo(), and ilNumberInputGUI\setValue().

Referenced by editQuestion().

113  {
114  // maxsize
115  $maxsize = new ilNumberInputGUI($this->lng->txt( "maxsize" ), "maxsize");
116  $maxsize->setValue( $this->object->getMaxSize() );
117  $maxsize->setInfo( $this->lng->txt( "maxsize_info" ) );
118  $maxsize->setSize( 10 );
119  $maxsize->setMinValue( 0 );
120  $maxsize->setMaxValue( $this->determineMaxFilesize() );
121  $maxsize->setRequired( FALSE );
122  $form->addItem( $maxsize );
123 
124  // allowedextensions
125  $allowedextensions = new ilTextInputGUI($this->lng->txt( "allowedextensions" ), "allowedextensions");
126  $allowedextensions->setInfo( $this->lng->txt( "allowedextensions_info" ) );
127  $allowedextensions->setValue( $this->object->getAllowedExtensions() );
128  $allowedextensions->setRequired( FALSE );
129  $form->addItem( $allowedextensions );
130 
131  // points
132  $points = new ilNumberInputGUI($this->lng->txt( "points" ), "points");
133  $points->allowDecimals(true);
134  $points->setValue( is_numeric( $this->object->getPoints() ) && $this->object->getPoints(
135  ) >= 0 ? $this->object->getPoints() : ''
136  );
137  $points->setRequired( TRUE );
138  $points->setSize( 3 );
139  $points->setMinValue( 0.0 );
140  $points->setMinvalueShouldBeGreater( false );
141  $form->addItem( $points );
142 
143  $subcompl = new ilCheckboxInputGUI($this->lng->txt( 'ass_completion_by_submission'
144  ), 'completion_by_submission');
145  $subcompl->setInfo( $this->lng->txt( 'ass_completion_by_submission_info' ) );
146  $subcompl->setValue( 1 );
147  $subcompl->setChecked( $this->object->isCompletionBySubmissionEnabled() );
148  $form->addItem( $subcompl );
149  return $form;
150  }
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
allowDecimals($a_value)
Toggle Decimals.
setInfo($a_info)
Set Information Text.
This class represents a number property in a property form.
This class represents a text property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setQuestionTabs()

assFileUploadGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Definition at line 409 of file class.assFileUploadGUI.php.

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

410  {
411  global $rbacsystem, $ilTabs;
412 
413  $ilTabs->clearTargets();
414 
415  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
416  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
417  $q_type = $this->object->getQuestionType();
418 
419  if (strlen($q_type))
420  {
421  $classname = $q_type . "GUI";
422  $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
423  $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
424  }
425 
426  if ($_GET["q_id"])
427  {
428  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
429  {
430  // edit page
431  $ilTabs->addTarget("edit_page",
432  $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
433  array("edit", "insert", "exec_pg"),
434  "", "", $force_active);
435  }
436 
437  $this->addTab_QuestionPreview($ilTabs);
438  }
439 
440  $force_active = false;
441  if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
442  {
443  $url = "";
444  if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
445  // edit question properties
446  $ilTabs->addTarget("edit_question",
447  $url,
448  array("editQuestion", "save", "cancel", "saveEdit"),
449  $classname, "");
450  }
451 
452  // add tab for question feedback within common class assQuestionGUI
453  $this->addTab_QuestionFeedback($ilTabs);
454 
455  // add tab for question hint within common class assQuestionGUI
456  $this->addTab_QuestionHints($ilTabs);
457 
458  // add tab for question's suggested solution within common class assQuestionGUI
459  $this->addTab_SuggestedSolution($ilTabs, $classname);
460 
461  // Assessment of questions sub menu entry
462  if ($_GET["q_id"])
463  {
464  $ilTabs->addTarget("statistics",
465  $this->ctrl->getLinkTargetByClass($classname, "assessment"),
466  array("assessment"),
467  $classname, "");
468  }
469 
470  if (($_GET["calling_test"] > 0) || ($_GET["test_ref_id"] > 0))
471  {
472  $ref_id = $_GET["calling_test"];
473  if (strlen($ref_id) == 0) $ref_id = $_GET["test_ref_id"];
474 
475  global $___test_express_mode;
476 
477  if (!$_GET['test_express_mode'] && !$___test_express_mode) {
478  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
479  }
480  else {
482  $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), $link);
483  }
484  }
485  else
486  {
487  $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
488  }
489  }
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
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
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
+ Here is the call graph for this function:

◆ writePostData()

assFileUploadGUI::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 51 of file class.assFileUploadGUI.php.

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

52  {
53  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
54  if (!$hasErrors)
55  {
56  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
59  $this->saveTaxonomyAssignments();
60  return 0;
61  }
62  return 1;
63  }
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.
+ Here is the call graph for this function:

◆ writeQuestionSpecificPostData()

assFileUploadGUI::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 65 of file class.assFileUploadGUI.php.

References $_POST.

Referenced by writePostData().

66  {
67  $this->object->setPoints( $_POST["points"] );
68  $this->object->setMaxSize( $_POST["maxsize"] );
69  $this->object->setAllowedExtensions( $_POST["allowedextensions"] );
70  $this->object->setCompletionBySubmission( $_POST['completion_by_submission'] == 1 ? true : false );
71  }
$_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: