19 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
20 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
21 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilObjQuestionScoringAdjustable.php';
22 require_once
'./Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
23 require_once
'./Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
63 $this->ordertext =
"";
73 if (strlen($this->title) and ($this->author) and ($this->question) and ($this->
getMaximumPoints() > 0)) {
109 $ilDB = $DIC[
'ilDB'];
118 $this->
setId($question_id);
127 include_once(
"./Services/RTE/classes/class.ilRTE.php");
145 parent::loadFromDb($question_id);
153 if ($this->
id <= 0) {
158 $this_id = $this->
getId();
162 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
166 if ((
int) $testObjId > 0) {
167 $clone->setObjId($testObjId);
188 $clone->copyPageOfQuestion($this_id);
190 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
192 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
202 if ($this->
id <= 0) {
208 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
211 $source_questionpool_id = $this->
getObjId();
212 $clone->setObjId($target_questionpool_id);
222 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
229 if ($this->
id <= 0) {
234 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
237 $sourceParentId = $this->
getObjId();
243 $clone->setObjId($targetParentId);
245 if ($targetQuestionTitle) {
246 $clone->setTitle($targetQuestionTitle);
251 $clone->copyPageOfQuestion($sourceQuestionId);
253 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
255 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
282 if ($returndetails) {
283 throw new ilTestException(
'return details not implemented for ' . __METHOD__);
287 $ilDB = $DIC[
'ilDB'];
289 $found_values = array();
290 if (is_null(
$pass)) {
314 include_once
"./Services/Utilities/classes/class.ilStr.php";
317 $result = preg_split(
"/\\s+/", $in_string);
322 foreach (
$result as $key => $value) {
331 return $_POST[
"orderresult"];
345 $ilDB = $DIC[
'ilDB'];
348 if (is_null(
$pass)) {
349 include_once
"./Modules/Test/classes/class.ilObjTest.php";
353 $entered_values =
false;
355 $this->
getProcessLocker()->executeUserSolutionUpdateLockOperation(
function () use (&$entered_values, $active_id,
$pass, $authorized) {
360 $entered_values =
false;
361 if (strlen($solutionSubmit)) {
363 $entered_values =
true;
367 if ($entered_values) {
368 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
373 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
385 $ilDB = $DIC[
'ilDB'];
390 .
" WHERE question_fi = %s",
392 array( $this->
getId() )
397 .
" (question_fi, ordertext, textsize) VALUES (%s, %s, %s)",
398 array(
"integer",
"text",
"float" ),
414 return "assOrderingHorizontal";
424 return "qpl_qst_horder";
452 $text = parent::getRTETextWithMediaObjects();
461 parent::setExportDetailsXLS($worksheet, $startrow, $active_id,
$pass);
465 $solutionvalue = str_replace(
"{::}",
" ", $solutions[0][
"value1"]);
467 $worksheet->setCell($startrow +
$i, 2, $solutionvalue);
470 return $startrow +
$i + 1;
485 public function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping, array $solutionhints = [])
487 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assOrderingHorizontalImport.php";
489 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
498 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
500 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assOrderingHorizontalExport.php";
502 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
512 $user_solution = array();
513 return $user_solution;
534 $elements = $this->
getShuffler()->shuffle($elements);
555 $this->ordertext = $a_value;
575 if ($a_value >= 10) {
576 $this->textsize = $a_value;
597 $this->separator = $a_value;
616 return parent::__get($value);
637 parent::__set($key, $value);
657 include_once(
"./Services/RTE/classes/class.ilRTE.php");
664 $result[
'shuffle'] = (bool)
true;
670 'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
671 'allcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
676 array_push($arr, array(
677 "answertext" => (
string) $answer,
678 "order" => (
int) $order + 1
699 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
729 $ilDB = $DIC[
'ilDB'];
732 $maxStep = $this->lookupMaxStep($active_id,
$pass);
734 if ($maxStep !== null) {
736 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s",
737 array(
"integer",
"integer",
"integer",
"integer"),
738 array($active_id,
$pass, $this->
getId(), $maxStep)
742 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
743 array(
"integer",
"integer",
"integer"),
751 $solutions = array();
753 foreach ($answer_elements as $answer) {
754 foreach ($elements as $key => $element) {
755 if ($element == $answer) {
756 $result->addKeyValue($key + 1, $answer);
762 if ($this->answer_separator =
'{::}') {
765 $result->addKeyValue(null, join($glue, $answer_elements));
787 if (array_key_exists(
$index, $elements)) {
803 $value = join($this->answer_separator, $value);
821 return parent::buildTestPresentationConfig()
823 ->setIsUnchangedAnswerPossible(
true)
824 ->setUseUnchangedAnswerLabel($this->lng->txt(
'tst_unchanged_order_is_correct'));
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getId()
Gets the id of the assQuestion object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
static getInstance($identifier)
static _getOriginalId($question_id)
Returns the original id of a question.
formatSAQuestion($a_q)
Format self assessment question.
const PercentageResultExpression
Class iQuestionCondition.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static strPos($a_haystack, $a_needle, $a_offset=null)
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.
Abstract basic class which is to be extended by the concrete assessment question type classes...
getSeparator()
Get order text separator.
copyObject($target_questionpool_id, $title="")
Copies an assOrderingHorizontal object.
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. ...
splitAndTrimOrderElementText($in_string, $separator)
Splits the answer string either by space(s) or the separator (eg.
setOrderText($a_value)
Set order text.
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
setNrOfTries($a_nr_of_tries)
const StringResultExpression
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
getOrderText()
Get order text.
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.
getBestSolution($active_id, $pass)
Returns the best solution for a given pass of a participant.
loadFromDb($question_id)
Loads a assOrderingHorizontal object from a database.
Base Exception for all Exceptions relating to Modules/Test.
__get($value)
Object getter.
getTextSize()
Get text size.
toJSON()
Returns a JSON representation of the question.
supportsJavascriptOutput()
static _getLogLanguage()
retrieve the log language for assessment logging
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setAuthor($author="")
Sets the authors name of the assQuestion object.
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assOrderingHorizontal constructor
Class ilUserQuestionResult.
isComplete()
Returns true, if a single choice question is complete for use.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
const NumericResultExpression
Class for formula question question exports.
buildTestPresentationConfig()
Get the test question configuration.
getQuestion()
Gets the question string of the question object.
Class for formula question imports.
fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping, array $solutionhints=[])
Creates a question from a QTI file.
const OrderingResultExpression
calculateReachedPointsForSolution($value)
setTextSize($a_value)
Set text size.
static getOperatorsByExpression($expression)
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...
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
getRandomOrderingElements()
Get ordering elements from order text in random sequence.
setPoints($a_points)
Sets the maximum available points for the question.
saveQuestionDataToDb($original_id="")
__set($key, $value)
Object setter.
setSeparator($a_value)
Set order text separator.
deleteAnswers($question_id)
Deletes datasets from answers tables.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{}
setQuestion($question="")
Sets the question string of the question object.
Interface ilObjQuestionScoringAdjustable.
removeCurrentSolution($active_id, $pass, $authorized=true)
__construct(Container $dic, ilPlugin $plugin)
getQuestionType()
Returns the question type of 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...
setLifecycle(ilAssQuestionLifecycle $lifecycle)
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
getTitle()
Gets the title string of the assQuestion object.
getExpressionTypes()
Get all available expression types for a specific question.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
saveToDb($original_id="")
Saves a assOrderingHorizontal object to a database.
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assOrderingHorizontal.
setComment($comment="")
Sets the comment string of the assQuestion object.
static getDraftInstance()
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.
getAnswerTableName()
Returns the name of the answer table in the database.
getOrderingElements()
Get ordering elements from order text.
getOperators($expression)
Get all available operations for a specific question.