ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilGroupXMLWriter Class Reference

XML writer class. More...

+ Inheritance diagram for ilGroupXMLWriter:
+ Collaboration diagram for ilGroupXMLWriter:

Public Member Functions

 __construct ($group_obj)
 constructor More...
 
 setMode ($a_mode)
 
 getMode ()
 
 start ()
 
 getXML ()
 
 __buildHeader ()
 
 __buildGroup ()
 Group start. More...
 
 __buildTitleDescription ()
 
 __buildRegistration ()
 
 __buildExtraSettings ()
 Build extra settings, like "show member list". More...
 
 __buildAdmin ()
 
 __buildMember ()
 
 __buildFooter ()
 
 setAttachUsers ($value)
 
- Public Member Functions inherited from ilXmlWriter
 __construct ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor More...
 
 _ilXmlWriter ()
 destructor @access public More...
 
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition. More...
 
 xmlSetStSheet ($stSheet)
 Sets stylesheet. More...
 
 xmlSetGenCmt ($genCmt)
 Sets generated comment. More...
 
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding. More...
 
 xmlFormatData ($data)
 Indents text for better reading. More...
 
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly. More...
 
 xmlHeader ()
 Writes xml header @access public. More...
 
 xmlStartTag ($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
 Writes a starttag. More...
 
 xmlEndTag ($tag)
 Writes an endtag. More...
 
 xmlComment ($comment)
 Writes a comment. More...
 
 xmlData ($data, $encode=true, $escape=true)
 Writes data. More...
 
 xmlElement ($tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile ($file, $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem ($format=true)
 Returns xml document from memory. More...
 
 appendXML ($a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr @access public More...
 

Data Fields

const MODE_SOAP = 1
 
const MODE_EXPORT = 2
 
- Data Fields inherited from ilXmlWriter
 $xmlStr
 
 $version
 
 $outEnc
 
 $inEnc
 
 $dtdDef = ""
 
 $stSheet = ""
 
 $genCmt = "Generated by ILIAS XmlWriter"
 

Protected Member Functions

 __buildMetaData ()
 write lom meta data More...
 
 __buildPeriod ()
 Build group period. More...
 

Private Member Functions

 __buildAdvancedMetaData ()
 Build advanced meta data. More...
 

Private Attributes

 $mode = self::MODE_SOAP
 
 $ilias
 
 $xml
 
 $group_obj
 
 $attach_users = true
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlWriter
static _xmlEscapeData ($data)
 Escapes reserved characters. More...
 

Detailed Description

XML writer class.

Class for writing xml export versions of courses

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilGroupXMLWriter.php 16108 2008-02-28 17:36:41Z rkuester

Definition at line 36 of file class.ilGroupXMLWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilGroupXMLWriter::__construct (   $group_obj)

constructor

Parameters
stringxml version
stringoutput encoding
stringinput encoding @access public

Definition at line 57 of file class.ilGroupXMLWriter.php.

58 {
59 global $DIC;
60
61 $ilias = $DIC['ilias'];
62
63 parent::__construct();
64
65 $this->EXPORT_VERSION = "3";
66
67 $this->ilias = $ilias;
68 $this->group_obj = $group_obj;
69 $this->participants = ilGroupParticipants::_getInstanceByObjId($this->group_obj->getId());
70 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
redirection script todo: (a better solution should control the processing via a xml file)
global $DIC
Definition: saml.php:7

References $DIC, $group_obj, $ilias, and ilGroupParticipants\_getInstanceByObjId().

+ Here is the call graph for this function:

Member Function Documentation

◆ __buildAdmin()

ilGroupXMLWriter::__buildAdmin ( )

Definition at line 268 of file class.ilGroupXMLWriter.php.

269 {
270 $admins = $this->group_obj->getGroupAdminIds();
271 $admins = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
272 'manage_members',
274 $this->group_obj->getRefId(),
275 $admins
276 );
277
278 foreach ($admins as $id) {
279 $attr['id'] = 'il_' . $this->ilias->getSetting('inst_id') . '_usr_' . $id;
280 $attr['notification'] = $this->participants->isNotificationEnabled($id) ? 'Yes' : 'No';
281
282 $this->xmlElement('admin', $attr);
283 }
284 return true;
285 }
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
if(!array_key_exists('StateId', $_REQUEST)) $id
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

References $GLOBALS, $id, ilOrgUnitOperation\OP_MANAGE_MEMBERS, and ilXmlWriter\xmlElement().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildAdvancedMetaData()

ilGroupXMLWriter::__buildAdvancedMetaData ( )
private

Build advanced meta data.

@access private

Definition at line 173 of file class.ilGroupXMLWriter.php.

174 {
175 ilAdvancedMDValues::_appendXMLByObjId($this, $this->group_obj->getId());
176 }
static _appendXMLByObjId(ilXmlWriter $a_xml_writer, $a_obj_id)
Get xml of object values.

References ilAdvancedMDValues\_appendXMLByObjId().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildExtraSettings()

ilGroupXMLWriter::__buildExtraSettings ( )

Build extra settings, like "show member list".

Definition at line 263 of file class.ilGroupXMLWriter.php.

264 {
265 $this->xmlElement('showMembers', null, $this->group_obj->getShowMembers());
266 }

References ilXmlWriter\xmlElement().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildFooter()

ilGroupXMLWriter::__buildFooter ( )

Definition at line 306 of file class.ilGroupXMLWriter.php.

307 {
308 $this->xmlEndTag('group');
309 }
xmlEndTag($tag)
Writes an endtag.

References ilXmlWriter\xmlEndTag().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildGroup()

ilGroupXMLWriter::__buildGroup ( )

Group start.

Returns

Definition at line 135 of file class.ilGroupXMLWriter.php.

136 {
137 $attrs["exportVersion"] = $this->EXPORT_VERSION;
138 $attrs["id"] = "il_" . $this->ilias->getSetting('inst_id') . '_grp_' . $this->group_obj->getId();
139
140 switch ($this->group_obj->readGroupStatus()) {
141 case GRP_TYPE_PUBLIC:
142 $attrs['type'] = 'open';
143 break;
144
145 case GRP_TYPE_CLOSED:
146 default:
147 $attrs['type'] = 'closed';
148 break;
149 }
150
151 $this->xmlStartTag("group", $attrs);
152 }
const GRP_TYPE_CLOSED
const GRP_TYPE_PUBLIC
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.

References GRP_TYPE_CLOSED, GRP_TYPE_PUBLIC, and ilXmlWriter\xmlStartTag().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildHeader()

ilGroupXMLWriter::__buildHeader ( )

Definition at line 121 of file class.ilGroupXMLWriter.php.

122 {
123 $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_group_3_10.dtd\">");
124 $this->xmlSetGenCmt("Export of ILIAS group " . $this->group_obj->getId() . " of installation " . $this->ilias->getSetting('inst_id') . ".");
125 $this->xmlHeader();
126
127
128 return true;
129 }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlHeader()
Writes xml header @access public.
xmlSetDtdDef($dtdDef)
Sets dtd definition.

References ilXmlWriter\xmlHeader(), ilXmlWriter\xmlSetDtdDef(), and ilXmlWriter\xmlSetGenCmt().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildMember()

ilGroupXMLWriter::__buildMember ( )

Definition at line 287 of file class.ilGroupXMLWriter.php.

288 {
289 $members = $this->group_obj->getGroupMemberIds();
290 $members = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
291 'manage_members',
293 $this->group_obj->getRefId(),
294 $members
295 );
296 foreach ($members as $id) {
297 if (!$this->group_obj->isAdmin($id)) {
298 $attr['id'] = 'il_' . $this->ilias->getSetting('inst_id') . '_usr_' . $id;
299
300 $this->xmlElement('member', $attr);
301 }
302 }
303 return true;
304 }

References $GLOBALS, $id, ilOrgUnitOperation\OP_MANAGE_MEMBERS, and ilXmlWriter\xmlElement().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildMetaData()

ilGroupXMLWriter::__buildMetaData ( )
protected

write lom meta data

Returns
bool

Definition at line 158 of file class.ilGroupXMLWriter.php.

159 {
160 $md2xml = new ilMD2XML($this->group_obj->getId(), $this->group_obj->getId(), 'grp');
161 $md2xml->startExport();
162 $this->appendXML($md2xml->getXML());
163
164 return true;
165 }
appendXML($a_str)
append xml string to document

References ilXmlWriter\appendXML().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildPeriod()

ilGroupXMLWriter::__buildPeriod ( )
protected

Build group period.

Definition at line 196 of file class.ilGroupXMLWriter.php.

197 {
198 if (
199 $this->group_obj->getStart() instanceof ilDate &&
200 $this->group_obj->getEnd() instanceof ilDate
201 ) {
202 $this->xmlStartTag('period');
203 $this->xmlElement('start', null, $this->group_obj->getStart()->get(IL_CAL_UNIX));
204 $this->xmlElement('end', null, $this->group_obj->getEnd()->get(IL_CAL_UNIX));
205 $this->xmlEndTag('period');
206 }
207 return;
208 }
const IL_CAL_UNIX
Class for single dates.

References IL_CAL_UNIX, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildRegistration()

ilGroupXMLWriter::__buildRegistration ( )

Definition at line 210 of file class.ilGroupXMLWriter.php.

211 {
212
213 // registration type
214 switch ($this->group_obj->getRegistrationType()) {
216 $attrs['type'] = 'direct';
217 break;
219 $attrs['type'] = 'confirmation';
220 break;
222 $attrs['type'] = 'password';
223 break;
224
225 default:
227 $attrs['type'] = 'disabled';
228 break;
229 }
230 $attrs['waitingList'] = $this->group_obj->isWaitingListEnabled() ? 'Yes' : 'No';
231
232 $this->xmlStartTag('registration', $attrs);
233
234 if (strlen($pwd = $this->group_obj->getPassword())) {
235 $this->xmlElement('password', null, $pwd);
236 }
237
238
239 // limited registration period
240 if (!$this->group_obj->isRegistrationUnlimited()) {
241 $this->xmlStartTag('temporarilyAvailable');
242 $this->xmlElement('start', null, $this->group_obj->getRegistrationStart()->get(IL_CAL_UNIX));
243 $this->xmlElement('end', null, $this->group_obj->getRegistrationEnd()->get(IL_CAL_UNIX));
244 $this->xmlEndTag('temporarilyAvailable');
245 }
246
247 // max members
248 $attrs = array();
249 $attrs['enabled'] = $this->group_obj->isMembershipLimited() ? 'Yes' : 'No';
250 $this->xmlElement('maxMembers', $attrs, $this->group_obj->getMaxMembers());
251 $this->xmlElement('minMembers', null, (int) $this->group_obj->getMinMembers());
252 $this->xmlElement('WaitingListAutoFill', null, (int) $this->group_obj->hasWaitingListAutoFill());
253 $this->xmlElement('CancellationEnd', null, ($this->group_obj->getCancellationEnd() && !$this->group_obj->getCancellationEnd()->isNull()) ? $this->group_obj->getCancellationEnd()->get(IL_CAL_UNIX) : null);
254
255 $this->xmlElement('mailMembersType', null, (string) $this->group_obj->getMailToMembersType());
256
257 $this->xmlEndTag('registration');
258 }
const GRP_REGISTRATION_DIRECT
const GRP_REGISTRATION_PASSWORD
const GRP_REGISTRATION_DEACTIVATED
const GRP_REGISTRATION_REQUEST

References GRP_REGISTRATION_DEACTIVATED, GRP_REGISTRATION_DIRECT, GRP_REGISTRATION_PASSWORD, GRP_REGISTRATION_REQUEST, IL_CAL_UNIX, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildTitleDescription()

ilGroupXMLWriter::__buildTitleDescription ( )

Definition at line 179 of file class.ilGroupXMLWriter.php.

180 {
181 $this->xmlElement('title', null, $this->group_obj->getTitle());
182
183 if ($desc = $this->group_obj->getDescription()) {
184 $this->xmlElement('description', null, $desc);
185 }
186
187 $attr['id'] = 'il_' . $this->ilias->getSetting('inst_id') . '_usr_' . $this->group_obj->getOwner();
188 $this->xmlElement('owner', $attr);
189
190 $this->xmlElement('information', null, $this->group_obj->getInformation());
191 }

References ilXmlWriter\xmlElement().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMode()

ilGroupXMLWriter::getMode ( )

Definition at line 77 of file class.ilGroupXMLWriter.php.

References $mode.

Referenced by start().

+ Here is the caller graph for this function:

◆ getXML()

ilGroupXMLWriter::getXML ( )

Definition at line 115 of file class.ilGroupXMLWriter.php.

116 {
117 return $this->xmlDumpMem(false);
118 }
xmlDumpMem($format=true)
Returns xml document from memory.

References ilXmlWriter\xmlDumpMem().

+ Here is the call graph for this function:

◆ setAttachUsers()

ilGroupXMLWriter::setAttachUsers (   $value)

Definition at line 311 of file class.ilGroupXMLWriter.php.

312 {
313 $this->attach_users = $value ? true : false;
314 }

◆ setMode()

ilGroupXMLWriter::setMode (   $a_mode)

Definition at line 72 of file class.ilGroupXMLWriter.php.

73 {
74 $this->mode = $a_mode;
75 }

◆ start()

ilGroupXMLWriter::start ( )

Definition at line 82 of file class.ilGroupXMLWriter.php.

83 {
84 if ($this->getMode() == self::MODE_SOAP) {
85 $this->__buildHeader();
86 $this->__buildGroup();
87 $this->__buildMetaData();
90 $this->__buildRegistration();
91 $this->__buildExtraSettings();
92 if ($this->attach_users) {
93 $this->__buildAdmin();
94 $this->__buildMember();
95 }
96 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
98 ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
99 $this->__buildFooter();
100 } elseif ($this->getMode() == self::MODE_EXPORT) {
101 $this->__buildGroup();
102 $this->__buildMetaData();
105 $this->__buildRegistration();
106 $this->__buildExtraSettings();
107 $this->__buildPeriod();
108 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
109 ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId());
110 ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
111 $this->__buildFooter();
112 }
113 }
static _exportContainerSortingSettings(ilXmlWriter $xml, $obj_id)
sorting XML-export for all container objects
static _exportContainerSettings(ilXmlWriter $a_xml, $a_obj_id)
__buildExtraSettings()
Build extra settings, like "show member list".
__buildMetaData()
write lom meta data
__buildAdvancedMetaData()
Build advanced meta data.
__buildPeriod()
Build group period.

References __buildAdmin(), __buildAdvancedMetaData(), __buildExtraSettings(), __buildFooter(), __buildGroup(), __buildHeader(), __buildMember(), __buildMetaData(), __buildPeriod(), __buildRegistration(), __buildTitleDescription(), ilContainer\_exportContainerSettings(), ilContainerSortingSettings\_exportContainerSortingSettings(), and getMode().

+ Here is the call graph for this function:

Field Documentation

◆ $attach_users

ilGroupXMLWriter::$attach_users = true
private

Definition at line 48 of file class.ilGroupXMLWriter.php.

◆ $group_obj

ilGroupXMLWriter::$group_obj
private

Definition at line 47 of file class.ilGroupXMLWriter.php.

Referenced by __construct().

◆ $ilias

ilGroupXMLWriter::$ilias
private

Definition at line 44 of file class.ilGroupXMLWriter.php.

Referenced by __construct().

◆ $mode

ilGroupXMLWriter::$mode = self::MODE_SOAP
private

Definition at line 41 of file class.ilGroupXMLWriter.php.

Referenced by getMode().

◆ $xml

ilGroupXMLWriter::$xml
private

Definition at line 46 of file class.ilGroupXMLWriter.php.

◆ MODE_EXPORT

const ilGroupXMLWriter::MODE_EXPORT = 2

Definition at line 39 of file class.ilGroupXMLWriter.php.

Referenced by ilGroupExporter\getXmlRepresentation().

◆ MODE_SOAP

const ilGroupXMLWriter::MODE_SOAP = 1

Definition at line 38 of file class.ilGroupXMLWriter.php.


The documentation for this class was generated from the following file: