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';
47 $this->ordertext =
"";
57 if (strlen($this->title) and ($this->author) and ($this->question) and ($this->
getMaximumPoints() > 0))
104 $this->
setId($question_id);
113 include_once(
"./Services/RTE/classes/class.ilRTE.php");
128 parent::loadFromDb($question_id);
142 $this_id = $this->
getId();
146 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
150 if( (
int)$testObjId > 0 )
152 $clone->setObjId($testObjId);
179 $clone->copyPageOfQuestion($this_id);
181 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
183 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
200 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
203 $source_questionpool_id = $this->
getObjId();
204 $clone->setObjId($target_questionpool_id);
215 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
228 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
231 $sourceParentId = $this->
getObjId();
237 $clone->setObjId($targetParentId);
239 if ($targetQuestionTitle)
241 $clone->setTitle($targetQuestionTitle);
246 $clone->copyPageOfQuestion($sourceQuestionId);
248 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
250 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
279 throw new ilTestException(
'return details not implemented for '.__METHOD__);
284 $found_values = array();
289 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
290 array(
'integer',
'integer',
'integer'),
298 $data[
'value1'] = join(
$data[
'value1'], $this->answer_separator);
319 include_once
"./Services/Utilities/classes/class.ilStr.php";
323 $result = preg_split(
"/\\s+/", $in_string);
330 foreach (
$result as $key => $value)
353 include_once
"./Modules/Test/classes/class.ilObjTest.php";
359 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
360 array(
'integer',
'integer',
'integer'),
364 $entered_values =
false;
365 if (strlen(
$_POST[
"orderresult"]))
367 $next_id = $ilDB->nextId(
'tst_solutions');
368 $affectedRows = $ilDB->insert(
"tst_solutions", array(
369 "solution_id" => array(
"integer", $next_id),
370 "active_fi" => array(
"integer", $active_id),
371 "question_fi" => array(
"integer", $this->
getId()),
372 "value1" => array(
"clob",
$_POST[
'orderresult']),
373 "value2" => array(
"clob", null),
374 "pass" => array(
"integer",
$pass),
375 "tstamp" => array(
"integer", time())
377 $entered_values =
true;
384 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
392 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
408 .
" WHERE question_fi = %s",
410 array( $this->
getId() )
414 .
" (question_fi, ordertext, textsize) VALUES (%s, %s, %s)",
415 array(
"integer",
"text",
"float" ),
447 include_once
"./Modules/Test/classes/class.ilObjTest.php";
453 if (count($solutions) == 1)
455 $elements = split(
"{::}", $solutions[0][
"value1"]);
459 $elements =
$_SESSION[
'qst_ordering_horizontal_elements'];
461 if (count($elements))
463 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
464 array(
'integer',
'integer',
'integer'),
468 if ($position < count($elements)-1)
470 $temp = $elements[$position];
471 $elements[$position] = $elements[$position+1];
472 $elements[$position+1] = $temp;
474 $entered_values =
false;
475 $next_id = $ilDB->nextId(
'tst_solutions');
476 $affectedRows = $ilDB->insert(
"tst_solutions", array(
477 "solution_id" => array(
"integer", $next_id),
478 "active_fi" => array(
"integer", $active_id),
479 "question_fi" => array(
"integer", $this->
getId()),
480 "value1" => array(
"clob", join($elements,
'{::}')),
481 "value2" => array(
"clob", null),
482 "pass" => array(
"integer",
$pass),
483 "tstamp" => array(
"integer", time())
485 $entered_values =
true;
488 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
496 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
514 return "assOrderingHorizontal";
524 return "qpl_qst_horder";
552 $text = parent::getRTETextWithMediaObjects();
569 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
575 $solutionvalue = str_replace(
"{::}",
" ", $solutions[0][
"value1"]);
579 return $startrow + $i + 1;
594 public function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
596 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assOrderingHorizontalImport.php";
598 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
607 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
609 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assOrderingHorizontalExport.php";
611 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
621 $user_solution = array();
622 return $user_solution;
664 $this->ordertext = $a_value;
686 $this->textsize = $a_value;
707 $this->separator = $a_value;
727 return parent::__get($value);
749 parent::__set($key, $value);
769 include_once(
"./Services/RTE/classes/class.ilRTE.php");
776 $result[
'shuffle'] = (bool)
true;
779 "onenotcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false),
780 "allcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true)
786 array_push($arr, array(
787 "answertext" => (
string) $answer,
788 "order" => (
int) $order+1
getId()
Gets the id of the assQuestion object.
Class for horizontal ordering questions.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
static _getOriginalId($question_id)
Returns the original id of a question.
formatSAQuestion($a_q)
Format self assessment question.
getPoints()
Returns the maximum available points for the question.
reworkWorkingData($active_id, $pass, $obligationsAnswered)
Reworks the allready saved working data if neccessary.
& getSolutionValues($active_id, $pass=NULL)
Loads solutions of a given user from the database an returns it.
Abstract basic class which is to be extended by the concrete assessment question type classes...
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
_convert_text($a_text, $a_target="has been removed")
getSeparator()
Get order text separator.
copyObject($target_questionpool_id, $title="")
Copies an assOrderingHorizontal object.
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.
splitAndTrimOrderElementText($in_string, $separator)
Splits the answer string either by space(s) or the separator (eg.
setOrderText($a_value)
Set order text.
setNrOfTries($a_nr_of_tries)
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
getOrderText()
Get order text.
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()
fetchAssoc($a_set)
Fetch row as associative array from result set.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setAuthor($author="")
Sets the authors name of the assQuestion object.
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assOrderingHorizontal constructor
saveWorkingData($active_id, $pass=NULL)
Saves the learners input of the question to the database.
isComplete()
Returns true, if a single choice question is complete for use.
Class for formula question question exports.
getQuestion()
Gets the question string of the question object.
Class for formula question imports.
setTextSize($a_value)
Set text size.
fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
Creates a question from a QTI file.
_getLogLanguage()
retrieve the log language for assessment logging
moveRight($position, $active_id, $pass=null)
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 ...
strPos($a_haystack, $a_needle, $a_offset=NULL)
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.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
setQuestion($question="")
Sets the question string of the question object.
Interface ilObjQuestionScoringAdjustable.
getQuestionType()
Returns the question type of the question.
setOriginalId($original_id)
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getTitle()
Gets the title string of the assQuestion object.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
saveToDb($original_id="")
Saves a assOrderingHorizontal object to a database.
calculateReachedPoints($active_id, $pass=NULL, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
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.
setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
Creates an Excel worksheet for the detailed cumulated results of this 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.