ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.assTextSubset.php
Go to the documentation of this file.
1 <?php
2 
19 require_once './Modules/Test/classes/inc.AssessmentConstants.php';
20 
37 {
43  public $answers;
44 
51 
57  public $text_rating;
58 
70  public function __construct(
71  $title = "",
72  $comment = "",
73  $author = "",
74  $owner = -1,
75  $question = ""
76  ) {
78  $this->answers = array();
79  $this->correctanswers = 0;
80  }
81 
88  public function isComplete(): bool
89  {
90  if (
91  strlen($this->title)
92  && $this->author
93  && $this->question &&
94  count($this->answers) >= $this->correctanswers
95  && $this->getMaximumPoints() > 0
96  ) {
97  return true;
98  }
99  return false;
100  }
101 
108  public function saveToDb($original_id = ""): void
109  {
110  if ($original_id == "") {
111  $this->saveQuestionDataToDb();
112  } else {
114  }
115 
118 
119  parent::saveToDb();
120  }
121 
129  public function loadFromDb($question_id): void
130  {
131  global $DIC;
132  $ilDB = $DIC['ilDB'];
133 
134  $result = $ilDB->queryF(
135  "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",
136  array("integer"),
137  array($question_id)
138  );
139  if ($result->numRows() == 1) {
140  $data = $ilDB->fetchAssoc($result);
141  $this->setId($question_id);
142  $this->setObjId($data["obj_fi"]);
143  $this->setNrOfTries($data['nr_of_tries']);
144  $this->setTitle((string) $data["title"]);
145  $this->setComment((string) $data["description"]);
146  $this->setOriginalId($data["original_id"]);
147  $this->setAuthor($data["author"]);
148  $this->setPoints($data["points"]);
149  $this->setOwner($data["owner"]);
150  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc((string) $data["question_text"], 1));
151  $this->setCorrectAnswers((int) $data["correctanswers"]);
152  $this->setTextRating($data["textgap_rating"]);
153 
154  try {
155  $this->setLifecycle(ilAssQuestionLifecycle::getInstance($data['lifecycle']));
158  }
159 
160  try {
161  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
162  } catch (ilTestQuestionPoolException $e) {
163  }
164  }
165 
166 
167  $result = $ilDB->queryF(
168  "SELECT * FROM qpl_a_textsubset WHERE question_fi = %s ORDER BY aorder ASC",
169  array('integer'),
170  array($question_id)
171  );
172  if ($result->numRows() > 0) {
173  while ($data = $ilDB->fetchAssoc($result)) {
174  $this->answers[] = new ASS_AnswerBinaryStateImage($data["answertext"], $data["points"], $data["aorder"]);
175  }
176  }
177 
178  parent::loadFromDb($question_id);
179  }
180 
186  public function addAnswer($answertext, $points, $order): void
187  {
188  if (array_key_exists($order, $this->answers)) {
189  // insert answer
190  $answer = new ASS_AnswerBinaryStateImage($answertext, $points, $order);
191  $newchoices = array();
192  for ($i = 0; $i < $order; $i++) {
193  $newchoices[] = $this->answers[$i];
194  }
195  $newchoices[] = $answer;
196  for ($i = $order, $iMax = count($this->answers); $i < $iMax; $i++) {
197  $changed = $this->answers[$i];
198  $changed->setOrder($i + 1);
199  $newchoices[] = $changed;
200  }
201  $this->answers = $newchoices;
202  } else {
203  // add answer
204  $this->answers[] = new ASS_AnswerBinaryStateImage($answertext, $points, count($this->answers));
205  }
206  }
207 
213  public function duplicate(bool $for_test = true, string $title = "", string $author = "", int $owner = -1, $testObjId = null): int
214  {
215  if ($this->id <= 0) {
216  // The question has not been saved. It cannot be duplicated
217  return -1;
218  }
219  // duplicate the question in database
220  $this_id = $this->getId();
221  $thisObjId = $this->getObjId();
222 
223  $clone = $this;
224 
225  $original_id = $this->questioninfo->getOriginalId($this->id);
226  $clone->id = -1;
227 
228  if ((int) $testObjId > 0) {
229  $clone->setObjId($testObjId);
230  }
231 
232  if ($title) {
233  $clone->setTitle($title);
234  }
235 
236  if ($author) {
237  $clone->setAuthor($author);
238  }
239  if ($owner) {
240  $clone->setOwner($owner);
241  }
242 
243  if ($for_test) {
244  $clone->saveToDb($original_id);
245  } else {
246  $clone->saveToDb();
247  }
248 
249  // copy question page content
250  $clone->copyPageOfQuestion($this_id);
251  // copy XHTML media objects
252  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
253 
254  $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
255 
256  return $clone->id;
257  }
258 
264  public function copyObject($target_questionpool_id, $title = ""): int
265  {
266  if ($this->getId() <= 0) {
267  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
268  }
269  // duplicate the question in database
270  $clone = $this;
271 
272  $original_id = $this->questioninfo->getOriginalId($this->id);
273  $clone->id = -1;
274  $source_questionpool_id = $this->getObjId();
275  $clone->setObjId($target_questionpool_id);
276  if ($title) {
277  $clone->setTitle($title);
278  }
279  $clone->saveToDb();
280  // copy question page content
281  $clone->copyPageOfQuestion($original_id);
282  // copy XHTML media objects
283  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
284 
285  $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
286 
287  return $clone->id;
288  }
289 
290  public function createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle = ""): int
291  {
292  if ($this->getId() <= 0) {
293  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
294  }
295 
296  $sourceQuestionId = $this->id;
297  $sourceParentId = $this->getObjId();
298 
299  // duplicate the question in database
300  $clone = $this;
301  $clone->id = -1;
302 
303  $clone->setObjId($targetParentId);
304 
305  if ($targetQuestionTitle) {
306  $clone->setTitle($targetQuestionTitle);
307  }
308 
309  $clone->saveToDb();
310  // copy question page content
311  $clone->copyPageOfQuestion($sourceQuestionId);
312  // copy XHTML media objects
313  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
314 
315  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
316 
317  return $clone->id;
318  }
319 
327  public function getAnswerCount(): int
328  {
329  return count($this->answers);
330  }
331 
341  public function getAnswer($index = 0): ?object
342  {
343  if ($index < 0) {
344  return null;
345  }
346  if (count($this->answers) < 1) {
347  return null;
348  }
349  if ($index >= count($this->answers)) {
350  return null;
351  }
352 
353  return $this->answers[$index];
354  }
355 
364  public function deleteAnswer($index = 0): void
365  {
366  if ($index < 0) {
367  return;
368  }
369  if (count($this->answers) < 1) {
370  return;
371  }
372  if ($index >= count($this->answers)) {
373  return;
374  }
375  unset($this->answers[$index]);
376  $this->answers = array_values($this->answers);
377  for ($i = 0, $iMax = count($this->answers); $i < $iMax; $i++) {
378  if ($this->answers[$i]->getOrder() > $index) {
379  $this->answers[$i]->setOrder($i);
380  }
381  }
382  }
383 
390  public function flushAnswers(): void
391  {
392  $this->answers = array();
393  }
394 
401  public function getMaximumPoints(): float
402  {
403  $points = array();
404  foreach ($this->answers as $answer) {
405  if ($answer->getPoints() > 0) {
406  $points[] = $answer->getPoints();
407  }
408  }
409  rsort($points, SORT_NUMERIC);
410  $maxpoints = 0;
411  for ($counter = 0; $counter < $this->getCorrectAnswers(); $counter++) {
412  if (isset($points[$counter])) {
413  $maxpoints += $points[$counter];
414  }
415  }
416  return $maxpoints;
417  }
418 
425  public function &getAvailableAnswers(): array
426  {
427  $available_answers = array();
428  foreach ($this->answers as $answer) {
429  $available_answers[] = $answer->getAnswertext();
430  }
431  return $available_answers;
432  }
433 
444  public function isAnswerCorrect($answers, $answer)
445  {
446  global $DIC;
447  $refinery = $DIC->refinery();
448  $textrating = $this->getTextRating();
449 
450  foreach ($answers as $key => $value) {
451  if ($this->answers[$key]->getPoints() <= 0) {
452  continue;
453  }
454  $value = html_entity_decode($value); #SB
455  switch ($textrating) {
457  if (strcmp(ilStr::strToLower($value), ilStr::strToLower($answer)) == 0) { #SB
458  return $key;
459  }
460  break;
462  if (strcmp($value, $answer) == 0) {
463  return $key;
464  }
465  break;
467  $transformation = $refinery->string()->levenshtein()->standard($answer, 1);
468  break;
470  $transformation = $refinery->string()->levenshtein()->standard($answer, 2);
471  break;
473  $transformation = $refinery->string()->levenshtein()->standard($answer, 3);
474  break;
476  $transformation = $refinery->string()->levenshtein()->standard($answer, 4);
477  break;
479  $transformation = $refinery->string()->levenshtein()->standard($answer, 5);
480  break;
481  }
482 
483  // run answers against Levenshtein2 methods
484  if (isset($transformation) && $transformation->transform($value) >= 0) {
485  return $key;
486  }
487  }
488  return false;
489  }
490 
498  public function getTextRating(): string
499  {
500  return $this->text_rating;
501  }
502 
510  public function setTextRating($a_text_rating): void
511  {
512  switch ($a_text_rating) {
520  $this->text_rating = $a_text_rating;
521  break;
522  default:
523  $this->text_rating = TEXTGAP_RATING_CASEINSENSITIVE;
524  break;
525  }
526  }
527 
538  public function calculateReachedPoints($active_id, $pass = null, $authorizedSolution = true, $returndetails = false): float
539  {
540  if ($returndetails) {
541  throw new ilTestException('return details not implemented for ' . __METHOD__);
542  }
543 
544  global $DIC;
545  $ilDB = $DIC['ilDB'];
546 
547 
548  if (is_null($pass)) {
549  $pass = $this->getSolutionMaxPass($active_id);
550  }
551  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
552 
553  $enteredTexts = array();
554  while ($data = $ilDB->fetchAssoc($result)) {
555  $enteredTexts[] = $data["value1"];
556  }
557 
558  return $this->calculateReachedPointsForSolution($enteredTexts);
559  }
560 
567  public function setCorrectAnswers(int $a_correct_answers): void
568  {
569  $this->correctanswers = $a_correct_answers;
570  }
571 
578  public function getCorrectAnswers(): int
579  {
580  return $this->correctanswers;
581  }
582 
591  public function saveWorkingData($active_id, $pass = null, $authorized = true): bool
592  {
593  global $DIC;
594  $ilDB = $DIC['ilDB'];
595  $ilUser = $DIC['ilUser'];
596 
597  if (is_null($pass)) {
598  $pass = ilObjTest::_getPass($active_id);
599  }
600 
601  $entered_values = 0;
602  $solutionSubmit = $this->getSolutionSubmit();
603 
604  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$entered_values, $solutionSubmit, $active_id, $pass, $authorized) {
605  $this->removeCurrentSolution($active_id, $pass, $authorized);
606 
607  foreach ($solutionSubmit as $value) {
608  if (strlen($value)) {
609  $this->saveCurrentSolution($active_id, $pass, $value, null, $authorized);
610  $entered_values++;
611  }
612  }
613  });
614 
615  if ($entered_values) {
617  assQuestion::logAction($this->lng->txtlng(
618  "assessment",
619  "log_user_entered_values",
621  ), $active_id, $this->getId());
622  }
624  assQuestion::logAction($this->lng->txtlng(
625  "assessment",
626  "log_user_not_entered_values",
628  ), $active_id, $this->getId());
629  }
630 
631  return true;
632  }
633 
634  public function saveAdditionalQuestionDataToDb()
635  {
637  global $DIC;
638  $ilDB = $DIC['ilDB'];
639 
640  // save additional data
641  $ilDB->manipulateF(
642  "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
643  array( "integer" ),
644  array( $this->getId() )
645  );
646 
647  $ilDB->manipulateF(
648  "INSERT INTO " . $this->getAdditionalTableName(
649  ) . " (question_fi, textgap_rating, correctanswers) VALUES (%s, %s, %s)",
650  array( "integer", "text", "integer" ),
651  array(
652  $this->getId(),
653  $this->getTextRating(),
654  $this->getCorrectAnswers()
655  )
656  );
657  }
658 
659  public function saveAnswerSpecificDataToDb()
660  {
662  global $DIC;
663  $ilDB = $DIC['ilDB'];
664  $ilDB->manipulateF(
665  "DELETE FROM qpl_a_textsubset WHERE question_fi = %s",
666  array( 'integer' ),
667  array( $this->getId() )
668  );
669 
670  foreach ($this->answers as $key => $value) {
671  $answer_obj = $this->answers[$key];
672  $next_id = $ilDB->nextId('qpl_a_textsubset');
673  $ilDB->manipulateF(
674  "INSERT INTO qpl_a_textsubset (answer_id, question_fi, answertext, points, aorder, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
675  array( 'integer', 'integer', 'text', 'float', 'integer', 'integer' ),
676  array(
677  $next_id,
678  $this->getId(),
679  $answer_obj->getAnswertext(),
680  $answer_obj->getPoints(),
681  $answer_obj->getOrder(),
682  time()
683  )
684  );
685  }
686  }
687 
694  public function getQuestionType(): string
695  {
696  return "assTextSubset";
697  }
698 
703  public function &joinAnswers(): array
704  {
705  $join = [];
706  foreach ($this->answers as $answer) {
707  $key = $answer->getPoints() . '';
708 
709  if (!isset($join[$key]) || !is_array($join[$key])) {
710  $join[$key] = [];
711  }
712 
713  $join[$key][] = $answer->getAnswertext();
714  }
715 
716  return $join;
717  }
718 
725  public function getMaxTextboxWidth(): int
726  {
727  $maxwidth = 0;
728  foreach ($this->answers as $answer) {
729  $len = strlen($answer->getAnswertext());
730  if ($len > $maxwidth) {
731  $maxwidth = $len;
732  }
733  }
734  return $maxwidth + 3;
735  }
736 
743  public function getAdditionalTableName(): string
744  {
745  return "qpl_qst_textsubset";
746  }
747 
754  public function getAnswerTableName(): string
755  {
756  return "qpl_a_textsubset";
757  }
758 
763  public function getRTETextWithMediaObjects(): string
764  {
765  return parent::getRTETextWithMediaObjects();
766  }
767 
771  public function setExportDetailsXLSX(ilAssExcelFormatHelper $worksheet, int $startrow, int $col, int $active_id, int $pass): int
772  {
773  parent::setExportDetailsXLSX($worksheet, $startrow, $col, $active_id, $pass);
774 
775  $solutions = $this->getSolutionValues($active_id, $pass);
776 
777  $i = 1;
778  foreach ($solutions as $solution) {
779  $worksheet->setCell($startrow + $i, $col + 2, $solution["value1"]);
780  $i++;
781  }
782 
783  return $startrow + $i + 1;
784  }
785 
786  public function getAnswers(): array
787  {
788  return $this->answers;
789  }
790 
794  public function toJSON(): string
795  {
796  $result = array();
797  $result['id'] = $this->getId();
798  $result['type'] = (string) $this->getQuestionType();
799  $result['title'] = $this->getTitleForHTMLOutput();
800  $result['question'] = $this->formatSAQuestion($this->getQuestion());
801  $result['nr_of_tries'] = $this->getNrOfTries();
802  $result['matching_method'] = $this->getTextRating();
803  $result['feedback'] = array(
804  'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
805  'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
806  );
807 
808  $answers = array();
809  foreach ($this->getAnswers() as $key => $answer_obj) {
810  $answers[] = array(
811  "answertext" => (string) $answer_obj->getAnswertext(),
812  "points" => (float) $answer_obj->getPoints(),
813  "order" => (int) $answer_obj->getOrder()
814  );
815  }
816  $result['correct_answers'] = $answers;
817 
818  $answers = array();
819  for ($loop = 1; $loop <= $this->getCorrectAnswers(); $loop++) {
820  $answers[] = array(
821  "answernr" => $loop
822  );
823  }
824  $result['answers'] = $answers;
825 
826  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
827  $result['mobs'] = $mobs;
828 
829  return json_encode($result);
830  }
831 
835  protected function getSolutionSubmit(): array
836  {
837  $purifier = $this->getHtmlUserSolutionPurifier();
838  $post = $this->dic->http()->wrapper()->post();
839 
840  $solutionSubmit = [];
841  foreach ($this->getAnswers() as $index => $a) {
842  if ($post->has("TEXTSUBSET_$index")) {
843  $value = $post->retrieve(
844  "TEXTSUBSET_$index",
845  $this->dic->refinery()->kindlyTo()->string()
846  );
847  if ($value) {
848  $value = $this->extendedTrim($value);
849  $value = $purifier->purify($value);
850  $solutionSubmit[] = $value;
851  }
852  }
853  }
854 
855  return $solutionSubmit;
856  }
857 
862  protected function calculateReachedPointsForSolution($enteredTexts): float
863  {
864  $enteredTexts ??= [];
865  $available_answers = $this->getAvailableAnswers();
866  $points = 0;
867  foreach ($enteredTexts as $enteredtext) {
868  $index = $this->isAnswerCorrect($available_answers, html_entity_decode($enteredtext));
869  if ($index !== false) {
870  unset($available_answers[$index]);
871  $points += $this->answers[$index]->getPoints();
872  }
873  }
874  return $points;
875  }
876 
885  public function getOperators($expression): array
886  {
888  }
889 
894  public function getExpressionTypes(): array
895  {
896  return array(
901  );
902  }
903 
912  public function getUserQuestionResult($active_id, $pass): ilUserQuestionResult
913  {
915  global $DIC;
916  $ilDB = $DIC['ilDB'];
917  $result = new ilUserQuestionResult($this, $active_id, $pass);
918 
919  $maxStep = $this->lookupMaxStep($active_id, $pass);
920 
921  if ($maxStep > 0) {
922  $data = $ilDB->queryF(
923  "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s ORDER BY solution_id",
924  array("integer", "integer", "integer","integer"),
925  array($active_id, $pass, $this->getId(), $maxStep)
926  );
927  } else {
928  $data = $ilDB->queryF(
929  "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s ORDER BY solution_id",
930  array("integer", "integer", "integer"),
931  array($active_id, $pass, $this->getId())
932  );
933  }
934 
935  for ($index = 1; $index <= $ilDB->numRows($data); ++$index) {
936  $row = $ilDB->fetchAssoc($data);
937  $result->addKeyValue($index, $row["value1"]);
938  }
939 
940  $points = $this->calculateReachedPoints($active_id, $pass);
941  $max_points = $this->getMaximumPoints();
942 
943  $result->setReachedPercentage(($points / $max_points) * 100);
944 
945  return $result;
946  }
947 
954  public function getAvailableAnswerOptions($index = null)
955  {
956  if ($index !== null) {
957  return $this->getAnswer($index);
958  } else {
959  return $this->getAnswers();
960  }
961  }
962 
963  public function isAddableAnswerOptionValue(int $qIndex, string $answerOptionValue): bool
964  {
965  $found = false;
966 
967  foreach ($this->getAnswers() as $item) {
968  if ($answerOptionValue !== $item->getAnswerText()) {
969  continue;
970  }
971 
972  $found = true;
973  break;
974  }
975 
976  return !$found;
977  }
978 
979  public function addAnswerOptionValue(int $qIndex, string $answerOptionValue, float $points): void
980  {
981  $this->addAnswer($answerOptionValue, $points, $qIndex);
982  }
983 }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
calculateReachedPointsForSolution($enteredTexts)
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
setNrOfTries(int $a_nr_of_tries)
addAnswer($answertext, $points, $order)
Adds an answer to the question.
setExportDetailsXLSX(ilAssExcelFormatHelper $worksheet, int $startrow, int $col, int $active_id, int $pass)
{}
getCorrectAnswers()
Returns the number of correct answers needed to solve the question.
const TEXTGAP_RATING_LEVENSHTEIN5
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
flushAnswers()
Deletes all answers.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
setCorrectAnswers(int $a_correct_answers)
Sets the number of correct answers needed to solve the question.
const TEXTGAP_RATING_LEVENSHTEIN2
const TEXTGAP_RATING_LEVENSHTEIN1
Abstract basic class which is to be extended by the concrete assessment question type classes...
Class for answers with a binary state indicator.
getOperators($expression)
Get all available operations for a specific question.
setOwner(int $owner=-1)
copyObject($target_questionpool_id, $title="")
Copies an assTextSubset object.
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
& joinAnswers()
Returns the answers of the question as a comma separated string.
getTextRating()
Returns the rating option for text comparisons.
setTextRating($a_text_rating)
Sets the rating option for text comparisons.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
toJSON()
Returns a JSON representation of 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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isComplete()
Returns true, if a TextSubset question is complete for use.
setCell($a_row, $a_col, $a_value, $datatype=null)
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
setComment(string $comment="")
duplicate(bool $for_test=true, string $title="", string $author="", int $owner=-1, $testObjId=null)
Duplicates an assTextSubsetQuestion.
float $points
The maximum available points for the question.
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
getQuestionType()
Returns the question type of the question.
Base Exception for all Exceptions relating to Modules/Test.
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assTextSubset constructor
global $DIC
Definition: feed.php:28
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
saveToDb($original_id="")
Saves a assTextSubset object to a database.
__construct(VocabulariesInterface $vocabularies)
const TEXTGAP_RATING_LEVENSHTEIN3
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addAnswerOptionValue(int $qIndex, string $answerOptionValue, float $points)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadFromDb($question_id)
Loads a assTextSubset object from a database.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
& getAvailableAnswers()
Returns the available answers for the question.
static logAction(string $logtext, int $active_id, int $question_id)
const TEXTGAP_RATING_CASESENSITIVE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $key
Consumer key/client ID value.
Definition: System.php:193
getAnswerCount()
Returns the number of answers.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setPoints(float $points)
setObjId(int $obj_id=0)
string $question
The question text.
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
getExpressionTypes()
Get all available expression types for a specific question.
isAddableAnswerOptionValue(int $qIndex, string $answerOptionValue)
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveQuestionDataToDb(int $original_id=-1)
getAnswer($index=0)
Returns an answer with a given index.
getSolutionMaxPass(int $active_id)
static extendedTrim(string $value)
Trim non-printable characters from the beginning and end of a string.
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setId(int $id=-1)
setOriginalId(?int $original_id)
const TEXTGAP_RATING_LEVENSHTEIN4
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $title="")
static strToLower(string $a_string)
Definition: class.ilStr.php:72
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
setLifecycle(ilAssQuestionLifecycle $lifecycle)
getCurrentSolutionResultSet(int $active_id, int $pass, bool $authorized=true)
deleteAnswer($index=0)
Deletes an answer with a given index.
getMaxTextboxWidth()
Returns the maximum width needed for the answer textboxes.
lookupMaxStep(int $active_id, int $pass)
setAuthor(string $author="")
$post
Definition: ltitoken.php:49
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
isAnswerCorrect($answers, $answer)
Returns the index of the found answer, if the given answer is in the set of correct answers and match...
ILIAS Refinery Factory $refinery
const TEXTGAP_RATING_CASEINSENSITIVE
setQuestion(string $question="")