23 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
88 $this->maxNumOfChars = 0;
91 $this->matchcondition = 0;
102 if (strlen($this->title) and ($this->author) and ($this->question) and ($this->
getMaximumPoints() > 0))
125 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() .
" WHERE question_fi = %s",
127 array($this->
getId())
130 $affectedRows = $ilDB->manipulateF(
"INSERT INTO " . $this->
getAdditionalTableName() .
" (question_fi, maxnumofchars, keywords, textgap_rating, matchcondition) VALUES (%s, %s, %s, %s, %s)",
131 array(
"integer",
"integer",
"text",
"text",
'integer'),
137 $this->matchcondition
162 $this->
setId($question_id);
171 include_once(
"./Services/RTE/classes/class.ilRTE.php");
177 $this->matchcondition = (strlen(
$data[
'matchcondition'])) ?
$data[
'matchcondition'] : 0;
196 $this_id = $this->
getId();
198 if( (
int)$testObjId > 0 )
204 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
208 if( (
int)$testObjId > 0 )
210 $clone->setObjId($testObjId);
237 $clone->copyPageOfQuestion($this_id);
239 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
241 $clone->duplicateFeedbackGeneric($this_id);
243 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
262 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
265 $source_questionpool = $this->
getObjId();
266 $clone->setObjId($target_questionpool);
293 if (strcmp($this->maxNumOfChars,
"") == 0)
312 $this->maxNumOfChars = $maxchars;
345 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_result SET points = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s",
346 array(
'float',
'integer',
'integer',
'integer'),
370 include_once
"./Services/Utilities/classes/class.ilStr.php";
377 if (
ilStr::strPos($answertext, $a_keyword) !==
false)
return TRUE;
380 $answerwords = array();
381 if (preg_match_all(
"/([^\s.]+)/", $answertext, $matches))
383 foreach ($matches[1] as $answerword)
385 array_push($answerwords, trim($answerword));
388 foreach ($answerwords as $a_original)
393 if (levenshtein($a_original, $a_keyword) <= 1)
return TRUE;
396 if (levenshtein($a_original, $a_keyword) <= 2)
return TRUE;
399 if (levenshtein($a_original, $a_keyword) <= 3)
return TRUE;
402 if (levenshtein($a_original, $a_keyword) <= 4)
return TRUE;
405 if (levenshtein($a_original, $a_keyword) <= 5)
return TRUE;
430 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
431 array(
'integer',
'integer',
'integer'),
446 if ($this->matchcondition == 0)
448 $foundkeyword =
false;
452 $foundkeyword =
true;
456 if ($this->matchcondition == 0)
489 include_once
"./Services/Utilities/classes/class.ilStr.php";
492 include_once
"./Modules/Test/classes/class.ilObjTest.php";
495 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
496 array(
'integer',
'integer',
'integer'),
502 include_once
"./Services/Utilities/classes/class.ilStr.php";
503 $text_without_tags = preg_replace(
"/<[^>*?]>/is",
"", $text);
508 if (!$this->
isHTML($text))
516 $text = preg_replace(
"/<[^>]*$/ims",
"", $text);
525 $next_id = $ilDB->nextId(
'tst_solutions');
526 $affectedRows = $ilDB->insert(
"tst_solutions", array(
527 "solution_id" => array(
"integer", $next_id),
528 "active_fi" => array(
"integer", $active_id),
529 "question_fi" => array(
"integer", $this->
getId()),
530 "value1" => array(
"clob", trim($text)),
531 "value2" => array(
"clob", null),
532 "pass" => array(
"integer",
$pass),
533 "tstamp" => array(
"integer", time())
539 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
547 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
569 return "assTextQuestion";
591 $this->keywords = $a_keywords;
603 if (preg_match_all(
"/([^\s]+)/", $this->keywords, $matches))
605 foreach ($matches[1] as $keyword)
634 switch ($a_text_rating)
643 $this->text_rating = $a_text_rating;
659 return "qpl_qst_essay";
685 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
691 if (strlen($solutions[0][
"value1"]))
696 return $startrow + $i + 1;
704 include_once(
"./Services/RTE/classes/class.ilRTE.php");