19 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
60 $this->
object->loadFromDb(
$id);
69 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
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);
98 $this->editForm = $form;
100 $form->setFormAction($this->
ctrl->getFormAction($this));
102 $form->setMultipart(
false);
103 $form->setTableWidth(
"100%");
104 $form->setId(
"assfileupload");
115 $form->setValuesByPost();
116 $errors = !$form->checkInput();
117 $form->setValuesByPost();
125 $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
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);
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);
149 $points->allowDecimals(
true);
151 is_numeric($this->
object->getPoints()) && $this->
object->getPoints(
152 ) >= 0 ? $this->
object->getPoints() :
'' 154 $points->setRequired(
true);
156 $points->setMinValue(0.0);
157 $points->setMinvalueShouldBeGreater(
true);
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());
185 $graphicalOutput =
false,
186 $result_output =
false,
187 $show_question_only =
true,
188 $show_feedback =
false,
189 $show_correct_solution =
false,
190 $show_manual_scoring =
false,
191 $show_question_text =
true 194 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
197 if (($active_id > 0) && (!$show_correct_solution)) {
198 $solutions = $this->
object->getSolutionValues($active_id, $pass);
200 $files = ($show_manual_scoring) ? $this->
object->getUploadedFilesForWeb($active_id, $pass) : $this->
object->getUploadedFiles($active_id, $pass);
202 $table_gui->setTitle(
203 $this->
lng->txt(
'already_delivered_files'),
204 'standard/icon_file.svg',
205 $this->
lng->txt(
'already_delivered_files')
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();
216 if ($this->
object->getAllowedExtensions() ===
'') {
217 $template->setCurrentBlock(
"allowed_extensions");
219 $template->parseCurrentBlock();
221 $template->setVariable(
"CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
226 if (($active_id > 0) && (!$show_correct_solution)) {
227 $reached_points = $this->
object->getReachedPoints($active_id, $pass);
228 if ($graphicalOutput) {
230 if ($reached_points == $this->
object->getMaximumPoints()) {
232 } elseif ($reached_points > 0) {
235 $template->setCurrentBlock(
"icon_ok");
236 $template->setVariable(
"ICON_OK", $correctness_icon);
237 $template->parseCurrentBlock();
240 $reached_points = $this->
object->getPoints();
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));
247 if ($show_question_text ==
true) {
248 $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
250 $questionoutput = $template->get();
251 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
253 if (strlen($feedback)) {
259 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
262 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
263 $solutionoutput = $solutiontemplate->get();
264 if (!$show_question_only) {
268 return $solutionoutput;
271 public function getPreview($show_question_only =
false, $showInlineFeedback =
false): string
273 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"Modules/TestQuestionPool");
278 $table_gui->setTitle(
279 $this->
lng->txt(
'already_delivered_files'),
280 'standard/icon_file.svg',
281 $this->
lng->txt(
'already_delivered_files')
283 $table_gui->setData($files);
287 $table_gui->initCommand(
293 $template->setCurrentBlock(
"files");
294 $template->setVariable(
'FILES', $table_gui->getHTML());
295 $template->parseCurrentBlock();
298 if ($this->
object->getAllowedExtensions() !==
'') {
299 $template->setCurrentBlock(
"allowed_extensions");
301 $template->parseCurrentBlock();
303 $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
309 $questionoutput = $template->get();
310 if (!$show_question_only) {
314 return $questionoutput;
317 public function getTestOutput($active_id, $pass, $is_postponed =
false, $use_post_solutions =
false, $show_feedback =
false): string
320 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"Modules/TestQuestionPool");
323 $files = $this->
object->getTestOutputSolutions($active_id, $pass);
326 $table_gui->setTitle(
327 $this->
lng->txt(
'already_delivered_files'),
328 'standard/icon_file.svg',
329 $this->
lng->txt(
'already_delivered_files')
331 $table_gui->setData($files);
334 $table_gui->initCommand(
340 $template->setCurrentBlock(
"files");
341 $template->setVariable(
'FILES', $table_gui->getHTML());
342 $template->parseCurrentBlock();
345 if ($this->
object->getAllowedExtensions() !==
'') {
346 $template->setCurrentBlock(
"allowed_extensions");
348 $template->parseCurrentBlock();
350 $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
351 $template->setVariable(
"CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
356 $questionoutput = $template->get();
361 $questionoutput = $template->get();
362 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
368 if ($this->
object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
369 return [self::REUSE_FILES_LANGVAR, self::REUSE_FILES_ACTION];
371 return [self::DELETE_FILES_LANGVAR, self::DELETE_FILES_ACTION];
408 if ($this->
object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
419 return $this->
lng->txt(
'use_previous_solution_advice_file_upload');
430 return self::FORM_ENCODING_MULTIPART;
442 $points->allowDecimals(
true);
444 is_numeric($this->
object->getPoints()) && $this->
object->getPoints(
445 ) >= 0 ? $this->
object->getPoints() :
'' 447 $points->setRequired(
true);
449 $points->setMinValue(0.0);
450 $points->setMinvalueShouldBeGreater(
true);
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());
467 $this->
object->setPoints((
float) str_replace(
',',
'.', $form->
getInput(
'points')));
468 $this->
object->setCompletionBySubmission((
bool) $form->
getInput(
'completion_by_submission'));
isTestPresentationContext()
hasCorrectSolution($activeId, $passIndex)
writePostData(bool $always=false)
{}
generateCorrectnessIconsForCorrectness(int $correctness)
getPreviousSolutionProvidedMessage()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
getPreviousSolutionConfirmationCheckboxHtml()
getTestOutput($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $show_feedback=false)
const REUSE_FILES_LANGVAR
getSpecificFeedbackOutput(array $userSolution)
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
getTestPresentationFileTablePostVar()
const CSS_CLASS_FEEDBACK_CORRECT
const REUSE_FILES_TBL_POSTVAR
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
Class for file upload questions.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
const DELETE_FILES_TBL_POSTVAR
const REUSE_FILES_TBL_POSTVAR
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
setErrorMessage(string $errormessage)
writeQuestionGenericPostData()
const DELETE_FILES_TBL_POSTVAR
isAnswerFreuqencyStatisticSupported()
getAggregatedAnswersView(array $relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
const CSS_CLASS_FEEDBACK_WRONG
Basic GUI class for assessment questions.
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const DELETE_FILES_ACTION
saveTaxonomyAssignments()
getPreview($show_question_only=false, $showInlineFeedback=false)
getILIASPage(string $html="")
Returns the ILIAS Page around a question.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
__construct($id=-1)
assFileUploadGUI constructor
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const DELETE_FILES_LANGVAR
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.
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
getCommandButtonLangVarAndAction()
getGenericFeedbackOutput(int $active_id, ?int $pass)