4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilGuiAnswerScoringAdjustable.php';
7 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
38 require_once
'./Modules/TestQuestionPool/classes/class.assNumeric.php';
42 $this->
object->loadFromDb($id);
48 if (substr(
$cmd, 0, 6) ==
"delete")
64 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
88 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
90 $form->setFormAction($this->ctrl->getFormAction($this));
92 $form->setMultipart(TRUE);
93 $form->setTableWidth(
"100%");
94 $form->setId(
"assnumeric");
106 $form->setValuesByPost();
107 $errors = !$form->checkInput();
108 $form->setValuesByPost();
109 if (
$errors) $checkonly =
false;
112 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
125 include_once
"./Services/Math/classes/class.EvalMath.php";
127 $eval->suppress_errors = TRUE;
128 if (($eval->e(
$_POST[
"rang_lower_limit"]) !== FALSE) AND ($eval->e(
$_POST [
"range_upper_limit"]) !== FALSE))
130 if ($eval->e(
$_POST[
"rang_lower_limit"]) < $eval->e(
$_POST[
"range_upper_limit"]))
151 $test_output = $this->
getTestOutput($active_id,
$pass, $is_postponed, $use_post_solutions);
152 $this->tpl->setVariable(
"QUESTION_OUTPUT", $test_output);
153 $this->tpl->setVariable(
"FORMACTION", $formaction);
174 $graphicalOutput = FALSE,
175 $result_output = FALSE,
176 $show_question_only = TRUE,
177 $show_feedback = FALSE,
178 $show_correct_solution = FALSE,
179 $show_manual_scoring = FALSE,
180 $show_question_text = TRUE
184 $solutions = array();
185 if (($active_id > 0) && (!$show_correct_solution))
187 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
191 array_push($solutions, array(
"value1" => sprintf($this->lng->txt(
"value_between_x_and_y"), $this->
object->getLowerLimit(), $this->
object->getUpperLimit())));
195 require_once
'./Services/UICore/classes/class.ilTemplate.php';
196 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
197 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
198 if (is_array($solutions))
200 if (($active_id > 0) && (!$show_correct_solution))
202 if ($graphicalOutput)
205 if ($this->object->getReachedPoints($active_id,
$pass) == $this->
object->getMaximumPoints())
207 $template->setCurrentBlock(
"icon_ok");
209 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
210 $template->parseCurrentBlock();
214 $template->setCurrentBlock(
"icon_ok");
216 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
217 $template->parseCurrentBlock();
221 foreach ($solutions as $solution)
223 $template->setVariable(
"NUMERIC_VALUE", $solution[
"value1"]);
225 if (count($solutions) == 0)
227 $template->setVariable(
"NUMERIC_VALUE",
" ");
230 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
231 $questiontext = $this->
object->getQuestion();
232 if ($show_question_text==
true)
234 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
236 $questionoutput = $template->get();
240 if (strlen($feedback)) $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $feedback,
true ));
241 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
243 $solutionoutput = $solutiontemplate->get();
244 if (!$show_question_only)
247 $solutionoutput =
'<div class="ilc_question_Standard">'.$solutionoutput.
"</div>";
249 return $solutionoutput;
260 require_once
'./Services/UICore/classes/class.ilTemplate.php';
261 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
262 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
263 $questiontext = $this->
object->getQuestion();
264 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
265 $questionoutput = $template->get();
266 if (!$show_question_only)
271 return $questionoutput;
282 public function getTestOutput($active_id,
$pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
289 require_once
'./Modules/Test/classes/class.ilObjTest.php';
294 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
298 require_once
'./Services/UICore/classes/class.ilTemplate.php';
299 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
300 if (is_array($solutions))
302 foreach ($solutions as $solution)
304 $template->setVariable(
"NUMERIC_VALUE",
" value=\"".$solution[
"value1"].
"\"");
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 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
324 global $rbacsystem, $ilTabs;
326 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
327 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
328 $q_type = $this->
object->getQuestionType();
332 $classname = $q_type .
"GUI";
333 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
334 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
339 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
342 $ilTabs->addTarget(
"edit_page",
343 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
344 array(
"edit",
"insert",
"exec_pg"),
345 "",
"", $force_active);
349 $ilTabs->addTarget(
"preview",
350 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"preview"),
352 "ilAssQuestionPageGUI",
"", $force_active);
355 $force_active =
false;
356 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
359 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
361 $ilTabs->addTarget(
"edit_question",
363 array(
"editQuestion",
"save",
"cancel",
"saveEdit",
"originalSyncForm"),
364 $classname,
"", $force_active);
375 $ilTabs->addTarget(
"solution_hint",
376 $this->ctrl->getLinkTargetByClass($classname,
"suggestedsolution"),
377 array(
"suggestedsolution",
"saveSuggestedSolution",
"outSolutionExplorer",
"cancel",
378 "addSuggestedSolution",
"cancelExplorer",
"linkChilds",
"removeSuggestedSolution"
388 $ilTabs->addTarget(
"statistics",
389 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
394 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0))
402 global $___test_express_mode;
403 if (!
$_GET[
'test_express_mode'] && !$___test_express_mode) {
404 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"),
"ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id");
408 $ilTabs->setBackTarget($this->lng->txt(
"backtocallingtest"), $link);
413 $ilTabs->setBackTarget($this->lng->txt(
"qpl"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));
426 return $this->
object->prepareTextareaOutput($output, TRUE);
431 $this->
object->setMaxChars(
$_POST[
"maxchars"] );
436 $this->
object->setLowerLimit(
$_POST[
'lowerlimit'] );
437 $this->
object->setUpperLimit(
$_POST[
'upperlimit'] );
438 $this->
object->setPoints(
$_POST[
'points'] );
444 $maxchars =
new ilNumberInputGUI($this->lng->txt(
"maxchars" ),
"maxchars");
445 $maxchars->
setInfo($this->lng->txt(
'qpl_maxchars_info_numeric_question'));
446 $maxchars->setSize( 10 );
447 $maxchars->setDecimals( 0 );
448 $maxchars->setMinValue( 1 );
449 $maxchars->setRequired(
true );
450 if ($this->object->getMaxChars() > 0)
452 $maxchars->setValue($this->object->getMaxChars());
462 $points->setValue( $this->object->getPoints() > 0 ? $this->
object->getPoints() :
'' );
463 $points->setRequired( TRUE );
464 $points->setSize( 3 );
465 $points->setMinValue( 0.0 );
466 $points->setMinvalueShouldBeGreater(
true );
470 $header->setTitle( $this->lng->txt(
"range" ) );
474 $lower_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_lower_limit" ),
"lowerlimit");
476 $lower_limit->setMaxLength( 20 );
477 $lower_limit->setRequired(
true );
478 $lower_limit->setValue( $this->object->getLowerLimit() );
479 $form->
addItem( $lower_limit );
482 $upper_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_upper_limit" ),
"upperlimit");
484 $upper_limit->setMaxLength( 20 );
485 $upper_limit->setRequired(
true );
486 $upper_limit->setValue( $this->object->getUpperLimit() );
487 $form->
addItem( $upper_limit );
490 if( $this->object->getMaxChars() > 0 )
492 $lower_limit->setSize( $this->object->getMaxChars() );
493 $lower_limit->setMaxLength( $this->object->getMaxChars() );
494 $upper_limit->setSize( $this->object->getMaxChars() );
495 $upper_limit->setMaxLength( $this->object->getMaxChars() );
524 return array(
'maxchars');
529 $element = $form->getItemByPostvar(
'maxchars');
530 $_POST[
'maxchars'] = $this->
object->getMaxChars();
531 $element->setValue( $this->object->getMaxChars() );
543 $passcount = count($relevant_answers);
544 foreach($relevant_answers as
$pass)
546 $actives[$pass[
'active_fi']] = $pass[
'active_fi'];
548 $usercount = count($actives);
549 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_header.html',
true,
true,
"Modules/TestQuestionPool");
550 $tpl->setVariable(
'HEADERTEXT', $this->lng->txt(
'overview'));
551 $tpl->setVariable(
'NUMBER_OF_USERS_INFO', $this->lng->txt(
'number_of_users'));
552 $tpl->setVariable(
'NUMBER_OF_USERS', $usercount);
553 $tpl->setVariable(
'NUMBER_OF_PASSES_INFO', $this->lng->txt(
'number_of_passes'));
554 $tpl->setVariable(
'NUMBER_OF_PASSES', $passcount);
562 $aggregate = array();
564 foreach ($relevant_answers_chosen as $relevant_answer)
566 if ( array_key_exists($relevant_answer[
'value1'], $aggregate) )
568 $aggregate[$relevant_answer[
'value1']]++;
572 $aggregate[$relevant_answer[
'value1']] = 1;
585 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html',
true,
true,
"Modules/TestQuestionPool");
586 $tpl->setVariable(
'OPTION_HEADER', $this->lng->txt(
'answer') );
587 $tpl->setVariable(
'COUNT_HEADER', $this->lng->txt(
'count') );
588 $tpl->setVariable(
'AGGREGATION_HEADER', $this->lng->txt(
'aggregated_answers_header') );
590 foreach ($aggregate as $answer => $count)
592 $tpl->setCurrentBlock(
'aggregaterow' );
593 $tpl->setVariable(
'OPTION', $answer );
594 $tpl->setVariable(
'COUNT', $count );
595 $tpl->parseCurrentBlock();