ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.assTextSubset.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.assQuestion.php';
5require_once './Modules/Test/classes/inc.AssessmentConstants.php';
6require_once './Modules/TestQuestionPool/interfaces/interface.ilObjQuestionScoringAdjustable.php';
7require_once './Modules/TestQuestionPool/interfaces/interface.ilObjAnswerScoringAdjustable.php';
8require_once './Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
9require_once './Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
10
27{
35 public $answers;
36
45
54
66 public function __construct(
67 $title = "",
68 $comment = "",
69 $author = "",
70 $owner = -1,
71 $question = ""
72 ) {
73 parent::__construct($title, $comment, $author, $owner, $question);
74 $this->answers = array();
75 $this->correctanswers = 0;
76 }
77
84 public function isComplete()
85 {
86 if (
87 strlen($this->title)
88 && $this->author
89 && $this->question &&
90 count($this->answers) >= $this->correctanswers
91 && $this->getMaximumPoints() > 0
92 ) {
93 return true;
94 }
95 return false;
96 }
97
104 public function saveToDb($original_id = "")
105 {
106 global $DIC;
107 $ilDB = $DIC['ilDB'];
108
112
113 parent::saveToDb($original_id);
114 }
115
123 public function loadFromDb($question_id)
124 {
125 global $DIC;
126 $ilDB = $DIC['ilDB'];
127
128 $result = $ilDB->queryF(
129 "SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s",
130 array("integer"),
131 array($question_id)
132 );
133 if ($result->numRows() == 1) {
134 $data = $ilDB->fetchAssoc($result);
135 $this->setId($question_id);
136 $this->setObjId($data["obj_fi"]);
137 $this->setNrOfTries($data['nr_of_tries']);
138 $this->setTitle($data["title"]);
139 $this->setComment($data["description"]);
140 $this->setOriginalId($data["original_id"]);
141 $this->setAuthor($data["author"]);
142 $this->setPoints($data["points"]);
143 $this->setOwner($data["owner"]);
144 include_once("./Services/RTE/classes/class.ilRTE.php");
145 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
146 $this->setCorrectAnswers($data["correctanswers"]);
147 $this->setTextRating($data["textgap_rating"]);
148 $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
149
150 try {
151 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
152 } catch (ilTestQuestionPoolException $e) {
153 }
154 }
155
156
157 $result = $ilDB->queryF(
158 "SELECT * FROM qpl_a_textsubset WHERE question_fi = %s ORDER BY aorder ASC",
159 array('integer'),
160 array($question_id)
161 );
162 include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
163 if ($result->numRows() > 0) {
164 while ($data = $ilDB->fetchAssoc($result)) {
165 array_push($this->answers, new ASS_AnswerBinaryStateImage($data["answertext"], $data["points"], $data["aorder"]));
166 }
167 }
168
169 parent::loadFromDb($question_id);
170 }
171
177 public function addAnswer($answertext, $points, $order)
178 {
179 include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
180 if (array_key_exists($order, $this->answers)) {
181 // insert answer
182 $answer = new ASS_AnswerBinaryStateImage($answertext, $points, $order);
183 $newchoices = array();
184 for ($i = 0; $i < $order; $i++) {
185 array_push($newchoices, $this->answers[$i]);
186 }
187 array_push($newchoices, $answer);
188 for ($i = $order; $i < count($this->answers); $i++) {
189 $changed = $this->answers[$i];
190 $changed->setOrder($i + 1);
191 array_push($newchoices, $changed);
192 }
193 $this->answers = $newchoices;
194 } else {
195 // add answer
196 array_push($this->answers, new ASS_AnswerBinaryStateImage($answertext, $points, count($this->answers)));
197 }
198 }
199
205 public function duplicate($for_test = true, $title = "", $author = "", $owner = "", $testObjId = null)
206 {
207 if ($this->id <= 0) {
208 // The question has not been saved. It cannot be duplicated
209 return;
210 }
211 // duplicate the question in database
212 $this_id = $this->getId();
213 $thisObjId = $this->getObjId();
214
215 $clone = $this;
216 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
218 $clone->id = -1;
219
220 if ((int) $testObjId > 0) {
221 $clone->setObjId($testObjId);
222 }
223
224 if ($title) {
225 $clone->setTitle($title);
226 }
227
228 if ($author) {
229 $clone->setAuthor($author);
230 }
231 if ($owner) {
232 $clone->setOwner($owner);
233 }
234
235 if ($for_test) {
236 $clone->saveToDb($original_id);
237 } else {
238 $clone->saveToDb();
239 }
240
241 // copy question page content
242 $clone->copyPageOfQuestion($this_id);
243 // copy XHTML media objects
244 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
245
246 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
247
248 return $clone->id;
249 }
250
256 public function copyObject($target_questionpool_id, $title = "")
257 {
258 if ($this->id <= 0) {
259 // The question has not been saved. It cannot be duplicated
260 return;
261 }
262 // duplicate the question in database
263 $clone = $this;
264 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
266 $clone->id = -1;
267 $source_questionpool_id = $this->getObjId();
268 $clone->setObjId($target_questionpool_id);
269 if ($title) {
270 $clone->setTitle($title);
271 }
272 $clone->saveToDb();
273 // copy question page content
274 $clone->copyPageOfQuestion($original_id);
275 // copy XHTML media objects
276 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
277
278 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
279
280 return $clone->id;
281 }
282
283 public function createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle = "")
284 {
285 if ($this->id <= 0) {
286 // The question has not been saved. It cannot be duplicated
287 return;
288 }
289
290 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
291
292 $sourceQuestionId = $this->id;
293 $sourceParentId = $this->getObjId();
294
295 // duplicate the question in database
296 $clone = $this;
297 $clone->id = -1;
298
299 $clone->setObjId($targetParentId);
300
301 if ($targetQuestionTitle) {
302 $clone->setTitle($targetQuestionTitle);
303 }
304
305 $clone->saveToDb();
306 // copy question page content
307 $clone->copyPageOfQuestion($sourceQuestionId);
308 // copy XHTML media objects
309 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
310
311 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
312
313 return $clone->id;
314 }
315
323 public function getAnswerCount()
324 {
325 return count($this->answers);
326 }
327
337 public function getAnswer($index = 0)
338 {
339 if ($index < 0) {
340 return null;
341 }
342 if (count($this->answers) < 1) {
343 return null;
344 }
345 if ($index >= count($this->answers)) {
346 return null;
347 }
348
349 return $this->answers[$index];
350 }
351
360 public function deleteAnswer($index = 0)
361 {
362 if ($index < 0) {
363 return;
364 }
365 if (count($this->answers) < 1) {
366 return;
367 }
368 if ($index >= count($this->answers)) {
369 return;
370 }
371 unset($this->answers[$index]);
372 $this->answers = array_values($this->answers);
373 for ($i = 0; $i < count($this->answers); $i++) {
374 if ($this->answers[$i]->getOrder() > $index) {
375 $this->answers[$i]->setOrder($i);
376 }
377 }
378 }
379
386 public function flushAnswers()
387 {
388 $this->answers = array();
389 }
390
397 public function getMaximumPoints()
398 {
399 $points = array();
400 foreach ($this->answers as $answer) {
401 if ($answer->getPoints() > 0) {
402 array_push($points, $answer->getPoints());
403 }
404 }
405 rsort($points, SORT_NUMERIC);
406 $maxpoints = 0;
407 for ($counter = 0; $counter < $this->getCorrectAnswers(); $counter++) {
408 $maxpoints += $points[$counter];
409 }
410 return $maxpoints;
411 }
412
419 public function &getAvailableAnswers()
420 {
421 $available_answers = array();
422 foreach ($this->answers as $answer) {
423 array_push($available_answers, $answer->getAnswertext());
424 }
425 return $available_answers;
426 }
427
438 public function isAnswerCorrect($answers, $answer)
439 {
440 include_once "./Services/Utilities/classes/class.ilStr.php";
441 $result = 0;
442 $textrating = $this->getTextRating();
443 foreach ($answers as $key => $value) {
444 switch ($textrating) {
446 if (strcmp(ilStr::strToLower($value), ilStr::strToLower($answer)) == 0 && $this->answers[$key]->getPoints() > 0) {
447 return $key;
448 }
449 break;
451 if (strcmp($value, $answer) == 0 && $this->answers[$key]->getPoints() > 0) {
452 return $key;
453 }
454 break;
456 if (levenshtein($value, $answer) <= 1 && $this->answers[$key]->getPoints() > 0) {
457 return $key;
458 }
459 break;
461 if (levenshtein($value, $answer) <= 2 && $this->answers[$key]->getPoints() > 0) {
462 return $key;
463 }
464 break;
466 if (levenshtein($value, $answer) <= 3 && $this->answers[$key]->getPoints() > 0) {
467 return $key;
468 }
469 break;
471 if (levenshtein($value, $answer) <= 4 && $this->answers[$key]->getPoints() > 0) {
472 return $key;
473 }
474 break;
476 if (levenshtein($value, $answer) <= 5 && $this->answers[$key]->getPoints() > 0) {
477 return $key;
478 }
479 break;
480 }
481 }
482 return false;
483 }
484
492 public function getTextRating()
493 {
494 return $this->text_rating;
495 }
496
504 public function setTextRating($a_text_rating)
505 {
506 switch ($a_text_rating) {
514 $this->text_rating = $a_text_rating;
515 break;
516 default:
517 $this->text_rating = TEXTGAP_RATING_CASEINSENSITIVE;
518 break;
519 }
520 }
521
532 public function calculateReachedPoints($active_id, $pass = null, $authorizedSolution = true, $returndetails = false)
533 {
534 if ($returndetails) {
535 throw new ilTestException('return details not implemented for ' . __METHOD__);
536 }
537
538 global $DIC;
539 $ilDB = $DIC['ilDB'];
540
541
542 if (is_null($pass)) {
543 $pass = $this->getSolutionMaxPass($active_id);
544 }
545 $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
546
547 $enteredTexts = array();
548 while ($data = $ilDB->fetchAssoc($result)) {
549 $enteredTexts[] = $data["value1"];
550 }
551
552 $points = $this->calculateReachedPointsForSolution($enteredTexts);
553
554 return $points;
555 }
556
563 public function setCorrectAnswers($a_correct_answers)
564 {
565 $this->correctanswers = $a_correct_answers;
566 }
567
574 public function getCorrectAnswers()
575 {
577 }
578
587 public function saveWorkingData($active_id, $pass = null, $authorized = true)
588 {
589 global $DIC;
590 $ilDB = $DIC['ilDB'];
591 $ilUser = $DIC['ilUser'];
592
593 if (is_null($pass)) {
594 include_once "./Modules/Test/classes/class.ilObjTest.php";
595 $pass = ilObjTest::_getPass($active_id);
596 }
597
598 $entered_values = 0;
599 $solutionSubmit = $this->getSolutionSubmit();
600
601 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$entered_values, $solutionSubmit, $active_id, $pass, $authorized) {
602 $this->removeCurrentSolution($active_id, $pass, $authorized);
603
604 foreach ($solutionSubmit as $value) {
605 if (strlen($value)) {
606 $this->saveCurrentSolution($active_id, $pass, $value, null, $authorized);
607 $entered_values++;
608 }
609 }
610 });
611
612 if ($entered_values) {
613 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
615 assQuestion::logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
616 }
617 } else {
618 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
620 assQuestion::logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
621 }
622 }
623
624 return true;
625 }
626
627 public function saveAdditionalQuestionDataToDb()
628 {
630 global $DIC;
631 $ilDB = $DIC['ilDB'];
632
633 // save additional data
634 $ilDB->manipulateF(
635 "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
636 array( "integer" ),
637 array( $this->getId() )
638 );
639
640 $ilDB->manipulateF(
641 "INSERT INTO " . $this->getAdditionalTableName(
642 ) . " (question_fi, textgap_rating, correctanswers) VALUES (%s, %s, %s)",
643 array( "integer", "text", "integer" ),
644 array(
645 $this->getId(),
646 $this->getTextRating(),
647 $this->getCorrectAnswers()
648 )
649 );
650 }
651
652 public function saveAnswerSpecificDataToDb()
653 {
655 global $DIC;
656 $ilDB = $DIC['ilDB'];
657 $ilDB->manipulateF(
658 "DELETE FROM qpl_a_textsubset WHERE question_fi = %s",
659 array( 'integer' ),
660 array( $this->getId() )
661 );
662
663 foreach ($this->answers as $key => $value) {
664 $answer_obj = $this->answers[$key];
665 $next_id = $ilDB->nextId('qpl_a_textsubset');
666 $ilDB->manipulateF(
667 "INSERT INTO qpl_a_textsubset (answer_id, question_fi, answertext, points, aorder, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
668 array( 'integer', 'integer', 'text', 'float', 'integer', 'integer' ),
669 array(
670 $next_id,
671 $this->getId(),
672 $answer_obj->getAnswertext(),
673 $answer_obj->getPoints(),
674 $answer_obj->getOrder(),
675 time()
676 )
677 );
678 }
679 }
680
687 public function getQuestionType()
688 {
689 return "assTextSubset";
690 }
691
698 public function &joinAnswers()
699 {
700 $join = array();
701 foreach ($this->answers as $answer) {
702 if (!is_array($join[$answer->getPoints() . ""])) {
703 $join[$answer->getPoints() . ""] = array();
704 }
705 array_push($join[$answer->getPoints() . ""], $answer->getAnswertext());
706 }
707 return $join;
708 }
709
716 public function getMaxTextboxWidth()
717 {
718 $maxwidth = 0;
719 foreach ($this->answers as $answer) {
720 $len = strlen($answer->getAnswertext());
721 if ($len > $maxwidth) {
722 $maxwidth = $len;
723 }
724 }
725 return $maxwidth + 3;
726 }
727
734 public function getAdditionalTableName()
735 {
736 return "qpl_qst_textsubset";
737 }
738
745 public function getAnswerTableName()
746 {
747 return "qpl_a_textsubset";
748 }
749
755 {
756 return parent::getRTETextWithMediaObjects();
757 }
758
762 public function setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
763 {
764 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
765
766 $solutions = $this->getSolutionValues($active_id, $pass);
767
768 $i = 1;
769 foreach ($solutions as $solution) {
770 $worksheet->setCell($startrow + $i, 0, $solution["value1"]);
771 $i++;
772 }
773
774 return $startrow + $i + 1;
775 }
776
777 public function getAnswers()
778 {
779 return $this->answers;
780 }
781
785 public function toJSON()
786 {
787 include_once("./Services/RTE/classes/class.ilRTE.php");
788 $result = array();
789 $result['id'] = (int) $this->getId();
790 $result['type'] = (string) $this->getQuestionType();
791 $result['title'] = (string) $this->getTitle();
792 $result['question'] = $this->formatSAQuestion($this->getQuestion());
793 $result['nr_of_tries'] = (int) $this->getNrOfTries();
794 $result['matching_method'] = (string) $this->getTextRating();
795 $result['feedback'] = array(
796 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
797 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
798 );
799
800 $answers = array();
801 foreach ($this->getAnswers() as $key => $answer_obj) {
802 array_push($answers, array(
803 "answertext" => (string) $answer_obj->getAnswertext(),
804 "points" => (float) $answer_obj->getPoints(),
805 "order" => (int) $answer_obj->getOrder()
806 ));
807 }
808 $result['correct_answers'] = $answers;
809
810 $answers = array();
811 for ($loop = 1; $loop <= (int) $this->getCorrectAnswers(); $loop++) {
812 array_push($answers, array(
813 "answernr" => $loop
814 ));
815 }
816 $result['answers'] = $answers;
817
818 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
819 $result['mobs'] = $mobs;
820
821 return json_encode($result);
822 }
823
827 protected function getSolutionSubmit()
828 {
829 $solutionSubmit = array();
830 $purifier = $this->getHtmlUserSolutionPurifier();
831 foreach ($_POST as $key => $val) {
832 if (preg_match("/^TEXTSUBSET_(\d+)/", $key, $matches)) {
833 $val = trim($val);
834 if (strlen($val)) {
835 $val = $purifier->purify($val);
836 $solutionSubmit[] = $val;
837 }
838 }
839 }
840 return $solutionSubmit;
841 }
842
847 protected function calculateReachedPointsForSolution($enteredTexts)
848 {
849 $available_answers = $this->getAvailableAnswers();
850 $points = 0;
851 foreach ($enteredTexts as $enteredtext) {
852 $index = $this->isAnswerCorrect($available_answers, $enteredtext);
853 if ($index !== false) {
854 unset($available_answers[$index]);
855 $points += $this->answers[$index]->getPoints();
856 }
857 }
858 return $points;
859 }
860
869 public function getOperators($expression)
870 {
871 require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
873 }
874
879 public function getExpressionTypes()
880 {
881 return array(
886 );
887 }
888
897 public function getUserQuestionResult($active_id, $pass)
898 {
900 global $DIC;
901 $ilDB = $DIC['ilDB'];
902 $result = new ilUserQuestionResult($this, $active_id, $pass);
903
904 $maxStep = $this->lookupMaxStep($active_id, $pass);
905
906 if ($maxStep !== null) {
907 $data = $ilDB->queryF(
908 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s ORDER BY solution_id",
909 array("integer", "integer", "integer","integer"),
910 array($active_id, $pass, $this->getId(), $maxStep)
911 );
912 } else {
913 $data = $ilDB->queryF(
914 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s ORDER BY solution_id",
915 array("integer", "integer", "integer"),
916 array($active_id, $pass, $this->getId())
917 );
918 }
919
920 for ($index = 1; $index <= $ilDB->numRows($data); ++$index) {
921 $row = $ilDB->fetchAssoc($data);
922 $result->addKeyValue($index, $row["value1"]);
923 }
924
925 $points = $this->calculateReachedPoints($active_id, $pass);
926 $max_points = $this->getMaximumPoints();
927
928 $result->setReachedPercentage(($points / $max_points) * 100);
929
930 return $result;
931 }
932
941 public function getAvailableAnswerOptions($index = null)
942 {
943 if ($index !== null) {
944 return $this->getAnswer($index);
945 } else {
946 return $this->getAnswers();
947 }
948 }
949}
$result
$_POST["username"]
Class for answers with a binary state indicator.
An exception for terminatinating execution or to throw for unit testing.
Abstract basic class which is to be extended by the concrete assessment question type classes.
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass.
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
static _getOriginalId($question_id)
Returns the original id of a question.
formatSAQuestion($a_q)
Format self assessment question.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
saveQuestionDataToDb($original_id="")
getId()
Gets the id of the assQuestion object.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
getObjId()
Get the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
removeCurrentSolution($active_id, $pass, $authorized=true)
setAuthor($author="")
Sets the authors name of the assQuestion object.
getPoints()
Returns the maximum available points for the question.
getTitle()
Gets the title string of the assQuestion object.
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
setNrOfTries($a_nr_of_tries)
getQuestion()
Gets the question string of the question object.
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
Class for TextSubset questions.
getExpressionTypes()
Get all available expression types for a specific question.
getMaxTextboxWidth()
Returns the maximum width needed for the answer textboxes.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
isAnswerCorrect($answers, $answer)
Returns the index of the found answer, if the given answer is in the set of correct answers and match...
& joinAnswers()
Returns the answers of the question as a comma separated string.
toJSON()
Returns a JSON representation of the question.
deleteAnswer($index=0)
Deletes an answer with a given index.
isComplete()
Returns true, if a TextSubset question is complete for use.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
setTextRating($a_text_rating)
Sets the rating option for text comparisons.
saveToDb($original_id="")
Saves a assTextSubset object to a database.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assTextSubsetQuestion.
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{Creates an Excel worksheet for the detailed cumulated results of this question.object}
calculateReachedPointsForSolution($enteredTexts)
addAnswer($answertext, $points, $order)
Adds an answer to the question.
getAnswerTableName()
Returns the name of the answer table in the database.
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
getOperators($expression)
Get all available operations for a specific question.
copyObject($target_questionpool_id, $title="")
Copies an assTextSubset object.
& getAvailableAnswers()
Returns the available answers for the question.
getTextRating()
Returns the rating option for text comparisons.
loadFromDb($question_id)
Loads a assTextSubset object from a database.
getQuestionType()
Returns the question type of the question.
getCorrectAnswers()
Returns the number of correct answers needed to solve the question.
getAnswerCount()
Returns the number of answers.
flushAnswers()
Deletes all answers.
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assTextSubset constructor
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
setCorrectAnswers($a_correct_answers)
Sets the number of correct answers needed to solve the question.
getAnswer($index=0)
Returns an answer with a given index.
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static strToLower($a_string)
Definition: class.ilStr.php:87
Base Exception for all Exceptions relating to Modules/Test.
Class ilUserQuestionResult.
$key
Definition: croninfo.php:18
$i
Definition: disco.tpl.php:19
const TEXTGAP_RATING_LEVENSHTEIN5
const TEXTGAP_RATING_LEVENSHTEIN4
const TEXTGAP_RATING_LEVENSHTEIN3
const TEXTGAP_RATING_CASESENSITIVE
const TEXTGAP_RATING_LEVENSHTEIN2
const TEXTGAP_RATING_CASEINSENSITIVE
const TEXTGAP_RATING_LEVENSHTEIN1
Class iQuestionCondition.
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
Interface ilObjAnswerScoringAdjustable.
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
Interface ilObjQuestionScoringAdjustable.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
$index
Definition: metadata.php:60
$row
global $DIC
Definition: saml.php:7
global $ilDB
$mobs
$ilUser
Definition: imgupload.php:18
$data
Definition: bench.php:6