19declare(strict_types=1);
26 public const string TAG_LSO =
'LearningSequence';
49 $this->condition_factory = $ls_object->
getDI()[
"conditions.factory"];
68 "<!DOCTYPE learning sequence PUBLIC \"-//ILIAS//DTD LearningSequence//EN\" \"" .
69 ILIAS_HTTP_PATH .
"/xml/ilias_lso_11_0.dtd\">"
73 "Export of ILIAS LearningSequence " .
74 $this->ls_object->getId() .
76 $this->settings->get(
"inst_id") .
83 $boundaries = $this->ls_object->getDI()[
"db.boundaries"]
84 ->getBoundariesFor($this->ls_object->getId());
87 'ref_id' => $this->ls_object->getRefId(),
88 'members_gallery' => $this->ls_settings->getMembersGallery() ?
'true' :
'false',
89 'mode' => $this->ls_settings->getMode(),
90 'start_ref_id' => $boundaries[
'start_ref_id'],
91 'end_ref_id' => $boundaries[
'end_ref_id'],
95 $this->
xmlElement(self::TAG_TITLE,
null, $this->ls_object->getTitle());
96 if ($desc = $this->ls_object->getDescription()) {
97 $this->
xmlElement(self::TAG_DESCRIPTION,
null, $desc);
106 $type = $this->lp_settings->getObjType();
107 $mode = $this->lp_settings->getMode();
116 $this->ls_object->getId(),
119 if (!is_null($collection)) {
120 $items = $collection->getItems();
121 foreach ($items as $item) {
122 $this->
xmlElement(self::TAG_LPREFID,
null, $item);
131 $ls_items = $this->ls_object->getLSItems();
132 foreach ($ls_items as $ls_item) {
133 $post_condition = $ls_item->getPostCondition();
139 'ref_id' => $ls_item->getRefId(),
140 'position' => $ls_item->getOrderNumber()
146 [
'type' => $post_condition->getConditionOperator()],
147 $post_condition->getValue()
163 foreach ($conditions as $condition) {
165 'type' => $condition[
'type']
168 if (isset($condition[
'subtype'])) {
169 $attrs[
'subtype'] = (string) $condition[
'subtype'];
172 $this->
xmlStartTag(self::TAG_ITEM_CONDITION, $attrs);
174 $payload = $condition[
'data'] ?? [];
177 $this->
xmlEndTag(self::TAG_ITEM_CONDITION);
179 $this->
xmlEndTag(self::TAG_ITEM_CONDITIONS);
189 foreach ($payload as $table_data) {
190 $table_name = (string) ($table_data[
'table'] ??
'');
191 $this->
xmlStartTag(
'Table', [
'name' => $table_name]);
193 $fields = is_array($table_data[
'fields'] ??
null) ? $table_data[
'fields'] : [];
195 foreach ($fields as $field_name => $definition) {
196 $attrs = [
'name' => (string) $field_name];
197 if (is_array($definition)) {
198 foreach ($definition as $meta_key => $meta_value) {
199 $attrs[(string) $meta_key] = is_bool($meta_value)
200 ? ($meta_value ?
'1' :
'0')
201 : (
string) $meta_value;
208 $rows = is_array($table_data[
'rows'] ??
null) ? $table_data[
'rows'] : [];
210 foreach (
$rows as $row) {
212 if (is_array($row)) {
213 foreach ($row as $col => $value) {
216 [
'name' => (
string) $col],
217 $value ===
null ?
'' : (
string) $value
233 $all_conditions = [];
235 $condition_ids = $this->condition_factory->getConditionIdsForItem($ls_item->getRefId());
236 foreach ($condition_ids as $condition_id) {
238 $condition = $this->condition_factory->getConditionInstanceById($condition_id);
239 }
catch (\Throwable) {
244 'type' => $condition->getIdentifierForClass($condition::class),
250 $entry[
'subtype'] = $condition->getSubtype();
253 $entry[
'data'] = $condition->export();
254 $all_conditions[] = $entry;
257 return $all_conditions;
static _exportContainerSettings(ilXmlWriter $a_xml, int $a_obj_id)
static getInstanceByMode(int $a_obj_id, int $a_mode)
Settings for an LSO (like abstract, extro)
const string TAG_LPSETTING
const string TAG_ITEM_CONDITION
const string TAG_ITEM_CONDITIONS
const string TAG_MEMBERSGALLERY
writeConditionsXml($ls_item)
const string TAG_CONDITION
__construct(protected ilObjLearningSequence $ls_object, protected ilSetting $settings, protected ilLPObjSettings $lp_settings)
getConditionData($ls_item)
ilLearningSequenceSettings $ls_settings
const string TAG_CONTAINERSETTING
const string TAG_DESCRIPTION
writeConditionPayloadXml(array $payload)
ConditionFactory $condition_factory
static _lookupObjectId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.
xmlDumpMem(bool $format=true)
Returns xml document from memory.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc