19 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
52 include_once
"./Modules/TestQuestionPool/classes/class.assFileUpload.php";
56 $this->
object->loadFromDb(
$id);
65 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
67 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
78 $this->
object->setPoints((
float) str_replace(
',',
'.', $_POST[
"points"]));
79 $this->
object->setMaxSize(($_POST[
'maxsize'] ?? null) ? (
int) $_POST[
'maxsize'] : null);
80 $this->
object->setAllowedExtensions($_POST[
"allowedextensions"]);
81 $this->
object->setCompletionBySubmission(isset($_POST[
'completion_by_submission']) && $_POST[
'completion_by_submission'] == 1);
94 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
96 $this->editForm = $form;
98 $form->setFormAction($this->
ctrl->getFormAction($this));
100 $form->setMultipart(
false);
101 $form->setTableWidth(
"100%");
102 $form->setId(
"assfileupload");
113 $form->setValuesByPost();
114 $errors = !$form->checkInput();
115 $form->setValuesByPost();
123 $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
132 $maxsize->setValue($this->
object->getMaxSize() > 0 ? (string) $this->
object->getMaxSize() : null);
133 $maxsize->setInfo($this->
lng->txt(
"maxsize_info"));
134 $maxsize->setSize(10);
135 $maxsize->setMinValue(0);
137 $maxsize->setRequired(
false);
140 $allowedextensions =
new ilTextInputGUI($this->
lng->txt(
"allowedextensions"),
"allowedextensions");
141 $allowedextensions->setInfo($this->
lng->txt(
"allowedextensions_info"));
142 $allowedextensions->setValue($this->
object->getAllowedExtensions());
143 $allowedextensions->setRequired(
false);
144 $form->
addItem($allowedextensions);
149 is_numeric($this->
object->getPoints()) && $this->
object->getPoints(
150 ) >= 0 ? $this->
object->getPoints() :
'' 152 $points->setRequired(
true);
154 $points->setMinValue(0.0);
155 $points->setMinvalueShouldBeGreater(
true);
159 'ass_completion_by_submission' 160 ),
'completion_by_submission');
161 $subcompl->
setInfo($this->
lng->txt(
'ass_completion_by_submission_info'));
162 $subcompl->setValue(
'1');
163 $subcompl->setChecked($this->
object->isCompletionBySubmissionEnabled());
171 $upload_max_filesize = get_cfg_var(
"upload_max_filesize");
173 $post_max_size = get_cfg_var(
"post_max_size");
176 $multiplier_a = array(
"K" => 1024,
"M" => 1024 * 1024,
"G" => 1024 * 1024 * 1024 );
177 $umf_parts = preg_split(
179 $upload_max_filesize,
181 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
183 $pms_parts = preg_split(
187 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
190 if (count($umf_parts) === 2) {
191 $upload_max_filesize = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
194 if (count($pms_parts) === 2) {
195 $post_max_size = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
199 $max_filesize = min($upload_max_filesize, $post_max_size);
201 if (!$max_filesize) {
202 $max_filesize = max($upload_max_filesize, $post_max_size);
203 return $max_filesize;
206 return $max_filesize;
224 $graphicalOutput =
false,
225 $result_output =
false,
226 $show_question_only =
true,
227 $show_feedback =
false,
228 $show_correct_solution =
false,
229 $show_manual_scoring =
false,
230 $show_question_text =
true 233 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
236 if (($active_id > 0) && (!$show_correct_solution)) {
237 $solutions = $this->
object->getSolutionValues($active_id, $pass);
239 $files = ($show_manual_scoring) ? $this->
object->getUploadedFilesForWeb($active_id, $pass) : $this->
object->getUploadedFiles($active_id, $pass);
240 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
242 $table_gui->setTitle(
243 $this->
lng->txt(
'already_delivered_files'),
245 $this->
lng->txt(
'already_delivered_files')
247 $table_gui->setData($files);
249 #$table_gui->initCommand( 250 #$this->buildFileTableDeleteButtonInstance(), assFileUploadGUI::DELETE_FILES_TBL_POSTVAR 253 $table_gui->setRowTemplate(
"tpl.il_as_qpl_fileupload_file_view_row.html",
"Modules/TestQuestionPool");
254 $table_gui->setSelectAllCheckbox(
"");
256 #$table_gui->clearCommandButtons(); 257 #$table_gui->disable('select_all'); 259 $table_gui->disable(
'numinfo');
260 $template->setCurrentBlock(
"files");
261 $template->setVariable(
'FILES', $table_gui->getHTML());
262 $template->parseCurrentBlock();
265 if (strlen($this->
object->getAllowedExtensions())) {
266 $template->setCurrentBlock(
"allowed_extensions");
267 $template->setVariable(
"TXT_ALLOWED_EXTENSIONS", $this->
object->prepareTextareaOutput($this->lng->txt(
"allowedextensions") .
": " . $this->
object->getAllowedExtensions()));
268 $template->parseCurrentBlock();
270 $template->setVariable(
"CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
271 $template->setVariable(
"TEXT_UPLOAD", $this->
object->prepareTextareaOutput($this->lng->txt(
'upload')));
272 $template->setVariable(
"TXT_UPLOAD_FILE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_add')));
273 $template->setVariable(
"TXT_MAX_SIZE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_notice') .
" " . $this->
object->getMaxFilesizeAsString()));
275 if (($active_id > 0) && (!$show_correct_solution)) {
276 $reached_points = $this->
object->getReachedPoints($active_id, $pass);
277 if ($graphicalOutput) {
279 if ($reached_points == $this->
object->getMaximumPoints()) {
281 } elseif ($reached_points > 0) {
284 $template->setCurrentBlock(
"icon_ok");
285 $template->setVariable(
"ICON_OK", $correctness_icon);
286 $template->parseCurrentBlock();
289 $reached_points = $this->
object->getPoints();
292 if ($result_output) {
293 $resulttext = ($reached_points == 1) ?
"(%s " . $this->
lng->txt(
"point") .
")" :
"(%s " . $this->
lng->txt(
"points") .
")";
294 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $reached_points));
296 if ($show_question_text ==
true) {
297 $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
299 $questionoutput = $template->get();
300 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
302 if (strlen($feedback)) {
308 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
309 $solutiontemplate->setVariable(
"FEEDBACK", $this->
object->prepareTextareaOutput($feedback,
true));
311 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
312 $solutionoutput = $solutiontemplate->get();
313 if (!$show_question_only) {
317 return $solutionoutput;
320 public function getPreview($show_question_only =
false, $showInlineFeedback =
false): string
322 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"Modules/TestQuestionPool");
326 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
328 $table_gui->setTitle(
329 $this->
lng->txt(
'already_delivered_files'),
331 $this->
lng->txt(
'already_delivered_files')
333 $table_gui->setData($files);
335 $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");
347 $template->setVariable(
"TXT_ALLOWED_EXTENSIONS", $this->
object->prepareTextareaOutput($this->lng->txt(
"allowedextensions") .
": " . $this->
object->getAllowedExtensions()));
348 $template->parseCurrentBlock();
350 $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
352 $template->setVariable(
"TEXT_UPLOAD", $this->
object->prepareTextareaOutput($this->lng->txt(
'upload')));
353 $template->setVariable(
"TXT_UPLOAD_FILE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_add')));
354 $template->setVariable(
"TXT_MAX_SIZE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_notice') .
" " . $this->
object->getMaxFilesizeAsString()));
356 $questionoutput = $template->get();
357 if (!$show_question_only) {
361 return $questionoutput;
365 public function getTestOutput($active_id, $pass, $is_postponed =
false, $use_post_solutions =
false, $show_feedback =
false): string
369 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"Modules/TestQuestionPool");
372 $files = $this->
object->getTestOutputSolutions($active_id, $pass);
374 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
376 $table_gui->setTitle(
377 $this->
lng->txt(
'already_delivered_files'),
379 $this->
lng->txt(
'already_delivered_files')
381 $table_gui->setData($files);
383 $table_gui->initCommand(
388 $template->setCurrentBlock(
"files");
389 $template->setVariable(
'FILES', $table_gui->getHTML());
390 $template->parseCurrentBlock();
393 if ($this->
object->getAllowedExtensions() !==
'') {
394 $template->setCurrentBlock(
"allowed_extensions");
395 $template->setVariable(
"TXT_ALLOWED_EXTENSIONS", $this->
object->prepareTextareaOutput($this->lng->txt(
"allowedextensions") .
": " . $this->
object->getAllowedExtensions()));
396 $template->parseCurrentBlock();
398 $template->setVariable(
"QUESTIONTEXT", $this->
object->getQuestionForHTMLOutput());
399 $template->setVariable(
"CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
400 $template->setVariable(
"TEXT_UPLOAD", $this->
object->prepareTextareaOutput($this->lng->txt(
'upload')));
401 $template->setVariable(
"TXT_UPLOAD_FILE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_add')));
402 $template->setVariable(
"TXT_MAX_SIZE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_notice') .
" " . $this->
object->getMaxFilesizeAsString()));
404 $questionoutput = $template->get();
409 $questionoutput = $template->get();
410 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
417 return $this->
object->prepareTextareaOutput($output,
true);
452 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableDeleteButton.php';
461 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableReuseButton.php';
470 if ($this->
object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
479 if ($this->
object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
490 return $this->
lng->txt(
'use_previous_solution_advice_file_upload');
501 return self::FORM_ENCODING_MULTIPART;
515 is_numeric($this->
object->getPoints()) && $this->
object->getPoints(
516 ) >= 0 ? $this->
object->getPoints() :
'' 518 $points->setRequired(
true);
520 $points->setMinValue(0.0);
521 $points->setMinvalueShouldBeGreater(
true);
525 'ass_completion_by_submission' 526 ),
'completion_by_submission');
527 $subcompl->
setInfo($this->
lng->txt(
'ass_completion_by_submission_info'));
528 $subcompl->setValue(1);
529 $subcompl->setChecked($this->
object->isCompletionBySubmissionEnabled());
538 $this->
object->setPoints((
float) str_replace(
',',
'.', $form->
getInput(
'points')));
539 $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)
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)
buildFileTableDeleteButtonInstance()
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
const DELETE_FILES_TBL_POSTVAR
buildTestPresentationFileTableCommandButtonInstance()
const REUSE_FILES_TBL_POSTVAR
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
setErrorMessage(string $errormessage)
writeQuestionGenericPostData()
const DELETE_FILES_TBL_POSTVAR
isAnswerFreuqencyStatisticSupported()
buildFileTableReuseButtonInstance()
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
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(Container $dic, ilPlugin $plugin)
__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...
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...
getGenericFeedbackOutput(int $active_id, ?int $pass)