ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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{
36
45
54
66 public function __construct(
67 $title = "",
68 $comment = "",
69 $author = "",
70 $owner = -1,
71 $question = ""
72 )
73 {
74 parent::__construct($title, $comment, $author, $owner, $question);
75 $this->answers = array();
76 $this->correctanswers = 0;
77 }
78
85 function isComplete()
86 {
87 if (
88 strlen($this->title)
89 && $this->author
90 && $this->question &&
91 count($this->answers) >= $this->correctanswers
92 && $this->getMaximumPoints() > 0
93 )
94 {
95 return true;
96 }
97 return false;
98 }
99
106 public function saveToDb($original_id = "")
107 {
108 global $ilDB;
109
113
114 parent::saveToDb($original_id);
115 }
116
124 function loadFromDb($question_id)
125 {
126 global $ilDB;
127
128 $result = $ilDB->queryF("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",
129 array("integer"),
130 array($question_id)
131 );
132 if ($result->numRows() == 1)
133 {
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 {
152 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
153 }
155 {
156 }
157 }
158
159
160 $result = $ilDB->queryF("SELECT * FROM qpl_a_textsubset WHERE question_fi = %s ORDER BY aorder ASC",
161 array('integer'),
162 array($question_id)
163 );
164 include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
165 if ($result->numRows() > 0)
166 {
167 while ($data = $ilDB->fetchAssoc($result))
168 {
169 array_push($this->answers, new ASS_AnswerBinaryStateImage($data["answertext"], $data["points"], $data["aorder"]));
170 }
171 }
172
173 parent::loadFromDb($question_id);
174 }
175
181 function addAnswer($answertext, $points, $order)
182 {
183 include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
184 if (array_key_exists($order, $this->answers))
185 {
186 // insert answer
187 $answer = new ASS_AnswerBinaryStateImage($answertext, $points, $order);
188 $newchoices = array();
189 for ($i = 0; $i < $order; $i++)
190 {
191 array_push($newchoices, $this->answers[$i]);
192 }
193 array_push($newchoices, $answer);
194 for ($i = $order; $i < count($this->answers); $i++)
195 {
196 $changed = $this->answers[$i];
197 $changed->setOrder($i+1);
198 array_push($newchoices, $changed);
199 }
200 $this->answers = $newchoices;
201 }
202 else
203 {
204 // add answer
205 array_push($this->answers, new ASS_AnswerBinaryStateImage($answertext, $points, count($this->answers)));
206 }
207 }
208
214 function duplicate($for_test = true, $title = "", $author = "", $owner = "", $testObjId = null)
215 {
216 if ($this->id <= 0)
217 {
218 // The question has not been saved. It cannot be duplicated
219 return;
220 }
221 // duplicate the question in database
222 $this_id = $this->getId();
223 $thisObjId = $this->getObjId();
224
225 $clone = $this;
226 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
228 $clone->id = -1;
229
230 if( (int)$testObjId > 0 )
231 {
232 $clone->setObjId($testObjId);
233 }
234
235 if ($title)
236 {
237 $clone->setTitle($title);
238 }
239
240 if ($author)
241 {
242 $clone->setAuthor($author);
243 }
244 if ($owner)
245 {
246 $clone->setOwner($owner);
247 }
248
249 if ($for_test)
250 {
251 $clone->saveToDb($original_id);
252 }
253 else
254 {
255 $clone->saveToDb();
256 }
257
258 // copy question page content
259 $clone->copyPageOfQuestion($this_id);
260 // copy XHTML media objects
261 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
262
263 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
264
265 return $clone->id;
266 }
267
273 function copyObject($target_questionpool_id, $title = "")
274 {
275 if ($this->id <= 0)
276 {
277 // The question has not been saved. It cannot be duplicated
278 return;
279 }
280 // duplicate the question in database
281 $clone = $this;
282 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
284 $clone->id = -1;
285 $source_questionpool_id = $this->getObjId();
286 $clone->setObjId($target_questionpool_id);
287 if ($title)
288 {
289 $clone->setTitle($title);
290 }
291 $clone->saveToDb();
292 // copy question page content
293 $clone->copyPageOfQuestion($original_id);
294 // copy XHTML media objects
295 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
296
297 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
298
299 return $clone->id;
300 }
301
302 public function createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle = "")
303 {
304 if ($this->id <= 0)
305 {
306 // The question has not been saved. It cannot be duplicated
307 return;
308 }
309
310 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
311
312 $sourceQuestionId = $this->id;
313 $sourceParentId = $this->getObjId();
314
315 // duplicate the question in database
316 $clone = $this;
317 $clone->id = -1;
318
319 $clone->setObjId($targetParentId);
320
321 if ($targetQuestionTitle)
322 {
323 $clone->setTitle($targetQuestionTitle);
324 }
325
326 $clone->saveToDb();
327 // copy question page content
328 $clone->copyPageOfQuestion($sourceQuestionId);
329 // copy XHTML media objects
330 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
331
332 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
333
334 return $clone->id;
335 }
336
344 function getAnswerCount()
345 {
346 return count($this->answers);
347 }
348
358 function getAnswer($index = 0)
359 {
360 if ($index < 0) return NULL;
361 if (count($this->answers) < 1) return NULL;
362 if ($index >= count($this->answers)) return NULL;
363
364 return $this->answers[$index];
365 }
366
375 function deleteAnswer($index = 0)
376 {
377 if ($index < 0) return;
378 if (count($this->answers) < 1) return;
379 if ($index >= count($this->answers)) return;
380 unset($this->answers[$index]);
381 $this->answers = array_values($this->answers);
382 for ($i = 0; $i < count($this->answers); $i++)
383 {
384 if ($this->answers[$i]->getOrder() > $index)
385 {
386 $this->answers[$i]->setOrder($i);
387 }
388 }
389 }
390
397 function flushAnswers()
398 {
399 $this->answers = array();
400 }
401
409 {
410 $points = array();
411 foreach ($this->answers as $answer)
412 {
413 if ($answer->getPoints() > 0)
414 {
415 array_push($points, $answer->getPoints());
416 }
417 }
418 rsort($points, SORT_NUMERIC);
419 $maxpoints = 0;
420 for ($counter = 0; $counter < $this->getCorrectAnswers(); $counter++)
421 {
422 $maxpoints += $points[$counter];
423 }
424 return $maxpoints;
425 }
426
434 {
435 $available_answers = array();
436 foreach ($this->answers as $answer)
437 {
438 array_push($available_answers, $answer->getAnswertext());
439 }
440 return $available_answers;
441 }
442
453 function isAnswerCorrect($answers, $answer)
454 {
455 include_once "./Services/Utilities/classes/class.ilStr.php";
456 $result = 0;
457 $textrating = $this->getTextRating();
458 foreach ($answers as $key => $value)
459 {
460 switch ($textrating)
461 {
463 if (strcmp(ilStr::strToLower($value), ilStr::strToLower($answer)) == 0 && $this->answers[$key]->getPoints() > 0) return $key;
464 break;
466 if (strcmp($value, $answer) == 0 && $this->answers[$key]->getPoints() > 0) return $key;
467 break;
469 if (levenshtein($value, $answer) <= 1 && $this->answers[$key]->getPoints() > 0) return $key;
470 break;
472 if (levenshtein($value, $answer) <= 2 && $this->answers[$key]->getPoints() > 0) return $key;
473 break;
475 if (levenshtein($value, $answer) <= 3 && $this->answers[$key]->getPoints() > 0) return $key;
476 break;
478 if (levenshtein($value, $answer) <= 4 && $this->answers[$key]->getPoints() > 0) return $key;
479 break;
481 if (levenshtein($value, $answer) <= 5 && $this->answers[$key]->getPoints() > 0) return $key;
482 break;
483 }
484 }
485 return FALSE;
486 }
487
495 function getTextRating()
496 {
497 return $this->text_rating;
498 }
499
507 function setTextRating($a_text_rating)
508 {
509 switch ($a_text_rating)
510 {
518 $this->text_rating = $a_text_rating;
519 break;
520 default:
521 $this->text_rating = TEXTGAP_RATING_CASEINSENSITIVE;
522 break;
523 }
524 }
525
536 public function calculateReachedPoints($active_id, $pass = NULL, $authorizedSolution = true, $returndetails = FALSE)
537 {
538 if( $returndetails )
539 {
540 throw new ilTestException('return details not implemented for '.__METHOD__);
541 }
542
543 global $ilDB;
544
545
546 if (is_null($pass))
547 {
548 $pass = $this->getSolutionMaxPass($active_id);
549 }
550 $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
551
552 $enteredTexts = array();
553 while ($data = $ilDB->fetchAssoc($result))
554 {
555 $enteredTexts[] = $data["value1"];
556 }
557
558 $points = $this->calculateReachedPointsForSolution($enteredTexts);
559
560 return $points;
561 }
562
569 function setCorrectAnswers($a_correct_answers)
570 {
571 $this->correctanswers = $a_correct_answers;
572 }
573
581 {
583 }
584
593 public function saveWorkingData($active_id, $pass = NULL, $authorized = true)
594 {
595 global $ilDB;
596 global $ilUser;
597
598 if (is_null($pass))
599 {
600 include_once "./Modules/Test/classes/class.ilObjTest.php";
601 $pass = ilObjTest::_getPass($active_id);
602 }
603
604 $entered_values = 0;
605 $solutionSubmit = $this->getSolutionSubmit();
606
607 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function() use (&$entered_values, $solutionSubmit, $active_id, $pass, $authorized) {
608
609 $this->removeCurrentSolution($active_id, $pass, $authorized);
610
611 foreach($solutionSubmit as $value)
612 {
613 if(strlen($value))
614 {
615 $this->saveCurrentSolution($active_id, $pass, $value, null, $authorized);
616 $entered_values++;
617 }
618 }
619
620 });
621
622 if ($entered_values)
623 {
624 include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
626 {
627 assQuestion::logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
628 }
629 }
630 else
631 {
632 include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
634 {
635 assQuestion::logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
636 }
637 }
638
639 return true;
640 }
641
642 public function saveAdditionalQuestionDataToDb()
643 {
645 global $ilDB;
646
647 // save additional data
648 $ilDB->manipulateF( "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
649 array( "integer" ),
650 array( $this->getId() )
651 );
652
653 $ilDB->manipulateF( "INSERT INTO " . $this->getAdditionalTableName(
654 ) . " (question_fi, textgap_rating, correctanswers) VALUES (%s, %s, %s)",
655 array( "integer", "text", "integer" ),
656 array(
657 $this->getId(),
658 $this->getTextRating(),
659 $this->getCorrectAnswers()
660 )
661 );
662 }
663
664 public function saveAnswerSpecificDataToDb()
665 {
667 global $ilDB;
668 $ilDB->manipulateF( "DELETE FROM qpl_a_textsubset WHERE question_fi = %s",
669 array( 'integer' ),
670 array( $this->getId() )
671 );
672
673 foreach ($this->answers as $key => $value)
674 {
675 $answer_obj = $this->answers[$key];
676 $next_id = $ilDB->nextId( 'qpl_a_textsubset' );
677 $ilDB->manipulateF( "INSERT INTO qpl_a_textsubset (answer_id, question_fi, answertext, points, aorder, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
678 array( 'integer', 'integer', 'text', 'float', 'integer', 'integer' ),
679 array(
680 $next_id,
681 $this->getId(),
682 $answer_obj->getAnswertext(),
683 $answer_obj->getPoints(),
684 $answer_obj->getOrder(),
685 time()
686 )
687 );
688 }
689 }
690
694 protected function reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
695 {
696 // nothing to rework!
697 }
698
706 {
707 return "assTextSubset";
708 }
709
716 function &joinAnswers()
717 {
718 $join = array();
719 foreach ($this->answers as $answer)
720 {
721 if (!is_array($join[$answer->getPoints() . ""]))
722 {
723 $join[$answer->getPoints() . ""] = array();
724 }
725 array_push($join[$answer->getPoints() . ""], $answer->getAnswertext());
726 }
727 return $join;
728 }
729
737 {
738 $maxwidth = 0;
739 foreach ($this->answers as $answer)
740 {
741 $len = strlen($answer->getAnswertext());
742 if ($len > $maxwidth) $maxwidth = $len;
743 }
744 return $maxwidth + 3;
745 }
746
754 {
755 return "qpl_qst_textsubset";
756 }
757
765 {
766 return "qpl_a_textsubset";
767 }
768
774 {
775 return parent::getRTETextWithMediaObjects();
776 }
777
781 public function setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
782 {
783 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
784
785 $solutions = $this->getSolutionValues($active_id, $pass);
786
787 $i = 1;
788 foreach ($solutions as $solution)
789 {
790 $worksheet->setCell($startrow + $i, 0, $solution["value1"]);
791 $i++;
792 }
793
794 return $startrow + $i + 1;
795 }
796
797 public function getAnswers()
798 {
799 return $this->answers;
800 }
801
805 public function toJSON()
806 {
807 include_once("./Services/RTE/classes/class.ilRTE.php");
808 $result = array();
809 $result['id'] = (int) $this->getId();
810 $result['type'] = (string) $this->getQuestionType();
811 $result['title'] = (string) $this->getTitle();
812 $result['question'] = $this->formatSAQuestion($this->getQuestion());
813 $result['nr_of_tries'] = (int) $this->getNrOfTries();
814 $result['matching_method'] = (string) $this->getTextRating();
815 $result['feedback'] = array(
816 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
817 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
818 );
819
820 $answers = array();
821 foreach ($this->getAnswers() as $key => $answer_obj)
822 {
823 array_push($answers, array(
824 "answertext" => (string) $answer_obj->getAnswertext(),
825 "points" => (float)$answer_obj->getPoints(),
826 "order" => (int)$answer_obj->getOrder()
827 ));
828 }
829 $result['correct_answers'] = $answers;
830
831 $answers = array();
832 for($loop = 1; $loop <= (int) $this->getCorrectAnswers(); $loop++)
833 {
834 array_push($answers, array(
835 "answernr" => $loop
836 ));
837 }
838 $result['answers'] = $answers;
839
840 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
841 $result['mobs'] = $mobs;
842
843 return json_encode($result);
844 }
845
849 protected function getSolutionSubmit()
850 {
851 $solutionSubmit = array();
852 $purifier = $this->getHtmlUserSolutionPurifier();
853 foreach($_POST as $key => $val)
854 {
855 if(preg_match("/^TEXTSUBSET_(\d+)/", $key, $matches))
856 {
857 $val = trim($val);
858 if(strlen($val))
859 {
860 $val = $purifier->purify($val);
861 $solutionSubmit[] = $val;
862 }
863 }
864 }
865 return $solutionSubmit;
866 }
867
872 protected function calculateReachedPointsForSolution($enteredTexts)
873 {
874 $available_answers = $this->getAvailableAnswers();
875 $points = 0;
876 foreach($enteredTexts as $enteredtext)
877 {
878 $index = $this->isAnswerCorrect($available_answers, $enteredtext);
879 if($index !== FALSE)
880 {
881 unset($available_answers[$index]);
882 $points += $this->answers[$index]->getPoints();
883 }
884 }
885 return $points;
886 }
887
896 public function getOperators($expression)
897 {
898 require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
900 }
901
906 public function getExpressionTypes()
907 {
908 return array(
913 );
914 }
915
924 public function getUserQuestionResult($active_id, $pass)
925 {
927 global $ilDB;
928 $result = new ilUserQuestionResult($this, $active_id, $pass);
929
930 $maxStep = $this->lookupMaxStep($active_id, $pass);
931
932 if( $maxStep !== null )
933 {
934 $data = $ilDB->queryF(
935 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s ORDER BY solution_id",
936 array("integer", "integer", "integer","integer"),
937 array($active_id, $pass, $this->getId(), $maxStep)
938 );
939 }
940 else
941 {
942 $data = $ilDB->queryF(
943 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s ORDER BY solution_id",
944 array("integer", "integer", "integer"),
945 array($active_id, $pass, $this->getId())
946 );
947 }
948
949 for($index = 1; $index <= $ilDB->numRows($data); ++$index)
950 {
951 $row = $ilDB->fetchAssoc($data);
952 $result->addKeyValue($index, $row["value1"]);
953 }
954
955 $points = $this->calculateReachedPoints($active_id, $pass);
956 $max_points = $this->getMaximumPoints();
957
958 $result->setReachedPercentage(($points/$max_points) * 100);
959
960 return $result;
961 }
962
971 public function getAvailableAnswerOptions($index = null)
972 {
973 if($index !== null)
974 {
975 return $this->getAnswer($index);
976 }
977 else
978 {
979 return $this->getAnswers();
980 }
981 }
982}
$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.
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.
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
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.
calculateReachedPoints($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
Returns the points, a learner has reached answering 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.
getOperators($expression)
Get all available operations for a specific question.
copyObject($target_questionpool_id, $title="")
Copies an assTextSubset object.
saveWorkingData($active_id, $pass=NULL, $authorized=true)
Saves the learners input of the question to the database.
& 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.
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)
Base Exception for all Exceptions relating to Modules/Test.
Class ilUserQuestionResult.
$counter
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.
global $ilDB
$mobs
$ilUser
Definition: imgupload.php:18