4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
6 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
39 include_once
"./Modules/TestQuestionPool/classes/class.assFileUpload.php";
43 $this->
object->loadFromDb($id);
52 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
54 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
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);
81 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
83 $this->editForm = $form;
85 $form->setFormAction($this->ctrl->getFormAction($this));
87 $form->setMultipart(
false);
88 $form->setTableWidth(
"100%");
89 $form->setId(
"assfileupload");
100 $form->setValuesByPost();
101 $errors = !$form->checkInput();
102 $form->setValuesByPost();
110 $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
119 $maxsize->
setValue($this->object->getMaxSize());
120 $maxsize->setInfo($this->lng->txt(
"maxsize_info"));
121 $maxsize->setSize(10);
122 $maxsize->setMinValue(0);
124 $maxsize->setRequired(
false);
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);
138 is_numeric($this->object->getPoints()) && $this->object->getPoints(
139 ) >= 0 ? $this->
object->getPoints() :
'' 141 $points->setRequired(
true);
143 $points->setMinValue(0.0);
144 $points->setMinvalueShouldBeGreater(
false);
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());
163 $upload_max_filesize = get_cfg_var(
"upload_max_filesize");
165 $post_max_size = get_cfg_var(
"post_max_size");
168 $multiplier_a = array(
"K" => 1024,
"M" => 1024 * 1024,
"G" => 1024 * 1024 * 1024 );
169 $umf_parts = preg_split(
171 $upload_max_filesize,
173 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
175 $pms_parts = preg_split(
179 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
182 if (count($umf_parts) == 2) {
183 $upload_max_filesize = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
186 if (count($pms_parts) == 2) {
187 $post_max_size = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
191 $max_filesize = min($upload_max_filesize, $post_max_size);
193 if (!$max_filesize) {
194 $max_filesize = max($upload_max_filesize, $post_max_size);
195 return $max_filesize;
197 return $max_filesize;
216 $graphicalOutput =
false,
217 $result_output =
false,
218 $show_question_only =
true,
219 $show_feedback =
false,
220 $show_correct_solution =
false,
221 $show_manual_scoring =
false,
222 $show_question_text =
true 225 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
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";
232 if (is_null(
$pass)) {
236 $solutions = &$this->
object->getSolutionValues($active_id,
$pass);
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";
241 $table_gui->setTitle($this->lng->txt(
'already_delivered_files'),
'icon_file.svg', $this->lng->txt(
'already_delivered_files'));
242 $table_gui->setData($files);
244 #$table_gui->initCommand( 245 #$this->buildFileTableDeleteButtonInstance(), assFileUploadGUI::DELETE_FILES_TBL_POSTVAR 248 $table_gui->setRowTemplate(
"tpl.il_as_qpl_fileupload_file_view_row.html",
"Modules/TestQuestionPool");
249 $table_gui->setSelectAllCheckbox(
"");
251 #$table_gui->clearCommandButtons(); 252 #$table_gui->disable('select_all'); 254 $table_gui->disable(
'numinfo');
255 $template->setCurrentBlock(
"files");
256 $template->setVariable(
'FILES', $table_gui->getHTML());
257 $template->parseCurrentBlock();
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();
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()));
270 if (($active_id > 0) && (!$show_correct_solution)) {
271 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
272 if ($graphicalOutput) {
274 if ($reached_points == $this->object->getMaximumPoints()) {
275 $template->setCurrentBlock(
"icon_ok");
277 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
278 $template->parseCurrentBlock();
280 $template->setCurrentBlock(
"icon_ok");
281 if ($reached_points > 0) {
283 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
286 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
288 $template->parseCurrentBlock();
292 $reached_points = $this->
object->getPoints();
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));
299 if ($show_question_text ==
true) {
300 $template->setVariable(
"QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
302 $questionoutput = $template->get();
303 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
305 if (strlen($feedback)) {
311 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
312 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback,
true));
314 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
315 $solutionoutput = $solutiontemplate->get();
316 if (!$show_question_only) {
320 return $solutionoutput;
323 public function getPreview($show_question_only =
false, $showInlineFeedback =
false)
325 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"Modules/TestQuestionPool");
329 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
331 $table_gui->setTitle($this->lng->txt(
'already_delivered_files'),
'icon_file.svg', $this->lng->txt(
'already_delivered_files'));
332 $table_gui->setData($files);
334 $table_gui->initCommand(
339 $template->setCurrentBlock(
"files");
340 $template->setVariable(
'FILES', $table_gui->getHTML());
341 $template->parseCurrentBlock();
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();
349 $template->setVariable(
"QUESTIONTEXT", $this->object->getQuestionForHTMLOutput());
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()));
355 $questionoutput = $template->get();
356 if (!$show_question_only) {
360 return $questionoutput;
364 public function getTestOutput($active_id,
$pass, $is_postponed =
false, $use_post_solutions =
false, $show_feedback =
false)
368 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"Modules/TestQuestionPool");
373 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 374 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 376 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 378 $files = $this->
object->getTestOutputSolutions($active_id,
$pass);
380 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
382 $table_gui->setTitle($this->lng->txt(
'already_delivered_files'),
'icon_file.svg', $this->lng->txt(
'already_delivered_files'));
383 $table_gui->setData($files);
385 $table_gui->initCommand(
390 $template->setCurrentBlock(
"files");
391 $template->setVariable(
'FILES', $table_gui->getHTML());
392 $template->parseCurrentBlock();
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();
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()));
406 $questionoutput = $template->get();
407 if (!$show_question_only) {
411 $questionoutput = $template->get();
412 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
419 return $this->
object->prepareTextareaOutput($output,
true);
456 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableDeleteButton.php';
465 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableReuseButton.php';
474 if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
483 if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
494 return $this->lng->txt(
'use_previous_solution_advice_file_upload');
505 return self::FORM_ENCODING_MULTIPART;
519 is_numeric($this->object->getPoints()) && $this->object->getPoints(
520 ) >= 0 ? $this->
object->getPoints() :
'' 522 $points->setRequired(
true);
524 $points->setMinValue(0.0);
525 $points->setMinvalueShouldBeGreater(
false);
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());
542 $this->
object->setPoints((
float) $form->
getInput(
'points'));
543 $this->
object->setCompletionBySubmission((
bool) $form->
getInput(
'completion_by_submission'));
isTestPresentationContext()
hasCorrectSolution($activeId, $passIndex)
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
getPreviousSolutionProvidedMessage()
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($userSolution)
getTestPresentationFileTablePostVar()
getQuestionTemplate()
get question template
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
populateTaxonomyFormSection(ilPropertyFormGUI $form)
buildFileTableDeleteButtonInstance()
const DELETE_FILES_TBL_POSTVAR
buildTestPresentationFileTableCommandButtonInstance()
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
const REUSE_FILES_TBL_POSTVAR
saveCorrectionsFormProperties(ilPropertyFormGUI $form)
writePostData($always=false)
{}
writeQuestionGenericPostData()
const DELETE_FILES_TBL_POSTVAR
isAnswerFreuqencyStatisticSupported()
buildFileTableReuseButtonInstance()
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)
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.
setErrorMessage($errormessage)
The assFileUploadGUI class encapsulates the GUI representation for file upload questions.
getAnswerFeedbackOutput($active_id, $pass)
Returns the answer generic feedback depending on the results of the question.
saveTaxonomyAssignments()
getPreview($show_question_only=false, $showInlineFeedback=false)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="", $inlineFeedbackEnabled=false)
output question page
__construct(Container $dic, ilPlugin $plugin)
__construct($id=-1)
assFileUploadGUI constructor
Interface ilGuiQuestionScoringAdjustable.
static _getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
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...
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.