ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
assFileUploadGUI Class Reference

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

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

Public Member Functions

 __construct ($id=-1)
 assFileUploadGUI constructor More...
 
 writeQuestionSpecificPostData (ilPropertyFormGUI $form)
 Extracts the question specific values from $_POST and applies them to the data object. More...
 
 editQuestion ($checkonly=false)
 Creates an output of the edit form for the question. More...
 
 populateQuestionSpecificFormPart (ilPropertyFormGUI $form)
 Adds the question specific forms parts to a question property form gui. More...
 
 determineMaxFilesize ()
 
 getSolutionOutput ( $active_id, $pass=null, $graphicalOutput=false, $result_output=false, $show_question_only=true, $show_feedback=false, $show_correct_solution=false, $show_manual_scoring=false, $show_question_text=true)
 Get the question solution output. More...
 
 getPreview ($show_question_only=false, $showInlineFeedback=false)
 
 getTestOutput ($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
 
 setQuestionTabs ()
 Sets the ILIAS tabs for this question type. More...
 
 getSpecificFeedbackOutput ($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...
 
 getCommand ($cmd)
 
 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 (ilTemplate $tpl)
 
 getQuestionTemplate ()
 get question template More...
 
 getILIASPage ($html="")
 Returns the ILIAS Page around a question. More...
 
 outQuestionPage ($a_temp_var, $a_postponed=false, $active_id="", $html="", $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
 
 $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
 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)
 
 getBasicEditQuestionTabCommands ()
 
 getAdditionalEditQuestionCommands ()
 
 addTab_QuestionFeedback (ilTabsGUI $tabs)
 adds the feedback tab to ilTabsGUI More...
 
 addTab_QuestionHints (ilTabsGUI $tabs)
 adds the hints tab to ilTabsGUI More...
 
 addTab_QuestionPreview (ilTabsGUI $tabsGUI)
 
 hasCorrectSolution ($activeId, $passIndex)
 
 writeQuestionGenericPostData ()
 
 completeTestOutputFormAction ($formAction, $active_id, $pass)
 
 addBackTab (ilTabsGUI $ilTabs)
 
 buildBasicEditFormObject ()
 
 buildEditForm ()
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestionGUI
static _getQuestionGUI ($question_type, $question_id=-1)
 Creates a question gui representation and returns the alias to the question gui note: please do not use $this inside this method to allow static calls. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
static getCommandsFromClassConstants ($guiClassName, $cmdConstantNameBegin='CMD_')
 extracts values of all constants of given class with given prefix as array can be used to get all possible commands in case of these commands are defined as constants More...
 
- Protected Attributes inherited from assQuestionGUI
 $editForm
 
 $use_intermediate_solution = false
 

Detailed Description

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

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

assFileUploadGUI: ilObjQuestionPoolGUI assFileUploadGUI: ilFormPropertyDispatchGUI

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

Constructor & Destructor Documentation

◆ __construct()

assFileUploadGUI::__construct (   $id = -1)

assFileUploadGUI constructor

The constructor takes possible arguments an creates an instance of the assFileUploadGUI object.

Parameters
integer$idThe database id of a single choice question object

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

References $id, and assQuestionGUI\setErrorMessage().

36  {
37  parent::__construct();
38  include_once "./Modules/TestQuestionPool/classes/class.assFileUpload.php";
39  $this->object = new assFileUpload();
40  $this->setErrorMessage($this->lng->txt("msg_form_save_error"));
41  if ($id >= 0) {
42  $this->object->loadFromDb($id);
43  }
44  }
if(!array_key_exists('StateId', $_REQUEST)) $id
Class for file upload questions.
setErrorMessage($errormessage)
+ Here is the call graph for this function:

Member Function Documentation

◆ buildFileTableDeleteButtonInstance()

assFileUploadGUI::buildFileTableDeleteButtonInstance ( )
protected
Returns
ilAssFileUploadFileTableDeleteButton

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

References ilAssFileUploadFileTableDeleteButton\getInstance().

Referenced by buildTestPresentationFileTableCommandButtonInstance(), and getPreview().

550  {
551  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableDeleteButton.php';
553  }
+ 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 558 of file class.assFileUploadGUI.php.

References ilAssFileUploadFileTableReuseButton\getInstance().

Referenced by buildTestPresentationFileTableCommandButtonInstance().

559  {
560  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableReuseButton.php';
562  }
+ 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 567 of file class.assFileUploadGUI.php.

References buildFileTableDeleteButtonInstance(), and buildFileTableReuseButtonInstance().

Referenced by getTestOutput().

568  {
569  if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
570  return $this->buildFileTableReuseButtonInstance();
571  }
572 
573  return $this->buildFileTableDeleteButtonInstance();
574  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineMaxFilesize()

assFileUploadGUI::determineMaxFilesize ( )
Returns
mixed

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

Referenced by populateQuestionSpecificFormPart().

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

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

Referenced by writePostData().

76  {
77  $save = $this->isSaveCommand();
78  $this->getQuestionTemplate();
79 
80  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
81  $form = new ilPropertyFormGUI();
82  $this->editForm = $form;
83 
84  $form->setFormAction($this->ctrl->getFormAction($this));
85  $form->setTitle($this->outQuestionType());
86  $form->setMultipart(false);
87  $form->setTableWidth("100%");
88  $form->setId("assfileupload");
89 
92 
95 
96  $errors = false;
97 
98  if ($save) {
99  $form->setValuesByPost();
100  $errors = !$form->checkInput();
101  $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and
102  // we need this if we don't want to have duplication of backslashes
103  if ($errors) {
104  $checkonly = false;
105  }
106  }
107 
108  if (!$checkonly) {
109  $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
110  }
111  return $errors;
112  }
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
This class represents a property form user interface.
getQuestionTemplate()
get question template
populateTaxonomyFormSection(ilPropertyFormGUI $form)
if(isset($_POST['submit'])) $form
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
$errors
Definition: index.php:6
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 526 of file class.assFileUploadGUI.php.

527  {
528  return array();
529  }

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

540  {
541  // Empty implementation here since a feasible way to aggregate answer is not known.
542  return ''; //print_r($relevant_answers,true);
543  }

◆ getFormEncodingType()

assFileUploadGUI::getFormEncodingType ( )

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

599  {
600  return self::FORM_ENCODING_MULTIPART;
601  }

◆ getPreview()

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

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

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

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

◆ getPreviousSolutionConfirmationCheckboxHtml()

assFileUploadGUI::getPreviousSolutionConfirmationCheckboxHtml ( )
protected

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

593  {
594  return '';
595  }

◆ getPreviousSolutionProvidedMessage()

assFileUploadGUI::getPreviousSolutionProvidedMessage ( )
protected

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

588  {
589  return $this->lng->txt('use_previous_solution_advice_file_upload');
590  }

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

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

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

References Sabre\VObject\$output.

512  {
513  $output = "";
514  return $this->object->prepareTextareaOutput($output, true);
515  }

◆ getTestOutput()

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

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

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

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

References assFileUpload\DELETE_FILES_TBL_POSTVAR, and assFileUpload\REUSE_FILES_TBL_POSTVAR.

Referenced by getTestOutput().

577  {
578  if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
580  }
581 
583  }
+ Here is the caller graph for this function:

◆ isAnswerFreuqencyStatisticSupported()

assFileUploadGUI::isAnswerFreuqencyStatisticSupported ( )

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

604  {
605  return false;
606  }

◆ populateCorrectionsFormProperties()

assFileUploadGUI::populateCorrectionsFormProperties ( ilPropertyFormGUI  $form)

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

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

609  {
610  // points
611  $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
612  $points->allowDecimals(true);
613  $points->setValue(
614  is_numeric($this->object->getPoints()) && $this->object->getPoints(
615  ) >= 0 ? $this->object->getPoints() : ''
616  );
617  $points->setRequired(true);
618  $points->setSize(3);
619  $points->setMinValue(0.0);
620  $points->setMinvalueShouldBeGreater(false);
621  $form->addItem($points);
622 
623  $subcompl = new ilCheckboxInputGUI($this->lng->txt(
624  'ass_completion_by_submission'
625  ), 'completion_by_submission');
626  $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
627  $subcompl->setValue(1);
628  $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
629  $form->addItem($subcompl);
630  }
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 114 of file class.assFileUploadGUI.php.

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

Referenced by editQuestion().

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

References ilPropertyFormGUI\getInput().

636  {
637  $this->object->setPoints((float) $form->getInput('points'));
638  $this->object->setCompletionBySubmission((bool) $form->getInput('completion_by_submission'));
639  }
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:

◆ setQuestionTabs()

assFileUploadGUI::setQuestionTabs ( )

Sets the ILIAS tabs for this question type.

public

Todo:
: MOVE THIS STEPS TO COMMON QUESTION CLASS assQuestionGUI

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

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

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

◆ writePostData()

assFileUploadGUI::writePostData (   $always = false)
protected

{}

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

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

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

References $_POST.

Referenced by writePostData().

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

◆ 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: