ILIAS
release_5-2 Revision v5.2.25-18-g3f80b828510
◀ 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
{
17
protected
$exp_options
= null;
18
private
$source
= 0;
19
23
public
function
__construct
($a_ref_id)
24
{
25
parent::__construct();
26
$this->source = $a_ref_id;
27
$this->exp_options =
ilExportOptions::getInstance
();
28
29
}
30
36
public
function
write
()
37
{
38
$this->
xmlStartTag
(
'Items'
);
39
$this->
writeSubitems
($this->source);
40
$this->
xmlEndTag
(
'Items'
);
41
}
42
49
protected
function
writeSubitems
($a_ref_id)
50
{
51
global $tree;
52
53
// because of the co-page-stuff (incl. styles) we also need to process the container itself
54
if
($a_ref_id != $this->source)
55
{
56
$mode = $this->exp_options->getOptionByRefId($a_ref_id,
ilExportOptions::KEY_ITEM_MODE
);
57
if
($mode == NULL
or
$mode ==
ilExportOptions::EXPORT_OMIT
)
58
{
59
return
false
;
60
}
61
}
62
63
$obj_id =
ilObject::_lookupObjId
($a_ref_id);
64
65
include_once(
'./Services/Container/classes/class.ilContainerPage.php'
);
66
include_once(
'./Services/Container/classes/class.ilContainerStartObjectsPage.php'
);
67
include_once(
'./Services/Style/Content/classes/class.ilObjStyleSheet.php'
);
68
69
$this->
xmlStartTag
(
70
'Item'
,
71
array
(
72
'RefId'
=> $a_ref_id,
73
'Id'
=> $obj_id,
74
'Title'
=>
ilObject::_lookupTitle
($obj_id),
75
'Type'
=>
ilObject::_lookupType
($obj_id),
76
'Page'
=>
ilContainerPage::_exists
(
'cont'
, $obj_id),
77
'StartPage'
=>
ilContainerStartObjectsPage::_exists
(
'cstr'
, $obj_id),
78
'Style'
=>
ilObjStyleSheet::lookupObjectStyle
($obj_id)
79
)
80
);
81
82
$this->
writeCourseItemInformation
($a_ref_id);
83
84
foreach
($tree->getChilds($a_ref_id) as $node)
85
{
86
$this->
writeSubitems
($node[
'child'
]);
87
}
88
89
$this->
xmlEndTag
(
'Item'
);
90
return
true
;
91
}
92
93
100
protected
function
writeCourseItemInformation
($a_ref_id)
101
{
102
include_once
'./Services/Object/classes/class.ilObjectActivation.php'
;
103
$item =
ilObjectActivation::getItem
($a_ref_id);
104
105
$this->
xmlStartTag
(
106
'Timing'
,
107
array
(
108
'Type'
=> $item[
'timing_type'
],
109
'Visible'
=> $item[
'visible'
],
110
'Changeable'
=> $item[
'changeable'
],
111
)
112
);
113
if
($item[
'timing_start'
])
114
{
115
$tmp_date =
new
ilDateTime
($item[
'timing_start'
],
IL_CAL_UNIX
);
116
$this->
xmlElement
(
'Start'
,
array
(),$tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
117
}
118
if
($item[
'timing_end'
])
119
{
120
$tmp_date =
new
ilDateTime
($item[
'timing_end'
],
IL_CAL_UNIX
);
121
$this->
xmlElement
(
'End'
,
array
(),$tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
122
}
123
if
($item[
'suggestion_start'
])
124
{
125
$tmp_date =
new
ilDateTime
($item[
'suggestion_start'
],
IL_CAL_UNIX
);
126
$this->
xmlElement
(
'SuggestionStart'
,
array
(),$tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
127
}
128
if
($item[
'suggestion_end'
])
129
{
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
{
135
$tmp_date =
new
ilDateTime
($item[
'earliest_start'
],
IL_CAL_UNIX
);
136
$this->
xmlElement
(
'EarliestStart'
,
array
(),$tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
137
}
138
if
($item[
'latest_end'
])
139
{
140
$tmp_date =
new
ilDateTime
($item[
'latest_end'
],
IL_CAL_UNIX
);
141
$this->
xmlElement
(
'LatestEnd'
,
array
(),$tmp_date->get(
IL_CAL_DATETIME
,
''
,
ilTimeZone::UTC
));
142
}
143
144
$this->
xmlEndTag
(
'Timing'
);
145
146
}
147
152
protected
function
buildHeader
()
153
{
154
$this->
xmlSetDtdDef
(
"<!DOCTYPE Container PUBLIC \"-//ILIAS//DTD Container//EN\" \""
.ILIAS_HTTP_PATH.
"/xml/ilias_container_4_1.dtd\">"
);
155
$this->
xmlSetGenCmt
(
"Container object"
);
156
$this->
xmlHeader
();
157
158
return
true
;
159
}
160
161
162
}
163
?>
ilPageObject\_exists
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Definition:
class.ilPageObject.php:365
ilExportOptions\KEY_ITEM_MODE
const KEY_ITEM_MODE
Definition:
class.ilExportOptions.php:22
ilExportOptions\EXPORT_OMIT
const EXPORT_OMIT
Definition:
class.ilExportOptions.php:19
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
ilTimeZone\UTC
const UTC
Definition:
class.ilTimeZone.php:45
ilExportOptions\getInstance
static getInstance()
Get singelton instance.
Definition:
class.ilExportOptions.php:44
ilXmlWriter\xmlStartTag
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
Definition:
class.ilXmlWriter.php:332
ilObjectActivation\getItem
static getItem($a_ref_id)
Get item data.
Definition:
class.ilObjectActivation.php:310
ilContainerXmlWriter\writeSubitems
writeSubitems($a_ref_id)
Write tree childs Recursive method.
Definition:
class.ilContainerXmlWriter.php:49
ilXmlWriter
XML writer class.
Definition:
class.ilXmlWriter.php:17
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:423
ilObject\_lookupTitle
static _lookupTitle($a_id)
lookup object title
Definition:
class.ilObject.php:924
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:3774
ilXmlWriter\xmlEndTag
xmlEndTag($tag)
Writes an endtag.
Definition:
class.ilXmlWriter.php:375
ilContainerXmlWriter\writeCourseItemInformation
writeCourseItemInformation($a_ref_id)
Write course item information Starting time, ending time...
Definition:
class.ilContainerXmlWriter.php:100
ilObject\_lookupObjId
static _lookupObjId($a_id)
Definition:
class.ilObject.php:1021
ilContainerXmlWriter\$source
$source
Definition:
class.ilContainerXmlWriter.php:18
ilDateTime
Date and time handling
Definition:
class.ilDateTime.php:32
ilXmlWriter\xmlHeader
xmlHeader()
Writes xml header public.
Definition:
class.ilXmlWriter.php:297
ilContainerXmlWriter\write
write()
Write XML.
Definition:
class.ilContainerXmlWriter.php:36
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:1176
ilContainerXmlWriter\$exp_options
$exp_options
Definition:
class.ilContainerXmlWriter.php:17
ilContainerXmlWriter\__construct
__construct($a_ref_id)
Constructor.
Definition:
class.ilContainerXmlWriter.php:23
ilContainerXmlWriter
XML writer for container structure.
Definition:
class.ilContainerXmlWriter.php:15
php
or
ilContainerXmlWriter\buildHeader
buildHeader()
Build XML header.
Definition:
class.ilContainerXmlWriter.php:152
Services
Container
classes
class.ilContainerXmlWriter.php
Generated on Fri Feb 21 2025 19:01:10 for ILIAS by
1.8.13 (using
Doxyfile
)