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 parent::__construct();
39 require_once
'./Modules/TestQuestionPool/classes/class.assNumeric.php';
43 $this->
object->loadFromDb($id);
49 if (substr(
$cmd, 0, 6) ==
"delete")
61 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
64 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
86 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
88 $this->editForm = $form;
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();
110 $lower = $form->getItemByPostVar(
'lowerlimit');
111 $upper = $form->getItemByPostVar(
'upperlimit');
113 if( !$this->
checkRange($lower->getValue(), $upper->getValue()) )
116 $lower->setAlert($DIC->language()->txt(
'qpl_numeric_lower_needs_valid_lower_alert'));
117 $upper->setAlert($DIC->language()->txt(
'qpl_numeric_upper_needs_valid_upper_alert'));
122 if (
$errors) $checkonly =
false;
125 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
138 include_once
"./Services/Math/classes/class.EvalMath.php";
140 $eval->suppress_errors = TRUE;
141 if (($eval->e($lower) !== FALSE) AND ($eval->e($upper) !== FALSE))
143 if ($eval->e($lower) <= $eval->e($upper))
173 $graphicalOutput = FALSE,
174 $result_output = FALSE,
175 $show_question_only = TRUE,
176 $show_feedback = FALSE,
177 $show_correct_solution = FALSE,
178 $show_manual_scoring = FALSE,
179 $show_question_text = TRUE
183 $solutions =
array();
184 if (($active_id > 0) && (!$show_correct_solution))
186 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
190 array_push($solutions,
array(
"value1" => sprintf($this->lng->txt(
"value_between_x_and_y"), $this->
object->getLowerLimit(), $this->
object->getUpperLimit())));
194 require_once
'./Services/UICore/classes/class.ilTemplate.php';
195 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
196 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
197 if (is_array($solutions))
199 if (($active_id > 0) && (!$show_correct_solution))
201 if ($graphicalOutput)
203 if($this->
object->getStep() === NULL)
205 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
209 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
212 if ($reached_points == $this->
object->getMaximumPoints())
214 $template->setCurrentBlock(
"icon_ok");
216 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
217 $template->parseCurrentBlock();
221 $template->setCurrentBlock(
"icon_ok");
223 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
224 $template->parseCurrentBlock();
228 foreach ($solutions as $solution)
230 $template->setVariable(
"NUMERIC_VALUE", $solution[
"value1"]);
232 if (count($solutions) == 0)
234 $template->setVariable(
"NUMERIC_VALUE",
" ");
237 $template->setVariable(
"NUMERIC_SIZE", $this->
object->getMaxChars());
238 $questiontext = $this->
object->getQuestion();
239 if ($show_question_text==
true)
241 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($questiontext, TRUE));
243 $questionoutput = $template->get();
247 if (strlen($feedback))
253 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
254 $solutiontemplate->setVariable(
"FEEDBACK", $this->
object->prepareTextareaOutput( $feedback,
true ));
256 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
258 $solutionoutput = $solutiontemplate->get();
259 if (!$show_question_only)
264 return $solutionoutput;
272 public function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
275 require_once
'./Services/UICore/classes/class.ilTemplate.php';
276 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
279 $template->setVariable(
"NUMERIC_VALUE",
" value=\"".$this->
getPreviewSession()->getParticipantsSolution().
"\"");
281 $template->setVariable(
"NUMERIC_SIZE", $this->
object->getMaxChars());
282 $questiontext = $this->
object->getQuestion();
283 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($questiontext, TRUE));
284 $questionoutput = $template->get();
285 if (!$show_question_only)
290 return $questionoutput;
302 public function getTestOutput($active_id,
$pass, $is_postponed = FALSE, $use_post_solutions = FALSE, $inlineFeedback)
307 if($use_post_solutions !==
false)
310 array(
'value1' => $use_post_solutions[
'numeric_result'])
317 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 318 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 320 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 322 $solutions = $this->
object->getTestOutputSolutions($active_id,
$pass);
327 require_once
'./Services/UICore/classes/class.ilTemplate.php';
328 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
329 if (is_array($solutions))
331 foreach ($solutions as $solution)
333 $template->setVariable(
"NUMERIC_VALUE",
" value=\"".$solution[
"value1"].
"\"");
336 $template->setVariable(
"NUMERIC_SIZE", $this->
object->getMaxChars());
337 $questiontext = $this->
object->getQuestion();
338 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($questiontext, TRUE));
339 $questionoutput = $template->get();
340 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
353 global $rbacsystem, $ilTabs;
355 $ilTabs->clearTargets();
357 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
358 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
359 $q_type = $this->
object->getQuestionType();
363 $classname = $q_type .
"GUI";
364 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
365 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
370 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
373 $ilTabs->addTarget(
"edit_page",
374 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
375 array(
"edit",
"insert",
"exec_pg"),
376 "",
"", $force_active);
382 $force_active =
false;
383 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
386 if ($classname)
$url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
388 $ilTabs->addTarget(
"edit_question",
390 array(
"editQuestion",
"save",
"cancel",
"saveEdit",
"originalSyncForm"),
391 $classname,
"", $force_active);
406 $ilTabs->addTarget(
"statistics",
407 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
424 return $this->
object->prepareTextareaOutput(
$output, TRUE);
429 $this->
object->setMaxChars(
$_POST[
"maxchars"] );
434 $this->
object->setLowerLimit(
$_POST[
'lowerlimit'] );
435 $this->
object->setUpperLimit(
$_POST[
'upperlimit'] );
436 $this->
object->setPoints(
$_POST[
'points'] );
442 $maxchars =
new ilNumberInputGUI($this->lng->txt(
"maxchars" ),
"maxchars");
443 $maxchars->
setInfo($this->lng->txt(
'qpl_maxchars_info_numeric_question'));
444 $maxchars->setSize( 10 );
445 $maxchars->setDecimals( 0 );
446 $maxchars->setMinValue( 1 );
447 $maxchars->setRequired(
true );
448 if ($this->
object->getMaxChars() > 0)
450 $maxchars->setValue($this->
object->getMaxChars());
460 $points->setValue( $this->
object->getPoints() > 0 ? $this->
object->getPoints() :
'' );
461 $points->setRequired( TRUE );
462 $points->setSize( 3 );
463 $points->setMinValue( 0.0 );
464 $points->setMinvalueShouldBeGreater(
true );
468 $header->setTitle( $this->lng->txt(
"range" ) );
472 $lower_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_lower_limit" ),
"lowerlimit");
474 $lower_limit->setMaxLength( 20 );
475 $lower_limit->setRequired(
true );
476 $lower_limit->setValue( $this->
object->getLowerLimit() );
477 $form->
addItem( $lower_limit );
480 $upper_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_upper_limit" ),
"upperlimit");
482 $upper_limit->setMaxLength( 20 );
483 $upper_limit->setRequired(
true );
484 $upper_limit->setValue( $this->
object->getUpperLimit() );
485 $form->
addItem( $upper_limit );
488 if( $this->
object->getMaxChars() > 0 )
490 $lower_limit->setSize( $this->
object->getMaxChars() );
491 $lower_limit->setMaxLength( $this->
object->getMaxChars() );
492 $upper_limit->setSize( $this->
object->getMaxChars() );
493 $upper_limit->setMaxLength( $this->
object->getMaxChars() );
541 $aggregate =
array();
543 foreach ($relevant_answers_chosen as $relevant_answer)
545 if ( array_key_exists($relevant_answer[
'value1'], $aggregate) )
547 $aggregate[$relevant_answer[
'value1']]++;
551 $aggregate[$relevant_answer[
'value1']] = 1;
564 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html',
true,
true,
"Modules/TestQuestionPool");
566 $tpl->setCurrentBlock(
'headercell');
567 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_answer_header'));
568 $tpl->parseCurrentBlock();
570 $tpl->setCurrentBlock(
'headercell');
571 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_frequency_header'));
572 $tpl->parseCurrentBlock();
574 foreach ($aggregate as $key => $value)
576 $tpl->setCurrentBlock(
'aggregaterow' );
577 $tpl->setVariable(
'OPTION', $key );
578 $tpl->setVariable(
'COUNT', $value );
579 $tpl->parseCurrentBlock();
isTestPresentationContext()
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question, working time.
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
aggregateAnswers($relevant_answers_chosen)
getSpecificFeedbackOutput($active_id, $pass)
writePostData($always=false)
{}
getQuestionTemplate()
get question template
const CSS_CLASS_FEEDBACK_CORRECT
populateTaxonomyFormSection(ilPropertyFormGUI $form)
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
checkRange($lower, $upper)
Checks the range limits.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
Numeric question GUI representation.
writeQuestionGenericPostData()
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.
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
setSize($a_size)
Set Size.
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
const CSS_CLASS_FEEDBACK_WRONG
Basic GUI class for assessment questions.
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
saveTaxonomyAssignments()
getTestOutput($active_id, $pass, $is_postponed=FALSE, $use_post_solutions=FALSE, $inlineFeedback)
Class for numeric questions.
Create new PHPExcel object
obj_idprivate
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
addBackTab(ilTabsGUI $ilTabs)
__construct($id=-1)
assNumericGUI constructor
Interface ilGuiAnswerScoringAdjustable.
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
renderAggregateView($aggregate)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
Interface ilGuiQuestionScoringAdjustable.
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.