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.iQuestionCondition.php';
8require_once
'./Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
48 $this->ordertext =
"";
58 if (strlen($this->title) and ($this->author) and ($this->question) and ($this->
getMaximumPoints() > 0)) {
102 $this->
setId($question_id);
111 include_once(
"./Services/RTE/classes/class.ilRTE.php");
123 parent::loadFromDb($question_id);
131 if ($this->
id <= 0) {
136 $this_id = $this->
getId();
140 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
144 if ((
int) $testObjId > 0) {
145 $clone->setObjId($testObjId);
166 $clone->copyPageOfQuestion($this_id);
168 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
170 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
180 if ($this->
id <= 0) {
186 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
189 $source_questionpool_id = $this->
getObjId();
190 $clone->setObjId($target_questionpool_id);
200 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
207 if ($this->
id <= 0) {
212 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
215 $sourceParentId = $this->
getObjId();
221 $clone->setObjId($targetParentId);
223 if ($targetQuestionTitle) {
224 $clone->setTitle($targetQuestionTitle);
229 $clone->copyPageOfQuestion($sourceQuestionId);
231 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
233 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
260 if ($returndetails) {
261 throw new ilTestException(
'return details not implemented for ' . __METHOD__);
266 $found_values = array();
267 if (is_null(
$pass)) {
291 include_once
"./Services/Utilities/classes/class.ilStr.php";
294 $result = preg_split(
"/\\s+/", $in_string);
308 return $_POST[
"orderresult"];
324 if (is_null(
$pass)) {
325 include_once
"./Modules/Test/classes/class.ilObjTest.php";
329 $entered_values =
false;
331 $this->
getProcessLocker()->executeUserSolutionUpdateLockOperation(
function () use (&$entered_values, $active_id,
$pass, $authorized) {
336 $entered_values =
false;
337 if (strlen($solutionSubmit)) {
339 $entered_values =
true;
343 if ($entered_values) {
344 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
349 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
365 .
" WHERE question_fi = %s",
367 array( $this->
getId() )
372 .
" (question_fi, ordertext, textsize) VALUES (%s, %s, %s)",
373 array(
"integer",
"text",
"float" ),
397 return "assOrderingHorizontal";
407 return "qpl_qst_horder";
435 $text = parent::getRTETextWithMediaObjects();
448 $solutionvalue = str_replace(
"{::}",
" ", $solutions[0][
"value1"]);
453 return $startrow +
$i + 1;
468 public function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
470 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assOrderingHorizontalImport.php";
472 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
481 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
483 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assOrderingHorizontalExport.php";
485 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
495 $user_solution = array();
496 return $user_solution;
517 $elements = $this->
getShuffler()->shuffle($elements);
538 $this->ordertext = $a_value;
558 if ($a_value >= 10) {
559 $this->textsize = $a_value;
580 $this->separator = $a_value;
599 return parent::__get($value);
620 parent::__set(
$key, $value);
640 include_once(
"./Services/RTE/classes/class.ilRTE.php");
647 $result[
'shuffle'] = (bool)
true;
653 'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
654 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
659 array_push($arr, array(
660 "answertext" => (
string) $answer,
661 "order" => (
int) $order+1
682 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
714 $maxStep = $this->lookupMaxStep($active_id,
$pass);
716 if ($maxStep !==
null) {
718 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s",
719 array(
"integer",
"integer",
"integer",
"integer"),
720 array($active_id,
$pass, $this->
getId(), $maxStep)
724 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
725 array(
"integer",
"integer",
"integer"),
733 $solutions = array();
735 foreach ($answer_elements as $answer) {
736 foreach ($elements as
$key => $element) {
737 if ($element == $answer) {
744 if ($this->answer_separator =
'{::}') {
747 $result->addKeyValue(
null, join($glue, $answer_elements));
769 if (array_key_exists(
$index, $elements)) {
785 $value = join($value, $this->answer_separator);
803 return parent::buildTestPresentationConfig()
805 ->setIsUnchangedAnswerPossible(
true)
806 ->setUseUnchangedAnswerLabel($this->lng->txt(
'tst_unchanged_order_is_correct'));
An exception for terminatinating execution or to throw for unit testing.
Class for formula question question exports.
Class for formula question imports.
Class for horizontal ordering questions.
setSeparator($a_value)
Set order text separator.
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
copyObject($target_questionpool_id, $title="")
Copies an assOrderingHorizontal object.
isComplete()
Returns true, if a single choice question is complete for use.
saveToDb($original_id="")
Saves a assOrderingHorizontal object to a database.
__get($value)
Object getter.
getOrderText()
Get order text.
setOrderText($a_value)
Set order text.
setTextSize($a_value)
Set text size.
getOperators($expression)
Get all available operations for a specific question.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
getTextSize()
Get text size.
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{Creates an Excel worksheet for the detailed cumulated results of this question.object}
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
toJSON()
Returns a JSON representation of the question.
getAnswerTableName()
Returns the name of the answer table in the database.
calculateReachedPointsForSolution($value)
loadFromDb($question_id)
Loads a assOrderingHorizontal object from a database.
getRandomOrderingElements()
Get ordering elements from order text in random sequence.
getOrderingElements()
Get ordering elements from order text.
getQuestionType()
Returns the question type of the question.
toXML($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM X...
getSeparator()
Get order text separator.
buildTestPresentationConfig()
Get the test question configuration.
getExpressionTypes()
Get all available expression types for a specific question.
deleteAnswers($question_id)
Deletes datasets from answers tables.
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
{Reworks the allready saved working data if neccessary.}
supportsJavascriptOutput()
Returns true if the question type supports JavaScript output.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assOrderingHorizontal constructor
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
__set($key, $value)
Object setter.
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
splitAndTrimOrderElementText($in_string, $separator)
Splits the answer string either by space(s) or the separator (eg.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
Creates a question from a QTI file.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assOrderingHorizontal.
getBestSolution($active_id, $pass)
Returns the best solution for a given pass of a participant.
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.
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
static _getOriginalId($question_id)
Returns the original id of a question.
formatSAQuestion($a_q)
Format self assessment 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.
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.
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
removeCurrentSolution($active_id, $pass, $authorized=true)
setAuthor($author="")
Sets the authors name of the assQuestion object.
getPoints()
Returns the maximum available points for the question.
getTitle()
Gets the title string of the assQuestion object.
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)
getQuestion()
Gets the question string of the question object.
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
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...
static strPos($a_haystack, $a_needle, $a_offset=null)
Base Exception for all Exceptions relating to Modules/Test.
Class ilUserQuestionResult.
Class iQuestionCondition.
const PercentageResultExpression
const OrderingResultExpression
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
const StringResultExpression
const NumericResultExpression
Interface ilObjQuestionScoringAdjustable.