24 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
25 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
52 include_once
"./Modules/TestQuestionPool/classes/class.assNumeric.php";
56 $this->
object->loadFromDb($id);
62 if (substr(
$cmd, 0, 6) ==
"delete")
78 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
81 $this->
object->setTitle(
$_POST[
"title"]);
82 $this->
object->setAuthor(
$_POST[
"author"]);
83 $this->
object->setComment(
$_POST[
"comment"]);
84 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
85 $questiontext =
$_POST[
"question"];
86 $this->
object->setQuestion($questiontext);
87 $this->
object->setMaxChars(
$_POST[
"maxchars"]);
88 $this->
object->setEstimatedWorkingTime(
93 $this->
object->setLowerLimit(
$_POST[
'lowerlimit']);
94 $this->
object->setUpperLimit(
$_POST[
'upperlimit']);
95 $this->
object->setPoints(
$_POST[
'points']);
114 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
116 $form->setFormAction($this->ctrl->getFormAction($this));
118 $form->setMultipart(TRUE);
119 $form->setTableWidth(
"100%");
120 $form->setId(
"assnumeric");
127 $maxchars->setDecimals(0);
128 $maxchars->setMinValue(1);
129 $maxchars->setRequired(
true);
130 if ($this->object->getMaxChars() > 0) $maxchars->setValue($this->object->getMaxChars());
131 $form->addItem($maxchars);
135 $points->
setValue($this->object->getPoints() > 0 ? $this->
object->getPoints() :
'');
136 $points->setRequired(TRUE);
138 $points->setMinValue(0.0);
139 $points->setMinvalueShouldBeGreater(
true);
140 $form->addItem($points);
143 $header->setTitle($this->lng->txt(
"range"));
144 $form->addItem($header);
147 $lower_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_lower_limit"),
"lowerlimit");
149 $lower_limit->setMaxLength(20);
150 $lower_limit->setRequired(
true);
151 $lower_limit->setValue($this->object->getLowerLimit());
152 $form->addItem($lower_limit);
155 $upper_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_upper_limit"),
"upperlimit");
157 $upper_limit->setMaxLength(20);
158 $upper_limit->setRequired(
true);
159 $upper_limit->setValue($this->object->getUpperLimit());
160 $form->addItem($upper_limit);
162 if( $this->object->getMaxChars() > 0 )
164 $lower_limit->setSize($this->object->getMaxChars());
165 $lower_limit->setMaxLength($this->object->getMaxChars());
166 $upper_limit->setSize($this->object->getMaxChars());
167 $upper_limit->setMaxLength($this->object->getMaxChars());
176 $form->setValuesByPost();
177 $errors = !$form->checkInput();
178 $form->setValuesByPost();
179 if (
$errors) $checkonly =
false;
182 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
197 include_once
"./Services/Math/classes/class.EvalMath.php";
199 $eval->suppress_errors = TRUE;
200 if (($eval->e(
$_POST[
"rang_lower_limit"]) !== FALSE) AND ($eval->e(
$_POST [
"range_upper_limit"]) !== FALSE))
202 if ($eval->e(
$_POST[
"rang_lower_limit"]) < $eval->e(
$_POST[
"range_upper_limit"]))
219 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $use_post_solutions);
220 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
221 $this->tpl->setVariable(
"FORMACTION", $formaction);
240 $graphicalOutput = FALSE,
241 $result_output = FALSE,
242 $show_question_only = TRUE,
243 $show_feedback = FALSE,
244 $show_correct_solution = FALSE,
245 $show_manual_scoring = FALSE,
246 $show_question_text = TRUE
250 $solutions = array();
251 if (($active_id > 0) && (!$show_correct_solution))
253 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
257 array_push($solutions, array(
"value1" => sprintf($this->lng->txt(
"value_between_x_and_y"), $this->
object->getLowerLimit(), $this->
object->getUpperLimit())));
261 include_once
"./Services/UICore/classes/class.ilTemplate.php";
262 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
263 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
264 if (is_array($solutions))
266 if (($active_id > 0) && (!$show_correct_solution))
268 if ($graphicalOutput)
271 if ($this->object->getReachedPoints($active_id,
$pass) == $this->
object->getMaximumPoints())
273 $template->setCurrentBlock(
"icon_ok");
275 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
276 $template->parseCurrentBlock();
280 $template->setCurrentBlock(
"icon_ok");
282 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
283 $template->parseCurrentBlock();
287 foreach ($solutions as $solution)
289 $template->setVariable(
"NUMERIC_VALUE", $solution[
"value1"]);
291 if (count($solutions) == 0)
293 $template->setVariable(
"NUMERIC_VALUE",
" ");
296 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
297 $questiontext = $this->
object->getQuestion();
298 if ($show_question_text==
true)
300 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
302 $questionoutput = $template->get();
304 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $feedback,
true ));
305 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
307 $solutionoutput = $solutiontemplate->get();
308 if (!$show_question_only)
311 $solutionoutput =
'<div class="ilc_question_Standard">'.$solutionoutput.
"</div>";
313 return $solutionoutput;
319 include_once
"./Services/UICore/classes/class.ilTemplate.php";
320 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
321 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
322 $questiontext = $this->
object->getQuestion();
323 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
324 $questionoutput = $template->get();
325 if (!$show_question_only)
330 return $questionoutput;
339 include_once
"./Modules/Test/classes/class.ilObjTest.php";
344 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
348 include_once
"./Services/UICore/classes/class.ilTemplate.php";
349 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
350 if (is_array($solutions))
352 foreach ($solutions as $solution)
354 $template->setVariable(
"NUMERIC_VALUE",
" value=\"".$solution[
"value1"].
"\"");
357 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
358 $questiontext = $this->
object->getQuestion();
359 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
360 $questionoutput = $template->get();
361 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
374 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
376 $this->
object->saveFeedbackGeneric(0,
$_POST[
"feedback_incomplete"]);
377 $this->
object->saveFeedbackGeneric(1,
$_POST[
"feedback_complete"]);
378 $this->
object->cleanupMediaObjectUsage();
391 global $rbacsystem, $ilTabs;
393 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
394 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
395 $q_type = $this->
object->getQuestionType();
399 $classname = $q_type .
"GUI";
400 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
401 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
406 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
409 $ilTabs->addTarget(
"edit_page",
410 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"edit"),
411 array(
"edit",
"insert",
"exec_pg"),
412 "",
"", $force_active);
416 $ilTabs->addTarget(
"preview",
417 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"preview"),
419 "ilPageObjectGUI",
"", $force_active);
422 $force_active =
false;
423 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
426 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
428 $ilTabs->addTarget(
"edit_question",
430 array(
"editQuestion",
"save",
"cancel",
"saveEdit",
"originalSyncForm"),
431 $classname,
"", $force_active);
436 $ilTabs->addTarget(
"feedback",
437 $this->ctrl->getLinkTargetByClass($classname,
"feedback"),
438 array(
"feedback",
"saveFeedback"),
447 $ilTabs->addTarget(
"solution_hint",
448 $this->ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
449 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
450 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution"
460 $ilTabs->addTarget(
"statistics",
461 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
466 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
471 global $___test_express_mode;
473 if (!
$_GET[
'test_express_mode'] && !$___test_express_mode) {
474 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
478 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
483 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));
490 return $this->
object->prepareTextareaOutput($output, TRUE);