Skip to content

Commit b75baa9

Browse files
kevenClausenKPGKeven Clausen
andcommitted
Fixed Mantis #39962: Reihenfolge der Sortierung ist vertauscht bei Import (#10861)
* Bugfix Export Object Position * postion in export is required * change typing position --------- Co-authored-by: Keven Clausen <[email protected]>
1 parent 93ccc07 commit b75baa9

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

components/ILIAS/Export/xml/SchemaValidation/ilias_lso_9_0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
</xs:sequence>
4040
<xs:attribute name="obj_id" type="xs:string" use="required"/>
4141
<xs:attribute name="ref_id" type="xs:string" use="required"/>
42+
<xs:attribute name="position" type="xs:string" use="required"/>
4243
</xs:complexType>
4344

4445
<xs:complexType name="Condition">

components/ILIAS/LearningSequence/classes/Export/class.ilLearningSequenceXMLParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public function handleBeginTag(
105105
case Writer::TAG_LSITEM:
106106
$this->counter = (int)$attributes["ref_id"];
107107
$this->ls_item_data[$this->counter]["ref_id"] = $attributes["ref_id"];
108+
$this->ls_item_data[$this->counter]["position"] = $attributes["position"];
108109
break;
109110

110111
case Writer::TAG_CONDITION:

components/ILIAS/LearningSequence/classes/Export/class.ilLearningSequenceXMLWriter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ protected function writeLPSettings(): void
115115
protected function writeLSItems(): void
116116
{
117117
$this->xmlStartTag(self::TAG_LSITEMS);
118-
119118
$ls_items = $this->ls_object->getLSItems();
120119
foreach ($ls_items as $ls_item) {
121120
$post_condition = $ls_item->getPostCondition();
@@ -124,7 +123,8 @@ protected function writeLSItems(): void
124123
self::TAG_LSITEM,
125124
[
126125
'obj_id' => \ilObject::_lookupObjectId($ls_item->getRefId()),
127-
'ref_id' => $ls_item->getRefId()
126+
'ref_id' => $ls_item->getRefId(),
127+
'position' => $ls_item->getOrderNumber()
128128
]
129129
);
130130

components/ILIAS/LearningSequence/classes/class.ilLearningSequenceImporter.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,24 @@ protected function buildLSItems(array $ls_data, ilImportMapping $mapping): void
109109
$mapped[$new_ref_id] = $data;
110110
}
111111

112-
$ls_items = $this->obj->getLSItems($this->obj->getRefId());
112+
$ls_items = $this->obj->getLSItems();
113113
$updated = [];
114114
foreach ($ls_items as $item) {
115115
$item_ref_id = $item->getRefId();
116-
if(array_key_exists($item_ref_id, $mapped)) {
116+
if (array_key_exists($item_ref_id, $mapped)) {
117117
$item_data = $mapped[$item_ref_id];
118118
$post_condition = new ilLSPostCondition(
119119
$item_ref_id,
120120
$item_data["condition_type"],
121121
$item_data["condition_value"]
122122
);
123-
$updated[] = $item->withPostCondition($post_condition);
123+
$item = $item->withPostCondition($post_condition);
124+
$item = $item->withOrderNumber((int) $item_data["position"]);
125+
$updated[] = $item;
124126
}
125127
}
126128

127-
if($updated) {
129+
if ($updated) {
128130
$this->obj->storeLSItems($updated);
129131
}
130132
}

0 commit comments

Comments
 (0)