ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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...
 
 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)
 
 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 ()
 
 geCommentsPanelHTML ()
 
 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)
 
 renderSolutionOutput (mixed $user_solutions, int $active_id, int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false,)
 
 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)
 
 isInLearningModuleContext ()
 
 setInLearningModuleContext (bool $flag)
 
 getAutoSavedSolutionOutput (int $active_id, int $pass, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_autosave_title=false, bool $show_inline_feedback=false)
 

Data Fields

const REUSE_FILES_TBL_POSTVAR = 'reusefiles'
 
const REUSE_FILES_LANGVAR = 'ass_file_upload_reuse_btn'
 
const REUSE_FILES_ACTION = 'reuse'
 
const DELETE_FILES_TBL_POSTVAR = 'deletefiles'
 
const DELETE_FILES_LANGVAR = 'delete'
 
const DELETE_FILES_ACTION = 'delete'
 
- 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)
 {} More...
 
 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)
 
 getTypeOptions ()
 
 createSuggestedSolutionLinkingTo (string $type, string $target)
 
 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)
 
 getSuggestedSolutionsRepo ()
 
 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 Member Functions

 getCommandButtonLangVarAndAction ()
 

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 (?string $txt_output, bool $prepare_for_latex_output=false, bool $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_CANCEL = 'cancelSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_SAVE = 'saveSuggestedSolution'
 
const SUGGESTED_SOLUTION_COMMANDS_DEFAULT = 'suggestedsolution'
 
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
ilLogger $logger
 
ILIAS TestQuestionPool QuestionInfoService $questioninfo
 
ILIAS Notes GUIService $notes_gui
 
ilCtrl $ctrl
 
Refinery $refinery
 
ilPropertyFormGUI $editForm
 
ILIAS TestQuestionPool InternalRequestService $request
 
bool $parent_type_is_lm = false
 
assQuestionSuggestedSolutionsDatabaseRepository $suggestedsolution_repo = null
 

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$

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

References $id, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\lng(), and assQuestionGUI\setErrorMessage().

54  {
56 
57  $this->object = new assFileUpload();
58  $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
59  if ($id >= 0) {
60  $this->object->loadFromDb($id);
61  }
62  }
Class for file upload questions.
__construct(VocabulariesInterface $vocabularies)
setErrorMessage(string $errormessage)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

Member Function Documentation

◆ editQuestion()

assFileUploadGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

public

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

References assQuestionGUI\addBasicQuestionFormProperties(), assQuestionGUI\addQuestionFormCommandButtons(), ILIAS\Repository\ctrl(), assQuestionGUI\getQuestionTemplate(), assQuestionGUI\isSaveCommand(), assQuestionGUI\outQuestionType(), populateQuestionSpecificFormPart(), and assQuestionGUI\populateTaxonomyFormSection().

Referenced by writePostData().

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

389  : array
390  {
391  return [];
392  }

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

400  : string
401  {
402  // Empty implementation here since a feasible way to aggregate answer is not known.
403  return ''; //print_r($relevant_answers,true);
404  }

◆ getCommandButtonLangVarAndAction()

assFileUploadGUI::getCommandButtonLangVarAndAction ( )
private

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

References ILIAS\Repository\object().

Referenced by getPreview(), and getTestOutput().

366  : array
367  {
368  if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
369  return [self::REUSE_FILES_LANGVAR, self::REUSE_FILES_ACTION];
370  }
371  return [self::DELETE_FILES_LANGVAR, self::DELETE_FILES_ACTION];
372  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFormEncodingType()

assFileUploadGUI::getFormEncodingType ( )

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

428  : string
429  {
430  return self::FORM_ENCODING_MULTIPART;
431  }

◆ getPreview()

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

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

References assFileUpload\DELETE_FILES_TBL_POSTVAR, getCommandButtonLangVarAndAction(), assQuestionGUI\getILIASPage(), assQuestionGUI\getPreviewSession(), assQuestionGUI\getQuestionActionCmd(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

271  : string
272  {
273  $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html", true, true, "Modules/TestQuestionPool");
274 
275  if (is_object($this->getPreviewSession())) {
276  $files = $this->object->getPreviewFileUploads($this->getPreviewSession());
277  $table_gui = new assFileUploadFileTableGUI(null, $this->getQuestionActionCmd(), 'ilAssQuestionPreview');
278  $table_gui->setTitle(
279  $this->lng->txt('already_delivered_files'),
280  'standard/icon_file.svg',
281  $this->lng->txt('already_delivered_files')
282  );
283  $table_gui->setData($files);
284  // hey: prevPassSolutions - support file reuse with table
285 
286  list($lang_var, $cmd) = $this->getCommandButtonLangVarAndAction();
287  $table_gui->initCommand(
288  $lang_var,
289  $cmd,
291  );
292  // hey.
293  $template->setCurrentBlock("files");
294  $template->setVariable('FILES', $table_gui->getHTML());
295  $template->parseCurrentBlock();
296  }
297 
298  if ($this->object->getAllowedExtensions() !== '') {
299  $template->setCurrentBlock("allowed_extensions");
300  $template->setVariable("TXT_ALLOWED_EXTENSIONS", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
301  $template->parseCurrentBlock();
302  }
303  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
304  $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
305  $template->setVariable("TEXT_UPLOAD", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt('upload')));
306  $template->setVariable("TXT_UPLOAD_FILE", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt('file_add')));
307  $template->setVariable("TXT_MAX_SIZE", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
308 
309  $questionoutput = $template->get();
310  if (!$show_question_only) {
311  // get page object output
312  $questionoutput = $this->getILIASPage($questionoutput);
313  }
314  return $questionoutput;
315  }
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.
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:

◆ getPreviousSolutionConfirmationCheckboxHtml()

assFileUploadGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

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

422  : string
423  {
424  return '';
425  }

◆ getPreviousSolutionProvidedMessage()

assFileUploadGUI::getPreviousSolutionProvidedMessage ( )
protected

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

References ILIAS\Repository\lng().

417  : string
418  {
419  return $this->lng->txt('use_previous_solution_advice_file_upload');
420  }
+ 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

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

References ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, assQuestionGUI\generateCorrectnessIconsForCorrectness(), assQuestionGUI\getGenericFeedbackOutput(), assQuestionGUI\getILIASPage(), assQuestionGUI\hasCorrectSolution(), assQuestionGUI\isTestPresentationContext(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

192  : string {
193  // get the solution of the user for the active pass or from the last pass if allowed
194  $template = new ilTemplate("tpl.il_as_qpl_fileupload_output_solution.html", true, true, "Modules/TestQuestionPool");
195 
196  $solutionvalue = "";
197  if (($active_id > 0) && (!$show_correct_solution)) {
198  $solutions = $this->object->getSolutionValues($active_id, $pass);
199 
200  $files = ($show_manual_scoring) ? $this->object->getUploadedFilesForWeb($active_id, $pass) : $this->object->getUploadedFiles($active_id, $pass);
201  $table_gui = new assFileUploadFileTableGUI($this, 'gotoquestion');
202  $table_gui->setTitle(
203  $this->lng->txt('already_delivered_files'),
204  'standard/icon_file.svg',
205  $this->lng->txt('already_delivered_files')
206  );
207  $table_gui->setData($files);
208  $table_gui->setRowTemplate("tpl.il_as_qpl_fileupload_file_view_row.html", "Modules/TestQuestionPool");
209  $table_gui->setSelectAllCheckbox("");
210  $table_gui->disable('numinfo');
211  $template->setCurrentBlock("files");
212  $template->setVariable('FILES', $table_gui->getHTML());
213  $template->parseCurrentBlock();
214  }
215 
216  if ($this->object->getAllowedExtensions() === '') {
217  $template->setCurrentBlock("allowed_extensions");
218  $template->setVariable("TXT_ALLOWED_EXTENSIONS", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
219  $template->parseCurrentBlock();
220  }
221  $template->setVariable("CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
222  $template->setVariable("TEXT_UPLOAD", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt('upload')));
223  $template->setVariable("TXT_UPLOAD_FILE", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt('file_add')));
224  $template->setVariable("TXT_MAX_SIZE", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
225 
226  if (($active_id > 0) && (!$show_correct_solution)) {
227  $reached_points = $this->object->getReachedPoints($active_id, $pass);
228  if ($graphicalOutput) {
229  $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_NOT_OK);
230  if ($reached_points == $this->object->getMaximumPoints()) {
231  $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_OK);
232  } elseif ($reached_points > 0) {
233  $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_MOSTLY_OK);
234  }
235  $template->setCurrentBlock("icon_ok");
236  $template->setVariable("ICON_OK", $correctness_icon);
237  $template->parseCurrentBlock();
238  }
239  } else {
240  $reached_points = $this->object->getPoints();
241  }
242 
243  if ($result_output) {
244  $resulttext = ($reached_points == 1) ? "(%s " . $this->lng->txt("point") . ")" : "(%s " . $this->lng->txt("points") . ")";
245  $template->setVariable("RESULT_OUTPUT", sprintf($resulttext, $reached_points));
246  }
247  if ($show_question_text == true) {
248  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
249  }
250  $questionoutput = $template->get();
251  $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
252  $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getGenericFeedbackOutput((int) $active_id, $pass) : "";
253  if (strlen($feedback)) {
254  $cssClass = (
255  $this->hasCorrectSolution($active_id, $pass) ?
257  );
258 
259  $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
260  $solutiontemplate->setVariable("FEEDBACK", ilLegacyFormElementsUtil::prepareTextareaOutput($feedback, true));
261  }
262  $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
263  $solutionoutput = $solutiontemplate->get();
264  if (!$show_question_only) {
265  // get page object output
266  $solutionoutput = $this->getILIASPage($solutionoutput);
267  }
268  return $solutionoutput;
269  }
hasCorrectSolution($activeId, $passIndex)
generateCorrectnessIconsForCorrectness(int $correctness)
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.
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
getGenericFeedbackOutput(int $active_id, ?int $pass)
+ Here is the call graph for this function:

◆ getSpecificFeedbackOutput()

assFileUploadGUI::getSpecificFeedbackOutput ( array  $userSolution)

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

References ilLegacyFormElementsUtil\prepareTextareaOutput().

374  : string
375  {
376  $output = "";
378  }
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:

◆ getTestOutput()

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

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

References getCommandButtonLangVarAndAction(), assQuestionGUI\getILIASPage(), assQuestionGUI\getQuestionActionCmd(), getTestPresentationFileTablePostVar(), ILIAS\Repository\lng(), ILIAS\Repository\object(), assQuestionGUI\outQuestionPage(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

317  : string
318  {
319  // generate the question output
320  $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html", true, true, "Modules/TestQuestionPool");
321 
322  if ($active_id) {
323  $files = $this->object->getTestOutputSolutions($active_id, $pass);
324  // hey.
325  $table_gui = new assFileUploadFileTableGUI(null, $this->getQuestionActionCmd());
326  $table_gui->setTitle(
327  $this->lng->txt('already_delivered_files'),
328  'standard/icon_file.svg',
329  $this->lng->txt('already_delivered_files')
330  );
331  $table_gui->setData($files);
332 
333  list($lang_var, $cmd) = $this->getCommandButtonLangVarAndAction();
334  $table_gui->initCommand(
335  $lang_var,
336  $cmd,
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", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
348  $template->parseCurrentBlock();
349  }
350  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
351  $template->setVariable("CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
352  $template->setVariable("TEXT_UPLOAD", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt('upload')));
353  $template->setVariable("TXT_UPLOAD_FILE", ilLegacyFormElementsUtil::prepareTextareaOutput($this->lng->txt('file_add')));
354  $template->setVariable("TXT_MAX_SIZE", ilLegacyFormElementsUtil::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  $questionoutput = $template->get();
362  $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
363  return $pageoutput;
364  }
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.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:

◆ getTestPresentationFileTablePostVar()

assFileUploadGUI::getTestPresentationFileTablePostVar ( )
protected

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

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

Referenced by getTestOutput().

406  : string
407  {
408  if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
410  }
411 
413  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnswerFreuqencyStatisticSupported()

assFileUploadGUI::isAnswerFreuqencyStatisticSupported ( )

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

433  : bool
434  {
435  return false;
436  }

◆ populateCorrectionsFormProperties()

assFileUploadGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

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

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

438  : void
439  {
440  // points
441  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
442  $points->allowDecimals(true);
443  $points->setValue(
444  is_numeric($this->object->getPoints()) && $this->object->getPoints(
445  ) >= 0 ? $this->object->getPoints() : ''
446  );
447  $points->setRequired(true);
448  $points->setSize(3);
449  $points->setMinValue(0.0);
450  $points->setMinvalueShouldBeGreater(true);
451  $form->addItem($points);
452 
453  $subcompl = new ilCheckboxInputGUI($this->lng->txt(
454  'ass_completion_by_submission'
455  ), 'completion_by_submission');
456  $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
457  $subcompl->setValue(1);
458  $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
459  $form->addItem($subcompl);
460  }
+ 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 130 of file class.assFileUploadGUI.php.

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

Referenced by editQuestion().

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

◆ saveCorrectionsFormProperties()

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

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

References ilPropertyFormGUI\getInput().

465  : void
466  {
467  $this->object->setPoints((float) str_replace(',', '.', $form->getInput('points')));
468  $this->object->setCompletionBySubmission((bool) $form->getInput('completion_by_submission'));
469  }
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-...
+ Here is the call graph for this function:

◆ writePostData()

assFileUploadGUI::writePostData ( bool  $always = false)
protected

{}

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

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

67  : int
68  {
69  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
70  if (!$hasErrors) {
73  $this->saveTaxonomyAssignments();
74  return 0;
75  }
76  return 1;
77  }
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.
+ 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 79 of file class.assFileUploadGUI.php.

Referenced by writePostData().

79  : void
80  {
81  $this->object->setPoints((float) str_replace(',', '.', $_POST["points"]));
82  $this->object->setMaxSize($this->request->int('maxsize') !== 0 ? $this->request->int('maxsize') : null);
83  $this->object->setAllowedExtensions($_POST["allowedextensions"] ?? '');
84  $this->object->setCompletionBySubmission(isset($_POST['completion_by_submission']) && $_POST['completion_by_submission'] == 1);
85  }
+ Here is the caller graph for this function:

Field Documentation

◆ DELETE_FILES_ACTION

const assFileUploadGUI::DELETE_FILES_ACTION = 'delete'

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

Referenced by assFileUpload\isFileDeletionAction().

◆ DELETE_FILES_LANGVAR

const assFileUploadGUI::DELETE_FILES_LANGVAR = 'delete'

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

◆ DELETE_FILES_TBL_POSTVAR

const assFileUploadGUI::DELETE_FILES_TBL_POSTVAR = 'deletefiles'

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

◆ HANDLE_FILE_UPLOAD

const assFileUploadGUI::HANDLE_FILE_UPLOAD = 'handleFileUpload'
private

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

◆ REUSE_FILES_ACTION

const assFileUploadGUI::REUSE_FILES_ACTION = 'reuse'

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

◆ REUSE_FILES_LANGVAR

const assFileUploadGUI::REUSE_FILES_LANGVAR = 'ass_file_upload_reuse_btn'

Definition at line 38 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: