19require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
110 $elements = array_filter(
112 fn ($element) => trim($element->getContent()) !=
''
114 $has_at_least_two_elements = count($elements) > 1;
120 && $has_at_least_two_elements;
127 protected function getRepository():
ILIAS\TA\Questions\Ordering\assOrderingQuestionDatabaseRepository
129 if (is_null($this->oq_repository)) {
132 $this->oq_repository =
new OQRepository(
$ilDB);
168 $result =
$ilDB->queryF(
173 if ($result->numRows() == 1) {
175 $this->
setId($question_id);
178 $this->
setComment((
string) $data[
"description"]);
184 include_once(
"./Services/RTE/classes/class.ilRTE.php");
190 $this->element_height =
$data[
"element_height"] ? (
int)
$data[
'element_height'] :
null;
204 parent::loadFromDb($question_id);
208 bool $for_test =
true,
214 if ($this->
id <= 0) {
219 $this_id = $this->
getId();
222 $clone = clone $this;
226 if ((
int) $testObjId > 0) {
227 $clone->setObjId($testObjId);
247 ->withQuestionId($clone->getId());
248 $list->distributeNewRandomIdentifiers();
249 $clone->setOrderingElementList($list);
252 $clone->copyPageOfQuestion($this_id);
253 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
254 $clone->duplicateImages($this_id, $thisObjId, $clone->getId(), $testObjId);
256 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
257 return $clone->getId();
267 if ($this->
getId() <= 0) {
268 throw new RuntimeException(
'The question has not been saved. It cannot be duplicated');
271 $clone = clone $this;
272 $this_id = $this->
getId();
275 $source_questionpool_id = $this->getObjId();
276 $clone->setObjId($target_questionpool_id);
278 $clone->setTitle($title);
282 $list = $this->getRepository()->getOrderingList($this_id)
283 ->withQuestionId($clone->getId());
284 $list->distributeNewRandomIdentifiers();
285 $clone->setOrderingElementList($list);
288 $clone->copyPageOfQuestion($original_id);
289 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
290 $clone->duplicateImages($original_id, $source_questionpool_id, $clone->getId(), $target_questionpool_id);
292 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
294 return $clone->getId();
299 if ($this->
getId() <= 0) {
300 throw new RuntimeException(
'The question has not been saved. It cannot be duplicated');
303 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
306 $sourceParentId = $this->getObjId();
309 $clone = clone $this;
312 $clone->setObjId($targetParentId);
314 if ($targetQuestionTitle) {
315 $clone->setTitle($targetQuestionTitle);
320 $list = $this->getRepository()->getOrderingList($this->
getId())
321 ->withQuestionId($clone->getId());
322 $list->distributeNewRandomIdentifiers();
323 $clone->setOrderingElementList($list);
327 $clone->copyPageOfQuestion($sourceQuestionId);
329 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
331 $clone->duplicateImages($sourceQuestionId, $sourceParentId, $clone->getId(), $clone->getObjId());
333 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
338 public function duplicateImages($src_question_id, $src_object_id, $dest_question_id, $dest_object_id): void
341 $ilLog =
$DIC[
'ilLog'];
342 if ($this->isImageOrderingType()) {
343 $imagepath_original = $this->getImagePath($src_question_id, $src_object_id);
344 $imagepath = $this->getImagePath($dest_question_id, $dest_object_id);
346 if (!file_exists($imagepath)) {
349 foreach ($this->getOrderingElementList() as $element) {
356 if (!file_exists($imagepath_original .
$filename)
358 $ilLog->write(
"image could not be duplicated!!!!");
359 $ilLog->write($imagepath_original .
$filename);
362 if (file_exists($imagepath_original . $this->getThumbPrefix() .
$filename)
363 && !copy($imagepath_original . $this->getThumbPrefix() .
$filename, $imagepath . $this->getThumbPrefix() .
$filename)) {
364 $ilLog->write(
"image thumbnail could not be duplicated!!!!");
375 public function copyImages($question_id, $source_questionpool): void
378 $ilLog =
$DIC[
'ilLog'];
380 $imagepath = $this->getImagePath();
381 $imagepath_original = str_replace(
"/$this->id/images",
"/$question_id/images", $imagepath);
382 $imagepath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $imagepath_original);
383 if (!file_exists($imagepath)) {
386 foreach ($this->getOrderingElementList() as $element) {
389 $ilLog->write(
"Ordering Question image could not be copied: ${imagepath_original}${filename}");
391 if (@file_exists($imagepath_original . $this->getThumbPrefix() .
$filename)) {
392 if (!@copy($imagepath_original . $this->getThumbPrefix() .
$filename, $imagepath . $this->getThumbPrefix() .
$filename)) {
393 $ilLog->write(
"Ordering Question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() .
$filename);
412 if (!in_array($ordering_type, $this->getValidOrderingTypes())) {
413 throw new \InvalidArgumentException(
'Must be valid ordering type.');
415 $this->ordering_type = $ordering_type;
420 return $this->ordering_type;
429 return in_array($this->getOrderingType(), $nested);
438 return in_array($this->getOrderingType(), $with_images);
444 self::OQ_CT_PICTURES,
447 throw new \InvalidArgumentException(
"use OQ content-type", 1);
449 if ($ct == self::OQ_CT_PICTURES) {
450 if ($this->isOrderingTypeNested()) {
455 $this->setThumbSize($this->getThumbSize());
457 if ($ct == self::OQ_CT_TERMS) {
458 if ($this->isOrderingTypeNested()) {
469 if ($this->isImageOrderingType()) {
475 if ($this->isImageOrderingType()) {
485 return $this->isImageOrderingType();
496 if ($forceCorrectSolution || !$activeId || $passIndex ===
null) {
497 return $this->getOrderingElementList();
500 $solutionValues = $this->getSolutionValues($activeId, $passIndex);
502 if (!count($solutionValues)) {
503 return $this->getShuffledOrderingElementList();
506 return $this->getSolutionOrderingElementList($this->fetchIndexedValuesFromValuePairs($solutionValues));
521 return $this->fetchSolutionListFromFormSubmissionData($lastPost);
523 $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs(
525 $this->getTestOutputSolutions($activeId, $pass)
529 if (count($indexedSolutionValues)) {
530 return $this->getSolutionOrderingElementList($indexedSolutionValues);
533 return $this->getShuffledOrderingElementList();
542 $value2 = explode(
':', $value2);
544 $randomIdentifier = $value2[0];
545 $selectedPosition = $value1;
546 $selectedIndentation = $value2[1];
548 $element = $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)->getClone();
550 $element->setPosition($selectedPosition);
551 $element->setIndentation($selectedIndentation);
562 $solutionIdentifier = $value1;
563 $selectedPosition = ($value2 - 1);
564 $selectedIndentation = 0;
566 $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($solutionIdentifier)->
getClone();
568 $element->setPosition($selectedPosition);
569 $element->setIndentation($selectedIndentation);
582 $solutionOrderingList->setQuestionId($this->
getId());
584 foreach ($indexedSolutionValues as $value1 => $value2) {
585 if ($this->isOrderingTypeNested()) {
586 $element = $this->getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2);
588 $element = $this->getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2);
591 $solutionOrderingList->addElement($element);
594 if (!$this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($solutionOrderingList)) {
598 return $solutionOrderingList;
603 $shuffledRandomIdentifierIndex = $this->getShuffler()->transform(
604 $this->getOrderingElementList()->getRandomIdentifierIndex()
607 $shuffledElementList = $this->getOrderingElementList()->
getClone();
608 $shuffledElementList->reorderByRandomIdentifiers($shuffledRandomIdentifierIndex);
609 $shuffledElementList->resetElementsIndentations();
611 return $shuffledElementList;
616 return $this->getRepository()->getOrderingList($this->
getId());
624 foreach ($elements as
$e) {
628 $this->getRepository()->updateOrderingList($list);
639 if (!$this->getOrderingElementList()->elementExistByPosition(
$index)) {
643 return $this->getOrderingElementList()->getElementByPosition(
$index);
656 $this->getOrderingElementList()->removeElement(
657 $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)
659 $this->getOrderingElementList()->saveToDb();
664 return $this->getOrderingElementList()->countElements();
679 if ($returndetails) {
680 throw new ilTestException(
'return details not implemented for ' . __METHOD__);
683 if (is_null($pass)) {
684 $pass = $this->getSolutionMaxPass($active_id);
687 $solutionValuePairs = $this->getSolutionValues($active_id, $pass, $authorizedSolution);
689 if (!count($solutionValuePairs)) {
693 $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs($solutionValuePairs);
694 $solutionOrderingElementList = $this->getSolutionOrderingElementList($indexedSolutionValues);
696 return $this->calculateReachedPointsForSolution($solutionOrderingElementList);
705 $solutionOrderingElementList = unserialize(
707 [
"allowed_classes" =>
true]
710 $reachedPoints = $this->calculateReachedPointsForSolution($solutionOrderingElementList);
711 $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
713 return $this->ensureNonNegativePoints($reachedPoints);
722 return $this->getPoints();
736 if (preg_match(
"/.*\\.(\\w+)$/",
$filename, $matches)) {
737 $extension = $matches[1];
739 return md5(
$filename) .
"." . $extension;
745 if (@file_exists($this->getImagePath())) {
747 foreach ($contents as
$f) {
748 if (strcmp(
$f[
'type'],
'file') == 0) {
750 foreach ($this->getOrderingElementList() as $orderElement) {
751 if (strcmp(
$f[
'entry'], $orderElement->getContent()) == 0) {
754 if (strcmp(
$f[
'entry'], $this->getThumbPrefix() . $orderElement->getContent()) == 0) {
759 if (@file_exists($this->getImagePath() .
$f[
'entry'])) {
760 @unlink($this->getImagePath() .
$f[
'entry']);
767 if (@file_exists($this->getImagePath())) {
779 if (!strlen($imageFilename)) {
783 $result = @unlink($this->getImagePath() . $imageFilename);
784 $result = $result && @unlink($this->getImagePath() . $this->getThumbPrefix() . $imageFilename);
791 if (!strlen($imageFilename)) {
795 if (!file_exists($this->getImagePath() . $imageFilename)) {
799 return is_file($this->getImagePath() . $imageFilename);
804 if (!$this->hasOrderingTypeUploadSupport()) {
815 public function storeImageFile(
string $upload_file,
string $upload_name): ?string
817 $name_parts = explode(
".", $upload_name);
818 $suffix = strtolower(array_pop($name_parts));
819 if (!in_array($suffix, self::VALID_UPLOAD_SUFFIXES)) {
823 $this->ensureImagePathExists();
824 $target_filename = $this->buildHashedImageFilename($upload_name,
true);
825 $target_filepath = $this->getImagePath() . $target_filename;
827 $thumb_path = $this->getImagePath() . $this->getThumbPrefix() . $target_filename;
830 return $target_filename;
838 $existing_image_path = $this->getImagePath() . $existing_image_name;
839 $target_filename = $this->buildHashedImageFilename($existing_image_name,
true);
840 $target_filepath = $this->getImagePath() . $target_filename;
842 unlink($this->getImagePath() . $this->getThumbPrefix() . $existing_image_name);
843 $thumb_path = $this->getImagePath() . $this->getThumbPrefix() . $target_filename;
846 return $target_filename;
849 return $existing_image_name;
854 $submittedSolutionList = $this->getSolutionListFromPostSubmit();
856 if (!$submittedSolutionList->hasElements()) {
860 return $this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($submittedSolutionList);
874 if (
$DIC->testQuestionPool()->internal()->request()->raw(
'test_answer_changed') ===
null) {
880 if (is_null($pass)) {
884 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(
885 function () use (&$entered_values, $active_id, $pass, $authorized) {
886 $this->removeCurrentSolution($active_id, $pass, $authorized);
888 foreach ($this->getSolutionListFromPostSubmit() as $orderingElement) {
889 $value1 = $orderingElement->getStorageValue1($this->getOrderingType());
890 $value2 = $orderingElement->getStorageValue2($this->getOrderingType());
892 $this->saveCurrentSolution($active_id, $pass, $value1, trim($value2), $authorized);
899 if ($entered_values) {
900 $this->log($active_id,
'log_user_entered_values');
902 $this->log($active_id,
'log_user_not_entered_values');
910 if ($this->validateSolutionSubmit()) {
915 public function saveAdditionalQuestionDataToDb()
923 "DELETE FROM " . $this->getAdditionalTableName() .
" WHERE question_fi = %s",
929 "INSERT INTO " . $this->getAdditionalTableName() .
" (question_fi, ordering_type, thumb_geometry, element_height)
930 VALUES (%s, %s, %s, %s)",
931 [
"integer",
"text",
"integer",
"integer"],
934 $this->ordering_type,
935 $this->getThumbSize(),
936 ($this->getElementHeight() > 20) ? $this->getElementHeight() :
null
945 return new \ILIAS\TA\Questions\Ordering\assOrderingQuestionDatabaseRepository(
$ilDB);
954 return "assOrderingQuestion";
959 return "qpl_qst_ordering";
970 return "qpl_a_ordering";
979 $text = parent::getRTETextWithMediaObjects();
981 foreach ($this->getOrderingElementList() as $orderingElement) {
982 $text .= $orderingElement->getContent();
994 return $this->getOrderingElementList()->getRandomIdentifierIndexedElements();
1018 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1020 $solutions = $this->getSolutionValues($active_id, $pass);
1022 foreach ($solutions as $solution) {
1023 $sol[$solution[
"value1"]] = $solution[
"value2"];
1026 $sol = array_keys($sol);
1029 foreach ($sol as $idx) {
1030 foreach ($solutions as $solution) {
1031 if ($solution[
"value1"] == $idx) {
1032 $worksheet->
setCell($startrow +
$i, 0, $solution[
"value2"]);
1036 $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($idx);
1037 $worksheet->
setCell($startrow +
$i, 2, $element->getContent());
1041 return $startrow +
$i + 1;
1046 return $this->element_height;
1051 $this->element_height = ($a_height < 20) ?
null : $a_height;
1059 if ($this->isImageOrderingType()) {
1060 foreach ($this->getOrderElements() as $orderingElement) {
1061 if ($orderingElement->getContent() !==
'') {
1062 $this->generateThumbForFile($this->getImagePath(), $orderingElement->getContent());
1077 $thumbpath =
$path . $this->getThumbPrefix() . $file;
1080 switch (strtoupper($path_info[
'extension'])) {
1100 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1102 $result[
'id'] = $this->
getId();
1103 $result[
'type'] = (string) $this->getQuestionType();
1104 $result[
'title'] = $this->getTitleForHTMLOutput();
1105 $result[
'question'] = $this->formatSAQuestion($this->getQuestion());
1106 $result[
'nr_of_tries'] = $this->getNrOfTries();
1107 $result[
'shuffle'] =
true;
1108 $result[
'points'] = $this->getPoints();
1109 $result[
'feedback'] = array(
1110 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
1111 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
1114 $result[
'path'] = $this->getImagePathWeb();
1119 foreach ($this->getOrderingElementList() as $orderingElement) {
1120 $answers[$counter] = $orderingElement->getContent();
1123 $answers = $this->getShuffler()->transform($answers);
1125 foreach ($answers as $order => $answer) {
1126 array_push($arr, array(
1127 "answertext" => (
string) $answer,
1128 "order" => (
int) $order
1131 $result[
'answers'] = $arr;
1134 $result[
'mobs'] =
$mobs;
1136 return json_encode($result);
1145 if ($this->isImageOrderingType()) {
1146 return $this->buildOrderingImagesInputGui();
1148 return $this->buildOrderingTextsInputGui();
1155 $formField->setInteractionEnabled(
true);
1156 $formField->setNestingEnabled($this->isOrderingTypeNested());
1163 $formField->setEditElementOccuranceEnabled(
true);
1164 $formField->setEditElementOrderEnabled(
true);
1170 $formField->
setInfo($this->
lng->txt(
'ordering_answer_sequence_info'));
1176 $formDataConverter = $this->buildOrderingTextsFormDataConverter();
1180 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1183 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1185 return $orderingElementInput;
1190 $formDataConverter = $this->buildOrderingImagesFormDataConverter();
1194 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1197 $orderingElementInput->setImageUploadCommand(self::ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG);
1198 $orderingElementInput->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1200 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1202 return $orderingElementInput;
1210 $formDataConverter = $this->buildNestedOrderingFormDataConverter();
1214 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1217 $orderingElementInput->setUniquePrefix($this->
getId());
1218 $orderingElementInput->setOrderingType($this->getOrderingType());
1219 $orderingElementInput->setElementImagePath($this->getImagePathWeb());
1220 $orderingElementInput->setThumbPrefix($this->getThumbPrefix());
1222 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1224 return $orderingElementInput;
1233 $orderingGUI = $this->buildNestedOrderingElementInputGui();
1235 $orderingGUI->setValueByArray($userSolutionPost);
1237 if (!$orderingGUI->checkInput()) {
1243 $storedElementList = $this->getOrderingElementList();
1245 foreach ($orderingGUI->getElementList($this->getId()) as $submittedElement) {
1246 $solutionElement = $storedElementList->getElementByRandomIdentifier(
1247 $submittedElement->getRandomIdentifier()
1250 $solutionElement->setPosition($submittedElement->getPosition());
1252 if ($this->isOrderingTypeNested()) {
1253 $solutionElement->setIndentation($submittedElement->getIndentation());
1256 $solutionOrderingElementList->addElement($solutionElement);
1259 return $solutionOrderingElementList;
1265 private $postSolutionOrderingElementList =
null;
1269 if ($this->postSolutionOrderingElementList ===
null) {
1273 $request =
$DIC->http()->request();
1276 $list = $this->fetchSolutionListFromFormSubmissionData(
$post_array);
1277 $this->postSolutionOrderingElementList = $list;
1280 return $this->postSolutionOrderingElementList;
1285 return $this->fetchSolutionSubmit($_POST);
1290 $reachedPoints = $this->getPoints();
1292 foreach ($this->getOrderingElementList() as $correctElement) {
1293 $userElement = $solutionOrderingElementList->
getElementByPosition($correctElement->getPosition());
1295 if (!$correctElement->isSameElement($userElement)) {
1301 return $reachedPoints;
1337 $maxStep = $this->lookupMaxStep($active_id, $pass);
1339 if ($maxStep !==
null) {
1341 "SELECT value1, value2 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s ORDER BY value1 ASC ",
1342 array(
"integer",
"integer",
"integer",
"integer"),
1343 array($active_id, $pass, $this->
getId(), $maxStep)
1347 "SELECT value1, value2 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s ORDER BY value1 ASC ",
1348 array(
"integer",
"integer",
"integer"),
1349 array($active_id, $pass, $this->
getId())
1353 $elements = array();
1355 $newKey = explode(
":", $row[
"value2"]);
1357 foreach ($this->getOrderingElementList() as $answer) {
1359 if (!$this->isOrderingTypeNested()) {
1360 if ($answer->getSolutionIdentifier() == $row[
"value1"]) {
1361 $elements[$row[
"value2"]] = $answer->getSolutionIdentifier() + 1;
1365 if ($answer->getRandomIdentifier() == $newKey[0]) {
1366 $elements[$row[
"value1"]] = $answer->getSolutionIdentifier() + 1;
1375 foreach (array_values($elements) as $element) {
1376 $result->addKeyValue($element, $element);
1379 $points = $this->calculateReachedPoints($active_id, $pass);
1380 $max_points = $this->getMaximumPoints();
1382 $result->setReachedPercentage(($points / $max_points) * 100);
1397 return $this->getOrderingElementList()->getElementByPosition(
$index);
1400 return $this->getOrderingElementList()->getElements();
1408 parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1409 $this->duplicateImages($dupQuestionId, $dupParentObjId, $origQuestionId, $origParentObjId);
1414 return parent::buildTestPresentationConfig()
1416 ->setUseUnchangedAnswerLabel($this->
lng->txt(
'tst_unchanged_order_is_correct'));
1421 if (!file_exists($this->getImagePath())) {
1428 $solutionSubmit = array();
1430 if (isset($formSubmissionDataStructure[
'orderresult'])) {
1431 $orderresult = $formSubmissionDataStructure[
'orderresult'];
1433 if (strlen($orderresult)) {
1434 $orderarray = explode(
":", $orderresult);
1436 foreach ($orderarray as
$index) {
1438 if (preg_match(
"/id_(\\d+)/",
$index, $idmatch)) {
1439 $randomid = $idmatch[1];
1440 foreach ($this->getOrderingElementList() as $answeridx => $answer) {
1441 if ($answer->getRandomIdentifier() == $randomid) {
1442 $solutionSubmit[$answeridx] = $ordervalue;
1451 foreach ($formSubmissionDataStructure[
'content'] as $randomId => $content) {
1452 $indentation = $formSubmissionDataStructure[
'indentation'];
1455 $value2 = implode(
':', array($randomId, $indentation));
1457 $solutionSubmit[$value1] = $value2;
1460 foreach ($formSubmissionDataStructure as
$key => $value) {
1462 if (preg_match(
"/^order_(\d+)/",
$key, $matches)) {
1463 if (!(preg_match(
"/initial_value_\d+/", $value))) {
1464 if (strlen($value)) {
1465 foreach ($this->getOrderingElementList() as $answeridx => $answer) {
1466 if ($answer->getRandomIdentifier() == $matches[1]) {
1467 $solutionSubmit[$answeridx] = $value;
1476 return $solutionSubmit;
1481 require_once
'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingFormValuesObjectsConverter.php';
1483 $converter->setPostVar(self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR);
1490 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1493 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1494 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1495 $formDataConverter->setImageFsPath($this->getImagePath());
1497 if ($this->getThumbPrefix()) {
1498 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1500 return $formDataConverter;
1505 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1507 return $formDataConverter;
1512 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1516 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1517 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1518 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1521 return $formDataConverter;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
repository for assOrderingQuestion (the answer elements within, at least...)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getOrderElements()
Returns the answers array.
const ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG
buildOrderingImagesFormDataConverter()
const ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG
getShuffledOrderingElementList()
getOperators($expression)
Get all available operations for a specific question.
getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2)
getAnswer($index=0)
Returns the ordering element from the given position.
getExpressionTypes()
Get all available expression types for a specific question.
duplicate(bool $for_test=true, ?string $title="", ?string $author="", ?string $owner="", $testObjId=null)
getQuestionType()
Returns the question type of the question.
copyImages($question_id, $source_questionpool)
initOrderingElementAuthoringProperties(ilFormPropertyGUI $formField)
const VALID_UPLOAD_SUFFIXES
getAnswerTableName()
Returns the name of the answer table in the database.
getSolutionOrderingElementList($indexedSolutionValues)
hasOrderingTypeUploadSupport()
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
buildNestedOrderingElementInputGui()
toJSON()
Returns a JSON representation of the question.
setOrderingType($ordering_type=self::OQ_TERMS)
fetchSolutionListFromFormSubmissionData($userSolutionPost)
dropImageFile($imageFilename)
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
setNestingType(bool $nesting)
isImageReplaced(ilAssOrderingElement $newElement, ilAssOrderingElement $oldElement)
isComplete()
Returns true, if a ordering question is complete for use.
saveToDb($original_id="")
Saves a assOrderingQuestion object to a database.
buildTestPresentationConfig()
build basic test question configuration instance
buildNestedOrderingFormDataConverter()
getOrderingElementListForSolutionOutput($forceCorrectSolution, $activeId, $passIndex)
fetchSolutionSubmit($formSubmissionDataStructure)
const ORDERING_ELEMENT_FORM_FIELD_POSTVAR
buildOrderingTextsInputGui()
savePreviewData(ilAssQuestionPreviewSession $previewSession)
const HAS_SPECIFIC_FEEDBACK
storeImageFile(string $upload_file, string $upload_name)
__construct( $title="", $comment="", $author="", $owner=-1, $question="", $ordering_type=self::OQ_TERMS)
assOrderingQuestion constructor
initOrderingElementFormFieldLabels(ilFormPropertyGUI $formField)
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2)
isImageFileStored($imageFilename)
getSolutionListFromPostSubmit()
buildOrderingTextsFormDataConverter()
buildOrderingElementFormDataConverter()
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
loadFromDb($question_id)
Loads a assOrderingQuestion object from a database.
getEncryptedFilename($filename)
setOrderingElementList(ilAssOrderingElementList $list)
duplicateImages($src_question_id, $src_object_id, $dest_question_id, $dest_object_id)
getSolutionOrderingElementListForTestOutput(ilAssNestedOrderingElementsInputGUI $inputGUI, $lastPost, $activeId, $pass)
afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
{}
deleteAnswer($randomIdentifier)
Deletes an answer with a given index.
calculateReachedPointsForSolution(ilAssOrderingElementList $solutionOrderingElementList)
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
buildOrderingImagesInputGui()
setExportDetailsXLS(ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $pass)
{}
supportsJavascriptOutput()
Returns true if the question type supports JavaScript output.
setElementHeight(?int $a_height)
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
copyObject($target_questionpool_id, $title="")
Copies an assOrderingQuestion object.
buildOrderingElementInputGui()
generateThumbForFile($path, $file)
updateImageFile(string $existing_image_name)
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
Abstract basic class which is to be extended by the concrete assessment question type classes.
setOriginalId(?int $original_id)
string $question
The question text.
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
setQuestion(string $question="")
static _getOriginalId(int $question_id)
saveQuestionDataToDb(int $original_id=-1)
setAuthor(string $author="")
setThumbSize(int $a_size)
setComment(string $comment="")
setNrOfTries(int $a_nr_of_tries)
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setTitle(string $title="")
static buildInstance(int $question_id, array $elements=[])
withQuestionId(int $question_id)
getElementByPosition($position)
withElements(array $elements)
ensureValidIdentifiers(ilAssOrderingElement $element)
static getDraftInstance()
static getInstance($identifier)
getParticipantsSolution()
setParticipantsSolution($participantSolution)
setBold(string $a_coords)
Set cell(s) to bold.
getColumnCoord(int $a_col)
Get column "name" from number.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static getDir(string $a_dir, bool $a_rec=false, ?string $a_sub_dir="")
get directory
static rename(string $a_source, string $a_target)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static getOperatorsByExpression($expression)
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static convertImage(string $a_from, string $a_to, string $a_target_format="", string $a_geometry="", string $a_background_color="")
convert image
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setIsUnchangedAnswerPossible($isUnchangedAnswerPossible)
Set if the saving of an unchanged answer is supported with an additional checkbox.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const OQ_PICTURES
Ordering question constants.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PercentageResultExpression
const OrderingResultExpression
const NumericResultExpression
const EmptyAnswerExpression
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.