ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. 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...
 
 getFormEncodingType ()
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 getOutputMode ()
 
 setOutputMode ($outputMode)
 
 isPdfOutputMode ()
 
 isContentEditingOutputMode ()
 
 getNavigationGUI ()
 
 setNavigationGUI ($navigationGUI)
 
 setTaxonomyIds ($taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder ($questionHeaderBlockBuilder)
 
 setQuestionActionCmd ($questionActionCmd)
 
 getQuestionActionCmd ()
 
_getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
 _getGUIClassNameForId ($a_q_id)
 
 _getClassNameForQType ($q_type)
 
createQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation. More...
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="")
 output question page More...
 
 cancel ()
 cancel action More...
 
 originalSyncForm ($return_to="", $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 save question More...
 
 save ()
 save question More...
 
 saveReturn ()
 save question More...
 
 apply ()
 apply changes More...
 
 getContextPath ($cont_obj, $a_endnode_id, $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber ($nr)
 
 getSequenceNumber ()
 
 setQuestionCount ($a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage ($errormessage)
 
 addErrorMessage ($errormessage)
 
 outAdditionalOutput ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 getAsValueAttribute ($a_value)
 Returns a HTML value attribute. More...
 
 addNewIdListener (&$a_object, $a_method, $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners ($a_new_id)
 Call the new id listeners. More...
 
 addQuestionFormCommandButtons ($form)
 Add the command buttons of a question properties form. More...
 
 addBasicQuestionFormProperties ($form)
 Add basic question form properties: assessment: title, author, description, question, working time. More...
 
 getAnswerFeedbackOutput ($active_id, $pass)
 Returns the answer generic feedback depending on the results of the question. More...
 
 getGenericFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput ($active_id, $pass)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 showSuggestedSolution ()
 
 suggestedsolution ()
 Allows to add suggested solutions for questions. More...
 
 outSolutionExplorer ()
 
 saveSuggestedSolution ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, $classname)
 
 getEditQuestionTabCommands ()
 
 getSolutionOutput ( $active_id, $pass=NULL, $graphicalOutput=FALSE, $result_output=FALSE, $show_question_only=TRUE, $show_feedback=FALSE, $show_correct_solution=FALSE, $show_manual_scoring=FALSE, $show_question_text=TRUE)
 
 isAutosaveable ()
 
 getPreview ($show_question_only=FALSE, $showInlineFeedback=false)
 
 outQuestionForTest ( $formaction, $active_id, $pass, $is_question_postponed=FALSE, $user_post_solutions=FALSE, $show_specific_inline_feedback=FALSE)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession ($previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 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...
 
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 
- Data Fields inherited from assQuestionGUI
const FORM_MODE_EDIT = 'edit'
 
const FORM_MODE_ADJUST = 'adjust'
 
const FORM_ENCODING_URLENCODE = 'application/x-www-form-urlencoded'
 
const FORM_ENCODING_MULTIPART = 'multipart/form-data'
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
 $object
 
 $tpl
 
 $lng
 
 $error
 
 $errormessage
 
 $sequence_no
 sequence number in test More...
 
 $question_count
 question count in test More...
 
const PRESENTATION_CONTEXT_TEST = 'pContextTest'
 
const PRESENTATION_CONTEXT_RESULTS = 'pContextResults'
 
const OUTPUT_MODE_SCREEN = 'outModeScreen'
 
const OUTPUT_MODE_PDF = 'outModePdf'
 
const OUTPUT_MODE_CONTENT_EDITING = 'outModeUsrSol'
 
- Protected Member Functions inherited from assQuestionGUI
 writePostData ()
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 getPreviousSolutionProvidedMessage ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 isLastSolutionSubmitAuthorized ($active_id, $pass)
 fetches solutions from database and prefers intermediate solutions, but falls back to authorized solutions. More...
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_QuestionPreview (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 getTestOutputSolutions ($activeId, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 

Detailed Description

The 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$

@ilctrl_iscalledby 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.

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)

References assQuestionGUI\setErrorMessage().

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

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 }
echo;exit;}function LogoutNotification($SessionID) { global $ilDB; $q="SELECT session_id, data FROM usr_session WHERE expires > (\w+)\|/" PREG_SPLIT_NO_EMPTY PREG_SPLIT_DELIM_CAPTURE

References PREG_SPLIT_DELIM_CAPTURE.

Referenced by populateQuestionSpecificFormPart().

+ Here is the caller graph for this function:

◆ editQuestion()

assFileUploadGUI::editQuestion (   $checkonly = FALSE)

Creates an output of the edit form for the question.

@access public

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

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
93
94 $this->populateTaxonomyFormSection($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 }
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getQuestionTemplate()
get question template
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
This class represents a property form user interface.
$errors

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

Referenced by writePostData().

+ 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 521 of file class.assFileUploadGUI.php.

522 {
523 return array();
524 }

◆ 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 534 of file class.assFileUploadGUI.php.

535 {
536 // Empty implementation here since a feasible way to aggregate answer is not known.
537 return ''; //print_r($relevant_answers,true);
538 }

◆ getFormEncodingType()

assFileUploadGUI::getFormEncodingType ( )

Reimplemented from assQuestionGUI.

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

541 {
543 }

References assQuestionGUI\FORM_ENCODING_MULTIPART.

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

329 {
330 $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
331
332 if( is_object($this->getPreviewSession()) )
333 {
334 $files = $this->object->getPreviewFileUploads($this->getPreviewSession());
335 include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
336 $table_gui = new assFileUploadFileTableGUI(null , $this->getQuestionActionCmd(), 'ilAssQuestionPreview');
337 $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
338 $table_gui->setData($files);
339 $table_gui->init();
340 $template->setCurrentBlock("files");
341 $template->setVariable('FILES', $table_gui->getHTML());
342 $template->parseCurrentBlock();
343 }
344
345 if (strlen($this->object->getAllowedExtensions()))
346 {
347 $template->setCurrentBlock("allowed_extensions");
348 $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
349 $template->parseCurrentBlock();
350 }
351 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->question, TRUE));
352 $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
353 $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
354 $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
355 $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
356
357 $questionoutput = $template->get();
358 if (!$show_question_only)
359 {
360 // get page object output
361 $questionoutput = $this->getILIASPage($questionoutput);
362 }
363 return $questionoutput;
364 }
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR

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

+ 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

Reimplemented from assQuestionGUI.

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

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 include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
237 $table_gui = new assFileUploadFileTableGUI($this->getTargetGuiClass(), 'gotoquestion');
238 $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
239 $table_gui->setData($files);
240 $table_gui->init();
241 $table_gui->setRowTemplate("tpl.il_as_qpl_fileupload_file_view_row.html", "Modules/TestQuestionPool");
242 $table_gui->setSelectAllCheckbox("");
243 $table_gui->clearCommandButtons();
244 $table_gui->disable('select_all');
245 $table_gui->disable('numinfo');
246 $template->setCurrentBlock("files");
247 $template->setVariable('FILES', $table_gui->getHTML());
248 $template->parseCurrentBlock();
249 }
250
251 if (strlen($this->object->getAllowedExtensions()))
252 {
253 $template->setCurrentBlock("allowed_extensions");
254 $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
255 $template->parseCurrentBlock();
256 }
257 $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
258 $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
259 $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
260 $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
261
262 if (($active_id > 0) && (!$show_correct_solution))
263 {
264 $reached_points = $this->object->getReachedPoints($active_id, $pass);
265 if ($graphicalOutput)
266 {
267 // output of ok/not ok icons for user entered solutions
268 if ($reached_points == $this->object->getMaximumPoints())
269 {
270 $template->setCurrentBlock("icon_ok");
271 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
272 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
273 $template->parseCurrentBlock();
274 }
275 else
276 {
277 $template->setCurrentBlock("icon_ok");
278 if ($reached_points > 0)
279 {
280 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
281 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
282 }
283 else
284 {
285 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
286 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
287 }
288 $template->parseCurrentBlock();
289 }
290 }
291 }
292 else
293 {
294 $reached_points = $this->object->getPoints();
295 }
296
297 if ($result_output)
298 {
299 $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
300 $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
301 }
302 if ($show_question_text==true)
303 {
304 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
305 }
306 $questionoutput = $template->get();
307 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
308 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
309 if (strlen($feedback))
310 {
311 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
313 );
314
315 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
316 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
317 }
318 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
319 $solutionoutput = $solutiontemplate->get();
320 if (!$show_question_only)
321 {
322 // get page object output
323 $solutionoutput = $this->getILIASPage($solutionoutput);
324 }
325 return $solutionoutput;
326 }
hasCorrectSolution($activeId, $passIndex)
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $pass, ilObjTest\_getPass(), ilObjTest\_getUsePreviousAnswers(), ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\getAnswerFeedbackOutput(), assQuestionGUI\getILIASPage(), ilUtil\getImagePath(), assQuestionGUI\getQuestionActionCmd(), assQuestionGUI\getTargetGuiClass(), assQuestionGUI\hasCorrectSolution(), and assQuestionGUI\isTestPresentationContext().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assFileUploadGUI::getSpecificFeedbackOutput (   $active_id,
  $pass 
)

Returns the answer specific feedback for the question.

This method should be overwritten by the actual question.

Todo:
Mark this method abstract!
Parameters
integer$active_idActive ID of the user
integer$passActive pass
Returns
string HTML Code with the answer specific feedback @access public

Reimplemented from assQuestionGUI.

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

507 {
508 $output = "";
509 return $this->object->prepareTextareaOutput($output, TRUE);
510 }

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

369 {
370 // generate the question output
371 $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
372
373 if ($active_id)
374 {
375 // hey: prevPassSolutions - obsolete due to central check
376 #$solutions = NULL;
377 #include_once "./Modules/Test/classes/class.ilObjTest.php";
378 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
379 #{
380 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
381 #}
382 $files = $this->getTestOutputSolutions($active_id, $pass);
383 // hey.
384 include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
385 $table_gui = new assFileUploadFileTableGUI(null , $this->getQuestionActionCmd());
386 $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
387 $table_gui->setData($files);
388 $table_gui->init();
389 $template->setCurrentBlock("files");
390 $template->setVariable('FILES', $table_gui->getHTML());
391 $template->parseCurrentBlock();
392 }
393
394 if (strlen($this->object->getAllowedExtensions()))
395 {
396 $template->setCurrentBlock("allowed_extensions");
397 $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
398 $template->parseCurrentBlock();
399 }
400 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->question, TRUE));
401 $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
402 $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
403 $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
404 $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
405
406 $questionoutput = $template->get();
407 if (!$show_question_only)
408 {
409 // get page object output
410 $questionoutput = $this->getILIASPage($questionoutput);
411 }
412 $questionoutput = $template->get();
413 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
414 return $pageoutput;
415 }
getTestOutputSolutions($activeId, $pass)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page

References $pass, assQuestionGUI\getILIASPage(), assQuestionGUI\getQuestionActionCmd(), assQuestionGUI\getTestOutputSolutions(), and assQuestionGUI\outQuestionPage().

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

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 }
This class represents a checkbox property in a property form.
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a text property in a property form.

References ilPropertyFormGUI\addItem(), and determineMaxFilesize().

Referenced by editQuestion().

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

@access public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

Reimplemented from assQuestionGUI.

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

425 {
426 global $rbacsystem, $ilTabs;
427
428 $ilTabs->clearTargets();
429
430 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
431 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
432 $q_type = $this->object->getQuestionType();
433
434 if (strlen($q_type))
435 {
436 $classname = $q_type . "GUI";
437 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
438 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
439 }
440
441 if ($_GET["q_id"])
442 {
443 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
444 {
445 // edit page
446 $ilTabs->addTarget("edit_page",
447 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
448 array("edit", "insert", "exec_pg"),
449 "", "", $force_active);
450 }
451
452 $this->addTab_QuestionPreview($ilTabs);
453 }
454
455 $force_active = false;
456 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
457 {
458 $url = "";
459 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
460 // edit question properties
461 $ilTabs->addTarget("edit_question",
462 $url,
463 array("editQuestion", "save", "cancel", "saveEdit"),
464 $classname, "");
465 }
466
467 // add tab for question feedback within common class assQuestionGUI
468 $this->addTab_QuestionFeedback($ilTabs);
469
470 // add tab for question hint within common class assQuestionGUI
471 $this->addTab_QuestionHints($ilTabs);
472
473 // add tab for question's suggested solution within common class assQuestionGUI
474 $this->addTab_SuggestedSolution($ilTabs, $classname);
475
476 // Assessment of questions sub menu entry
477 if ($_GET["q_id"])
478 {
479 $ilTabs->addTarget("statistics",
480 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
481 array("assessment"),
482 $classname, "");
483 }
484
485 if (($_GET["calling_test"] > 0) || ($_GET["test_ref_id"] > 0))
486 {
487 $ref_id = $_GET["calling_test"];
488 if (strlen($ref_id) == 0) $ref_id = $_GET["test_ref_id"];
489
490 global $___test_express_mode;
491
492 if (!$_GET['test_express_mode'] && !$___test_express_mode) {
493 $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
494 }
495 else {
497 $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), $link);
498 }
499 }
500 else
501 {
502 $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
503 }
504 }
$_GET["client_id"]
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
static getReturnToPageLink($q_id=null)
$ref_id
Definition: sahs_server.php:39
$url
Definition: shib_logout.php:72

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

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

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

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

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

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

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

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