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';
42 $this->
object->loadFromDb(
$id);
48 if (substr($cmd, 0, 6) ==
"delete") {
59 $hasErrors = (!$always) ? $this->
editQuestion(
true) :
false;
61 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
83 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
85 $this->editForm =
$form;
87 $form->setFormAction($this->ctrl->getFormAction($this));
89 $form->setMultipart(
true);
90 $form->setTableWidth(
"100%");
91 $form->setId(
"assnumeric");
102 $form->setValuesByPost();
104 $form->setValuesByPost();
106 $lower =
$form->getItemByPostVar(
'lowerlimit');
107 $upper =
$form->getItemByPostVar(
'upperlimit');
109 if (!$this->
checkRange($lower->getValue(), $upper->getValue())) {
111 $lower->setAlert($DIC->language()->txt(
'qpl_numeric_lower_needs_valid_lower_alert'));
112 $upper->setAlert($DIC->language()->txt(
'qpl_numeric_upper_needs_valid_upper_alert'));
123 $this->tpl->setVariable(
"QUESTION_DATA",
$form->getHTML());
137 include_once
"./Services/Math/classes/class.EvalMath.php";
139 $eval->suppress_errors =
true;
140 if (($eval->e($lower) !==
false) and ($eval->e($upper) !==
false)) {
141 if ($eval->e($lower) <= $eval->e($upper)) {
168 $graphicalOutput =
false,
169 $result_output =
false,
170 $show_question_only =
true,
171 $show_feedback =
false,
172 $show_correct_solution =
false,
173 $show_manual_scoring =
false,
174 $show_question_text =
true 177 $solutions =
array();
178 if (($active_id > 0) && (!$show_correct_solution)) {
179 $solutions =&$this->
object->getSolutionValues($active_id,
$pass);
181 array_push($solutions,
array(
"value1" => sprintf($this->lng->txt(
"value_between_x_and_y"), $this->
object->getLowerLimit(), $this->
object->getUpperLimit())));
185 require_once
'./Services/UICore/classes/class.ilTemplate.php';
186 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output_solution.html",
true,
true,
"Modules/TestQuestionPool");
187 $solutiontemplate =
new ilTemplate(
"tpl.il_as_tst_solution_output.html",
true,
true,
"Modules/TestQuestionPool");
188 if (is_array($solutions)) {
189 if (($active_id > 0) && (!$show_correct_solution)) {
190 if ($graphicalOutput) {
191 if ($this->
object->getStep() === null) {
192 $reached_points = $this->
object->getReachedPoints($active_id,
$pass);
194 $reached_points = $this->
object->calculateReachedPoints($active_id,
$pass);
197 if ($reached_points == $this->
object->getMaximumPoints()) {
200 $template->setVariable(
"TEXT_OK", $this->lng->txt(
"answer_is_right"));
205 $template->setVariable(
"TEXT_NOT_OK", $this->lng->txt(
"answer_is_wrong"));
210 foreach ($solutions as $solution) {
211 $template->setVariable(
"NUMERIC_VALUE", $solution[
"value1"]);
213 if (count($solutions) == 0) {
214 $template->setVariable(
"NUMERIC_VALUE",
" ");
218 $questiontext = $this->
object->getQuestion();
219 if ($show_question_text==
true) {
220 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($questiontext,
true));
226 if (strlen($feedback)) {
232 $solutiontemplate->setVariable(
"ILC_FB_CSS_CLASS", $cssClass);
233 $solutiontemplate->setVariable(
"FEEDBACK", $this->
object->prepareTextareaOutput($feedback,
true));
235 $solutiontemplate->setVariable(
"SOLUTION_OUTPUT", $questionoutput);
237 $solutionoutput = $solutiontemplate->get();
238 if (!$show_question_only) {
242 return $solutionoutput;
250 public function getPreview($show_question_only =
false, $showInlineFeedback =
false)
253 require_once
'./Services/UICore/classes/class.ilTemplate.php';
254 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html",
true,
true,
"Modules/TestQuestionPool");
259 $questiontext = $this->
object->getQuestion();
260 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($questiontext,
true));
262 if (!$show_question_only) {
266 return $questionoutput;
278 public function getTestOutput($active_id,
$pass, $is_postponed =
false, $use_post_solutions =
false, $inlineFeedback)
283 if ($use_post_solutions !==
false) {
285 array(
'value1' => $use_post_solutions[
'numeric_result'])
287 } elseif ($active_id) {
290 #include_once "./Modules/Test/classes/class.ilObjTest.php"; 291 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) 293 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id); 295 $solutions = $this->
object->getTestOutputSolutions($active_id,
$pass);
300 require_once
'./Services/UICore/classes/class.ilTemplate.php';
301 $template =
new ilTemplate(
"tpl.il_as_qpl_numeric_output.html",
true,
true,
"Modules/TestQuestionPool");
302 if (is_array($solutions)) {
303 foreach ($solutions as $solution) {
304 $template->setVariable(
"NUMERIC_VALUE",
" value=\"" . $solution[
"value1"] .
"\"");
308 $questiontext = $this->
object->getQuestion();
309 $template->setVariable(
"QUESTIONTEXT", $this->
object->prepareTextareaOutput($questiontext,
true));
311 $pageoutput = $this->
outQuestionPage(
"", $is_postponed, $active_id, $questionoutput);
324 global $rbacsystem, $ilTabs;
326 $ilTabs->clearTargets();
328 $this->ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id",
$_GET[
"q_id"]);
329 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
330 $q_type = $this->
object->getQuestionType();
332 if (strlen($q_type)) {
333 $classname = $q_type .
"GUI";
334 $this->ctrl->setParameterByClass(strtolower($classname),
"sel_question_types", $q_type);
335 $this->ctrl->setParameterByClass(strtolower($classname),
"q_id",
$_GET[
"q_id"]);
339 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
343 $this->ctrl->getLinkTargetByClass(
"ilAssQuestionPageGUI",
"edit"),
344 array(
"edit",
"insert",
"exec_pg"),
354 $force_active =
false;
355 if ($rbacsystem->checkAccess(
'write',
$_GET[
"ref_id"])) {
358 $url = $this->ctrl->getLinkTargetByClass($classname,
"editQuestion");
364 array(
"editQuestion",
"save",
"cancel",
"saveEdit",
"originalSyncForm"),
384 $this->ctrl->getLinkTargetByClass($classname,
"assessment"),
403 return $this->
object->prepareTextareaOutput(
$output,
true);
408 $this->
object->setMaxChars(
$_POST[
"maxchars"]);
413 $this->
object->setLowerLimit(
$_POST[
'lowerlimit']);
414 $this->
object->setUpperLimit(
$_POST[
'upperlimit']);
415 $this->
object->setPoints(
$_POST[
'points']);
422 $maxchars->
setInfo($this->lng->txt(
'qpl_maxchars_info_numeric_question'));
423 $maxchars->setSize(10);
424 $maxchars->setDecimals(0);
425 $maxchars->setMinValue(1);
426 $maxchars->setRequired(
true);
427 if ($this->
object->getMaxChars() > 0) {
428 $maxchars->setValue($this->
object->getMaxChars());
438 $points->setValue($this->
object->getPoints() > 0 ? $this->
object->getPoints() :
'');
439 $points->setRequired(
true);
441 $points->setMinValue(0.0);
442 $points->setMinvalueShouldBeGreater(
true);
446 $header->setTitle($this->lng->txt(
"range"));
450 $lower_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_lower_limit"),
"lowerlimit");
452 $lower_limit->setMaxLength(20);
453 $lower_limit->setRequired(
true);
454 $lower_limit->setValue($this->
object->getLowerLimit());
458 $upper_limit =
new ilFormulaInputGUI($this->lng->txt(
"range_upper_limit"),
"upperlimit");
460 $upper_limit->setMaxLength(20);
461 $upper_limit->setRequired(
true);
462 $upper_limit->setValue($this->
object->getUpperLimit());
466 if ($this->
object->getMaxChars() > 0) {
467 $lower_limit->setSize($this->
object->getMaxChars());
468 $lower_limit->setMaxLength($this->
object->getMaxChars());
469 $upper_limit->setSize($this->
object->getMaxChars());
470 $upper_limit->setMaxLength($this->
object->getMaxChars());
519 $aggregate =
array();
521 foreach ($relevant_answers_chosen as $relevant_answer) {
522 if (array_key_exists($relevant_answer[
'value1'], $aggregate)) {
523 $aggregate[$relevant_answer[
'value1']]++;
525 $aggregate[$relevant_answer[
'value1']] = 1;
538 $tpl =
new ilTemplate(
'tpl.il_as_aggregated_answers_table.html',
true,
true,
"Modules/TestQuestionPool");
540 $tpl->setCurrentBlock(
'headercell');
541 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_answer_header'));
542 $tpl->parseCurrentBlock();
544 $tpl->setCurrentBlock(
'headercell');
545 $tpl->setVariable(
'HEADER', $this->lng->txt(
'tst_answer_aggr_frequency_header'));
546 $tpl->parseCurrentBlock();
548 foreach ($aggregate as
$key => $value) {
549 $tpl->setCurrentBlock(
'aggregaterow');
551 $tpl->setVariable(
'COUNT', $value);
552 $tpl->parseCurrentBlock();
isTestPresentationContext()
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
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
getPreview($show_question_only=false, $showInlineFeedback=false)
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)
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.
if(!array_key_exists('StateId', $_REQUEST)) $id
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()
if(isset($_POST['submit'])) $form
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.
getTestOutput($active_id, $pass, $is_postponed=false, $use_post_solutions=false, $inlineFeedback)
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()
Class for numeric questions.
Create new PHPExcel object
obj_idprivate
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)
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.