4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
5 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
6 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilObjQuestionScoringAdjustable.php';
7 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilObjAnswerScoringAdjustable.php';
8 require_once
'./Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
9 require_once
'./Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
104 $this->
setId($question_id);
113 require_once
'./Services/RTE/classes/class.ilRTE.php';
125 "SELECT * FROM qpl_num_range WHERE question_fi = %s ORDER BY aorder ASC",
130 require_once
'./Modules/TestQuestionPool/classes/class.assNumericRange.php';
140 parent::loadFromDb($question_id);
156 if ($this->
id <= 0) {
161 $this_id = $this->
getId();
165 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
169 if ((
int) $testObjId > 0) {
170 $clone->setObjId($testObjId);
191 $clone->copyPageOfQuestion($this_id);
193 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
195 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
210 if ($this->
id <= 0) {
216 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
219 $source_questionpool_id = $this->
getObjId();
220 $clone->setObjId($target_questionpool_id);
231 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
238 if ($this->
id <= 0) {
243 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
246 $sourceParentId = $this->
getObjId();
252 $clone->setObjId($targetParentId);
254 if ($targetQuestionTitle) {
255 $clone->setTitle($targetQuestionTitle);
260 $clone->copyPageOfQuestion($sourceQuestionId);
262 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
264 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
281 $a_limit = str_replace(
',',
'.', $a_limit);
282 $this->lower_limit = $a_limit;
287 $a_limit = str_replace(
',',
'.', $a_limit);
288 $this->upper_limit = $a_limit;
327 if ($returndetails) {
328 throw new ilTestException(
'return details not implemented for ' . __METHOD__);
334 $found_values =
array();
335 if (is_null(
$pass)) {
341 $enteredvalue =
$data[
"value1"];
344 if ($this->
contains($enteredvalue)) {
363 require_once
'./Services/Math/classes/class.EvalMath.php';
365 $eval->suppress_errors =
true;
379 if (is_numeric($submittedValue)) {
383 if (preg_match(
'/^[-+]{0,1}\d+\/\d+$/', $submittedValue)) {
402 return trim(str_replace(
",",
".",
$_POST[
"numeric_result"]));
407 require_once
'./Services/Math/classes/class.EvalMath.php';
409 $math->suppress_errors =
true;
410 $result = $math->evaluate($numeric_solution);
413 (
$result ===
false ||
$result ===
true) && strlen($numeric_solution) > 0
430 if (is_null(
$pass)) {
431 require_once
'./Modules/Test/classes/class.ilObjTest.php';
441 $this->
getProcessLocker()->executeUserSolutionUpdateLockOperation(
function () use (&$entered_values, $numeric_result, $ilDB, $active_id,
$pass, $authorized) {
445 $update =
$row[
"solution_id"];
447 if (strlen($numeric_result)) {
454 if (strlen($numeric_result)) {
461 if ($entered_values) {
462 require_once
'./Modules/Test/classes/class.ilObjAssessmentFolder.php';
467 "log_user_entered_values",
475 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
480 "log_user_not_entered_values",
512 ) .
" (question_fi, maxnumofchars) VALUES (%s, %s)",
513 array(
"integer",
"integer" ),
528 "DELETE FROM qpl_num_range WHERE question_fi = %s",
533 $next_id = $ilDB->nextId(
'qpl_num_range');
535 "INSERT INTO qpl_num_range (range_id, question_fi, lowerlimit, upperlimit, points, aorder, tstamp) 536 VALUES (%s, %s, %s, %s, %s, %s, %s)",
537 array(
'integer',
'integer',
'text',
'text',
'float',
'integer',
'integer' ),
588 return "qpl_qst_numeric";
597 return parent::getRTETextWithMediaObjects();
610 $worksheet->setCell($startrow +
$i, 0, $this->lng->txt(
"result"));
614 if (strlen($solutions[0][
"value1"])) {
615 $worksheet->setCell($startrow +
$i, 1, $solutions[0][
"value1"]);
619 return $startrow +
$i + 1;
632 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
663 $maxStep = $this->lookupMaxStep($active_id,
$pass);
665 if ($maxStep !== null) {
666 $data = $ilDB->queryF(
667 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s",
668 array(
"integer",
"integer",
"integer",
"integer"),
672 $data = $ilDB->queryF(
673 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
674 array(
"integer",
"integer",
"integer"),
679 while (
$row = $ilDB->fetchAssoc(
$data)) {
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
getId()
Gets the id of the assQuestion object.
static _getOriginalId($question_id)
Returns the original id of a question.
const PercentageResultExpression
Class iQuestionCondition.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assNumeric constructor
getExpressionTypes()
Get all available expression types for a specific question.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
getPoints()
Returns the maximum available points for the question.
getMaxChars()
Returns the maximum number of characters for the numeric input field.
Abstract basic class which is to be extended by the concrete assessment question type classes...
ensureNonNegativePoints($points)
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
setId($id=-1)
Sets the id of the assQuestion object.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second. ...
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{}
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
getParticipantsSolution()
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
getQuestionType()
Returns the question type of the question.
loadFromDb($question_id)
Loads the question from the database.
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...
getObjId()
Get the object id of the container object.
isValidNumericSubmitValue($submittedValue)
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
Base Exception for all Exceptions relating to Modules/Test.
setMaxChars($maxchars)
Sets the maximum number of characters for the numeric input field.
setParticipantsSolution($participantSolution)
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
removeSolutionRecordById($solutionId)
static _getLogLanguage()
retrieve the log language for assessment logging
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
{}
setAuthor($author="")
Sets the authors name of the assQuestion object.
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
Class ilUserQuestionResult.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
const NumericResultExpression
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
Interface ilObjAnswerScoringAdjustable.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assNumericQuestion.
saveToDb($original_id="")
Saves a assNumeric object to a database.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
getOperators($expression)
Get all available operations for a specific question.
updateCurrentSolution($solutionId, $value1, $value2, $authorized=true)
Create styles array
The data for the language used.
static getOperatorsByExpression($expression)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
copyObject($target_questionpool_id, $title="")
Copies an assNumeric object.
setPoints($a_points)
Sets the maximum available points for the question.
saveQuestionDataToDb($original_id="")
isValidSolutionSubmit($numeric_solution)
isComplete()
Returns true, if a numeric question is complete for use.
Class for numeric questions.
setQuestion($question="")
Sets the question string of the question object.
Interface ilObjQuestionScoringAdjustable.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
setOriginalId($original_id)
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass...
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
savePreviewData(ilAssQuestionPreviewSession $previewSession)
setComment($comment="")
Sets the comment string of the assQuestion object.
contains($value)
Checks for a given value within the range.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
const EmptyAnswerExpression