ILIAS  release_8 Revision v8.24
assFileUploadGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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)
 
 getSpecificFeedbackOutput (array $userSolution)
 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 (array $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 ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 hasInlineFeedback ()
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext (string $presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled (bool $previousSolutionPrefilled)
 
 getRenderPurpose ()
 
 setRenderPurpose (string $renderPurpose)
 
 isRenderPurposePrintPdf ()
 
 isRenderPurposePreview ()
 
 isRenderPurposeInputValue ()
 
 isRenderPurposePlayback ()
 
 isRenderPurposeDemoplay ()
 
 renderPurposeSupportsFormHtml ()
 
 getEditContext ()
 
 setEditContext (string $editContext)
 
 isAuthoringEditContext ()
 
 isAdjustmentEditContext ()
 
 setAdjustmentEditContext ()
 
 getNavigationGUI ()
 
 setNavigationGUI (?ilTestQuestionNavigationGUI $navigationGUI)
 
 setTaxonomyIds (array $taxonomyIds)
 
 getTaxonomyIds ()
 
 setTargetGui ($linkTargetGui)
 
 setTargetGuiClass ($targetGuiClass)
 
 getTargetGuiClass ()
 
 setQuestionHeaderBlockBuilder (\ilQuestionHeaderBlockBuilder $questionHeaderBlockBuilder)
 
 getQuestionHeaderBlockBuilder ()
 
 setQuestionActionCmd (string $questionActionCmd)
 
 getQuestionActionCmd ()
 
 assessment ()
 
 populateJavascriptFilesRequiredForWorkForm (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 getQuestionTemplate ()
 
 getILIASPage (string $html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
 
 cancel ()
 
 originalSyncForm (string $return_to="", string $return_to_feedback='')
 
 sync ()
 
 cancelSync ()
 
 saveEdit ()
 
 save ()
 
 saveReturn ()
 
 apply ()
 
 getContextPath ($cont_obj, int $a_endnode_id, int $a_startnode_id=1)
 get context path in content object tree More...
 
 setSequenceNumber (int $nr)
 
 getSequenceNumber ()
 
 setQuestionCount (int $a_question_count)
 
 getQuestionCount ()
 
 getErrorMessage ()
 
 setErrorMessage (string $errormessage)
 
 addErrorMessage (string $errormessage)
 
 outAdditionalOutput ()
 Why are you here? Some magic for plugins? More...
 
 getQuestionType ()
 
 getAsValueAttribute (string $a_value)
 
 addNewIdListener ($a_object, string $a_method, string $a_parameters="")
 Add a listener that is notified with the new question ID, when a new question is saved. More...
 
 callNewIdListeners (int $a_new_id)
 
 addQuestionFormCommandButtons (ilPropertyFormGUI $form)
 
 addBasicQuestionFormProperties (ilPropertyFormGUI $form)
 
 getGenericFeedbackOutput (int $active_id, ?int $pass)
 
 getGenericFeedbackOutputForCorrectSolution ()
 
 getGenericFeedbackOutputForIncorrectSolution ()
 
 getSpecificFeedbackOutput (array $userSolution)
 Returns the answer specific feedback for the question. More...
 
 outQuestionType ()
 
 suggestedsolution ()
 
 outSolutionExplorer ()
 
 saveSuggestedSolutionType ()
 
 cancelExplorer ()
 
 outPageSelector ()
 
 outChapterSelector ()
 
 outGlossarySelector ()
 
 linkChilds ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 isSaveCommand ()
 
 setQuestionTabs ()
 
 addTab_SuggestedSolution (ilTabsGUI $tabs, string $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 (string $formaction, int $active_id, ?int $pass, bool $is_question_postponed=false, $user_post_solutions=false, bool $show_specific_inline_feedback=false)
 
 magicAfterTestOutput ()
 
 getTestOutput ( $active_id, $pass, $is_question_postponed, $user_post_solutions, $show_specific_inline_feedback)
 
 getFormEncodingType ()
 
 setPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 getPreviewSession ()
 
 showHints ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFrequencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 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 (array $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 CORRECTNESS_NOT_OK = 0
 
const CORRECTNESS_MOSTLY_OK = 1
 
const CORRECTNESS_OK = 2
 
const ALLOWED_PLAIN_TEXT_TAGS = "<em>, <strong>"
 sk - 12.05.2023: This const is also used in ilKprimChoiceWizardInputGUI. More...
 
const SESSION_PREVIEW_DATA_BASE_INDEX = 'ilAssQuestionPreviewAnswers'
 
assQuestion $object
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
 $error
 
string $errormessage
 
int $sequence_no
 sequence number in test More...
 
int $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 (bool $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
 hasSpecialQuestionCommands ()
 
 writePostData (bool $always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm (ilPropertyFormGUI $form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 addNumberOfTriesToFormIfNecessary (ilPropertyFormGUI $form)
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 genericFeedbackOutputBuilder (string $feedback_correct, string $feedback_incorrect, int $active_id, ?int $pass)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 
 addTab_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 generateCorrectnessIconsForCorrectness (int $correctness)
 
 cleanupAnswerText (array $answer_text, bool $is_rte)
 sk - 12.05.2023: This is one more of those that we need, but don't want. More...
 
 addSaveOnEnterOnLoadCode ()
 

Private Attributes

const HANDLE_FILE_UPLOAD = 'handleFileUpload'
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI (string $question_type='', int $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants (string $guiClassName, string $cmdConstantNameBegin='CMD_')
 
static prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output where latex code may be in it If the text is HTML-free, CHR(13) will be converted to a line break. More...
 
- Protected Attributes inherited from assQuestionGUI
const SUGGESTED_SOLUTION_COMMANDS
 
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
ILIAS Notes GUIService $notes_gui
 
ilCtrl $ctrl
 
ilPropertyFormGUI $editForm
 
ILIAS TestQuestionPool InternalRequestService $request
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 35 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 49 of file class.assFileUploadGUI.php.

50 {
52 include_once "./Modules/TestQuestionPool/classes/class.assFileUpload.php";
53 $this->object = new assFileUpload();
54 $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
55 if ($id >= 0) {
56 $this->object->loadFromDb($id);
57 }
58 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class for file upload questions.
setErrorMessage(string $errormessage)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $id, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and assQuestionGUI\setErrorMessage().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildFileTableDeleteButtonInstance()

assFileUploadGUI::buildFileTableDeleteButtonInstance ( )
protected
Returns
ilAssFileUploadFileTableDeleteButton

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

451 {
452 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableDeleteButton.php';
454 }

References ilAssFileUploadFileTableDeleteButton\getInstance().

+ Here is the call graph for this function:

◆ buildFileTableReuseButtonInstance()

assFileUploadGUI::buildFileTableReuseButtonInstance ( )
protected
Returns
ilAssFileUploadFileTableReuseButton

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

460 {
461 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableReuseButton.php';
463 }

References ilAssFileUploadFileTableReuseButton\getInstance().

+ Here is the call graph for this function:

◆ buildTestPresentationFileTableCommandButtonInstance()

assFileUploadGUI::buildTestPresentationFileTableCommandButtonInstance ( )
protected
Returns
ilAssFileUploadFileTableCommandButton

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

469 {
470 if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
471 return $this->buildFileTableReuseButtonInstance();
472 }
473
475 }

References ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ determineMaxFilesize()

assFileUploadGUI::determineMaxFilesize ( )

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

168 : int
169 {
170 //mbecker: Quick fix for mantis bug 8595: Change size file
171 $upload_max_filesize = get_cfg_var("upload_max_filesize");
172 // get the value for the maximal post data from the php.ini (if available)
173 $post_max_size = get_cfg_var("post_max_size");
174
175 //convert from short-string representation to "real" bytes
176 $multiplier_a = array( "K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024 );
177 $umf_parts = preg_split(
178 "/(\d+)([K|G|M])/",
179 $upload_max_filesize,
180 -1,
181 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
182 );
183 $pms_parts = preg_split(
184 "/(\d+)([K|G|M])/",
185 $post_max_size,
186 -1,
187 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
188 );
189
190 if (count($umf_parts) === 2) {
191 $upload_max_filesize = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
192 }
193
194 if (count($pms_parts) === 2) {
195 $post_max_size = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
196 }
197
198 // use the smaller one as limit
199 $max_filesize = min($upload_max_filesize, $post_max_size);
200
201 if (!$max_filesize) {
202 $max_filesize = max($upload_max_filesize, $post_max_size);
203 return $max_filesize;
204 }
205
206 return $max_filesize;
207 }

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

89 : bool
90 {
91 $save = $this->isSaveCommand();
92 $this->getQuestionTemplate();
93
94 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
95 $form = new ilPropertyFormGUI();
96 $this->editForm = $form;
97
98 $form->setFormAction($this->ctrl->getFormAction($this));
99 $form->setTitle($this->outQuestionType());
100 $form->setMultipart(false);
101 $form->setTableWidth("100%");
102 $form->setId("assfileupload");
103
104 $this->addBasicQuestionFormProperties($form);
106
107 $this->populateTaxonomyFormSection($form);
108 $this->addQuestionFormCommandButtons($form);
109
110 $errors = false;
111
112 if ($save) {
113 $form->setValuesByPost();
114 $errors = !$form->checkInput();
115 $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and
116 // we need this if we don't want to have duplication of backslashes
117 if ($errors) {
118 $checkonly = false;
119 }
120 }
121
122 if (!$checkonly) {
123 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
124 }
125 return $errors;
126 }
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
This class represents a property form user interface.
$errors
Definition: imgupload.php:65

References $errors, assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), ILIAS\Repository\ctrl(), 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 429 of file class.assFileUploadGUI.php.

429 : array
430 {
431 return array();
432 }

◆ getAggregatedAnswersView()

assFileUploadGUI::getAggregatedAnswersView ( array  $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 440 of file class.assFileUploadGUI.php.

440 : string
441 {
442 // Empty implementation here since a feasible way to aggregate answer is not known.
443 return ''; //print_r($relevant_answers,true);
444 }

◆ getFormEncodingType()

assFileUploadGUI::getFormEncodingType ( )

Reimplemented from assQuestionGUI.

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

499 : string
500 {
502 }

◆ getPreview()

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

Reimplemented from assQuestionGUI.

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

320 : string
321 {
322 $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html", true, true, "Modules/TestQuestionPool");
323
324 if (is_object($this->getPreviewSession())) {
325 $files = $this->object->getPreviewFileUploads($this->getPreviewSession());
326 include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
327 $table_gui = new assFileUploadFileTableGUI(null, $this->getQuestionActionCmd(), 'ilAssQuestionPreview');
328 $table_gui->setTitle(
329 $this->lng->txt('already_delivered_files'),
330 'icon_file.svg',
331 $this->lng->txt('already_delivered_files')
332 );
333 $table_gui->setData($files);
334 // hey: prevPassSolutions - support file reuse with table
335 $table_gui->initCommand(
338 );
339 // hey.
340 $template->setCurrentBlock("files");
341 $template->setVariable('FILES', $table_gui->getHTML());
342 $template->parseCurrentBlock();
343 }
344
345 if ($this->object->getAllowedExtensions() !== '') {
346 $template->setCurrentBlock("allowed_extensions");
347 $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
348 $template->parseCurrentBlock();
349 }
350 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
351 $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
352 $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
353 $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
354 $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
355
356 $questionoutput = $template->get();
357 if (!$show_question_only) {
358 // get page object output
359 $questionoutput = $this->getILIASPage($questionoutput);
360 }
361 return $questionoutput;
362 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
special template class to simplify handling of ITX/PEAR

References assFileUpload\DELETE_FILES_TBL_POSTVAR, ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getPreviousSolutionConfirmationCheckboxHtml()

assFileUploadGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

Reimplemented from assQuestionGUI.

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

493 : string
494 {
495 return '';
496 }

◆ getPreviousSolutionProvidedMessage()

assFileUploadGUI::getPreviousSolutionProvidedMessage ( )
protected

Reimplemented from assQuestionGUI.

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

488 : string
489 {
490 return $this->lng->txt('use_previous_solution_advice_file_upload');
491 }

References ILIAS\Repository\lng().

+ 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
string The solution output of the question as HTML code

Reimplemented from assQuestionGUI.

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

231 : string {
232 // get the solution of the user for the active pass or from the last pass if allowed
233 $template = new ilTemplate("tpl.il_as_qpl_fileupload_output_solution.html", true, true, "Modules/TestQuestionPool");
234
235 $solutionvalue = "";
236 if (($active_id > 0) && (!$show_correct_solution)) {
237 $solutions = $this->object->getSolutionValues($active_id, $pass);
238
239 $files = ($show_manual_scoring) ? $this->object->getUploadedFilesForWeb($active_id, $pass) : $this->object->getUploadedFiles($active_id, $pass);
240 include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
241 $table_gui = new assFileUploadFileTableGUI($this, 'gotoquestion');
242 $table_gui->setTitle(
243 $this->lng->txt('already_delivered_files'),
244 'icon_file.svg',
245 $this->lng->txt('already_delivered_files')
246 );
247 $table_gui->setData($files);
248 // hey: prevPassSolutions - table refactored
249 #$table_gui->initCommand(
250 #$this->buildFileTableDeleteButtonInstance(), assFileUploadGUI::DELETE_FILES_TBL_POSTVAR
251 #);
252 // hey.
253 $table_gui->setRowTemplate("tpl.il_as_qpl_fileupload_file_view_row.html", "Modules/TestQuestionPool");
254 $table_gui->setSelectAllCheckbox("");
255 // hey: prevPassSolutions - table refactored
256 #$table_gui->clearCommandButtons();
257 #$table_gui->disable('select_all');
258 // hey.
259 $table_gui->disable('numinfo');
260 $template->setCurrentBlock("files");
261 $template->setVariable('FILES', $table_gui->getHTML());
262 $template->parseCurrentBlock();
263 }
264
265 if (strlen($this->object->getAllowedExtensions())) {
266 $template->setCurrentBlock("allowed_extensions");
267 $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
268 $template->parseCurrentBlock();
269 }
270 $template->setVariable("CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
271 $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
272 $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
273 $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
274
275 if (($active_id > 0) && (!$show_correct_solution)) {
276 $reached_points = $this->object->getReachedPoints($active_id, $pass);
277 if ($graphicalOutput) {
278 $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_NOT_OK);
279 if ($reached_points == $this->object->getMaximumPoints()) {
280 $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_OK);
281 } elseif ($reached_points > 0) {
282 $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_MOSTLY_OK);
283 }
284 $template->setCurrentBlock("icon_ok");
285 $template->setVariable("ICON_OK", $correctness_icon);
286 $template->parseCurrentBlock();
287 }
288 } else {
289 $reached_points = $this->object->getPoints();
290 }
291
292 if ($result_output) {
293 $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
294 $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
295 }
296 if ($show_question_text == true) {
297 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
298 }
299 $questionoutput = $template->get();
300 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
301 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getGenericFeedbackOutput((int) $active_id, $pass) : "";
302 if (strlen($feedback)) {
303 $cssClass = (
304 $this->hasCorrectSolution($active_id, $pass) ?
306 );
307
308 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
309 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
310 }
311 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
312 $solutionoutput = $solutiontemplate->get();
313 if (!$show_question_only) {
314 // get page object output
315 $solutionoutput = $this->getILIASPage($solutionoutput);
316 }
317 return $solutionoutput;
318 }
getGenericFeedbackOutput(int $active_id, ?int $pass)
hasCorrectSolution($activeId, $passIndex)
generateCorrectnessIconsForCorrectness(int $correctness)

References ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assFileUploadGUI::getSpecificFeedbackOutput ( array  $userSolution)

Returns the answer specific feedback for the question.

Parameters
array$userSolution($userSolution[<value1>] = <value2>)

Reimplemented from assQuestionGUI.

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

414 : string
415 {
416 $output = "";
417 return $this->object->prepareTextareaOutput($output, true);
418 }

◆ getTestOutput()

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

Reimplemented from assQuestionGUI.

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

365 : string
366 // hey.
367 {
368 // generate the question output
369 $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html", true, true, "Modules/TestQuestionPool");
370
371 if ($active_id) {
372 $files = $this->object->getTestOutputSolutions($active_id, $pass);
373 // hey.
374 include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
375 $table_gui = new assFileUploadFileTableGUI(null, $this->getQuestionActionCmd());
376 $table_gui->setTitle(
377 $this->lng->txt('already_delivered_files'),
378 'icon_file.svg',
379 $this->lng->txt('already_delivered_files')
380 );
381 $table_gui->setData($files);
382 // hey: prevPassSolutions - support file reuse with table
383 $table_gui->initCommand(
386 );
387 // hey.
388 $template->setCurrentBlock("files");
389 $template->setVariable('FILES', $table_gui->getHTML());
390 $template->parseCurrentBlock();
391 }
392
393 if ($this->object->getAllowedExtensions() !== '') {
394 $template->setCurrentBlock("allowed_extensions");
395 $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
396 $template->parseCurrentBlock();
397 }
398 $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
399 $template->setVariable("CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
400 $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
401 $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
402 $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
403
404 $questionoutput = $template->get();
405 //if (!$show_question_only) {
406 // get page object output
407 $questionoutput = $this->getILIASPage($questionoutput);
408 //}
409 $questionoutput = $template->get();
410 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
411 return $pageoutput;
412 }
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)

References ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getTestPresentationFileTablePostVar()

assFileUploadGUI::getTestPresentationFileTablePostVar ( )
protected

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

477 : string
478 {
479 if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
481 }
482
484 }

References assFileUpload\DELETE_FILES_TBL_POSTVAR, ILIAS\Repository\object(), and assFileUpload\REUSE_FILES_TBL_POSTVAR.

+ Here is the call graph for this function:

◆ isAnswerFreuqencyStatisticSupported()

assFileUploadGUI::isAnswerFreuqencyStatisticSupported ( )

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

504 : bool
505 {
506 return false;
507 }

◆ populateCorrectionsFormProperties()

assFileUploadGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

Reimplemented from assQuestionGUI.

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

509 : void
510 {
511 // points
512 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
513 $points->allowDecimals(true);
514 $points->setValue(
515 is_numeric($this->object->getPoints()) && $this->object->getPoints(
516 ) >= 0 ? $this->object->getPoints() : ''
517 );
518 $points->setRequired(true);
519 $points->setSize(3);
520 $points->setMinValue(0.0);
521 $points->setMinvalueShouldBeGreater(true);
522 $form->addItem($points);
523
524 $subcompl = new ilCheckboxInputGUI($this->lng->txt(
525 'ass_completion_by_submission'
526 ), 'completion_by_submission');
527 $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
528 $subcompl->setValue(1);
529 $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
530 $form->addItem($subcompl);
531 }
This class represents a checkbox property in a property form.
This class represents a number property in a property form.

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

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

Implements ilGuiQuestionScoringAdjustable.

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

129 {
130 $maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize");
131 $maxsize->allowDecimals(false);
132 $maxsize->setValue($this->object->getMaxSize() > 0 ? (string) $this->object->getMaxSize() : null);
133 $maxsize->setInfo($this->lng->txt("maxsize_info"));
134 $maxsize->setSize(10);
135 $maxsize->setMinValue(0);
136 $maxsize->setMaxValue((float) $this->determineMaxFilesize());
137 $maxsize->setRequired(false);
138 $form->addItem($maxsize);
139
140 $allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions");
141 $allowedextensions->setInfo($this->lng->txt("allowedextensions_info"));
142 $allowedextensions->setValue($this->object->getAllowedExtensions());
143 $allowedextensions->setRequired(false);
144 $form->addItem($allowedextensions);
145
146 $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
147 $points->allowDecimals(true);
148 $points->setValue(
149 is_numeric($this->object->getPoints()) && $this->object->getPoints(
150 ) >= 0 ? $this->object->getPoints() : ''
151 );
152 $points->setRequired(true);
153 $points->setSize(3);
154 $points->setMinValue(0.0);
155 $points->setMinvalueShouldBeGreater(true);
156 $form->addItem($points);
157
158 $subcompl = new ilCheckboxInputGUI($this->lng->txt(
159 'ass_completion_by_submission'
160 ), 'completion_by_submission');
161 $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
162 $subcompl->setValue('1');
163 $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
164 $form->addItem($subcompl);
165 return $form;
166 }
This class represents a text property in a property form.

References ilPropertyFormGUI\addItem(), determineMaxFilesize(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by editQuestion().

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

◆ saveCorrectionsFormProperties()

assFileUploadGUI::saveCorrectionsFormProperties ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form

Reimplemented from assQuestionGUI.

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

536 : void
537 {
538 $this->object->setPoints((float) str_replace(',', '.', $form->getInput('points')));
539 $this->object->setCompletionBySubmission((bool) $form->getInput('completion_by_submission'));
540 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...

References ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ writePostData()

assFileUploadGUI::writePostData ( bool  $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 63 of file class.assFileUploadGUI.php.

63 : int
64 {
65 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
66 if (!$hasErrors) {
67 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
71 return 0;
72 }
73 return 1;
74 }
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.

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.

Implements ilGuiQuestionScoringAdjustable.

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

76 : void
77 {
78 $this->object->setPoints((float) str_replace(',', '.', $_POST["points"]));
79 $this->object->setMaxSize(($_POST['maxsize'] ?? null) ? (int) $_POST['maxsize'] : null);
80 $this->object->setAllowedExtensions($_POST["allowedextensions"]);
81 $this->object->setCompletionBySubmission(isset($_POST['completion_by_submission']) && $_POST['completion_by_submission'] == 1);
82 }

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

◆ HANDLE_FILE_UPLOAD

const assFileUploadGUI::HANDLE_FILE_UPLOAD = 'handleFileUpload'
private

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

◆ REUSE_FILES_TBL_POSTVAR

const assFileUploadGUI::REUSE_FILES_TBL_POSTVAR = 'reusefiles'

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


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