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";
43 $this->
object->loadFromDb($id);
52 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
55 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
66 $this->
object->setPoints(
$_POST[
"points"] );
67 $this->
object->setMaxSize(
$_POST[
"maxsize"] );
68 $this->
object->setAllowedExtensions(
$_POST[
"allowedextensions"] );
69 $this->
object->setCompletionBySubmission(
$_POST[
'completion_by_submission'] == 1 ?
true :
false );
82 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
84 $this->editForm = $form;
86 $form->setFormAction($this->ctrl->getFormAction($this));
88 $form->setMultipart(
false);
89 $form->setTableWidth(
"100%");
90 $form->setId(
"assfileupload");
102 $form->setValuesByPost();
103 $errors = !$form->checkInput();
104 $form->setValuesByPost();
106 if (
$errors) $checkonly =
false;
109 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
118 $maxsize->setInfo( $this->lng->txt(
"maxsize_info" ) );
119 $maxsize->setSize( 10 );
120 $maxsize->setMinValue( 0 );
122 $maxsize->setRequired( FALSE );
126 $allowedextensions =
new ilTextInputGUI($this->lng->txt(
"allowedextensions" ),
"allowedextensions");
127 $allowedextensions->
setInfo( $this->lng->txt(
"allowedextensions_info" ) );
128 $allowedextensions->setValue( $this->
object->getAllowedExtensions() );
129 $allowedextensions->setRequired( FALSE );
130 $form->
addItem( $allowedextensions );
135 $points->setValue( is_numeric( $this->
object->getPoints() ) && $this->
object->getPoints(
136 ) >= 0 ? $this->
object->getPoints() :
'' 138 $points->setRequired( TRUE );
139 $points->setSize( 3 );
140 $points->setMinValue( 0.0 );
141 $points->setMinvalueShouldBeGreater(
false );
145 ),
'completion_by_submission');
146 $subcompl->
setInfo( $this->lng->txt(
'ass_completion_by_submission_info' ) );
147 $subcompl->setValue( 1 );
148 $subcompl->setChecked( $this->
object->isCompletionBySubmissionEnabled() );
159 $upload_max_filesize = get_cfg_var(
"upload_max_filesize" );
161 $post_max_size = get_cfg_var(
"post_max_size" );
164 $multiplier_a =
array(
"K" => 1024,
"M" => 1024 * 1024,
"G" => 1024 * 1024 * 1024 );
165 $umf_parts = preg_split(
"/(\d+)([K|G|M])/",
166 $upload_max_filesize,
168 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
170 $pms_parts = preg_split(
"/(\d+)([K|G|M])/",
173 PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
176 if (count( $umf_parts ) == 2)
178 $upload_max_filesize = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
181 if (count( $pms_parts ) == 2)
183 $post_max_size = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
187 $max_filesize = min( $upload_max_filesize, $post_max_size );
191 $max_filesize = max( $upload_max_filesize, $post_max_size );
192 return $max_filesize;
194 return $max_filesize;
213 $graphicalOutput = FALSE,
214 $result_output = FALSE,
215 $show_question_only = TRUE,
216 $show_feedback = FALSE,
217 $show_correct_solution = FALSE,
218 $show_manual_scoring = FALSE,
219 $show_question_text = TRUE
223 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
226 if (($active_id > 0) && (!$show_correct_solution))
228 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
229 include_once
"./Modules/Test/classes/class.ilObjTest.php";
234 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
236 $files = ($show_manual_scoring) ? $this->
object->getUploadedFilesForWeb($active_id,
$pass) : $this->
object->getUploadedFiles($active_id,
$pass);
237 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
239 $table_gui->setTitle($this->lng->txt(
'already_delivered_files'),
'icon_file.svg', $this->lng->txt(
'already_delivered_files'));
240 $table_gui->setData(
$files);
242 #$table_gui->initCommand( 243 #$this->buildFileTableDeleteButtonInstance(), assFileUploadGUI::DELETE_FILES_TBL_POSTVAR 246 $table_gui->setRowTemplate(
"tpl.il_as_qpl_fileupload_file_view_row.html",
"Modules/TestQuestionPool");
247 $table_gui->setSelectAllCheckbox(
"");
249 #$table_gui->clearCommandButtons(); 250 #$table_gui->disable('select_all'); 252 $table_gui->disable(
'numinfo');
253 $template->setCurrentBlock(
"files");
254 $template->setVariable(
'FILES', $table_gui->getHTML());
255 $template->parseCurrentBlock();
258 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()));
262 $template->parseCurrentBlock();
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))
271 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
272 if ($graphicalOutput)
275 if ($reached_points == $this->
object->getMaximumPoints())
277 $template->setCurrentBlock(
"icon_ok");
279 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
280 $template->parseCurrentBlock();
284 $template->setCurrentBlock(
"icon_ok");
285 if ($reached_points > 0)
288 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_not_correct_but_positive"));
293 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
295 $template->parseCurrentBlock();
301 $reached_points = $this->
object->getPoints();
306 $resulttext = ($reached_points == 1) ?
"(%s " . $this->lng->txt(
"point") .
")" :
"(%s " . $this->lng->txt(
"points") .
")";
307 $template->setVariable(
"RESULT_OUTPUT", sprintf($resulttext, $reached_points));
309 if ($show_question_text==
true)
311 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
313 $questionoutput = $template->get();
314 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
316 if (strlen($feedback))
322 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
323 $solutiontemplate->setVariable(
"FEEDBACK", $this->
object->prepareTextareaOutput( $feedback,
true ));
325 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
326 $solutionoutput = $solutiontemplate->get();
327 if (!$show_question_only)
332 return $solutionoutput;
335 function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
337 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
342 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
344 $table_gui->setTitle($this->lng->txt(
'already_delivered_files'),
'icon_file.svg', $this->lng->txt(
'already_delivered_files'));
345 $table_gui->setData(
$files);
347 $table_gui->initCommand(
352 $template->setCurrentBlock(
"files");
353 $template->setVariable(
'FILES', $table_gui->getHTML());
354 $template->parseCurrentBlock();
357 if (strlen($this->
object->getAllowedExtensions()))
359 $template->setCurrentBlock(
"allowed_extensions");
360 $template->setVariable(
"TXT_ALLOWED_EXTENSIONS", $this->
object->prepareTextareaOutput($this->lng->txt(
"allowedextensions") .
": " . $this->
object->getAllowedExtensions()));
361 $template->parseCurrentBlock();
363 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->question, TRUE));
365 $template->setVariable(
"TEXT_UPLOAD", $this->
object->prepareTextareaOutput($this->lng->txt(
'upload')));
366 $template->setVariable(
"TXT_UPLOAD_FILE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_add')));
367 $template->setVariable(
"TXT_MAX_SIZE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_notice') .
" " . $this->
object->getMaxFilesizeAsString()));
369 $questionoutput = $template->get();
370 if (!$show_question_only)
375 return $questionoutput;
379 function getTestOutput($active_id,
$pass, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
383 $template =
new ilTemplate(
"tpl.il_as_qpl_fileupload_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
389 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 390 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 392 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 394 $files = $this->
object->getTestOutputSolutions($active_id,
$pass);
396 include_once
"./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
398 $table_gui->setTitle($this->lng->txt(
'already_delivered_files'),
'icon_file.svg', $this->lng->txt(
'already_delivered_files'));
399 $table_gui->setData(
$files);
401 $table_gui->initCommand(
406 $template->setCurrentBlock(
"files");
407 $template->setVariable(
'FILES', $table_gui->getHTML());
408 $template->parseCurrentBlock();
411 if (strlen($this->
object->getAllowedExtensions()))
413 $template->setCurrentBlock(
"allowed_extensions");
414 $template->setVariable(
"TXT_ALLOWED_EXTENSIONS", $this->
object->prepareTextareaOutput($this->lng->txt(
"allowedextensions") .
": " . $this->
object->getAllowedExtensions()));
415 $template->parseCurrentBlock();
417 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($this->object->question, TRUE));
419 $template->setVariable(
"TEXT_UPLOAD", $this->
object->prepareTextareaOutput($this->lng->txt(
'upload')));
420 $template->setVariable(
"TXT_UPLOAD_FILE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_add')));
421 $template->setVariable(
"TXT_MAX_SIZE", $this->
object->prepareTextareaOutput($this->lng->txt(
'file_notice') .
" " . $this->
object->getMaxFilesizeAsString()));
423 $questionoutput = $template->get();
424 if (!$show_question_only)
429 $questionoutput = $template->get();
430 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
443 global $rbacsystem, $ilTabs;
445 $ilTabs->clearTargets();
447 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
448 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
449 $q_type = $this->
object->getQuestionType();
453 $classname = $q_type .
"GUI";
454 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
455 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
460 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
463 $ilTabs->addTarget(
"edit_page",
464 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
465 array(
"edit",
"insert",
"exec_pg"),
466 "",
"", $force_active);
472 $force_active =
false;
473 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
476 if ($classname)
$url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
478 $ilTabs->addTarget(
"edit_question",
480 array(
"editQuestion",
"save",
"cancel",
"saveEdit"),
496 $ilTabs->addTarget(
"statistics",
497 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
502 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
507 global $___test_express_mode;
509 if (!
$_GET[
'test_express_mode'] && !$___test_express_mode) {
510 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
514 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
519 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));
526 return $this->
object->prepareTextareaOutput(
$output, TRUE);
563 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableDeleteButton.php';
572 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssFileUploadFileTableReuseButton.php';
581 if( $this->
object->getTestPresentationConfig()->isSolutionInitiallyPrefilled() )
591 if( $this->
object->getTestPresentationConfig()->isSolutionInitiallyPrefilled() )
603 return $this->lng->txt(
'use_previous_solution_advice_file_upload');
614 return self::FORM_ENCODING_MULTIPART;
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
getPreviousSolutionConfirmationCheckboxHtml()
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
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...
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
const REUSE_FILES_TBL_POSTVAR
writePostData($always=false)
{}
writeQuestionGenericPostData()
static getReturnToPageLink($q_id=null)
const DELETE_FILES_TBL_POSTVAR
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.
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)
Create styles array
The data for the language used.
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.
getSpecificFeedbackOutput($active_id, $pass)
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
saveTaxonomyAssignments()
Create new PHPExcel object
obj_idprivate
getTestOutput($active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $show_feedback=FALSE)
__construct($id=-1)
assFileUploadGUI constructor
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
Interface ilGuiQuestionScoringAdjustable.
static _getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
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.
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.