ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
39 $this->object->loadFromDb($id);
40 }
41 }
42
46 protected function writePostData($always = false)
47 {
48 $hasErrors = (!$always) ? $this->editQuestion(true) : false;
49 if (!$hasErrors)
50 {
51 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
56 return 0;
57 }
58 return 1;
59 }
60
66 public function editQuestion($checkonly = FALSE)
67 {
68 $save = $this->isSaveCommand();
69 $this->getQuestionTemplate();
70
71 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
72 $form = new ilPropertyFormGUI();
73 $this->editForm = $form;
74
75 $form->setFormAction($this->ctrl->getFormAction($this));
76 $form->setTitle($this->outQuestionType());
77 $form->setMultipart(TRUE);
78 $form->setTableWidth("100%");
79 $form->setId("asstextquestion");
80
81 $this->addBasicQuestionFormProperties( $form );
83 $this->populateAnswerSpecificFormPart( $form );
84
85
86 $this->populateTaxonomyFormSection($form);
87
89
90 $errors = false;
91
92 if ($save)
93 {
94 $form->setValuesByPost();
95 $errors = !$form->checkInput();
96 $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
97 if ($errors) $checkonly = false;
98 }
99
100 if (!$checkonly) $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
101 return $errors;
102 }
103
104 private static function buildAnswerTextOnlyArray($answers)
105 {
106 $answerTexts = array();
107
108 foreach($answers as $answer)
109 {
110 $answerTexts[] = $answer->getAnswertext();
111 }
112
113 return $answerTexts;
114 }
115
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
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 {
162 // get the solution of the user for the active pass or from the last pass if allowed
163
164 $user_solution = $this->getUserAnswer( $active_id, $pass );
165
166 if (($active_id > 0) && (!$show_correct_solution))
167 {
168 $solution = $user_solution;
169 }
170 else
171 {
172 $solution = $this->getBestAnswer($this->renderPurposeSupportsFormHtml());
173 }
174
175 // generate the question output
176 include_once "./Services/UICore/classes/class.ilTemplate.php";
177 $template = new ilTemplate("tpl.il_as_qpl_text_question_output_solution.html", TRUE, TRUE, "Modules/TestQuestionPool");
178 $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html",TRUE, TRUE, "Modules/TestQuestionPool");
179
180 $solution = $this->object->getHtmlUserSolutionPurifier()->purify($solution);
181 if( $this->renderPurposeSupportsFormHtml() )
182 {
183 $template->setCurrentBlock('essay_div');
184 $template->setVariable("DIV_ESSAY", $this->object->prepareTextareaOutput($solution, TRUE));
185 }
186 else
187 {
188 $template->setCurrentBlock('essay_textarea');
189 $template->setVariable("TA_ESSAY", $this->object->prepareTextareaOutput($solution, TRUE, true));
190 }
191 $template->parseCurrentBlock();
192
193 $questiontext = $this->object->getQuestion();
194
195 if (!$show_correct_solution)
196 {
197 $max_no_of_chars = $this->object->getMaxNumOfChars();
198
199 if ($max_no_of_chars == 0)
200 {
201 $max_no_of_chars = ucfirst($this->lng->txt('unlimited'));
202 }
203 $act_no_of_chars = $this->object->countLetters($user_solution);
204 $template->setVariable("CHARACTER_INFO", '<b>' . $max_no_of_chars . '</b>' .
205 $this->lng->txt('answer_characters') . ' <b>' . $act_no_of_chars . '</b>');
206 }
207 if (($active_id > 0) && (!$show_correct_solution))
208 {
209 if ($graphicalOutput)
210 {
211 // output of ok/not ok icons for user entered solutions
212 $reached_points = $this->object->getReachedPoints($active_id, $pass);
213 if ($reached_points == $this->object->getMaximumPoints())
214 {
215 $template->setCurrentBlock("icon_ok");
216 $template->setVariable("ICON_OK", ilUtil::getImagePath("icon_ok.svg"));
217 $template->setVariable("TEXT_OK", $this->lng->txt("answer_is_right"));
218 $template->parseCurrentBlock();
219 }
220 else
221 {
222 $template->setCurrentBlock("icon_ok");
223 if ($reached_points > 0)
224 {
225 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_mostly_ok.svg"));
226 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_not_correct_but_positive"));
227 }
228 else
229 {
230 $template->setVariable("ICON_NOT_OK", ilUtil::getImagePath("icon_not_ok.svg"));
231 $template->setVariable("TEXT_NOT_OK", $this->lng->txt("answer_is_wrong"));
232 }
233 $template->parseCurrentBlock();
234 }
235 }
236 }
237 if ($show_question_text==true)
238 {
239 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
240 }
241 $questionoutput = $template->get();
242
243 $feedback = '';
244 if($show_feedback)
245 {
246 if( !$this->isTestPresentationContext() )
247 {
248 $fb = $this->getGenericFeedbackOutput($active_id, $pass);
249 $feedback .= strlen($fb) ? $fb : '';
250 }
251
252 $fb = $this->getSpecificFeedbackOutput($active_id, $pass);
253 $feedback .= strlen($fb) ? $fb : '';
254 }
255 if (strlen($feedback))
256 {
257 $cssClass = ( $this->hasCorrectSolution($active_id, $pass) ?
259 );
260
261 $solutiontemplate->setVariable("ILC_FB_CSS_CLASS", $cssClass);
262 $solutiontemplate->setVariable("FEEDBACK", $this->object->prepareTextareaOutput( $feedback, true ));
263 }
264
265 $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
266
267 $solutionoutput = $solutiontemplate->get();
268 if (!$show_question_only)
269 {
270 // get page object output
271 $solutionoutput = $this->getILIASPage($solutionoutput);
272 }
273 return $solutionoutput;
274 }
275
276 private function getBestAnswer($asHtml)
277 {
278 $answers = $this->object->getAnswers();
279 if( !count($answers) )
280 {
281 return '';
282 }
283
284 if($asHtml)
285 {
286 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_html.html';
287 }
288 else
289 {
290 $tplFile = 'tpl.il_as_qpl_text_question_best_solution_ta.html';
291 }
292
293 $tpl = new ilTemplate($tplFile, true, true, 'Modules/TestQuestionPool');
294
295 foreach ($answers as $answer)
296 {
297 $keywordString = $answer->getAnswertext();
298
299 if( in_array($this->object->getKeywordRelation(), assTextQuestion::getScoringModesWithPointsByKeyword()) )
300 {
301 $keywordString .= ' ' . $this->lng->txt('for') . ' ';
302 $keywordString .= $answer->getPoints() . ' ' . $this->lng->txt('points');
303 }
304
305 $tpl->setCurrentBlock('keyword');
306 $tpl->setVariable('KEYWORD', $keywordString);
307 $tpl->parseCurrentBlock();
308 }
309
310 $tpl->setVariable('KEYWORD_HEADER', $this->lng->txt('solution_contain_keywords'));
311 $tpl->setVariable('SCORING_LABEL', $this->lng->txt('essay_scoring_mode').': ');
312
313 switch( $this->object->getKeywordRelation() )
314 {
315 case 'any':
316 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_any'));
317 break;
318 case 'all':
319 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_all'));
320 break;
321 case 'one':
322 $tpl->setVariable('SCORING_MODE', $this->lng->txt('essay_scoring_mode_keyword_relation_one'));
323 break;
324 }
325
326 return $tpl->get();
327 }
328
329 private function getUserAnswer($active_id, $pass)
330 {
331 $user_solution = "";
332 $solutions = $this->object->getSolutionValues( $active_id, $pass );
333 foreach ($solutions as $idx => $solution_value)
334 {
335 $user_solution = $solution_value["value1"];
336 }
337 return $user_solution;
338 }
339
340 function getPreview($show_question_only = FALSE, $showInlineFeedback = false)
341 {
342 // generate the question output
343 include_once "./Services/UICore/classes/class.ilTemplate.php";
344 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
345 if ($this->object->getMaxNumOfChars())
346 {
347 $template->setCurrentBlock("maximum_char_hint");
348 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
349 $template->parseCurrentBlock();
350 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
351 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
352 $template->parseCurrentBlock();
353 $template->setCurrentBlock("maxchars_counter");
354 $template->setVariable("QID", $this->object->getId());
355 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
356 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
357 $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
358 $template->parseCurrentBlock();
359 }
360
361 if( is_object($this->getPreviewSession()) )
362 {
363 $template->setVariable("ESSAY", ilUtil::prepareFormOutput(
364 $this->getPreviewSession()->getParticipantsSolution()
365 ));
366 }
367
368 $questiontext = $this->object->getQuestion();
369 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
370 $template->setVariable("QID", $this->object->getId());
371
372 $questionoutput = $template->get();
373
374 $questionoutput .= $this->getJsCode();
375
376 if (!$show_question_only)
377 {
378 // get page object output
379 $questionoutput = $this->getILIASPage($questionoutput);
380 }
381 return $questionoutput;
382 }
383
384 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $inlineFeedback = false)
385 {
386 // get the solution of the user for the active pass or from the last pass if allowed
387 $user_solution = "";
388 if ($active_id)
389 {
390 $solutions = NULL;
391 // hey: prevPassSolutions - obsolete due to central check
392 #include_once "./Modules/Test/classes/class.ilObjTest.php";
393 #if (!ilObjTest::_getUsePreviousAnswers($active_id, true))
394 #{
395 # if (is_null($pass)) $pass = ilObjTest::_getPass($active_id);
396 #}
397 // hey.
398 $solutions = $this->object->getUserSolutionPreferingIntermediate($active_id, $pass);
399 foreach ($solutions as $idx => $solution_value)
400 {
401 $user_solution = $solution_value["value1"];
402 }
403 }
404
405 // generate the question output
406 include_once "./Services/UICore/classes/class.ilTemplate.php";
407 $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
408 if ($this->object->getMaxNumOfChars())
409 {
410 $template->setCurrentBlock("maximum_char_hint");
411 $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
412 $template->parseCurrentBlock();
413 #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
414 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
415 $template->parseCurrentBlock();
416 $template->setCurrentBlock("maxchars_counter");
417 $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
418 $template->setVariable("QID", $this->object->getId());
419 $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
420 $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
421 $template->parseCurrentBlock();
422 }
423 $template->setVariable("QID", $this->object->getId());
424 $template->setVariable("ESSAY", ilUtil::prepareFormOutput($user_solution));
425 $questiontext = $this->object->getQuestion();
426 $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
427 $questionoutput = $template->get();
428
429 $questionoutput .= $this->getJsCode();
430
431 $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
432 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
434 return $pageoutput;
435 }
436
437 protected function getJsCode()
438 {
439 $tpl = new ilTemplate('tpl.charcounter.html', true, true, 'Modules/TestQuestionPool');
440
441 $tpl->setCurrentBlock('tinymce_handler');
442 $tpl->touchBlock('tinymce_handler');
443 $tpl->parseCurrentBlock();
444
445 if ($this->object->getMaxNumOfChars() > 0)
446 {
447 $tpl->setCurrentBlock('letter_counter_js');
448 $tpl->setVariable("QID", $this->object->getId());
449 $tpl->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
450 $tpl->parseCurrentBlock();
451 }
452
453 return $tpl->get();
454 }
455
457 {
458 $_SESSION["subquestion_index"] = 0;
459 if ($_POST["cmd"]["addSuggestedSolution"])
460 {
461 if ($this->writePostData())
462 {
464 $this->editQuestion();
465 return;
466 }
467 if (!$this->checkInput())
468 {
469 ilUtil::sendInfo($this->lng->txt("fill_out_all_required_fields_add_answer"));
470 $this->editQuestion();
471 return;
472 }
473 }
474 $this->object->saveToDb();
475 $this->ctrl->setParameter($this, "q_id", $this->object->getId());
476 $this->tpl->setVariable("HEADER", $this->object->getTitle());
477 $this->getQuestionTemplate();
478 parent::addSuggestedSolution();
479 }
480
489 {
490 global $rbacsystem, $ilTabs;
491
492 $ilTabs->clearTargets();
493
494 $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $_GET["q_id"]);
495 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
496 $q_type = $this->object->getQuestionType();
497
498 if (strlen($q_type))
499 {
500 $classname = $q_type . "GUI";
501 $this->ctrl->setParameterByClass(strtolower($classname), "sel_question_types", $q_type);
502 $this->ctrl->setParameterByClass(strtolower($classname), "q_id", $_GET["q_id"]);
503 }
504
505 if ($_GET["q_id"])
506 {
507 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
508 {
509 // edit page
510 $ilTabs->addTarget("edit_page",
511 $this->ctrl->getLinkTargetByClass("ilAssQuestionPageGUI", "edit"),
512 array("edit", "insert", "exec_pg"),
513 "", "", $force_active);
514 }
515
516 $this->addTab_QuestionPreview($ilTabs);
517 }
518
519 $force_active = false;
520 if ($rbacsystem->checkAccess('write', $_GET["ref_id"]))
521 {
522 $url = "";
523 if ($classname) $url = $this->ctrl->getLinkTargetByClass($classname, "editQuestion");
524 // edit question properties
525 $ilTabs->addTarget("edit_question",
526 $url,
527 array("editQuestion", "save", "saveEdit", "originalSyncForm"),
528 $classname, "", $force_active);
529 }
530
531 // add tab for question feedback within common class assQuestionGUI
532 $this->addTab_QuestionFeedback($ilTabs);
533
534 // add tab for question hint within common class assQuestionGUI
535 $this->addTab_QuestionHints($ilTabs);
536
537 // add tab for question's suggested solution within common class assQuestionGUI
538 $this->addTab_SuggestedSolution($ilTabs, $classname);
539
540 // Assessment of questions sub menu entry
541 if ($_GET["q_id"])
542 {
543 $ilTabs->addTarget("statistics",
544 $this->ctrl->getLinkTargetByClass($classname, "assessment"),
545 array("assessment"),
546 $classname, "");
547 }
548
549 $this->addBackTab($ilTabs);
550 }
551
552 function getSpecificFeedbackOutput($active_id, $pass)
553 {
554 $feedback = '<table><tbody>';
555 $user_answers = $this->object->getSolutionValues($active_id);
556 $user_answer = ' '. $user_answers[0]['value1'];
557
558 foreach ($this->object->getAnswers() as $idx => $ans)
559 {
560 if ($this->object->isKeywordMatching($user_answer, $ans->getAnswertext() ))
561 {
562 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation(
563 $this->object->getId(), $idx
564 );
565 $feedback .= '<tr><td><b><i>' . $ans->getAnswertext() . '</i></b></td><td>';
566 $feedback .= $fb . '</td> </tr>';
567 }
568 }
569
570 $feedback .= '</tbody></table>';
571 return $this->object->prepareTextareaOutput($feedback, TRUE);
572 }
573
575 {
576 $this->object->setMaxNumOfChars( $_POST["maxchars"] );
577 $this->object->setTextRating( $_POST["text_rating"] );
578 $this->object->setKeywordRelation( $_POST['scoring_mode'] );
579 }
580
582 {
583 switch ($this->object->getKeywordRelation())
584 {
585 case 'non':
586 $this->object->setAnswers( array() );
587 $this->object->setPoints( $_POST['non_keyword_points'] );
588 break;
589 case 'any':
590 $this->object->setAnswers( $_POST['any_keyword'] );
591 $this->object->setPoints( $this->object->getMaximumPoints() );
592 break;
593 case 'all':
594 $this->object->setAnswers( $_POST['all_keyword'] );
595 $this->object->setPoints( $_POST['all_keyword_points'] );
596 break;
597 case 'one':
598 $this->object->setAnswers( $_POST['one_keyword'] );
599 $this->object->setPoints( $_POST['one_keyword_points'] );
600 break;
601 }
602 }
603
605 {
606 // maxchars
607 $maxchars = new ilNumberInputGUI($this->lng->txt( "maxchars" ), "maxchars");
608 $maxchars->setSize( 5 );
609 if ($this->object->getMaxNumOfChars() > 0)
610 $maxchars->setValue( $this->object->getMaxNumOfChars() );
611 $maxchars->setInfo( $this->lng->txt( "description_maxchars" ) );
612 $form->addItem( $maxchars );
613
614 // text rating
615 $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
616 $text_options = array(
617 "ci" => $this->lng->txt("cloze_textgap_case_insensitive"),
618 "cs" => $this->lng->txt("cloze_textgap_case_sensitive"),
619 "l1" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1"),
620 "l2" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2"),
621 "l3" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3"),
622 "l4" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4"),
623 "l5" => sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5")
624 );
625 $textrating->setOptions($text_options);
626 $textrating->setValue($this->object->getTextRating());
627 $form->addItem($textrating);
628
629 return $form;
630 }
631
633 {
634 $scoringMode = new ilRadioGroupInputGUI(
635 $this->lng->txt( 'essay_scoring_mode' ), 'scoring_mode'
636 );
637
638 $scoringOptionNone = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_without_keywords' ),
639 'non', $this->lng->txt( 'essay_scoring_mode_without_keywords_desc'
640 )
641 );
642 $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_keyword_relation_any' ),
643 'any', $this->lng->txt( 'essay_scoring_mode_keyword_relation_any_desc'
644 )
645 );
646 $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_keyword_relation_all' ),
647 'all', $this->lng->txt( 'essay_scoring_mode_keyword_relation_all_desc'
648 )
649 );
650 $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt( 'essay_scoring_mode_keyword_relation_one' ),
651 'one', $this->lng->txt( 'essay_scoring_mode_keyword_relation_one_desc'
652 )
653 );
654
655 $scoringMode->addOption( $scoringOptionNone );
656 $scoringMode->addOption( $scoringOptionAnyKeyword );
657 $scoringMode->addOption( $scoringOptionAllKeyword );
658 $scoringMode->addOption( $scoringOptionOneKeyword );
659 $scoringMode->setRequired( true );
660 $scoringMode->setValue( strlen( $this->object->getKeywordRelation() ) ? $this->object->getKeywordRelation(
661 ) : 'non'
662 );
663
664 if ($this->object->getAnswerCount() == 0)
665 {
666 $this->object->addAnswer( "", 1, 0, 0 );
667 }
668 require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
669
670 // Without Keywords
671 $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt( "points" ), "non_keyword_points");
672 $nonKeywordPoints->allowDecimals(true);
673 $nonKeywordPoints->setValue( $this->object->getPoints() );
674 $nonKeywordPoints->setRequired( TRUE );
675 $nonKeywordPoints->setSize( 3 );
676 $nonKeywordPoints->setMinValue( 0.0 );
677 $nonKeywordPoints->setMinvalueShouldBeGreater( true );
678 $scoringOptionNone->addSubItem( $nonKeywordPoints );
679
680 // Any Keyword
681 $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt( "answers" ), "any_keyword");
682 $anyKeyword->setRequired( TRUE );
683 $anyKeyword->setQuestionObject( $this->object );
684 $anyKeyword->setSingleline( TRUE );
685 $anyKeyword->setValues( $this->object->getAnswers() );
686 $scoringOptionAnyKeyword->addSubItem( $anyKeyword );
687
688 // All Keywords
689 $allKeyword = new ilTextWizardInputGUI($this->lng->txt( "answers" ), "all_keyword");
690 $allKeyword->setRequired( TRUE );
691 //$allKeyword->setQuestionObject($this->object);
692 //$allKeyword->setSingleline(TRUE);
693 $allKeyword->setValues( self::buildAnswerTextOnlyArray( $this->object->getAnswers() ) );
694 $scoringOptionAllKeyword->addSubItem( $allKeyword );
695 $allKeywordPoints = new ilNumberInputGUI($this->lng->txt( "points" ), "all_keyword_points");
696 $allKeywordPoints->allowDecimals(true);
697 $allKeywordPoints->setValue( $this->object->getPoints() );
698 $allKeywordPoints->setRequired( TRUE );
699 $allKeywordPoints->setSize( 3 );
700 $allKeywordPoints->setMinValue( 0.0 );
701 $allKeywordPoints->setMinvalueShouldBeGreater( true );
702 $scoringOptionAllKeyword->addSubItem( $allKeywordPoints );
703
704 // One Keywords
705 $oneKeyword = new ilTextWizardInputGUI($this->lng->txt( "answers" ), "one_keyword");
706 $oneKeyword->setRequired( TRUE );
707 //$oneKeyword->setQuestionObject($this->object);
708 //$oneKeyword->setSingleline(TRUE);
709 $oneKeyword->setValues( self::buildAnswerTextOnlyArray( $this->object->getAnswers() ) );
710 $scoringOptionOneKeyword->addSubItem( $oneKeyword );
711 $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt( "points" ), "one_keyword_points");
712 $oneKeywordPoints->allowDecimals(true);
713 $oneKeywordPoints->setValue( $this->object->getPoints() );
714 $oneKeywordPoints->setRequired( TRUE );
715 $oneKeywordPoints->setSize( 3 );
716 $oneKeywordPoints->setMinValue( 0.0 );
717 $oneKeywordPoints->setMinvalueShouldBeGreater( true );
718 $scoringOptionOneKeyword->addSubItem( $oneKeywordPoints );
719
720 $form->addItem( $scoringMode );
721 }
722
733 {
734 return array();
735 }
736
747 {
748 return array();
749 }
750
759 public function getAggregatedAnswersView($relevant_answers)
760 {
761 return ''; //print_r($relevant_answers,true);
762 }
763}
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.
getPreview($show_question_only=FALSE, $showInlineFeedback=false)
getAggregatedAnswersView($relevant_answers)
Returns an html string containing a question specific representation of the answers so far given in t...
populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
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.
writeQuestionSpecificPostData(ilPropertyFormGUI $form)
Extracts the question 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)
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
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...
editQuestion($checkonly=FALSE)
Creates an output of the edit form for the question.
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.
getUserAnswer($active_id, $pass)
static buildAnswerTextOnlyArray($answers)
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.
addItem($a_item)
Add Item (Property, SectionHeader).
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.
Interface ilGuiAnswerScoringAdjustable.
Interface ilGuiQuestionScoringAdjustable.
$url
Definition: shib_logout.php:72
$errors