24 include_once
"./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
25 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
51 include_once
"./Modules/TestQuestionPool/classes/class.assNumeric.php";
55 $this->
object->loadFromDb($id);
61 if (substr(
$cmd, 0, 6) ==
"delete")
77 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
80 $this->
object->setTitle(
$_POST[
"title"]);
81 $this->
object->setAuthor(
$_POST[
"author"]);
82 $this->
object->setComment(
$_POST[
"comment"]);
83 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
84 $questiontext =
$_POST[
"question"];
85 $this->
object->setQuestion($questiontext);
86 $this->
object->setMaxChars(
$_POST[
"maxchars"]);
87 $this->
object->setEstimatedWorkingTime(
92 $this->
object->setLowerLimit(
$_POST[
'lowerlimit']);
93 $this->
object->setUpperLimit(
$_POST[
'upperlimit']);
94 $this->
object->setPoints(
$_POST[
'points']);
110 $save = ((strcmp($this->ctrl->getCmd(),
"save") == 0) || (strcmp($this->ctrl->getCmd(),
"saveEdit") == 0)) ? TRUE : FALSE;
113 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
115 $form->setFormAction($this->ctrl->getFormAction($this));
117 $form->setMultipart(TRUE);
118 $form->setTableWidth(
"100%");
119 $form->setId(
"assnumeric");
126 $maxchars->setDecimals(0);
127 $maxchars->setMinValue(1);
128 $maxchars->setRequired(
true);
129 if ($this->object->getMaxChars() > 0) $maxchars->setValue($this->object->getMaxChars());
130 $form->addItem($maxchars);
134 $points->setValue($this->object->getPoints());
141 $header->setTitle($this->lng->txt(
"range"));
142 $form->addItem($header);
145 $lower_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_lower_limit"),
"lowerlimit");
147 $lower_limit->setMaxLength(20);
148 $lower_limit->setRequired(
true);
149 $lower_limit->setValue($this->object->getLowerLimit());
150 $form->addItem($lower_limit);
153 $upper_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_upper_limit"),
"upperlimit");
155 $upper_limit->setMaxLength(20);
156 $upper_limit->setRequired(
true);
157 $upper_limit->setValue($this->object->getUpperLimit());
158 $form->addItem($upper_limit);
166 $form->setValuesByPost();
167 $errors = !$form->checkInput();
168 $form->setValuesByPost();
169 if (
$errors) $checkonly =
false;
172 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
187 include_once
"./Services/Math/classes/class.EvalMath.php";
189 $eval->suppress_errors = TRUE;
190 if (($eval->e(
$_POST[
"rang_lower_limit"]) !== FALSE) AND ($eval->e(
$_POST [
"range_upper_limit"]) !== FALSE))
192 if ($eval->e(
$_POST[
"rang_lower_limit"]) < $eval->e(
$_POST[
"range_upper_limit"]))
209 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $use_post_solutions);
210 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
211 $this->tpl->setVariable(
"FORMACTION", $formaction);
230 $graphicalOutput = FALSE,
231 $result_output = FALSE,
232 $show_question_only = TRUE,
233 $show_feedback = FALSE,
234 $show_correct_solution = FALSE,
235 $show_manual_scoring = FALSE
239 $solutions = array();
240 if (($active_id > 0) && (!$show_correct_solution))
242 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
246 array_push($solutions, array(
"value1" => sprintf($this->lng->txt(
"value_between_x_and_y"), $this->
object->getLowerLimit(), $this->
object->getUpperLimit())));
250 include_once
"./classes/class.ilTemplate.php";
251 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
252 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
253 if (is_array($solutions))
255 if (($active_id > 0) && (!$show_correct_solution))
257 if ($graphicalOutput)
260 if ($this->object->getReachedPoints($active_id,
$pass) == $this->
object->getMaximumPoints())
262 $template->setCurrentBlock(
"icon_ok");
264 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
265 $template->parseCurrentBlock();
269 $template->setCurrentBlock(
"icon_ok");
271 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
272 $template->parseCurrentBlock();
276 foreach ($solutions as $solution)
278 $template->setVariable(
"NUMERIC_VALUE", $solution[
"value1"]);
280 if (count($solutions) == 0)
282 $template->setVariable(
"NUMERIC_VALUE",
" ");
285 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
286 $questiontext = $this->
object->getQuestion();
287 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
288 $questionoutput = $template->get();
290 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $feedback);
291 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
293 $solutionoutput = $solutiontemplate->get();
294 if (!$show_question_only)
299 return $solutionoutput;
305 include_once
"./classes/class.ilTemplate.php";
306 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
307 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
308 $questiontext = $this->
object->getQuestion();
309 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
310 $questionoutput = $template->get();
311 if (!$show_question_only)
316 return $questionoutput;
325 include_once
"./Modules/Test/classes/class.ilObjTest.php";
330 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
334 include_once
"./classes/class.ilTemplate.php";
335 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
336 if (is_array($solutions))
338 foreach ($solutions as $solution)
340 $template->setVariable(
"NUMERIC_VALUE",
" value=\"".$solution[
"value1"].
"\"");
343 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
344 $questiontext = $this->
object->getQuestion();
345 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
346 $questionoutput = $template->get();
347 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
360 include_once
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
362 $this->
object->saveFeedbackGeneric(0,
$_POST[
"feedback_incomplete"]);
363 $this->
object->saveFeedbackGeneric(1,
$_POST[
"feedback_complete"]);
364 $this->
object->cleanupMediaObjectUsage();
375 global $rbacsystem, $ilTabs;
377 $this->ctrl->setParameterByClass(
"ilpageobjectgui",
"q_id",
$_GET[
"q_id"]);
378 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
379 $q_type = $this->
object->getQuestionType();
383 $classname = $q_type .
"GUI";
384 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
385 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
390 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
393 $ilTabs->addTarget(
"edit_content",
394 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"edit"),
395 array(
"edit",
"insert",
"exec_pg"),
396 "",
"", $force_active);
400 $ilTabs->addTarget(
"preview",
401 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI",
"preview"),
403 "ilPageObjectGUI",
"", $force_active);
406 $force_active =
false;
407 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
410 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
412 $ilTabs->addTarget(
"edit_properties",
414 array(
"editQuestion",
"save",
"cancel",
"saveEdit",
"originalSyncForm"),
415 $classname,
"", $force_active);
420 $ilTabs->addTarget(
"feedback",
421 $this->ctrl->getLinkTargetByClass($classname,
"feedback"),
422 array(
"feedback",
"saveFeedback"),
428 $ilTabs->addTarget(
"solution_hint",
429 $this->ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
430 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
431 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution"
441 $ilTabs->addTarget(
"statistics",
442 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
447 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
451 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
455 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));