ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.assTextQuestionGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once './Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
5require_once './Modules/TestQuestionPool/interfaces/interface.ilGuiQuestionScoringAdjustable.php';
6require_once './Modules/TestQuestionPool/interfaces/interface.ilGuiAnswerScoringAdjustable.php';
7require_once './Modules/Test/classes/inc.AssessmentConstants.php';
8
24{
32 public function __construct($id = -1)
33 {
34 parent::__construct();
35 include_once "./Modules/TestQuestionPool/classes/class.assTextQuestion.php";
36 $this->object = new assTextQuestion();
37 if ($id >= 0) {
38 $this->object->loadFromDb($id);
39 }
40 }
41
45 protected function writePostData($always = false)
46 {
47 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
48 if (!$hasErrors) {
49 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
54 return 0;
55 }
56 return 1;
57 }
58
64 public function editQuestion($checkonly = false)
65 {
66 $save = $this->isSaveCommand();
67 $this->getQuestionTemplate();
68
69 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
71 $this->editForm = $form;
72
73 $form->setFormAction($this->ctrl->getFormAction($this));
74 $form->setTitle($this->outQuestionType());
75 $form->setMultipart(true);
76 $form->setTableWidth("100%");
77 $form->setId("asstextquestion");
78
82
83
85
87
88 $errors = false;
89
90 if ($save) {
91 $form->setValuesByPost();
92 $errors = !$form->checkInput();
93 $form->setValuesByPost(); // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
94 if ($errors) {
95 $checkonly = false;
96 }
97 }
98
99 if (!$checkonly) {
100 $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
101 }
102 return $errors;
103 }
104
105 private static function buildAnswerTextOnlyArray($answers)
106 {
107 $answerTexts = array();
108
109 foreach ($answers as $answer) {
110 $answerTexts[] = $answer->getAnswertext();
111 }
112
113 return $answerTexts;
114 }
115
116 public function outAdditionalOutput()
117 {
118 }
119
120 public function magicAfterTestOutput()
121 {
122 // TODO - BEGIN: what exactly is done here? cant we use the parent method?
123
124 include_once "./Services/RTE/classes/class.ilRTE.php";
125 $rtestring = ilRTE::_getRTEClassname();
126 include_once "./Services/RTE/classes/class.$rtestring.php";
127 $rte = new $rtestring();
128 include_once "./Services/Object/classes/class.ilObject.php";
129 $obj_id = ilObject::_lookupObjectId($_GET["ref_id"]);
130 $obj_type = ilObject::_lookupType($_GET["ref_id"], true);
131 $rte->addUserTextEditor("textinput");
132 $this->outAdditionalOutput();
133
134 // TODO - END: what exactly is done here? cant we use the parent method?
135 }
136
150 public function getSolutionOutput(
151 $active_id,
152 $pass = null,
153 $graphicalOutput = false,
154 $result_output = false,
155 $show_question_only = true,
156 $show_feedback = false,
157 $show_correct_solution = false,
158 $show_manual_scoring = false,
159 $show_question_text = true
160 ) {
161 // get the solution of the user for the active pass or from the last pass if allowed
162
163 $user_solution = $this->getUserAnswer($active_id, $pass);
164
165 if (($active_id > 0) && (!$show_correct_solution)) {
166 $solution = $user_solution;
167 } else {
168 $solution = $this->getBestAnswer($this->renderPurposeSupportsFormHtml());
169 }
170
171 // generate the question output
172 include_once "./Services/UICore/classes/class.ilTemplate.php";
173 $template = new ilTemplate("tpl.il_as_qpl_text_question_output_solution.html", true, true, "Modules/TestQuestionPool");
174 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", true, true, "Modules/TestQuestionPool");
175
176 $solution = $this->object->getHtmlUserSolutionPurifier()->purify($solution);
177 if ($this->renderPurposeSupportsFormHtml()) {
178 $template->setCurrentBlock('essay_div');
179 $template->setVariable("DIV_ESSAY", $this->object->prepareTextareaOutput($solution, true));
180 } else {
181 $template->setCurrentBlock('essay_textarea');
182 $template->setVariable("TA_ESSAY", $this->object->prepareTextareaOutput($solution, true, true));
183 }
184 $template->parseCurrentBlock();
185
186 $questiontext = $this->object->getQuestion();
187
188 if (!$show_correct_solution) {
189 $max_no_of_chars = $this->object->getMaxNumOfChars();
190
191 if ($max_no_of_chars == 0) {
192 $max_no_of_chars = ucfirst($this->lng->txt('unlimited'));
193 }
194
195 $act_no_of_chars = $this->object->countLetters($user_solution);
196 $template->setVariable("CHARACTER_INFO", '<b>' . $max_no_of_chars . '</b>' .
197 $this->lng->txt('answer_characters') . ' <b>' . $act_no_of_chars . '</b>');
198 }
199 if (($active_id > 0) && (!$show_correct_solution)) {
200 if ($graphicalOutput) {
201 // output of ok/not ok icons for user entered solutions
202 $reached_points = $this->object->getReachedPoints($active_id, $pass);
203 if ($reached_points == $this->object->getMaximumPoints()) {
204 $template->setCurrentBlock("icon_ok");
205 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
206 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
207 $template->parseCurrentBlock();
208 } else {
209 $template->setCurrentBlock("icon_ok");
210 if ($reached_points > 0) {
211 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
212 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
213 } else {
214 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
215 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
216 }
217 $template->parseCurrentBlock();
218 }
219 }
220 }
221 if ($show_question_text==true) {
222 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
223 }
224 $questionoutput = $template->get();
225
226 $feedback = '';
227 if ($show_feedback) {
228 if (!$this->isTestPresentationContext()) {
229 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
230 $feedback .= strlen($fb) ? $fb : '';
231 }
232
233 $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
234 $feedback .= strlen($fb) ? $fb : '';
235 }
236 if (strlen($feedback)) {
237 $cssClass = (
238 $this->hasCorrectSolution($active_id, $pass) ?
240 );
241
242 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
243 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($feedback, true));
244 }
245
246 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
247
248 $solutionoutput = $solutiontemplate->get();
249 if (!$show_question_only) {
250 // get page object output
251 $solutionoutput = $this->getILIASPage($solutionoutput);
252 }
253 return $solutionoutput;
254 }
255
256 private function getBestAnswer($asHtml)
257 {
258 $answers = $this->object->getAnswers();
259 if (!count($answers)) {
260 return '';
261 }
262
263 if ($asHtml) {
264 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_html.html';
265 } else {
266 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_ta.html';
267 }
268
269 $tpl = new ilTemplate($tplFile, true, true, 'Modules/TestQuestionPool');
270
271 foreach ($answers as $answer) {
272 $keywordString = $answer->getAnswertext();
273
274 if (in_array($this->object->getKeywordRelation(), assTextQuestion::getScoringModesWithPointsByKeyword())) {
275 $keywordString .= ' ' . $this->lng->txt('for') . ' ';
276 $keywordString .= $answer->getPoints() . ' ' . $this->lng->txt('points');
277 }
278
279 $tpl->setCurrentBlock('keyword');
280 $tpl->setVariable('KEYWORD', $keywordString);
281 $tpl->parseCurrentBlock();
282 }
283
284 $tpl->setVariable('KEYWORD_HEADER', $this->lng->txt('solution_contain_keywords'));
285 $tpl->setVariable('SCORING_LABEL', $this->lng->txt('essay_scoring_mode') . ': ');
286
287 switch ($this->object->getKeywordRelation()) {
288 case 'any':
289 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_any'));
290 break;
291 case 'all':
292 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_all'));
293 break;
294 case 'one':
295 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_one'));
296 break;
297 }
298
299 return $tpl->get();
300 }
301
302 private function getUserAnswer($active_id, $pass)
303 {
304 $user_solution = "";
305 $solutions = $this->object->getSolutionValues($active_id, $pass);
306 foreach ($solutions as $idx => $solution_value) {
307 $user_solution = $solution_value["value1"];
308 }
309 return $user_solution;
310 }
311
312 public function getPreview($show_question_only = false, $showInlineFeedback = false)
313 {
314 // generate the question output
315 include_once "./Services/UICore/classes/class.ilTemplate.php";
316 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", true, true, "Modules/TestQuestionPool");
317 if ($this->object->getMaxNumOfChars()) {
318 $template->setCurrentBlock("maximum_char_hint");
319 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
320 $template->parseCurrentBlock();
321 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
322 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
323 $template->parseCurrentBlock();
324 $template->setCurrentBlock("maxchars_counter");
325 $template->setVariable("QID", $this->object->getId());
326 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
327 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
328 $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
329 $template->parseCurrentBlock();
330 }
331
332 if (is_object($this->getPreviewSession())) {
333 $template->setVariable("ESSAY", ilUtil::prepareFormOutput(
334 $this->getPreviewSession()->getParticipantsSolution()
335 ));
336 }
337
338 $questiontext = $this->object->getQuestion();
339 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
340 $template->setVariable("QID", $this->object->getId());
341
342 $questionoutput = $template->get();
343
344 $questionoutput .= $this->getJsCode();
345
346 if (!$show_question_only) {
347 // get page object output
348 $questionoutput = $this->getILIASPage($questionoutput);
349 }
350 return $questionoutput;
351 }
352
353 public function getTestOutput($active_id, $pass = null, $is_postponed = false, $use_post_solutions = false, $inlineFeedback = false)
354 {
355 // get the solution of the user for the active pass or from the last pass if allowed
356 $user_solution = "";
357 if ($active_id) {
358 $solutions = null;
359 // hey: prevPassSolutions - obsolete due to central check
360 #include_once "./Modules/Test/classes/class.ilObjTest.php";
361 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
362 #{
363 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
364 #}
365 // hey.
366 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
367 foreach ($solutions as $idx => $solution_value) {
368 $user_solution = $solution_value["value1"];
369 }
370 }
371
372 // generate the question output
373 include_once "./Services/UICore/classes/class.ilTemplate.php";
374 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", true, true, "Modules/TestQuestionPool");
375 if ($this->object->getMaxNumOfChars()) {
376 $template->setCurrentBlock("maximum_char_hint");
377 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
378 $template->parseCurrentBlock();
379 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
380 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
381 $template->parseCurrentBlock();
382 $template->setCurrentBlock("maxchars_counter");
383 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
384 $template->setVariable("QID", $this->object->getId());
385 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
386 $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
387 $template->parseCurrentBlock();
388 }
389 $template->setVariable("QID", $this->object->getId());
390 $template->setVariable("ESSAY", ilUtil::prepareFormOutput($user_solution));
391 $questiontext = $this->object->getQuestion();
392 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, true));
393 $questionoutput = $template->get();
394
395 $questionoutput .= $this->getJsCode();
396
397 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
398 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
400 return $pageoutput;
401 }
402
403 protected function getJsCode()
404 {
405 $tpl = new ilTemplate('tpl.charcounter.html', true, true, 'Modules/TestQuestionPool');
406
407 $tpl->setCurrentBlock('tinymce_handler');
408 $tpl->touchBlock('tinymce_handler');
409 $tpl->parseCurrentBlock();
410
411 if ($this->object->getMaxNumOfChars() > 0) {
412 $tpl->setCurrentBlock('letter_counter_js');
413 $tpl->setVariable("QID", $this->object->getId());
414 $tpl->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
415 $tpl->parseCurrentBlock();
416 }
417
418 return $tpl->get();
419 }
420
421 public function addSuggestedSolution()
422 {
423 $_SESSION["subquestion_index"] = 0;
424 if ($_POST["cmd"]["addSuggestedSolution"]) {
425 if ($this->writePostData()) {
427 $this->editQuestion();
428 return;
429 }
430 if (!$this->checkInput()) {
431 ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
432 $this->editQuestion();
433 return;
434 }
435 }
436 $this->object->saveToDb();
437 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
438 $this->tpl->setVariable("HEADER", $this->object->getTitle());
439 $this->getQuestionTemplate();
440 parent::addSuggestedSolution();
441 }
442
450 public function setQuestionTabs()
451 {
452 global $rbacsystem, $ilTabs;
453
454 $ilTabs->clearTargets();
455
456 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
457 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
458 $q_type = $this->object->getQuestionType();
459
460 if (strlen($q_type)) {
461 $classname = $q_type . "GUI";
462 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
463 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
464 }
465
466 if ($_GET["q_id"]) {
467 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
468 // edit page
469 $ilTabs->addTarget(
470 "edit_page",
471 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
472 array("edit", "insert", "exec_pg"),
473 "",
474 "",
475 $force_active
476 );
477 }
478
479 $this->addTab_QuestionPreview($ilTabs);
480 }
481
482 $force_active = false;
483 if ($rbacsystem->checkAccess('write', $_GET["ref_id"])) {
484 $url = "";
485 if ($classname) {
486 $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
487 }
488 // edit question properties
489 $ilTabs->addTarget(
490 "edit_question",
491 $url,
492 array("editQuestion", "save", "saveEdit", "originalSyncForm"),
493 $classname,
494 "",
495 $force_active
496 );
497 }
498
499 // add tab for question feedback within common class assQuestionGUI
500 $this->addTab_QuestionFeedback($ilTabs);
501
502 // add tab for question hint within common class assQuestionGUI
503 $this->addTab_QuestionHints($ilTabs);
504
505 // add tab for question's suggested solution within common class assQuestionGUI
506 $this->addTab_SuggestedSolution($ilTabs, $classname);
507
508 // Assessment of questions sub menu entry
509 if ($_GET["q_id"]) {
510 $ilTabs->addTarget(
511 "statistics",
512 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
513 array("assessment"),
514 $classname,
515 ""
516 );
517 }
518
519 $this->addBackTab($ilTabs);
520 }
521
522 public function getSpecificFeedbackOutput($active_id, $pass)
523 {
524 $feedback = '<table><tbody>';
525 $user_answers = $this->object->getSolutionValues($active_id);
526 $user_answer = ' ' . $user_answers[0]['value1'];
527
528 foreach ($this->object->getAnswers() as $idx => $ans) {
529 if ($this->object->isKeywordMatching($user_answer, $ans->getAnswertext())) {
530 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
531 $this->object->getId(),
532 $idx
533 );
534 $feedback .= '<tr><td><b><i>' . $ans->getAnswertext() . '</i></b></td><td>';
535 $feedback .= $fb . '</td> </tr>';
536 }
537 }
538
539 $feedback .= '</tbody></table>';
540 return $this->object->prepareTextareaOutput($feedback, true);
541 }
542
544 {
545 $this->object->setMaxNumOfChars($_POST["maxchars"]);
546 $this->object->setTextRating($_POST["text_rating"]);
547 $this->object->setKeywordRelation($_POST['scoring_mode']);
548 }
549
551 {
552 switch ($this->object->getKeywordRelation()) {
553 case 'non':
554 $this->object->setAnswers(array());
555 $this->object->setPoints($_POST['non_keyword_points']);
556 break;
557 case 'any':
558 $this->object->setAnswers($_POST['any_keyword']);
559 $this->object->setPoints($this->object->getMaximumPoints());
560 break;
561 case 'all':
562 $this->object->setAnswers($_POST['all_keyword']);
563 $this->object->setPoints($_POST['all_keyword_points']);
564 break;
565 case 'one':
566 $this->object->setAnswers($_POST['one_keyword']);
567 $this->object->setPoints($_POST['one_keyword_points']);
568 break;
569 }
570 }
571
573 {
574 // maxchars
575 $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
576 $maxchars->setSize(5);
577 if ($this->object->getMaxNumOfChars() > 0) {
578 $maxchars->setValue($this->object->getMaxNumOfChars());
579 }
580 $maxchars->setInfo($this->lng->txt("description_maxchars"));
581 $form->addItem($maxchars);
582
583 // text rating
584 $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
585 $text_options = array(
586 "ci" => $this->lng->txt("cloze_textgap_case_insensitive"),
587 "cs" => $this->lng->txt("cloze_textgap_case_sensitive"),
588 "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"),
589 "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"),
590 "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"),
591 "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"),
592 "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")
593 );
594 $textrating->setOptions($text_options);
595 $textrating->setValue($this->object->getTextRating());
596 $form->addItem($textrating);
597
598 return $form;
599 }
600
602 {
603 $scoringMode = new ilRadioGroupInputGUI(
604 $this->lng->txt('essay_scoring_mode'),
605 'scoring_mode'
606 );
607
608 $scoringOptionNone = new ilRadioOption(
609 $this->lng->txt('essay_scoring_mode_without_keywords'),
610 'non',
611 $this->lng->txt(
612 'essay_scoring_mode_without_keywords_desc'
613 )
614 );
615 $scoringOptionAnyKeyword = new ilRadioOption(
616 $this->lng->txt('essay_scoring_mode_keyword_relation_any'),
617 'any',
618 $this->lng->txt(
619 'essay_scoring_mode_keyword_relation_any_desc'
620 )
621 );
622 $scoringOptionAllKeyword = new ilRadioOption(
623 $this->lng->txt('essay_scoring_mode_keyword_relation_all'),
624 'all',
625 $this->lng->txt(
626 'essay_scoring_mode_keyword_relation_all_desc'
627 )
628 );
629 $scoringOptionOneKeyword = new ilRadioOption(
630 $this->lng->txt('essay_scoring_mode_keyword_relation_one'),
631 'one',
632 $this->lng->txt(
633 'essay_scoring_mode_keyword_relation_one_desc'
634 )
635 );
636
637 $scoringMode->addOption($scoringOptionNone);
638 $scoringMode->addOption($scoringOptionAnyKeyword);
639 $scoringMode->addOption($scoringOptionAllKeyword);
640 $scoringMode->addOption($scoringOptionOneKeyword);
641 $scoringMode->setRequired(true);
642 $scoringMode->setValue(
643 strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation(
644 ) : 'non'
645 );
646
647 if ($this->object->getAnswerCount() == 0) {
648 $this->object->addAnswer("", 1, 0, 0);
649 }
650 require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
651
652 // Without Keywords
653 $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points");
654 $nonKeywordPoints->allowDecimals(true);
655 $nonKeywordPoints->setValue($this->object->getPoints());
656 $nonKeywordPoints->setRequired(true);
657 $nonKeywordPoints->setSize(3);
658 $nonKeywordPoints->setMinValue(0.0);
659 $nonKeywordPoints->setMinvalueShouldBeGreater(true);
660 $scoringOptionNone->addSubItem($nonKeywordPoints);
661
662 // Any Keyword
663 $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword");
664 $anyKeyword->setRequired(true);
665 $anyKeyword->setQuestionObject($this->object);
666 $anyKeyword->setSingleline(true);
667 $anyKeyword->setValues($this->object->getAnswers());
668 $scoringOptionAnyKeyword->addSubItem($anyKeyword);
669
670 // All Keywords
671 $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword");
672 $allKeyword->setRequired(true);
673 //$allKeyword->setQuestionObject($this->object);
674 //$allKeyword->setSingleline(TRUE);
675 $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
676 $scoringOptionAllKeyword->addSubItem($allKeyword);
677 $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points");
678 $allKeywordPoints->allowDecimals(true);
679 $allKeywordPoints->setValue($this->object->getPoints());
680 $allKeywordPoints->setRequired(true);
681 $allKeywordPoints->setSize(3);
682 $allKeywordPoints->setMinValue(0.0);
683 $allKeywordPoints->setMinvalueShouldBeGreater(true);
684 $scoringOptionAllKeyword->addSubItem($allKeywordPoints);
685
686 // One Keywords
687 $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword");
688 $oneKeyword->setRequired(true);
689 //$oneKeyword->setQuestionObject($this->object);
690 //$oneKeyword->setSingleline(TRUE);
691 $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
692 $scoringOptionOneKeyword->addSubItem($oneKeyword);
693 $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points");
694 $oneKeywordPoints->allowDecimals(true);
695 $oneKeywordPoints->setValue($this->object->getPoints());
696 $oneKeywordPoints->setRequired(true);
697 $oneKeywordPoints->setSize(3);
698 $oneKeywordPoints->setMinValue(0.0);
699 $oneKeywordPoints->setMinvalueShouldBeGreater(true);
700 $scoringOptionOneKeyword->addSubItem($oneKeywordPoints);
701
702 $form->addItem($scoringMode);
703 }
704
715 {
716 return array();
717 }
718
729 {
730 return array();
731 }
732
741 public function getAggregatedAnswersView($relevant_answers)
742 {
743 return ''; //print_r($relevant_answers,true);
744 }
745}
sprintf('%.4f', $callTime)
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
Basic GUI class for assessment questions.
populateTaxonomyFormSection(ilPropertyFormGUI $form)
addTab_QuestionHints(ilTabsGUI $tabs)
adds the hints tab to ilTabsGUI
addQuestionFormCommandButtons($form)
Add the command buttons of a question properties form.
getILIASPage($html="")
Returns the ILIAS Page around a question.
getQuestionTemplate()
get question template
addTab_SuggestedSolution(ilTabsGUI $tabs, $classname)
outQuestionPage($a_temp_var, $a_postponed=false, $active_id="", $html="")
output question page
addBackTab(ilTabsGUI $ilTabs)
hasCorrectSolution($activeId, $passIndex)
addTab_QuestionFeedback(ilTabsGUI $tabs)
adds the feedback tab to ilTabsGUI
addBasicQuestionFormProperties($form)
Add basic question form properties: assessment: title, author, description, question,...
addTab_QuestionPreview(ilTabsGUI $tabsGUI)
getGenericFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
Text question GUI representation.
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
getPreview($show_question_only=false, $showInlineFeedback=false)
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question specific values from $_POST and applies them to the data object.
writePostData($always=false)
{Evaluates a posted edit form and writes the form data in the question object.integer A positive valu...
__construct($id=-1)
assTextQuestionGUI constructor
editQuestion($checkonly=false)
Creates an output of the edit form for the question.
getSpecificFeedbackOutput($active_id, $pass)
Returns the answer specific feedback for the question.
getAfterParticipationSuppressionQuestionPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
setQuestionTabs()
Sets the ILIAS tabs for this question type.
getAfterParticipationSuppressionAnswerPostVars()
Returns a list of postvars which will be suppressed in the form output when used in scoring adjustmen...
writeAnswerSpecificPostData(ilPropertyFormGUI $form)
Extracts the answer specific values from $_POST and applies them to the data object.
getTestOutput($active_id, $pass=null, $is_postponed=false, $use_post_solutions=false, $inlineFeedback=false)
getUserAnswer($active_id, $pass)
static buildAnswerTextOnlyArray($answers)
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.
populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
Class for text questions.
static getScoringModesWithPointsByKeyword()
This class represents a number property in a property form.
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a property form user interface.
static _getRTEClassname()
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
special template class to simplify handling of ITX/PEAR
This class represents a text wizard property in a property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static initDomEvent()
Init YUI DomEvent.
$template
if(!array_key_exists('StateId', $_REQUEST)) $id
Interface ilGuiAnswerScoringAdjustable.
Interface ilGuiQuestionScoringAdjustable.
$errors
Definition: index.php:6
$url
if(isset($_POST['submit'])) $form