ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilContainerXmlWriter.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
include_once
"./Services/Xml/classes/class.ilXmlWriter.php"
;
5
include_once
'./Services/Export/classes/class.ilExportOptions.php'
;
6
15
class
ilContainerXmlWriter
extends
ilXmlWriter
16
{
20
protected
$tree
;
21
22
protected
$exp_options
= null;
23
private
$source
= 0;
24
28
public
function
__construct
($a_ref_id)
29
{
30
global
$DIC
;
31
32
$this->tree = $DIC->repositoryTree();
33
parent::__construct();
34
$this->source = $a_ref_id;
35
$this->exp_options =
ilExportOptions::getInstance
();
36
}
37
43
public
function
write
()
44
{
45
$this->
xmlStartTag
(
'Items'
);
46
$this->
writeSubitems
($this->source);
47
$this->
xmlEndTag
(
'Items'
);
48
}
49
56
protected
function
writeSubitems
($a_ref_id)
57
{
58
$tree
=
$this->tree
;
59
60
// because of the co-page-stuff (incl. styles) we also need to process the container itself
61
if
($a_ref_id != $this->source) {
62
$mode = $this->exp_options->getOptionByRefId($a_ref_id,
ilExportOptions::KEY_ITEM_MODE
);
63
if
($mode == null or $mode ==
ilExportOptions::EXPORT_OMIT
) {
64
return
false
;
65
}
66
}
67
68
$obj_id =
ilObject::_lookupObjId
($a_ref_id);
69
70
include_once(
'./Services/Container/classes/class.ilContainerPage.php'
);
71
include_once(
'./Services/Container/classes/class.ilContainerStartObjectsPage.php'
);
72
include_once(
'./Services/Style/Content/classes/class.ilObjStyleSheet.php'
);
73
74
$this->
xmlStartTag
(
75
'Item'
,
76
array
(
77
'RefId'
=> $a_ref_id,
78
'Id'
=> $obj_id,
79
'Title'
=>
ilObject::_lookupTitle
($obj_id),
80
'Type'
=>
ilObject::_lookupType
($obj_id),
81
'Page'
=>
ilContainerPage::_exists
(
'cont'
, $obj_id),
82
'StartPage'
=>
ilContainerStartObjectsPage::_exists
(
'cstr'
, $obj_id),
83
'Style'
=>
ilObjStyleSheet::lookupObjectStyle
($obj_id)
84
)
85
);
86
87
$this->
writeCourseItemInformation
($a_ref_id);
88
89
foreach
(
$tree
->getChilds($a_ref_id) as $node) {
90
$this->
writeSubitems
($node[
'child'
]);
91
}
92
93
$this->
xmlEndTag
(
'Item'
);
94
return
true
;
95
}
96
97
104
protected
function
writeCourseItemInformation
($a_ref_id)
105
{
106
include_once
'./Services/Object/classes/class.ilObjectActivation.php'
;
107
$item =
ilObjectActivation::getItem
($a_ref_id);
108
109
$this->
xmlStartTag
(
110
'Timing'
,
111
array
(
112
'Type'
=> $item[
'timing_type'
],
113
'Visible'
=> $item[
'visible'
],
114
'Changeable'
=> $item[
'changeable'
],
115
)
116
);
117
if
($item[
'timing_start'
]) {
118
$tmp_date =
new
ilDateTime
($item[
'timing_start'
],
IL_CAL_UNIX
);
119
$this->
xmlElement
(
'Start'
,
array
(), $tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
120
}
121
if
($item[
'timing_end'
]) {
122
$tmp_date =
new
ilDateTime
($item[
'timing_end'
],
IL_CAL_UNIX
);
123
$this->
xmlElement
(
'End'
,
array
(), $tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
124
}
125
if
($item[
'suggestion_start'
]) {
126
$tmp_date =
new
ilDateTime
($item[
'suggestion_start'
],
IL_CAL_UNIX
);
127
$this->
xmlElement
(
'SuggestionStart'
,
array
(), $tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
128
}
129
if
($item[
'suggestion_end'
]) {
130
$tmp_date =
new
ilDateTime
($item[
'suggestion_end'
],
IL_CAL_UNIX
);
131
$this->
xmlElement
(
'SuggestionEnd'
,
array
(), $tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
132
}
133
if
($item[
'earliest_start'
]) {
134
$tmp_date =
new
ilDateTime
($item[
'earliest_start'
],
IL_CAL_UNIX
);
135
$this->
xmlElement
(
'EarliestStart'
,
array
(), $tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
136
}
137
if
($item[
'latest_end'
]) {
138
$tmp_date =
new
ilDateTime
($item[
'latest_end'
],
IL_CAL_UNIX
);
139
$this->
xmlElement
(
'LatestEnd'
,
array
(), $tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
140
}
141
142
$this->
xmlEndTag
(
'Timing'
);
143
}
144
149
protected
function
buildHeader
()
150
{
151
$this->
xmlSetDtdDef
(
"<!DOCTYPE Container PUBLIC \"-//ILIAS//DTD Container//EN\" \""
. ILIAS_HTTP_PATH .
"/xml/ilias_container_4_1.dtd\">"
);
152
$this->
xmlSetGenCmt
(
"Container object"
);
153
$this->
xmlHeader
();
154
155
return
true
;
156
}
157
}
ilPageObject\_exists
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Definition:
class.ilPageObject.php:409
ilExportOptions\KEY_ITEM_MODE
const KEY_ITEM_MODE
Definition:
class.ilExportOptions.php:22
ilXmlWriter\xmlStartTag
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
Definition:
class.ilXmlWriter.php:307
ilExportOptions\EXPORT_OMIT
const EXPORT_OMIT
Definition:
class.ilExportOptions.php:19
ilContainerXmlWriter\$tree
$tree
Definition:
class.ilContainerXmlWriter.php:20
ilXmlWriter\xmlSetGenCmt
xmlSetGenCmt($genCmt)
Sets generated comment.
Definition:
class.ilXmlWriter.php:121
IL_CAL_DATETIME
const IL_CAL_DATETIME
Definition:
class.ilDateTime.php:9
ilXmlWriter\xmlSetDtdDef
xmlSetDtdDef($dtdDef)
Sets dtd definition.
Definition:
class.ilXmlWriter.php:101
$DIC
global $DIC
Definition:
saml.php:7
ilTimeZone\UTC
const UTC
Definition:
class.ilTimeZone.php:45
ilExportOptions\getInstance
static getInstance()
Get singelton instance.
Definition:
class.ilExportOptions.php:44
ilObjectActivation\getItem
static getItem($a_ref_id)
Get item data.
Definition:
class.ilObjectActivation.php:324
ilContainerXmlWriter\writeSubitems
writeSubitems($a_ref_id)
Write tree childs Recursive method.
Definition:
class.ilContainerXmlWriter.php:56
ilXmlWriter
XML writer class.
Definition:
class.ilXmlWriter.php:17
ilObject\_lookupTitle
static _lookupTitle($a_id)
lookup object title
Definition:
class.ilObject.php:933
IL_CAL_UNIX
const IL_CAL_UNIX
Definition:
class.ilDateTime.php:11
ilObjStyleSheet\lookupObjectStyle
static lookupObjectStyle($a_obj_id)
Lookup object style.
Definition:
class.ilObjStyleSheet.php:3643
ilXmlWriter\xmlEndTag
xmlEndTag($tag)
Writes an endtag.
Definition:
class.ilXmlWriter.php:343
ilContainerXmlWriter\writeCourseItemInformation
writeCourseItemInformation($a_ref_id)
Write course item information Starting time, ending time...
Definition:
class.ilContainerXmlWriter.php:104
ilObject\_lookupObjId
static _lookupObjId($a_id)
Definition:
class.ilObject.php:1036
ilContainerXmlWriter\$source
$source
Definition:
class.ilContainerXmlWriter.php:23
ilDateTime
Date and time handling
Definition:
class.ilDateTime.php:32
ilXmlWriter\xmlHeader
xmlHeader()
Writes xml header public.
Definition:
class.ilXmlWriter.php:275
ilContainerXmlWriter\write
write()
Write XML.
Definition:
class.ilContainerXmlWriter.php:43
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
ilObject\_lookupType
static _lookupType($a_id, $a_reference=false)
lookup object type
Definition:
class.ilObject.php:1204
ilContainerXmlWriter\$exp_options
$exp_options
Definition:
class.ilContainerXmlWriter.php:22
ilXmlWriter\xmlElement
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
Definition:
class.ilXmlWriter.php:389
ilContainerXmlWriter\__construct
__construct($a_ref_id)
Constructor.
Definition:
class.ilContainerXmlWriter.php:28
ilContainerXmlWriter
XML writer for container structure.
Definition:
class.ilContainerXmlWriter.php:15
ilContainerXmlWriter\buildHeader
buildHeader()
Build XML header.
Definition:
class.ilContainerXmlWriter.php:149
Services
Container
classes
class.ilContainerXmlWriter.php
Generated on Sat Jan 18 2025 19:01:29 for ILIAS by
1.8.13 (using
Doxyfile
)