ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
assFileUploadGUI Class Reference

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

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

Public Member Functions

 __construct ($id=-1)
 assFileUploadGUI constructor More...
 
 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 ($userSolution)
 
 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 ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 
- Public Member Functions inherited from assQuestionGUI
 __construct ()
 assQuestionGUI constructor More...
 
 hasInlineFeedback ()
 this method can be overwritten per question type More...
 
 addHeaderAction ()
 
 redrawHeaderAction ()
 
 getHeaderAction ()
 
 getNotesHTML ()
 
 executeCommand ()
 execute command More...
 
 getType ()
 needed for page editor compliance More...
 
 getPresentationContext ()
 
 setPresentationContext ($presentationContext)
 
 isTestPresentationContext ()
 
 isPreviousSolutionPrefilled ()
 
 setPreviousSolutionPrefilled ($previousSolutionPrefilled)
 
 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 (ilGlobalTemplateInterface $tpl)
 
 getPresentationJavascripts ()
 
 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="", $inlineFeedbackEnabled=false)
 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 ($userSolution)
 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)
 
 supportsIntermediateSolutionOutput ()
 Question type specific support of intermediate solution output The function getSolutionOutput respects getUseIntermediateSolution() More...
 
 hasIntermediateSolution ($activeId, $passIndex)
 Check if the question has an intermediate solution. More...
 
 setUseIntermediateSolution ($use)
 
 getUseIntermediateSolution ()
 Get if intermediate solution should be used for solution output. More...
 
 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 ()
 
 buildFocusAnchorHtml ()
 
 isAnswerFreuqencyStatisticSupported ()
 
 getSubQuestionsIndex ()
 
 getAnswersFrequency ($relevantAnswers, $questionIndex)
 
 getAnswerFrequencyTableGUI ($parentGui, $parentCmd, $relevantAnswers, $questionIndex)
 
 prepareReprintableCorrectionsForm (ilPropertyFormGUI $form)
 
 populateCorrectionsFormProperties (ilPropertyFormGUI $form)
 
 saveCorrectionsFormProperties (ilPropertyFormGUI $form)
 

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
 
 $request
 
 $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)
 {} More...
 
 buildFileTableDeleteButtonInstance ()
 
 buildFileTableReuseButtonInstance ()
 
 buildTestPresentationFileTableCommandButtonInstance ()
 
 getTestPresentationFileTablePostVar ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
- Protected Member Functions inherited from assQuestionGUI
 hasSpecialQuestionCommands ()
 
 writePostData ($always=false)
 Evaluates a posted edit form and writes the form data in the question object. More...
 
 renderEditForm ($form)
 
 getUseUnchangedAnswerCheckboxHtml ()
 
 getPreviousSolutionProvidedMessage ()
 
 getPreviousSolutionConfirmationCheckboxHtml ()
 
 saveTaxonomyAssignments ()
 
 populateTaxonomyFormSection (ilPropertyFormGUI $form)
 
 setDefaultTabs (ilTabsGUI $ilTabs)
 
 setQuestionSpecificTabs (ilTabsGUI $ilTabs)
 
 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_Question (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 escapeTemplatePlaceholders (string $text)
 
 buildEditForm ()
 
 addSaveOnEnterOnLoadCode ()
 

Private Attributes

const HANDLE_FILE_UPLOAD = 'handleFileUpload'
 

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
const HAS_SPECIAL_QUESTION_COMMANDS = false
 
 $ctrl
 
 $editForm
 
 $use_intermediate_solution = false
 

Detailed Description

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

References ILIAS\GlobalScreen\Provider\__construct(), and assQuestionGUI\setErrorMessage().

37  {
39  include_once "./Modules/TestQuestionPool/classes/class.assFileUpload.php";
40  $this->object = new assFileUpload();
41  $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
42  if ($id >= 0) {
43  $this->object->loadFromDb($id);
44  }
45  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setErrorMessage($errormessage)
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ buildFileTableDeleteButtonInstance()

assFileUploadGUI::buildFileTableDeleteButtonInstance ( )
protected
Returns
ilAssFileUploadFileTableDeleteButton

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

References ilAssFileUploadFileTableDeleteButton\getInstance().

Referenced by buildTestPresentationFileTableCommandButtonInstance(), and getPreview().

455  {
456  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableDeleteButton.php';
458  }
+ 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 463 of file class.assFileUploadGUI.php.

References ilAssFileUploadFileTableReuseButton\getInstance().

Referenced by buildTestPresentationFileTableCommandButtonInstance().

464  {
465  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableReuseButton.php';
467  }
+ 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 472 of file class.assFileUploadGUI.php.

References buildFileTableDeleteButtonInstance(), and buildFileTableReuseButtonInstance().

Referenced by getTestOutput().

473  {
474  if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
475  return $this->buildFileTableReuseButtonInstance();
476  }
477 
478  return $this->buildFileTableDeleteButtonInstance();
479  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineMaxFilesize()

assFileUploadGUI::determineMaxFilesize ( )
Returns
mixed

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

Referenced by populateQuestionSpecificFormPart().

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

◆ editQuestion()

assFileUploadGUI::editQuestion (   $checkonly = false)

Creates an output of the edit form for the question.

public

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

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

Referenced by writePostData().

77  {
78  $save = $this->isSaveCommand();
79  $this->getQuestionTemplate();
80 
81  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
82  $form = new ilPropertyFormGUI();
83  $this->editForm = $form;
84 
85  $form->setFormAction($this->ctrl->getFormAction($this));
86  $form->setTitle($this->outQuestionType());
87  $form->setMultipart(false);
88  $form->setTableWidth("100%");
89  $form->setId("assfileupload");
90 
91  $this->addBasicQuestionFormProperties($form);
93 
94  $this->populateTaxonomyFormSection($form);
95  $this->addQuestionFormCommandButtons($form);
96 
97  $errors = false;
98 
99  if ($save) {
100  $form->setValuesByPost();
101  $errors = !$form->checkInput();
102  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and
103  // we need this if we don't want to have duplication of backslashes
104  if ($errors) {
105  $checkonly = false;
106  }
107  }
108 
109  if (!$checkonly) {
110  $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
111  }
112  return $errors;
113  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
$errors
Definition: imgupload.php:49
This class represents a property form user interface.
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAfterParticipationSuppressionQuestionPostVars()

assFileUploadGUI::getAfterParticipationSuppressionQuestionPostVars ( )

Returns a list of postvars which will be suppressed in the form output when used in scoring adjustment.

The form elements will be shown disabled, so the users see the usual form but can only edit the settings, which make sense in the given context.

E.g. array('cloze_type', 'image_filename')

Returns
string[]

Implements ilGuiQuestionScoringAdjustable.

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

432  {
433  return array();
434  }

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

445  {
446  // Empty implementation here since a feasible way to aggregate answer is not known.
447  return ''; //print_r($relevant_answers,true);
448  }

◆ getFormEncodingType()

assFileUploadGUI::getFormEncodingType ( )

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

504  {
505  return self::FORM_ENCODING_MULTIPART;
506  }

◆ getPreview()

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

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

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

324  {
325  $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html", true, true, "Modules/TestQuestionPool");
326 
327  if (is_object($this->getPreviewSession())) {
328  $files = $this->object->getPreviewFileUploads($this->getPreviewSession());
329  include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
330  $table_gui = new assFileUploadFileTableGUI(null, $this->getQuestionActionCmd(), 'ilAssQuestionPreview');
331  $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
332  $table_gui->setData($files);
333  // hey: prevPassSolutions - support file reuse with table
334  $table_gui->initCommand(
337  );
338  // hey.
339  $template->setCurrentBlock("files");
340  $template->setVariable('FILES', $table_gui->getHTML());
341  $template->parseCurrentBlock();
342  }
343 
344  if (strlen($this->object->getAllowedExtensions())) {
345  $template->setCurrentBlock("allowed_extensions");
346  $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
347  $template->parseCurrentBlock();
348  }
349  $template->setVariable("QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
350  $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
351  $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
352  $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
353  $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
354 
355  $questionoutput = $template->get();
356  if (!$show_question_only) {
357  // get page object output
358  $questionoutput = $this->getILIASPage($questionoutput);
359  }
360  return $questionoutput;
361  }
getILIASPage($html="")
Returns the ILIAS Page around a question.
+ Here is the call graph for this function:

◆ getPreviousSolutionConfirmationCheckboxHtml()

assFileUploadGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

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

498  {
499  return '';
500  }

◆ getPreviousSolutionProvidedMessage()

assFileUploadGUI::getPreviousSolutionProvidedMessage ( )
protected

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

493  {
494  return $this->lng->txt('use_previous_solution_advice_file_upload');
495  }

◆ getSolutionOutput()

assFileUploadGUI::getSolutionOutput (   $active_id,
  $pass = null,
  $graphicalOutput = false,
  $result_output = false,
  $show_question_only = true,
  $show_feedback = false,
  $show_correct_solution = false,
  $show_manual_scoring = false,
  $show_question_text = true 
)

Get the question solution output.

Parameters
integer$active_idThe active user id
integer$passThe test pass
boolean$graphicalOutputShow visual feedback for right/wrong answers
boolean$result_outputShow the reached points for parts of the question
boolean$show_question_onlyShow the question without the ILIAS content around
boolean$show_feedbackShow the question feedback
boolean$show_correct_solutionShow the correct solution instead of the user solution
boolean$show_manual_scoringShow specific information for the manual scoring output
Returns
The solution output of the question as HTML code

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

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

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

◆ getSpecificFeedbackOutput()

assFileUploadGUI::getSpecificFeedbackOutput (   $userSolution)

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

417  {
418  $output = "";
419  return $this->object->prepareTextareaOutput($output, true);
420  }

◆ getTestOutput()

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

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

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

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

◆ getTestPresentationFileTablePostVar()

assFileUploadGUI::getTestPresentationFileTablePostVar ( )
protected

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

References assFileUpload\DELETE_FILES_TBL_POSTVAR, and assFileUpload\REUSE_FILES_TBL_POSTVAR.

Referenced by getTestOutput().

482  {
483  if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
485  }
486 
488  }
+ Here is the caller graph for this function:

◆ isAnswerFreuqencyStatisticSupported()

assFileUploadGUI::isAnswerFreuqencyStatisticSupported ( )

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

509  {
510  return false;
511  }

◆ populateCorrectionsFormProperties()

assFileUploadGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

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

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

514  {
515  // points
516  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
517  $points->allowDecimals(true);
518  $points->setValue(
519  is_numeric($this->object->getPoints()) && $this->object->getPoints(
520  ) >= 0 ? $this->object->getPoints() : ''
521  );
522  $points->setRequired(true);
523  $points->setSize(3);
524  $points->setMinValue(0.0);
525  $points->setMinvalueShouldBeGreater(false);
526  $form->addItem($points);
527 
528  $subcompl = new ilCheckboxInputGUI($this->lng->txt(
529  'ass_completion_by_submission'
530  ), 'completion_by_submission');
531  $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
532  $subcompl->setValue(1);
533  $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
534  $form->addItem($subcompl);
535  }
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
allowDecimals($a_value)
Toggle Decimals.
setInfo($a_info)
Set Information Text.
This class represents a number property in a property form.
+ Here is the call graph for this function:

◆ populateQuestionSpecificFormPart()

assFileUploadGUI::populateQuestionSpecificFormPart ( ilPropertyFormGUI  $form)

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

Parameters
ilPropertyFormGUI$form
Returns
ilPropertyFormGUI

Implements ilGuiQuestionScoringAdjustable.

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

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

Referenced by editQuestion().

116  {
117  // maxsize
118  $maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize");
119  $maxsize->setValue($this->object->getMaxSize());
120  $maxsize->setInfo($this->lng->txt("maxsize_info"));
121  $maxsize->setSize(10);
122  $maxsize->setMinValue(0);
123  $maxsize->setMaxValue($this->determineMaxFilesize());
124  $maxsize->setRequired(false);
125  $form->addItem($maxsize);
126 
127  // allowedextensions
128  $allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions");
129  $allowedextensions->setInfo($this->lng->txt("allowedextensions_info"));
130  $allowedextensions->setValue($this->object->getAllowedExtensions());
131  $allowedextensions->setRequired(false);
132  $form->addItem($allowedextensions);
133 
134  // points
135  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
136  $points->allowDecimals(true);
137  $points->setValue(
138  is_numeric($this->object->getPoints()) && $this->object->getPoints(
139  ) >= 0 ? $this->object->getPoints() : ''
140  );
141  $points->setRequired(true);
142  $points->setSize(3);
143  $points->setMinValue(0.0);
144  $points->setMinvalueShouldBeGreater(false);
145  $form->addItem($points);
146 
147  $subcompl = new ilCheckboxInputGUI($this->lng->txt(
148  'ass_completion_by_submission'
149  ), 'completion_by_submission');
150  $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
151  $subcompl->setValue(1);
152  $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
153  $form->addItem($subcompl);
154  return $form;
155  }
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
allowDecimals($a_value)
Toggle Decimals.
setInfo($a_info)
Set Information Text.
This class represents a number property in a property form.
+ 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 540 of file class.assFileUploadGUI.php.

References ilPropertyFormGUI\getInput().

541  {
542  $this->object->setPoints((float) $form->getInput('points'));
543  $this->object->setCompletionBySubmission((bool) $form->getInput('completion_by_submission'));
544  }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ writePostData()

assFileUploadGUI::writePostData (   $always = false)
protected

{}

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

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

51  {
52  $hasErrors = (!$always) ? $this->editQuestion(true) : false;
53  if (!$hasErrors) {
54  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
57  $this->saveTaxonomyAssignments();
58  return 0;
59  }
60  return 1;
61  }
This class represents a property form user interface.
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.

Parameters
bool$alwaysIf true, a check for form validity is omitted.
Returns
void

Implements ilGuiQuestionScoringAdjustable.

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

References $_POST.

Referenced by writePostData().

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

◆ HANDLE_FILE_UPLOAD

const assFileUploadGUI::HANDLE_FILE_UPLOAD = 'handleFileUpload'
private

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