23 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
82 if (($this->title) and ($this->author) and ($this->question) and ($this->
getMaximumPoints() > 0))
105 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() .
" WHERE question_fi = %s",
107 array($this->
getId())
110 $affectedRows = $ilDB->manipulateF(
"INSERT INTO " . $this->
getAdditionalTableName() .
" (question_fi, maxnumofchars) VALUES (%s, %s)",
111 array(
"integer",
"integer"),
121 $result = $ilDB->manipulateF(
"DELETE FROM qpl_num_range WHERE question_fi = %s",
123 array($this->
getId())
127 $next_id = $ilDB->nextId(
'qpl_num_range');
128 $answer_result = $ilDB->manipulateF(
"INSERT INTO qpl_num_range (range_id, question_fi, lowerlimit, upperlimit, points, aorder, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
129 array(
'integer',
'integer',
'text',
'text',
'float',
'integer',
'integer'),
151 if ($result->numRows() == 1)
153 $data = $ilDB->fetchAssoc($result);
154 $this->
setId($question_id);
163 include_once(
"./Services/RTE/classes/class.ilRTE.php");
170 $result = $ilDB->queryF(
"SELECT * FROM qpl_num_range WHERE question_fi = %s ORDER BY aorder ASC",
175 include_once
"./Modules/TestQuestionPool/classes/class.assNumericRange.php";
176 if ($result->numRows() > 0)
178 while (
$data = $ilDB->fetchAssoc($result))
202 $this_id = $this->
getId();
204 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
231 $clone->copyPageOfQuestion($this_id);
233 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
235 $clone->duplicateFeedbackGeneric($this_id);
237 $clone->onDuplicate($this_id);
255 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
258 $source_questionpool = $this->
getObjId();
259 $clone->setObjId($target_questionpool);
289 $this->lower_limit = $a_limit;
294 $this->upper_limit = $a_limit;
321 $found_values = array();
326 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
327 array(
'integer',
'integer',
'integer'),
330 $data = $ilDB->fetchAssoc($result);
332 $enteredvalue =
$data[
"value1"];
355 include_once
"./Services/Math/classes/class.EvalMath.php";
357 $eval->suppress_errors = TRUE;
358 $result = $eval->e($value);
359 if (($result === FALSE) || ($result === TRUE))
return FALSE;
360 if (($result >= $eval->e($this->getLowerLimit())) && ($result <= $eval->e($this->
getUpperLimit())))
383 include_once
"./Modules/Test/classes/class.ilObjTest.php";
387 $numeric_result = str_replace(
",",
".",
$_POST[
"numeric_result"]);
389 include_once
"./Services/Math/classes/class.EvalMath.php";
391 $math->suppress_errors = TRUE;
392 $result = $math->evaluate($numeric_result);
394 if ((($result === FALSE) || ($result === TRUE)) && (strlen($result) > 0))
397 $returnvalue =
false;
399 $result = $ilDB->queryF(
"SELECT solution_id FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
400 array(
'integer',
'integer',
'integer'),
403 $row = $ilDB->fetchAssoc($result);
404 $update =
$row[
"solution_id"];
407 if (strlen($numeric_result))
409 $affectedRows = $ilDB->update(
"tst_solutions", array(
410 "value1" => array(
"clob", trim($numeric_result)),
411 "tstamp" => array(
"integer", time())
413 "solution_id" => array(
"integer", $update)
419 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE solution_id = %s",
427 if (strlen($numeric_result))
429 $next_id = $ilDB->nextId(
'tst_solutions');
430 $affectedRows = $ilDB->insert(
"tst_solutions", array(
431 "solution_id" => array(
"integer", $next_id),
432 "active_fi" => array(
"integer", $active_id),
433 "question_fi" => array(
"integer", $this->
getId()),
434 "value1" => array(
"clob", trim($numeric_result)),
435 "value2" => array(
"clob", null),
436 "pass" => array(
"integer",
$pass),
437 "tstamp" => array(
"integer", time())
444 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
452 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
504 return "qpl_qst_numeric";
528 $adapter->setCellValue($startrow, 0, $this->lng->txt($this->getQuestionType()),
CELL_FORMAT_TITLE);
531 $adapter->setCellValue($startrow + $i, 0, $this->lng->txt(
"result"),
CELL_FORMAT_BOLD);
532 if (strlen($solutions[0][
"value1"]))
534 $adapter->setCellValue($startrow + $i, 1, $solutions[0][
"value1"]);
537 return $startrow + $i + 1;