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';
37 parent::__construct();
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;
67 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
89 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
91 $form->setFormAction($this->ctrl->getFormAction($this));
93 $form->setMultipart(TRUE);
94 $form->setTableWidth(
"100%");
95 $form->setId(
"assnumeric");
107 $form->setValuesByPost();
108 $errors = !$form->checkInput();
109 $form->setValuesByPost();
110 if (
$errors) $checkonly =
false;
113 if (!$checkonly) $this->tpl->setVariable(
"QUESTION_DATA", $form->getHTML());
126 include_once
"./Services/Math/classes/class.EvalMath.php";
128 $eval->suppress_errors = TRUE;
129 if (($eval->e(
$_POST[
"rang_lower_limit"]) !== FALSE) AND ($eval->e(
$_POST [
"range_upper_limit"]) !== FALSE))
131 if ($eval->e(
$_POST[
"rang_lower_limit"]) < $eval->e(
$_POST[
"range_upper_limit"]))
161 $graphicalOutput = FALSE,
162 $result_output = FALSE,
163 $show_question_only = TRUE,
164 $show_feedback = FALSE,
165 $show_correct_solution = FALSE,
166 $show_manual_scoring = FALSE,
167 $show_question_text = TRUE
171 $solutions = array();
172 if (($active_id > 0) && (!$show_correct_solution))
174 $solutions =& $this->
object->getSolutionValues($active_id,
$pass);
178 array_push($solutions, array(
"value1" => sprintf($this->lng->txt(
"value_between_x_and_y"), $this->
object->getLowerLimit(), $this->
object->getUpperLimit())));
182 require_once
'./Services/UICore/classes/class.ilTemplate.php';
183 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output_solution.html", TRUE, TRUE,
"Modules/TestQuestionPool");
184 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",TRUE, TRUE,
"Modules/TestQuestionPool");
185 if (is_array($solutions))
187 if (($active_id > 0) && (!$show_correct_solution))
189 if ($graphicalOutput)
191 if($this->object->getStep() === NULL)
193 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
197 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
200 if ($reached_points == $this->object->getMaximumPoints())
202 $template->setCurrentBlock(
"icon_ok");
204 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
205 $template->parseCurrentBlock();
209 $template->setCurrentBlock(
"icon_ok");
211 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
212 $template->parseCurrentBlock();
216 foreach ($solutions as $solution)
218 $template->setVariable(
"NUMERIC_VALUE", $solution[
"value1"]);
220 if (count($solutions) == 0)
222 $template->setVariable(
"NUMERIC_VALUE",
" ");
225 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
226 $questiontext = $this->
object->getQuestion();
227 if ($show_question_text==
true)
229 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
231 $questionoutput = $template->get();
235 if (strlen($feedback))
241 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
242 $solutiontemplate->setVariable(
"FEEDBACK", $this->object->prepareTextareaOutput( $feedback,
true ));
244 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
246 $solutionoutput = $solutiontemplate->get();
247 if (!$show_question_only)
252 return $solutionoutput;
260 public function getPreview($show_question_only = FALSE, $showInlineFeedback =
false)
263 require_once
'./Services/UICore/classes/class.ilTemplate.php';
264 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
267 $template->setVariable(
"NUMERIC_VALUE",
" value=\"".$this->
getPreviewSession()->getParticipantsSolution().
"\"");
269 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
270 $questiontext = $this->
object->getQuestion();
271 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
272 $questionoutput = $template->get();
273 if (!$show_question_only)
278 return $questionoutput;
290 public function getTestOutput($active_id,
$pass, $is_postponed = FALSE, $use_post_solutions = FALSE, $inlineFeedback)
299 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 300 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 302 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 309 require_once
'./Services/UICore/classes/class.ilTemplate.php';
310 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html", TRUE, TRUE,
"Modules/TestQuestionPool");
311 if (is_array($solutions))
313 foreach ($solutions as $solution)
315 $template->setVariable(
"NUMERIC_VALUE",
" value=\"".$solution[
"value1"].
"\"");
318 $template->setVariable(
"NUMERIC_SIZE", $this->object->getMaxChars());
319 $questiontext = $this->
object->getQuestion();
320 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
321 $questionoutput = $template->get();
322 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
335 global $rbacsystem, $ilTabs;
337 $ilTabs->clearTargets();
339 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
340 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
341 $q_type = $this->
object->getQuestionType();
345 $classname = $q_type .
"GUI";
346 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
347 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
352 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
355 $ilTabs->addTarget(
"edit_page",
356 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
357 array(
"edit",
"insert",
"exec_pg"),
358 "",
"", $force_active);
364 $force_active =
false;
365 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"]))
368 if ($classname)
$url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
370 $ilTabs->addTarget(
"edit_question",
372 array(
"editQuestion",
"save",
"cancel",
"saveEdit",
"originalSyncForm"),
373 $classname,
"", $force_active);
388 $ilTabs->addTarget(
"statistics",
389 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
406 return $this->
object->prepareTextareaOutput($output, TRUE);
411 $this->
object->setMaxChars(
$_POST[
"maxchars"] );
416 $this->
object->setLowerLimit(
$_POST[
'lowerlimit'] );
417 $this->
object->setUpperLimit(
$_POST[
'upperlimit'] );
418 $this->
object->setPoints(
$_POST[
'points'] );
424 $maxchars =
new ilNumberInputGUI($this->lng->txt(
"maxchars" ),
"maxchars");
425 $maxchars->
setInfo($this->lng->txt(
'qpl_maxchars_info_numeric_question'));
426 $maxchars->setSize( 10 );
427 $maxchars->setDecimals( 0 );
428 $maxchars->setMinValue( 1 );
429 $maxchars->setRequired(
true );
430 if ($this->object->getMaxChars() > 0)
432 $maxchars->setValue($this->object->getMaxChars());
442 $points->setValue( $this->object->getPoints() > 0 ? $this->
object->getPoints() :
'' );
443 $points->setRequired( TRUE );
444 $points->setSize( 3 );
445 $points->setMinValue( 0.0 );
446 $points->setMinvalueShouldBeGreater(
true );
450 $header->setTitle( $this->lng->txt(
"range" ) );
454 $lower_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_lower_limit" ),
"lowerlimit");
456 $lower_limit->setMaxLength( 20 );
457 $lower_limit->setRequired(
true );
458 $lower_limit->setValue( $this->object->getLowerLimit() );
459 $form->
addItem( $lower_limit );
462 $upper_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_upper_limit" ),
"upperlimit");
464 $upper_limit->setMaxLength( 20 );
465 $upper_limit->setRequired(
true );
466 $upper_limit->setValue( $this->object->getUpperLimit() );
467 $form->
addItem( $upper_limit );
470 if( $this->object->getMaxChars() > 0 )
472 $lower_limit->setSize( $this->object->getMaxChars() );
473 $lower_limit->setMaxLength( $this->object->getMaxChars() );
474 $upper_limit->setSize( $this->object->getMaxChars() );
475 $upper_limit->setMaxLength( $this->object->getMaxChars() );
523 $aggregate = array();
525 foreach ($relevant_answers_chosen as $relevant_answer)
527 if ( array_key_exists($relevant_answer[
'value1'], $aggregate) )
529 $aggregate[$relevant_answer[
'value1']]++;
533 $aggregate[$relevant_answer[
'value1']] = 1;
546 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html',
true,
true,
"Modules/TestQuestionPool");
548 $tpl->setCurrentBlock(
'headercell');
549 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_answer_header'));
550 $tpl->parseCurrentBlock();
552 $tpl->setCurrentBlock(
'headercell');
553 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_frequency_header'));
554 $tpl->parseCurrentBlock();
556 foreach ($aggregate as $key => $value)
558 $tpl->setCurrentBlock(
'aggregaterow' );
559 $tpl->setVariable(
'OPTION', $key );
560 $tpl->setVariable(
'COUNT', $value );
561 $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)
getTestOutputSolutions($activeId, $pass)
writePostData($always=false)
Evaluates a posted edit form and writes the form data in the question object.
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.
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)
checkRange()
Checks the range limits.
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)
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.
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.