ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 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 ()
 
 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 ()
 
 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...
 

Data Fields

const REUSE_FILES_TBL_POSTVAR = 'reusefiles'
 
const DELETE_FILES_TBL_POSTVAR = 'deletefiles'
 
- 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 Member Functions

 writePostData ($always=false)
 {Evaluates a posted edit form and writes the form data in the question object.
Returns
integer A positive value, if one of the required fields wasn't set, else 0
} More...
 
 buildFileTableDeleteButtonInstance ()
 
 buildFileTableReuseButtonInstance ()
 
 buildTestPresentationFileTableCommandButtonInstance ()
 
 getTestPresentationFileTablePostVar ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
- 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...
 
- Protected Attributes inherited from assQuestionGUI
 $editForm
 

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 @ilCtrl_Calls assFileUploadGUI: ilFormPropertyDispatchGUI

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

36 {
37 parent::__construct();
38 include_once "./Modules/TestQuestionPool/classes/class.assFileUpload.php";
39 $this->object = new assFileUpload();
40 $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
41 if ($id >= 0)
42 {
43 $this->object->loadFromDb($id);
44 }
45 }
Class for file upload questions.
setErrorMessage($errormessage)

References assQuestionGUI\setErrorMessage().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildFileTableDeleteButtonInstance()

assFileUploadGUI::buildFileTableDeleteButtonInstance ( )
protected
Returns
ilAssFileUploadFileTableDeleteButton

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

562 {
563 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableDeleteButton.php';
565 }

References ilAssFileUploadFileTableDeleteButton\getInstance().

Referenced by buildTestPresentationFileTableCommandButtonInstance(), and getPreview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFileTableReuseButtonInstance()

assFileUploadGUI::buildFileTableReuseButtonInstance ( )
protected
Returns
ilAssFileUploadFileTableReuseButton

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

571 {
572 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableReuseButton.php';
574 }

References ilAssFileUploadFileTableReuseButton\getInstance().

Referenced by buildTestPresentationFileTableCommandButtonInstance().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTestPresentationFileTableCommandButtonInstance()

assFileUploadGUI::buildTestPresentationFileTableCommandButtonInstance ( )
protected
Returns
ilAssFileUploadFileTableCommandButton

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

580 {
581 if( $this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled() )
582 {
583 return $this->buildFileTableReuseButtonInstance();
584 }
585
587 }

References buildFileTableDeleteButtonInstance(), and buildFileTableReuseButtonInstance().

Referenced by getTestOutput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineMaxFilesize()

assFileUploadGUI::determineMaxFilesize ( )
Returns
mixed

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

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

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

539 {
540 return array();
541 }

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

552 {
553 // Empty implementation here since a feasible way to aggregate answer is not known.
554 return ''; //print_r($relevant_answers,true);
555 }

◆ getFormEncodingType()

assFileUploadGUI::getFormEncodingType ( )

Reimplemented from assQuestionGUI.

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

613 {
615 }

References assQuestionGUI\FORM_ENCODING_MULTIPART.

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

336 {
337 $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
338
339 if( is_object($this->getPreviewSession()) )
340 {
341 $files = $this->object->getPreviewFileUploads($this->getPreviewSession());
342 include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
343 $table_gui = new assFileUploadFileTableGUI(null , $this->getQuestionActionCmd(), 'ilAssQuestionPreview');
344 $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
345 $table_gui->setData($files);
346 // hey: prevPassSolutions - support file reuse with table
347 $table_gui->initCommand(
350 );
351 // hey.
352 $template->setCurrentBlock("files");
353 $template->setVariable('FILES', $table_gui->getHTML());
354 $template->parseCurrentBlock();
355 }
356
357 if (strlen($this->object->getAllowedExtensions()))
358 {
359 $template->setCurrentBlock("allowed_extensions");
360 $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
361 $template->parseCurrentBlock();
362 }
363 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->question, TRUE));
364 $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
365 $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
366 $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
367 $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
368
369 $questionoutput = $template->get();
370 if (!$show_question_only)
371 {
372 // get page object output
373 $questionoutput = $this->getILIASPage($questionoutput);
374 }
375 return $questionoutput;
376 }
$files
Definition: add-vimline.php:18
getILIASPage($html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR

References $files, buildFileTableDeleteButtonInstance(), assFileUpload\DELETE_FILES_TBL_POSTVAR, assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), and assQuestionGUI\getQuestionActionCmd().

+ Here is the call graph for this function:

◆ getPreviousSolutionConfirmationCheckboxHtml()

assFileUploadGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

Reimplemented from assQuestionGUI.

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

607 {
608 return '';
609 }

◆ getPreviousSolutionProvidedMessage()

assFileUploadGUI::getPreviousSolutionProvidedMessage ( )
protected

Reimplemented from assQuestionGUI.

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

602 {
603 return $this->lng->txt('use_previous_solution_advice_file_upload');
604 }

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

221 {
222 // get the solution of the user for the active pass or from the last pass if allowed
223 $template = new ilTemplate("tpl.il_as_qpl_fileupload_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
224
225 $solutionvalue = "";
226 if (($active_id > 0) && (!$show_correct_solution))
227 {
228 $solutions =& $this->object->getSolutionValues($active_id, $pass);
229 include_once "./Modules/Test/classes/class.ilObjTest.php";
230 if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
231 {
232 if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
233 }
234 $solutions =& $this->object->getSolutionValues($active_id, $pass);
235
236 $files = ($show_manual_scoring) ? $this->object->getUploadedFilesForWeb($active_id, $pass) : $this->object->getUploadedFiles($active_id, $pass);
237 include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
238 $table_gui = new assFileUploadFileTableGUI($this->getTargetGuiClass(), 'gotoquestion');
239 $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
240 $table_gui->setData($files);
241 // hey: prevPassSolutions - table refactored
242 #$table_gui->initCommand(
243 #$this->buildFileTableDeleteButtonInstance(), assFileUploadGUI::DELETE_FILES_TBL_POSTVAR
244 #);
245 // hey.
246 $table_gui->setRowTemplate("tpl.il_as_qpl_fileupload_file_view_row.html", "Modules/TestQuestionPool");
247 $table_gui->setSelectAllCheckbox("");
248 // hey: prevPassSolutions - table refactored
249 #$table_gui->clearCommandButtons();
250 #$table_gui->disable('select_all');
251 // hey.
252 $table_gui->disable('numinfo');
253 $template->setCurrentBlock("files");
254 $template->setVariable('FILES', $table_gui->getHTML());
255 $template->parseCurrentBlock();
256 }
257
258 if (strlen($this->object->getAllowedExtensions()))
259 {
260 $template->setCurrentBlock("allowed_extensions");
261 $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
262 $template->parseCurrentBlock();
263 }
264 $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
265 $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
266 $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
267 $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
268
269 if (($active_id > 0) && (!$show_correct_solution))
270 {
271 $reached_points = $this->object->getReachedPoints($active_id, $pass);
272 if ($graphicalOutput)
273 {
274 // output of ok/not ok icons for user entered solutions
275 if ($reached_points == $this->object->getMaximumPoints())
276 {
277 $template->setCurrentBlock("icon_ok");
278 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
279 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
280 $template->parseCurrentBlock();
281 }
282 else
283 {
284 $template->setCurrentBlock("icon_ok");
285 if ($reached_points > 0)
286 {
287 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
288 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
289 }
290 else
291 {
292 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
293 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
294 }
295 $template->parseCurrentBlock();
296 }
297 }
298 }
299 else
300 {
301 $reached_points = $this->object->getPoints();
302 }
303
304 if ($result_output)
305 {
306 $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
307 $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
308 }
309 if ($show_question_text==true)
310 {
311 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
312 }
313 $questionoutput = $template->get();
314 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
315 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getAnswerFeedbackOutput($active_id, $pass) : "";
316 if (strlen($feedback))
317 {
318 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
320 );
321
322 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
323 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
324 }
325 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
326 $solutionoutput = $solutiontemplate->get();
327 if (!$show_question_only)
328 {
329 // get page object output
330 $solutionoutput = $this->getILIASPage($solutionoutput);
331 }
332 return $solutionoutput;
333 }
sprintf('%.4f', $callTime)
hasCorrectSolution($activeId, $passIndex)
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
static _getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
static _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 $files, $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(), assQuestionGUI\isTestPresentationContext(), and sprintf.

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

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

References $output.

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

381 {
382 // generate the question output
383 $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
384
385 if ($active_id)
386 {
387 // hey: prevPassSolutions - obsolete due to central check
388 #$solutions = NULL;
389 #include_once "./Modules/Test/classes/class.ilObjTest.php";
390 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
391 #{
392 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
393 #}
394 $files = $this->object->getTestOutputSolutions($active_id, $pass);
395 // hey.
396 include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
397 $table_gui = new assFileUploadFileTableGUI(null , $this->getQuestionActionCmd());
398 $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
399 $table_gui->setData($files);
400 // hey: prevPassSolutions - support file reuse with table
401 $table_gui->initCommand(
404 );
405 // hey.
406 $template->setCurrentBlock("files");
407 $template->setVariable('FILES', $table_gui->getHTML());
408 $template->parseCurrentBlock();
409 }
410
411 if (strlen($this->object->getAllowedExtensions()))
412 {
413 $template->setCurrentBlock("allowed_extensions");
414 $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
415 $template->parseCurrentBlock();
416 }
417 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->question, TRUE));
418 $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
419 $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
420 $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
421 $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
422
423 $questionoutput = $template->get();
424 if (!$show_question_only)
425 {
426 // get page object output
427 $questionoutput = $this->getILIASPage($questionoutput);
428 }
429 $questionoutput = $template->get();
430 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
431 return $pageoutput;
432 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page

References $files, $pass, buildTestPresentationFileTableCommandButtonInstance(), assQuestionGUI\getILIASPage(), assQuestionGUI\getQuestionActionCmd(), getTestPresentationFileTablePostVar(), and assQuestionGUI\outQuestionPage().

+ Here is the call graph for this function:

◆ getTestPresentationFileTablePostVar()

assFileUploadGUI::getTestPresentationFileTablePostVar ( )
protected

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

590 {
591 if( $this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled() )
592 {
594 }
595
597 }

References assFileUpload\DELETE_FILES_TBL_POSTVAR, and assFileUpload\REUSE_FILES_TBL_POSTVAR.

Referenced by getTestOutput().

+ Here is the caller 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 113 of file class.assFileUploadGUI.php.

114 {
115 // maxsize
116 $maxsize = new ilNumberInputGUI($this->lng->txt( "maxsize" ), "maxsize");
117 $maxsize->setValue( $this->object->getMaxSize() );
118 $maxsize->setInfo( $this->lng->txt( "maxsize_info" ) );
119 $maxsize->setSize( 10 );
120 $maxsize->setMinValue( 0 );
121 $maxsize->setMaxValue( $this->determineMaxFilesize() );
122 $maxsize->setRequired( FALSE );
123 $form->addItem( $maxsize );
124
125 // allowedextensions
126 $allowedextensions = new ilTextInputGUI($this->lng->txt( "allowedextensions" ), "allowedextensions");
127 $allowedextensions->setInfo( $this->lng->txt( "allowedextensions_info" ) );
128 $allowedextensions->setValue( $this->object->getAllowedExtensions() );
129 $allowedextensions->setRequired( FALSE );
130 $form->addItem( $allowedextensions );
131
132 // points
133 $points = new ilNumberInputGUI($this->lng->txt( "points" ), "points");
134 $points->allowDecimals(true);
135 $points->setValue( is_numeric( $this->object->getPoints() ) && $this->object->getPoints(
136 ) >= 0 ? $this->object->getPoints() : ''
137 );
138 $points->setRequired( TRUE );
139 $points->setSize( 3 );
140 $points->setMinValue( 0.0 );
141 $points->setMinvalueShouldBeGreater( false );
142 $form->addItem( $points );
143
144 $subcompl = new ilCheckboxInputGUI($this->lng->txt( 'ass_completion_by_submission'
145 ), 'completion_by_submission');
146 $subcompl->setInfo( $this->lng->txt( 'ass_completion_by_submission_info' ) );
147 $subcompl->setValue( 1 );
148 $subcompl->setChecked( $this->object->isCompletionBySubmissionEnabled() );
149 $form->addItem( $subcompl );
150 return $form;
151 }
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 441 of file class.assFileUploadGUI.php.

442 {
443 global $rbacsystem, $ilTabs;
444
445 $ilTabs->clearTargets();
446
447 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
448 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
449 $q_type = $this->object->getQuestionType();
450
451 if (strlen($q_type))
452 {
453 $classname = $q_type . "GUI";
454 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
455 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
456 }
457
458 if ($_GET["q_id"])
459 {
460 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
461 {
462 // edit page
463 $ilTabs->addTarget("edit_page",
464 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
465 array("edit", "insert", "exec_pg"),
466 "", "", $force_active);
467 }
468
469 $this->addTab_QuestionPreview($ilTabs);
470 }
471
472 $force_active = false;
473 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
474 {
475 $url = "";
476 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
477 // edit question properties
478 $ilTabs->addTarget("edit_question",
479 $url,
480 array("editQuestion", "save", "cancel", "saveEdit"),
481 $classname, "");
482 }
483
484 // add tab for question feedback within common class assQuestionGUI
485 $this->addTab_QuestionFeedback($ilTabs);
486
487 // add tab for question hint within common class assQuestionGUI
488 $this->addTab_QuestionHints($ilTabs);
489
490 // add tab for question's suggested solution within common class assQuestionGUI
491 $this->addTab_SuggestedSolution($ilTabs, $classname);
492
493 // Assessment of questions sub menu entry
494 if ($_GET["q_id"])
495 {
496 $ilTabs->addTarget("statistics",
497 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
498 array("assessment"),
499 $classname, "");
500 }
501
502 if (($_GET["calling_test"] > 0) || ($_GET["test_ref_id"] > 0))
503 {
504 $ref_id = $_GET["calling_test"];
505 if (strlen($ref_id) == 0) $ref_id = $_GET["test_ref_id"];
506
507 global $___test_express_mode;
508
509 if (!$_GET['test_express_mode'] && !$___test_express_mode) {
510 $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
511 }
512 else {
514 $ilTabs->setBackTarget($this->lng->txt("backtocallingtest"), $link);
515 }
516 }
517 else
518 {
519 $ilTabs->setBackTarget($this->lng->txt("qpl"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
520 }
521 }
$_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)
protected

{Evaluates a posted edit form and writes the form data in the question object.

Returns
integer A positive value, if one of the required fields wasn't set, else 0
}

Reimplemented from assQuestionGUI.

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

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

65 {
66 $this->object->setPoints( $_POST["points"] );
67 $this->object->setMaxSize( $_POST["maxsize"] );
68 $this->object->setAllowedExtensions( $_POST["allowedextensions"] );
69 $this->object->setCompletionBySubmission( $_POST['completion_by_submission'] == 1 ? true : false );
70 }
$_POST["username"]

References $_POST.

Referenced by writePostData().

+ Here is the caller graph for this function:

Field Documentation

◆ DELETE_FILES_TBL_POSTVAR

const assFileUploadGUI::DELETE_FILES_TBL_POSTVAR = 'deletefiles'

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

◆ REUSE_FILES_TBL_POSTVAR

const assFileUploadGUI::REUSE_FILES_TBL_POSTVAR = 'reusefiles'

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


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