56 $this->
object->loadFromDb(
$id);
77 $this->
object->setPoints($this->request_data_collector->float(
'points'));
78 $this->
object->setMaxSize($this->request_data_collector->int(
'maxsize') ??
null);
80 $this->
object->setAllowedExtensions($this->request_data_collector->string(
'allowedextensions'));
81 $completion_by_submission = $this->request_data_collector->int(
'completion_by_submission');
82 $this->
object->setCompletionBySubmission($completion_by_submission === 1);
86 bool $checkonly =
false,
87 ?
bool $is_save_cmd =
null
92 $this->editForm = $form;
94 $form->setFormAction($this->
ctrl->getFormAction($this));
96 $form->setMultipart(
false);
97 $form->setTableWidth(
"100%");
98 $form->setId(
"assfileupload");
109 $form->setValuesByPost();
110 $errors = !$form->checkInput();
111 $form->setValuesByPost();
127 $maxsize->allowDecimals(
false);
128 $maxsize->setValue($this->
object->getMaxSize() > 0 ? (
string) $this->object->getMaxSize() :
null);
129 $maxsize->setInfo($this->
lng->txt(
"maxsize_info"));
130 $maxsize->setSize(10);
131 $maxsize->setMinValue(0);
132 $maxsize->setMaxValue((
float) $this->
object->determineMaxFilesize());
133 $maxsize->setRequired(
false);
136 $allowedextensions =
new ilTextInputGUI($this->
lng->txt(
"allowedextensions"),
"allowedextensions");
137 $allowedextensions->setInfo($this->
lng->txt(
"allowedextensions_info"));
138 $allowedextensions->setValue($this->
object->getAllowedExtensions());
139 $allowedextensions->setRequired(
false);
140 $form->
addItem($allowedextensions);
143 $points->allowDecimals(
true);
145 is_numeric($this->
object->getPoints()) && $this->object->getPoints(
146 ) >= 0 ? $this->object->getPoints() :
''
148 $points->setRequired(
true);
150 $points->setMinValue(0.0);
151 $points->setMinvalueShouldBeGreater(
true);
155 'ass_completion_by_submission'
156 ),
'completion_by_submission');
157 $subcompl->setInfo($this->
lng->txt(
'ass_completion_by_submission_info'));
158 $subcompl->setValue(
'1');
159 $subcompl->setChecked($this->
object->isCompletionBySubmissionEnabled());
167 bool $graphical_output =
false,
168 bool $result_output =
false,
169 bool $show_question_only =
true,
170 bool $show_feedback =
false,
171 bool $show_correct_solution =
false,
172 bool $show_manual_scoring =
false,
173 bool $show_question_text =
true,
174 bool $show_inline_feedback =
true
177 $template = new
ilTemplate(
"tpl.il_as_qpl_fileupload_output_solution.html",
true,
true,
"components/ILIAS/TestQuestionPool");
180 if (($active_id > 0) && (!$show_correct_solution)) {
181 $solutions = $this->
object->getSolutionValues($active_id, $pass);
183 $files = ($show_manual_scoring) ? $this->
object->getUploadedFilesForWeb($active_id, $pass) : $this->
object->getUploadedFiles($active_id, $pass);
185 $table_gui->setTitle(
186 $this->
lng->txt(
'already_delivered_files'),
187 'standard/icon_file.svg',
188 $this->lng->txt(
'already_delivered_files')
190 $table_gui->setData($files);
191 $table_gui->setRowTemplate(
"tpl.il_as_qpl_fileupload_file_view_row.html",
"components/ILIAS/TestQuestionPool");
192 $table_gui->setSelectAllCheckbox(
"");
193 $table_gui->disable(
'numinfo');
194 $template->setCurrentBlock(
"files");
195 $template->setVariable(
'FILES', $table_gui->getHTML());
196 $template->parseCurrentBlock();
199 if ($this->
object->getAllowedExtensions() ===
'') {
200 $template->setCurrentBlock(
"allowed_extensions");
202 $template->parseCurrentBlock();
204 $template->setVariable(
"CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
209 if (($active_id > 0) && (!$show_correct_solution)) {
210 $reached_points = $this->
object->getReachedPoints($active_id, $pass);
211 if ($graphical_output) {
212 $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_NOT_OK);
213 if ($reached_points == $this->
object->getMaximumPoints()) {
214 $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_OK);
215 } elseif ($reached_points > 0) {
216 $correctness_icon = $this->generateCorrectnessIconsForCorrectness(self::CORRECTNESS_MOSTLY_OK);
218 $template->setCurrentBlock(
"icon_ok");
219 $template->setVariable(
"ICON_OK", $correctness_icon);
220 $template->parseCurrentBlock();
223 $reached_points = $this->
object->getPoints();
226 if ($result_output) {
227 $resulttext = ($reached_points == 1) ?
"(%s " . $this->
lng->txt(
"point") .
")" :
"(%s " . $this->
lng->txt(
"points") .
")";
228 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $reached_points));
230 if ($show_question_text ==
true) {
231 $template->setVariable(
"QUESTIONTEXT", $this->renderLatex($this->
object->getQuestionForHTMLOutput()));
233 $questionoutput = $template->get();
234 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"components/ILIAS/TestQuestionPool");
235 $feedback = ($show_feedback && !$this->isTestPresentationContext()) ? $this->getGenericFeedbackOutput((
int) $active_id, $pass) :
"";
236 if (strlen($feedback)) {
238 $this->hasCorrectSolution($active_id, $pass) ?
242 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
245 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
246 $solutionoutput = $solutiontemplate->get();
247 if (!$show_question_only) {
249 $solutionoutput = $this->getILIASPage($solutionoutput);
251 return $solutionoutput;
255 bool $show_question_only =
false,
256 bool $show_inline_feedback =
false
258 $template = new
ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"components/ILIAS/TestQuestionPool");
260 if (is_object($this->getPreviewSession())) {
261 $files = $this->
object->getPreviewFileUploads($this->getPreviewSession());
263 $table_gui->setTitle(
264 $this->
lng->txt(
'already_delivered_files'),
265 'standard/icon_file.svg',
266 $this->lng->txt(
'already_delivered_files')
268 $table_gui->setData($files);
271 list($lang_var, $cmd) = $this->getCommandButtonLangVarAndAction();
272 $table_gui->initCommand(
278 $template->setCurrentBlock(
"files");
279 $template->setVariable(
'FILES', $table_gui->getHTML());
280 $template->parseCurrentBlock();
283 if ($this->
object->getAllowedExtensions() !==
'') {
284 $template->setCurrentBlock(
"allowed_extensions");
286 $template->parseCurrentBlock();
288 $template->setVariable(
"QUESTIONTEXT", $this->renderLatex($this->
object->getQuestionForHTMLOutput()));
289 $template->setVariable(
"CMD_UPLOAD", $this->getQuestionActionCmd());
294 $questionoutput = $template->get();
295 if (!$show_question_only) {
297 $questionoutput = $this->getILIASPage($questionoutput);
299 return $questionoutput;
305 bool $is_question_postponed =
false,
306 array|
bool $user_post_solutions =
false,
307 bool $show_specific_inline_feedback =
false
310 $template = new
ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"components/ILIAS/TestQuestionPool");
313 $files = $this->
object->getTestOutputSolutions($active_id, $pass);
316 $table_gui->setTitle(
317 $this->
lng->txt(
'already_delivered_files'),
318 'standard/icon_file.svg',
319 $this->lng->txt(
'already_delivered_files')
321 $table_gui->setData($files);
323 list($lang_var, $cmd) = $this->getCommandButtonLangVarAndAction();
324 $table_gui->initCommand(
327 $this->getTestPresentationFileTablePostVar()
330 $template->setCurrentBlock(
"files");
331 $template->setVariable(
'FILES', $table_gui->getHTML());
332 $template->parseCurrentBlock();
335 if ($this->
object->getAllowedExtensions() !==
'') {
336 $template->setCurrentBlock(
"allowed_extensions");
338 $template->parseCurrentBlock();
340 $template->setVariable(
"QUESTIONTEXT", $this->renderLatex($this->
object->getQuestionForHTMLOutput()));
341 $template->setVariable(
"CMD_UPLOAD", self::HANDLE_FILE_UPLOAD);
346 $questionoutput = $template->get();
349 $questionoutput = $this->getILIASPage($questionoutput);
351 $questionoutput = $template->get();
352 $pageoutput = $this->outQuestionPage(
"", $is_question_postponed, $active_id, $questionoutput);
358 if ($this->
object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
359 return [self::REUSE_FILES_LANGVAR, self::REUSE_FILES_ACTION];
361 return [self::DELETE_FILES_LANGVAR, self::DELETE_FILES_ACTION];
386 if ($this->
object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
397 return $this->
lng->txt(
'use_previous_solution_advice_file_upload');
408 return self::FORM_ENCODING_MULTIPART;
420 $points->allowDecimals(
true);
422 is_numeric($this->
object->getPoints()) && $this->object->getPoints(
423 ) >= 0 ? $this->object->getPoints() :
''
425 $points->setRequired(
true);
427 $points->setMinValue(0.0);
428 $points->setMinvalueShouldBeGreater(
true);
432 'ass_completion_by_submission'
433 ),
'completion_by_submission');
434 $subcompl->setInfo($this->
lng->txt(
'ass_completion_by_submission_info'));
435 $subcompl->setValue(1);
436 $subcompl->setChecked($this->
object->isCompletionBySubmissionEnabled());
445 $this->
object->setPoints((
float) str_replace(
',',
'.', $form->
getInput(
'points')));
446 $this->
object->setCompletionBySubmission((
bool) $form->
getInput(
'completion_by_submission'));
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
getCommandButtonLangVarAndAction()
isAnswerFreuqencyStatisticSupported()
getTestPresentationFileTablePostVar()
__construct(int $id=-1)
assFileUploadGUI constructor
getTestOutput(int $active_id, int $pass, bool $is_question_postponed=false, array|bool $user_post_solutions=false, bool $show_specific_inline_feedback=false)
editQuestion(bool $checkonly=false, ?bool $is_save_cmd=null)
getSolutionOutput(int $active_id, ?int $pass=null, bool $graphical_output=false, bool $result_output=false, bool $show_question_only=true, bool $show_feedback=false, bool $show_correct_solution=false, bool $show_manual_scoring=false, bool $show_question_text=true, bool $show_inline_feedback=true)
getPreviousSolutionProvidedMessage()
getPreview(bool $show_question_only=false, bool $show_inline_feedback=false)
writePostData(bool $always=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
const REUSE_FILES_LANGVAR
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from the request and applies them to the data object.
getSpecificFeedbackOutput(array $userSolution)
Returns the answer specific feedback for the question.
const DELETE_FILES_LANGVAR
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
getPreviousSolutionConfirmationCheckboxHtml()
populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
Adds the question specific forms parts to a question property form gui.
const DELETE_FILES_ACTION
Class for file upload questions.
const REUSE_FILES_TBL_POSTVAR
const DELETE_FILES_TBL_POSTVAR
populateTaxonomyFormSection(ilPropertyFormGUI $form)
writeQuestionGenericPostData()
addBasicQuestionFormProperties(ilPropertyFormGUI $form)
renderEditForm(ilPropertyFormGUI $form)
saveTaxonomyAssignments()
addQuestionFormCommandButtons(ilPropertyFormGUI $form)
setErrorMessage(string $errormessage)
const CSS_CLASS_FEEDBACK_WRONG
const CSS_CLASS_FEEDBACK_CORRECT
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc