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';
37 parent::__construct();
38 include_once
"./Modules/TestQuestionPool/classes/class.assFileUpload.php";
42 $this->
object->loadFromDb(
$id);
51 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
53 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
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);
80 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
82 $this->editForm =
$form;
84 $form->setFormAction($this->ctrl->getFormAction($this));
86 $form->setMultipart(
false);
87 $form->setTableWidth(
"100%");
88 $form->setId(
"assfileupload");
99 $form->setValuesByPost();
101 $form->setValuesByPost();
109 $this->tpl->setVariable(
"QUESTION_DATA",
$form->getHTML());
118 $maxsize->
setValue($this->object->getMaxSize());
119 $maxsize->setInfo($this->lng->txt(
"maxsize_info"));
120 $maxsize->setSize(10);
121 $maxsize->setMinValue(0);
123 $maxsize->setRequired(
false);
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);
137 is_numeric($this->object->getPoints()) && $this->object->getPoints(
138 ) >= 0 ? $this->
object->getPoints() :
'' 140 $points->setRequired(
true);
142 $points->setMinValue(0.0);
143 $points->setMinvalueShouldBeGreater(
false);
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());
162 $upload_max_filesize = get_cfg_var(
"upload_max_filesize");
164 $post_max_size = get_cfg_var(
"post_max_size");
167 $multiplier_a = array(
"K" => 1024,
"M" => 1024 * 1024,
"G" => 1024 * 1024 * 1024 );
168 $umf_parts = preg_split(
170 $upload_max_filesize,
172 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
174 $pms_parts = preg_split(
178 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
181 if (count($umf_parts) == 2) {
182 $upload_max_filesize = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
185 if (count($pms_parts) == 2) {
186 $post_max_size = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
190 $max_filesize = min($upload_max_filesize, $post_max_size);
192 if (!$max_filesize) {
193 $max_filesize = max($upload_max_filesize, $post_max_size);
194 return $max_filesize;
196 return $max_filesize;
215 $graphicalOutput =
false,
216 $result_output =
false,
217 $show_question_only =
true,
218 $show_feedback =
false,
219 $show_correct_solution =
false,
220 $show_manual_scoring =
false,
221 $show_question_text =
true 224 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
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";
231 if (is_null(
$pass)) {
235 $solutions = &$this->
object->getSolutionValues($active_id,
$pass);
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";
240 $table_gui->setTitle($this->lng->txt(
'already_delivered_files'),
'icon_file.svg', $this->lng->txt(
'already_delivered_files'));
241 $table_gui->setData(
$files);
243 #$table_gui->initCommand( 244 #$this->buildFileTableDeleteButtonInstance(), assFileUploadGUI::DELETE_FILES_TBL_POSTVAR 247 $table_gui->setRowTemplate(
"tpl.il_as_qpl_fileupload_file_view_row.html",
"Modules/TestQuestionPool");
248 $table_gui->setSelectAllCheckbox(
"");
250 #$table_gui->clearCommandButtons(); 251 #$table_gui->disable('select_all'); 253 $table_gui->disable(
'numinfo');
255 $template->setVariable(
'FILES', $table_gui->getHTML());
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()));
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()));
269 if (($active_id > 0) && (!$show_correct_solution)) {
270 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
271 if ($graphicalOutput) {
273 if ($reached_points == $this->object->getMaximumPoints()) {
276 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
280 if ($reached_points > 0) {
282 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
285 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
291 $reached_points = $this->
object->getPoints();
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));
298 if ($show_question_text ==
true) {
299 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(),
true));
302 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
304 if (strlen($feedback)) {
310 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
311 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput($feedback,
true));
313 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
314 $solutionoutput = $solutiontemplate->get();
315 if (!$show_question_only) {
319 return $solutionoutput;
322 public function getPreview($show_question_only =
false, $showInlineFeedback =
false)
324 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"Modules/TestQuestionPool");
328 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
330 $table_gui->setTitle($this->lng->txt(
'already_delivered_files'),
'icon_file.svg', $this->lng->txt(
'already_delivered_files'));
331 $table_gui->setData(
$files);
333 $table_gui->initCommand(
339 $template->setVariable(
'FILES', $table_gui->getHTML());
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()));
348 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->question,
true));
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()));
355 if (!$show_question_only) {
359 return $questionoutput;
363 public function getTestOutput($active_id,
$pass, $is_postponed =
false, $use_post_solutions =
false, $show_feedback =
false)
367 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",
true,
true,
"Modules/TestQuestionPool");
372 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 373 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 375 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 377 $files = $this->
object->getTestOutputSolutions($active_id,
$pass);
379 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
381 $table_gui->setTitle($this->lng->txt(
'already_delivered_files'),
'icon_file.svg', $this->lng->txt(
'already_delivered_files'));
382 $table_gui->setData(
$files);
384 $table_gui->initCommand(
390 $template->setVariable(
'FILES', $table_gui->getHTML());
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()));
399 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->question,
true));
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()));
406 if (!$show_question_only) {
411 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
425 $rbacsystem = $DIC[
'rbacsystem'];
426 $ilTabs = $DIC[
'ilTabs'];
428 $ilTabs->clearTargets();
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();
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"]);
441 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
445 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
446 array(
"edit",
"insert",
"exec_pg"),
456 $force_active =
false;
457 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
460 $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
466 array(
"editQuestion",
"save",
"cancel",
"saveEdit"),
485 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
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"];
498 global $___test_express_mode;
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");
504 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
507 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));
514 return $this->
object->prepareTextareaOutput(
$output,
true);
551 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableDeleteButton.php';
560 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableReuseButton.php';
569 if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
578 if ($this->object->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
589 return $this->lng->txt(
'use_previous_solution_advice_file_upload');
600 return self::FORM_ENCODING_MULTIPART;
614 is_numeric($this->object->getPoints()) && $this->object->getPoints(
615 ) >= 0 ? $this->
object->getPoints() :
'' 617 $points->setRequired(
true);
619 $points->setMinValue(0.0);
620 $points->setMinvalueShouldBeGreater(
false);
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());
637 $this->
object->setPoints((
float) $form->
getInput(
'points'));
638 $this->
object->setCompletionBySubmission((
bool) $form->
getInput(
'completion_by_submission'));
isTestPresentationContext()
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
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()
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
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)
if(!array_key_exists('StateId', $_REQUEST)) $id
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.
Class for file upload questions.
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()
static getReturnToPageLink($q_id=null)
const DELETE_FILES_TBL_POSTVAR
if(isset($_POST['submit'])) $form
isAnswerFreuqencyStatisticSupported()
buildFileTableReuseButtonInstance()
setQuestionTabs()
Sets the ILIAS tabs for this question type.
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
This class represents a text property in a property form.
populateCorrectionsFormProperties(ilPropertyFormGUI $form)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
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($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...
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.