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() > 0 ? $this->
object->getPoints() : 
'');
 
  135                 $points->setRequired(TRUE);
 
  137                 $points->setMinValue(0.0);
 
  138                 $points->setMinvalueShouldBeGreater(
true);
 
  139                 $form->addItem($points);
 
  142                 $header->setTitle($this->lng->txt(
"range"));
 
  143                 $form->addItem($header);
 
  146                 $lower_limit = 
new ilFormulaInputGUI($this->lng->txt(
"range_lower_limit"), 
"lowerlimit");
 
  148                 $lower_limit->setMaxLength(20);
 
  149                 $lower_limit->setRequired(
true);
 
  150                 $lower_limit->setValue($this->object->getLowerLimit());
 
  151                 $form->addItem($lower_limit);
 
  154                 $upper_limit = 
new ilFormulaInputGUI($this->lng->txt(
"range_upper_limit"), 
"upperlimit");
 
  156                 $upper_limit->setMaxLength(20);
 
  157                 $upper_limit->setRequired(
true);
 
  158                 $upper_limit->setValue($this->object->getUpperLimit());
 
  159                 $form->addItem($upper_limit);
 
  167                         $form->setValuesByPost();
 
  168                         $errors = !$form->checkInput();
 
  169                         $form->setValuesByPost(); 
 
  170                         if (
$errors) $checkonly = 
false;
 
  173                 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
 
  188                 include_once 
"./Services/Math/classes/class.EvalMath.php";
 
  190                 $eval->suppress_errors = TRUE;
 
  191                 if (($eval->e(
$_POST[
"rang_lower_limit"]) !== FALSE) AND ($eval->e(
$_POST [
"range_upper_limit"]) !== FALSE))
 
  193                         if ($eval->e(
$_POST[
"rang_lower_limit"]) < $eval->e(
$_POST[
"range_upper_limit"]))
 
  210                 $test_output = $this->
getTestOutput($active_id, 
$pass, $is_postponed, $use_post_solutions); 
 
  211                 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
 
  212                 $this->tpl->setVariable(
"FORMACTION", $formaction);
 
  231                 $graphicalOutput = FALSE,
 
  232                 $result_output = FALSE,
 
  233                 $show_question_only = TRUE,
 
  234                 $show_feedback = FALSE,
 
  235                 $show_correct_solution = FALSE,
 
  236                 $show_manual_scoring = FALSE
 
  240                 $solutions = array();
 
  241                 if (($active_id > 0) && (!$show_correct_solution))
 
  243                         $solutions =& $this->
object->getSolutionValues($active_id, 
$pass);
 
  247                         array_push($solutions, array(
"value1" => sprintf($this->lng->txt(
"value_between_x_and_y"), $this->
object->getLowerLimit(), $this->
object->getUpperLimit())));
 
  251                 include_once 
"./classes/class.ilTemplate.php";
 
  252                 $template = 
new ilTemplate(
"tpl.il_as_qpl_numeric_output_solution.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  253                 $solutiontemplate = 
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  254                 if (is_array($solutions))
 
  256                         if (($active_id > 0) && (!$show_correct_solution))
 
  258                                 if ($graphicalOutput)
 
  261                                         if ($this->object->getReachedPoints($active_id, 
$pass) == $this->
object->getMaximumPoints())
 
  263                                                 $template->setCurrentBlock(
"icon_ok");
 
  265                                                 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
 
  266                                                 $template->parseCurrentBlock();
 
  270                                                 $template->setCurrentBlock(
"icon_ok");
 
  272                                                 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
 
  273                                                 $template->parseCurrentBlock();
 
  277                         foreach ($solutions as $solution)
 
  279                                 $template->setVariable(
"NUMERIC_VALUE", $solution[
"value1"]);
 
  281                         if (count($solutions) == 0)
 
  283                                 $template->setVariable(
"NUMERIC_VALUE", 
"      ");
 
  286                 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
 
  287                 $questiontext = $this->
object->getQuestion();
 
  288                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  289                 $questionoutput = $template->get();
 
  291                 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $feedback);
 
  292                 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
 
  294                 $solutionoutput = $solutiontemplate->get(); 
 
  295                 if (!$show_question_only)
 
  300                 return $solutionoutput;
 
  306                 include_once 
"./classes/class.ilTemplate.php";
 
  307                 $template = 
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  308                 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
 
  309                 $questiontext = $this->
object->getQuestion();
 
  310                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  311                 $questionoutput = $template->get();
 
  312                 if (!$show_question_only)
 
  317                 return $questionoutput;
 
  326                         include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  331                         $solutions =& $this->
object->getSolutionValues($active_id, 
$pass);
 
  335                 include_once 
"./classes/class.ilTemplate.php";
 
  336                 $template = 
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  337                 if (is_array($solutions))
 
  339                         foreach ($solutions as $solution)
 
  341                                 $template->setVariable(
"NUMERIC_VALUE", 
" value=\"".$solution[
"value1"].
"\"");
 
  344                 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
 
  345                 $questiontext = $this->
object->getQuestion();
 
  346                 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
 
  347                 $questionoutput = $template->get();
 
  348                 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
 
  361                 include_once 
"./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
 
  363                 $this->
object->saveFeedbackGeneric(0, 
$_POST[
"feedback_incomplete"]);
 
  364                 $this->
object->saveFeedbackGeneric(1, 
$_POST[
"feedback_complete"]);
 
  365                 $this->
object->cleanupMediaObjectUsage();
 
  376                 global $rbacsystem, $ilTabs;
 
  378                 $this->ctrl->setParameterByClass(
"ilpageobjectgui", 
"q_id", 
$_GET[
"q_id"]);
 
  379                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  380                 $q_type = $this->
object->getQuestionType();
 
  384                         $classname = $q_type . 
"GUI";
 
  385                         $this->ctrl->setParameterByClass(strtolower($classname), 
"sel_question_types", $q_type);
 
  386                         $this->ctrl->setParameterByClass(strtolower($classname), 
"q_id", 
$_GET[
"q_id"]);
 
  391                         if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  394                                 $ilTabs->addTarget(
"edit_content",
 
  395                                         $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI", 
"edit"),
 
  396                                         array(
"edit", 
"insert", 
"exec_pg"),
 
  397                                         "", 
"", $force_active);
 
  401                         $ilTabs->addTarget(
"preview",
 
  402                                 $this->ctrl->getLinkTargetByClass(
"ilPageObjectGUI", 
"preview"),
 
  404                                 "ilPageObjectGUI", 
"", $force_active);
 
  407                 $force_active = 
false;
 
  408                 if ($rbacsystem->checkAccess(
'write', 
$_GET[
"ref_id"]))
 
  411                         if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, 
"editQuestion");
 
  413                         $ilTabs->addTarget(
"edit_properties",
 
  415                                 array(
"editQuestion", 
"save", 
"cancel", 
"saveEdit", 
"originalSyncForm"),
 
  416                                 $classname, 
"", $force_active);
 
  421                         $ilTabs->addTarget(
"feedback",
 
  422                                 $this->ctrl->getLinkTargetByClass($classname, 
"feedback"),
 
  423                                 array(
"feedback", 
"saveFeedback"),
 
  429                         $ilTabs->addTarget(
"solution_hint",
 
  430                                 $this->ctrl->getLinkTargetByClass($classname, 
"suggestedsolution"),
 
  431                                 array(
"suggestedsolution", 
"saveSuggestedSolution", 
"outSolutionExplorer", 
"cancel", 
 
  432                                 "addSuggestedSolution",
"cancelExplorer", 
"linkChilds", 
"removeSuggestedSolution" 
  442                         $ilTabs->addTarget(
"statistics",
 
  443                                 $this->ctrl->getLinkTargetByClass($classname, 
"assessment"),
 
  448                 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
 
  452                         $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), 
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
 
  456                         $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui", 
"questions"));