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';
106 $this->
setId($question_id);
115 require_once
'./Services/RTE/classes/class.ilRTE.php';
129 $result =
$ilDB->queryF(
"SELECT * FROM qpl_num_range WHERE question_fi = %s ORDER BY aorder ASC",
134 require_once
'./Modules/TestQuestionPool/classes/class.assNumericRange.php';
146 parent::loadFromDb($question_id);
168 $this_id = $this->
getId();
172 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
176 if( (
int)$testObjId > 0 )
178 $clone->setObjId($testObjId);
205 $clone->copyPageOfQuestion($this_id);
207 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
209 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
231 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
234 $source_questionpool_id = $this->
getObjId();
235 $clone->setObjId($target_questionpool_id);
247 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
260 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
263 $sourceParentId = $this->
getObjId();
269 $clone->setObjId($targetParentId);
271 if ($targetQuestionTitle)
273 $clone->setTitle($targetQuestionTitle);
278 $clone->copyPageOfQuestion($sourceQuestionId);
280 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
282 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
299 $a_limit = str_replace(
',',
'.', $a_limit);
300 $this->lower_limit = $a_limit;
305 $a_limit = str_replace(
',',
'.', $a_limit);
306 $this->upper_limit = $a_limit;
348 throw new ilTestException(
'return details not implemented for '.__METHOD__);
354 $found_values = array();
362 $enteredvalue =
$data[
"value1"];
385 require_once
'./Services/Math/classes/class.EvalMath.php';
387 $eval->suppress_errors = TRUE;
403 if( is_numeric($submittedValue) )
408 if( preg_match(
'/^[-+]{0,1}\d+\/\d+$/', $submittedValue) )
429 return trim(str_replace(
",",
".",
$_POST[
"numeric_result"]));
434 require_once
'./Services/Math/classes/class.EvalMath.php';
436 $math->suppress_errors = TRUE;
437 $result = $math->evaluate($numeric_solution);
440 (
$result === FALSE ||
$result === TRUE) && strlen($numeric_solution) > 0
459 require_once
'./Modules/Test/classes/class.ilObjTest.php';
469 $this->
getProcessLocker()->executeUserSolutionUpdateLockOperation(
function() use (&$entered_values, $numeric_result,
$ilDB, $active_id,
$pass, $authorized) {
474 $update =
$row[
"solution_id"];
477 if(strlen($numeric_result))
489 if(strlen($numeric_result))
500 require_once
'./Modules/Test/classes/class.ilObjAssessmentFolder.php';
505 "log_user_entered_values",
515 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
520 "log_user_not_entered_values",
546 array( $this->
getId() )
550 ) .
" (question_fi, maxnumofchars) VALUES (%s, %s)",
551 array(
"integer",
"integer" ),
565 $ilDB->manipulateF(
"DELETE FROM qpl_num_range WHERE question_fi = %s",
567 array( $this->
getId() )
570 $next_id =
$ilDB->nextId(
'qpl_num_range' );
571 $ilDB->manipulateF(
"INSERT INTO qpl_num_range (range_id, question_fi, lowerlimit, upperlimit, points, aorder, tstamp)
572 VALUES (%s, %s, %s, %s, %s, %s, %s)",
573 array(
'integer',
'integer',
'text',
'text',
'float',
'integer',
'integer' ),
624 return "qpl_qst_numeric";
633 return parent::getRTETextWithMediaObjects();
646 $worksheet->setCell($startrow + $i, 0, $this->lng->txt(
"result"));
650 if (strlen($solutions[0][
"value1"]))
652 $worksheet->setCell($startrow + $i, 1, $solutions[0][
"value1"]);
656 return $startrow + $i + 1;
669 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
700 $maxStep = $this->lookupMaxStep($active_id,
$pass);
702 if( $maxStep !==
null )
705 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s",
706 array(
"integer",
"integer",
"integer",
"integer"),
707 array($active_id,
$pass, $this->
getId(), $maxStep)
713 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
714 array(
"integer",
"integer",
"integer"),
An exception for terminatinating execution or to throw for unit testing.
Class for numeric questions.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assNumericQuestion.
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
{Reworks the allready saved working data if neccessary.}
getExpressionTypes()
Get all available expression types for a specific question.
copyObject($target_questionpool_id, $title="")
Copies an assNumeric object.
contains($value)
Checks for a given value within the range.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
setMaxChars($maxchars)
Sets the maximum number of characters for the numeric input field.
isValidNumericSubmitValue($submittedValue)
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{Creates an Excel worksheet for the detailed cumulated results of this question.object}
saveToDb($original_id="")
Saves a assNumeric object to a database.
getQuestionType()
Returns the question type of the question.
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assNumeric constructor
savePreviewData(ilAssQuestionPreviewSession $previewSession)
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
getAdditionalTableName()
Returns the name of the additional question data table in the database.
getMaxChars()
Returns the maximum number of characters for the numeric input field.
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
getOperators($expression)
Get all available operations for a specific question.
isValidSolutionSubmit($numeric_solution)
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
isComplete()
Returns true, if a numeric question is complete for use.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
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.
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.
calculateReachedPoints($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
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.
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
updateCurrentSolution($solutionId, $value1, $value2, $authorized=true)
removeSolutionRecordById($solutionId)
setAuthor($author="")
Sets the authors name of the assQuestion object.
getPoints()
Returns the maximum available points for the question.
saveWorkingData($active_id, $pass=NULL, $authorized=true)
Saves the learners input of the question to the database.
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
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)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
loadFromDb($question_id)
Loads the question from the database.
ensureNonNegativePoints($points)
getParticipantsSolution()
setParticipantsSolution($participantSolution)
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static getOperatorsByExpression($expression)
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...
Base Exception for all Exceptions relating to Modules/Test.
Class ilUserQuestionResult.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class iQuestionCondition.
const PercentageResultExpression
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
const NumericResultExpression
const EmptyAnswerExpression
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.