ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilDB;
107
111
112 parent::saveToDb($original_id);
113 }
114
122 public function loadFromDb($question_id)
123 {
124 global $ilDB;
125
126 $result = $ilDB->queryF(
127 "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",
128 array("integer"),
129 array($question_id)
130 );
131 if ($result->numRows() == 1) {
132 $data = $ilDB->fetchAssoc($result);
133 $this->setId($question_id);
134 $this->setObjId($data["obj_fi"]);
135 $this->setNrOfTries($data['nr_of_tries']);
136 $this->setTitle($data["title"]);
137 $this->setComment($data["description"]);
138 $this->setOriginalId($data["original_id"]);
139 $this->setAuthor($data["author"]);
140 $this->setPoints($data["points"]);
141 $this->setOwner($data["owner"]);
142 include_once("./Services/RTE/classes/class.ilRTE.php");
143 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
144 $this->setCorrectAnswers($data["correctanswers"]);
145 $this->setTextRating($data["textgap_rating"]);
146 $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
147
148 try {
149 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
150 } catch (ilTestQuestionPoolException $e) {
151 }
152 }
153
154
155 $result = $ilDB->queryF(
156 "SELECT * FROM qpl_a_textsubset WHERE question_fi = %s ORDER BY aorder ASC",
157 array('integer'),
158 array($question_id)
159 );
160 include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
161 if ($result->numRows() > 0) {
162 while ($data = $ilDB->fetchAssoc($result)) {
163 array_push($this->answers, new ASS_AnswerBinaryStateImage($data["answertext"], $data["points"], $data["aorder"]));
164 }
165 }
166
167 parent::loadFromDb($question_id);
168 }
169
175 public function addAnswer($answertext, $points, $order)
176 {
177 include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
178 if (array_key_exists($order, $this->answers)) {
179 // insert answer
180 $answer = new ASS_AnswerBinaryStateImage($answertext, $points, $order);
181 $newchoices = array();
182 for ($i = 0; $i < $order; $i++) {
183 array_push($newchoices, $this->answers[$i]);
184 }
185 array_push($newchoices, $answer);
186 for ($i = $order; $i < count($this->answers); $i++) {
187 $changed = $this->answers[$i];
188 $changed->setOrder($i+1);
189 array_push($newchoices, $changed);
190 }
191 $this->answers = $newchoices;
192 } else {
193 // add answer
194 array_push($this->answers, new ASS_AnswerBinaryStateImage($answertext, $points, count($this->answers)));
195 }
196 }
197
203 public function duplicate($for_test = true, $title = "", $author = "", $owner = "", $testObjId = null)
204 {
205 if ($this->id <= 0) {
206 // The question has not been saved. It cannot be duplicated
207 return;
208 }
209 // duplicate the question in database
210 $this_id = $this->getId();
211 $thisObjId = $this->getObjId();
212
213 $clone = $this;
214 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
216 $clone->id = -1;
217
218 if ((int) $testObjId > 0) {
219 $clone->setObjId($testObjId);
220 }
221
222 if ($title) {
223 $clone->setTitle($title);
224 }
225
226 if ($author) {
227 $clone->setAuthor($author);
228 }
229 if ($owner) {
230 $clone->setOwner($owner);
231 }
232
233 if ($for_test) {
234 $clone->saveToDb($original_id);
235 } else {
236 $clone->saveToDb();
237 }
238
239 // copy question page content
240 $clone->copyPageOfQuestion($this_id);
241 // copy XHTML media objects
242 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
243
244 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
245
246 return $clone->id;
247 }
248
254 public function copyObject($target_questionpool_id, $title = "")
255 {
256 if ($this->id <= 0) {
257 // The question has not been saved. It cannot be duplicated
258 return;
259 }
260 // duplicate the question in database
261 $clone = $this;
262 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
264 $clone->id = -1;
265 $source_questionpool_id = $this->getObjId();
266 $clone->setObjId($target_questionpool_id);
267 if ($title) {
268 $clone->setTitle($title);
269 }
270 $clone->saveToDb();
271 // copy question page content
272 $clone->copyPageOfQuestion($original_id);
273 // copy XHTML media objects
274 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
275
276 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
277
278 return $clone->id;
279 }
280
281 public function createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle = "")
282 {
283 if ($this->id <= 0) {
284 // The question has not been saved. It cannot be duplicated
285 return;
286 }
287
288 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
289
290 $sourceQuestionId = $this->id;
291 $sourceParentId = $this->getObjId();
292
293 // duplicate the question in database
294 $clone = $this;
295 $clone->id = -1;
296
297 $clone->setObjId($targetParentId);
298
299 if ($targetQuestionTitle) {
300 $clone->setTitle($targetQuestionTitle);
301 }
302
303 $clone->saveToDb();
304 // copy question page content
305 $clone->copyPageOfQuestion($sourceQuestionId);
306 // copy XHTML media objects
307 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
308
309 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
310
311 return $clone->id;
312 }
313
321 public function getAnswerCount()
322 {
323 return count($this->answers);
324 }
325
335 public function getAnswer($index = 0)
336 {
337 if ($index < 0) {
338 return null;
339 }
340 if (count($this->answers) < 1) {
341 return null;
342 }
343 if ($index >= count($this->answers)) {
344 return null;
345 }
346
347 return $this->answers[$index];
348 }
349
358 public function deleteAnswer($index = 0)
359 {
360 if ($index < 0) {
361 return;
362 }
363 if (count($this->answers) < 1) {
364 return;
365 }
366 if ($index >= count($this->answers)) {
367 return;
368 }
369 unset($this->answers[$index]);
370 $this->answers = array_values($this->answers);
371 for ($i = 0; $i < count($this->answers); $i++) {
372 if ($this->answers[$i]->getOrder() > $index) {
373 $this->answers[$i]->setOrder($i);
374 }
375 }
376 }
377
384 public function flushAnswers()
385 {
386 $this->answers = array();
387 }
388
395 public function getMaximumPoints()
396 {
397 $points = array();
398 foreach ($this->answers as $answer) {
399 if ($answer->getPoints() > 0) {
400 array_push($points, $answer->getPoints());
401 }
402 }
403 rsort($points, SORT_NUMERIC);
404 $maxpoints = 0;
405 for ($counter = 0; $counter < $this->getCorrectAnswers(); $counter++) {
406 $maxpoints += $points[$counter];
407 }
408 return $maxpoints;
409 }
410
417 public function &getAvailableAnswers()
418 {
419 $available_answers = array();
420 foreach ($this->answers as $answer) {
421 array_push($available_answers, $answer->getAnswertext());
422 }
423 return $available_answers;
424 }
425
436 public function isAnswerCorrect($answers, $answer)
437 {
438 include_once "./Services/Utilities/classes/class.ilStr.php";
439 $result = 0;
440 $textrating = $this->getTextRating();
441 foreach ($answers as $key => $value) {
442 switch ($textrating) {
444 if (strcmp(ilStr::strToLower($value), ilStr::strToLower($answer)) == 0 && $this->answers[$key]->getPoints() > 0) {
445 return $key;
446 }
447 break;
449 if (strcmp($value, $answer) == 0 && $this->answers[$key]->getPoints() > 0) {
450 return $key;
451 }
452 break;
454 if (levenshtein($value, $answer) <= 1 && $this->answers[$key]->getPoints() > 0) {
455 return $key;
456 }
457 break;
459 if (levenshtein($value, $answer) <= 2 && $this->answers[$key]->getPoints() > 0) {
460 return $key;
461 }
462 break;
464 if (levenshtein($value, $answer) <= 3 && $this->answers[$key]->getPoints() > 0) {
465 return $key;
466 }
467 break;
469 if (levenshtein($value, $answer) <= 4 && $this->answers[$key]->getPoints() > 0) {
470 return $key;
471 }
472 break;
474 if (levenshtein($value, $answer) <= 5 && $this->answers[$key]->getPoints() > 0) {
475 return $key;
476 }
477 break;
478 }
479 }
480 return false;
481 }
482
490 public function getTextRating()
491 {
492 return $this->text_rating;
493 }
494
502 public function setTextRating($a_text_rating)
503 {
504 switch ($a_text_rating) {
512 $this->text_rating = $a_text_rating;
513 break;
514 default:
515 $this->text_rating = TEXTGAP_RATING_CASEINSENSITIVE;
516 break;
517 }
518 }
519
530 public function calculateReachedPoints($active_id, $pass = null, $authorizedSolution = true, $returndetails = false)
531 {
532 if ($returndetails) {
533 throw new ilTestException('return details not implemented for ' . __METHOD__);
534 }
535
536 global $ilDB;
537
538
539 if (is_null($pass)) {
540 $pass = $this->getSolutionMaxPass($active_id);
541 }
542 $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
543
544 $enteredTexts = array();
545 while ($data = $ilDB->fetchAssoc($result)) {
546 $enteredTexts[] = $data["value1"];
547 }
548
549 $points = $this->calculateReachedPointsForSolution($enteredTexts);
550
551 return $points;
552 }
553
560 public function setCorrectAnswers($a_correct_answers)
561 {
562 $this->correctanswers = $a_correct_answers;
563 }
564
571 public function getCorrectAnswers()
572 {
574 }
575
584 public function saveWorkingData($active_id, $pass = null, $authorized = true)
585 {
586 global $ilDB;
587 global $ilUser;
588
589 if (is_null($pass)) {
590 include_once "./Modules/Test/classes/class.ilObjTest.php";
591 $pass = ilObjTest::_getPass($active_id);
592 }
593
594 $entered_values = 0;
595 $solutionSubmit = $this->getSolutionSubmit();
596
597 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$entered_values, $solutionSubmit, $active_id, $pass, $authorized) {
598 $this->removeCurrentSolution($active_id, $pass, $authorized);
599
600 foreach ($solutionSubmit as $value) {
601 if (strlen($value)) {
602 $this->saveCurrentSolution($active_id, $pass, $value, null, $authorized);
603 $entered_values++;
604 }
605 }
606 });
607
608 if ($entered_values) {
609 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
611 assQuestion::logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
612 }
613 } else {
614 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
616 assQuestion::logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
617 }
618 }
619
620 return true;
621 }
622
623 public function saveAdditionalQuestionDataToDb()
624 {
626 global $ilDB;
627
628 // save additional data
629 $ilDB->manipulateF(
630 "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
631 array( "integer" ),
632 array( $this->getId() )
633 );
634
635 $ilDB->manipulateF(
636 "INSERT INTO " . $this->getAdditionalTableName(
637 ) . " (question_fi, textgap_rating, correctanswers) VALUES (%s, %s, %s)",
638 array( "integer", "text", "integer" ),
639 array(
640 $this->getId(),
641 $this->getTextRating(),
642 $this->getCorrectAnswers()
643 )
644 );
645 }
646
647 public function saveAnswerSpecificDataToDb()
648 {
650 global $ilDB;
651 $ilDB->manipulateF(
652 "DELETE FROM qpl_a_textsubset WHERE question_fi = %s",
653 array( 'integer' ),
654 array( $this->getId() )
655 );
656
657 foreach ($this->answers as $key => $value) {
658 $answer_obj = $this->answers[$key];
659 $next_id = $ilDB->nextId('qpl_a_textsubset');
660 $ilDB->manipulateF(
661 "INSERT INTO qpl_a_textsubset (answer_id, question_fi, answertext, points, aorder, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
662 array( 'integer', 'integer', 'text', 'float', 'integer', 'integer' ),
663 array(
664 $next_id,
665 $this->getId(),
666 $answer_obj->getAnswertext(),
667 $answer_obj->getPoints(),
668 $answer_obj->getOrder(),
669 time()
670 )
671 );
672 }
673 }
674
678 protected function reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
679 {
680 // nothing to rework!
681 }
682
689 public function getQuestionType()
690 {
691 return "assTextSubset";
692 }
693
700 public function &joinAnswers()
701 {
702 $join = array();
703 foreach ($this->answers as $answer) {
704 if (!is_array($join[$answer->getPoints() . ""])) {
705 $join[$answer->getPoints() . ""] = array();
706 }
707 array_push($join[$answer->getPoints() . ""], $answer->getAnswertext());
708 }
709 return $join;
710 }
711
718 public function getMaxTextboxWidth()
719 {
720 $maxwidth = 0;
721 foreach ($this->answers as $answer) {
722 $len = strlen($answer->getAnswertext());
723 if ($len > $maxwidth) {
724 $maxwidth = $len;
725 }
726 }
727 return $maxwidth + 3;
728 }
729
736 public function getAdditionalTableName()
737 {
738 return "qpl_qst_textsubset";
739 }
740
747 public function getAnswerTableName()
748 {
749 return "qpl_a_textsubset";
750 }
751
757 {
758 return parent::getRTETextWithMediaObjects();
759 }
760
764 public function setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
765 {
766 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
767
768 $solutions = $this->getSolutionValues($active_id, $pass);
769
770 $i = 1;
771 foreach ($solutions as $solution) {
772 $worksheet->setCell($startrow + $i, 0, $solution["value1"]);
773 $i++;
774 }
775
776 return $startrow + $i + 1;
777 }
778
779 public function getAnswers()
780 {
781 return $this->answers;
782 }
783
787 public function toJSON()
788 {
789 include_once("./Services/RTE/classes/class.ilRTE.php");
790 $result = array();
791 $result['id'] = (int) $this->getId();
792 $result['type'] = (string) $this->getQuestionType();
793 $result['title'] = (string) $this->getTitle();
794 $result['question'] = $this->formatSAQuestion($this->getQuestion());
795 $result['nr_of_tries'] = (int) $this->getNrOfTries();
796 $result['matching_method'] = (string) $this->getTextRating();
797 $result['feedback'] = array(
798 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
799 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
800 );
801
802 $answers = array();
803 foreach ($this->getAnswers() as $key => $answer_obj) {
804 array_push($answers, array(
805 "answertext" => (string) $answer_obj->getAnswertext(),
806 "points" => (float) $answer_obj->getPoints(),
807 "order" => (int) $answer_obj->getOrder()
808 ));
809 }
810 $result['correct_answers'] = $answers;
811
812 $answers = array();
813 for ($loop = 1; $loop <= (int) $this->getCorrectAnswers(); $loop++) {
814 array_push($answers, array(
815 "answernr" => $loop
816 ));
817 }
818 $result['answers'] = $answers;
819
820 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
821 $result['mobs'] = $mobs;
822
823 return json_encode($result);
824 }
825
829 protected function getSolutionSubmit()
830 {
831 $solutionSubmit = array();
832 $purifier = $this->getHtmlUserSolutionPurifier();
833 foreach ($_POST as $key => $val) {
834 if (preg_match("/^TEXTSUBSET_(\d+)/", $key, $matches)) {
835 $val = trim($val);
836 if (strlen($val)) {
837 $val = $purifier->purify($val);
838 $solutionSubmit[] = $val;
839 }
840 }
841 }
842 return $solutionSubmit;
843 }
844
849 protected function calculateReachedPointsForSolution($enteredTexts)
850 {
851 $available_answers = $this->getAvailableAnswers();
852 $points = 0;
853 foreach ($enteredTexts as $enteredtext) {
854 $index = $this->isAnswerCorrect($available_answers, $enteredtext);
855 if ($index !== false) {
856 unset($available_answers[$index]);
857 $points += $this->answers[$index]->getPoints();
858 }
859 }
860 return $points;
861 }
862
871 public function getOperators($expression)
872 {
873 require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
875 }
876
881 public function getExpressionTypes()
882 {
883 return array(
888 );
889 }
890
899 public function getUserQuestionResult($active_id, $pass)
900 {
902 global $ilDB;
903 $result = new ilUserQuestionResult($this, $active_id, $pass);
904
905 $maxStep = $this->lookupMaxStep($active_id, $pass);
906
907 if ($maxStep !== null) {
908 $data = $ilDB->queryF(
909 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s ORDER BY solution_id",
910 array("integer", "integer", "integer","integer"),
911 array($active_id, $pass, $this->getId(), $maxStep)
912 );
913 } else {
914 $data = $ilDB->queryF(
915 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s ORDER BY solution_id",
916 array("integer", "integer", "integer"),
917 array($active_id, $pass, $this->getId())
918 );
919 }
920
921 for ($index = 1; $index <= $ilDB->numRows($data); ++$index) {
922 $row = $ilDB->fetchAssoc($data);
923 $result->addKeyValue($index, $row["value1"]);
924 }
925
926 $points = $this->calculateReachedPoints($active_id, $pass);
927 $max_points = $this->getMaximumPoints();
928
929 $result->setReachedPercentage(($points/$max_points) * 100);
930
931 return $result;
932 }
933
942 public function getAvailableAnswerOptions($index = null)
943 {
944 if ($index !== null) {
945 return $this->getAnswer($index);
946 } else {
947 return $this->getAnswers();
948 }
949 }
950}
$worksheet
$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.
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
{Reworks the allready saved working data if neccessary.}
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.
$counter
$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
global $ilDB
$mobs
$ilUser
Definition: imgupload.php:18