ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 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 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 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

 __buildPeriod ()
 Build group period. 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 public

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

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

58  {
59  global $ilias;
60 
61  parent::__construct();
62 
63  $this->EXPORT_VERSION = "3";
64 
65  $this->ilias =&$ilias;
66  $this->group_obj =&$group_obj;
67  $this->participants = ilGroupParticipants::_getInstanceByObjId($this->group_obj->getId());
68  }
redirection script todo: (a better solution should control the processing via a xml file) ...
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildAdmin()

ilGroupXMLWriter::__buildAdmin ( )

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

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

Referenced by start().

238  {
239  $admins = $this->group_obj->getGroupAdminIds();
240  $admins = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
241  'manage_members',
243  $this->group_obj->getRefId(),
244  $admins
245  );
246 
247  foreach ($admins as $id) {
248  $attr['id'] = 'il_' . $this->ilias->getSetting('inst_id') . '_usr_' . $id;
249  $attr['notification'] = $this->participants->isNotificationEnabled($id) ? 'Yes' : 'No';
250 
251  $this->xmlElement('admin', $attr);
252  }
253  return true;
254  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!array_key_exists('StateId', $_REQUEST)) $id
redirection script todo: (a better solution should control the processing via a xml file) ...
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ 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 232 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlElement().

Referenced by start().

233  {
234  $this->xmlElement('showMembers', null, $this->group_obj->getShowMembers());
235  }
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildFooter()

ilGroupXMLWriter::__buildFooter ( )

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

References ilXmlWriter\xmlEndTag().

Referenced by start().

276  {
277  $this->xmlEndTag('group');
278  }
xmlEndTag($tag)
Writes an endtag.
+ 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 129 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

130  {
131  $attrs["exportVersion"] = $this->EXPORT_VERSION;
132  $attrs["id"] = "il_" . $this->ilias->getSetting('inst_id') . '_grp_' . $this->group_obj->getId();
133 
134  switch ($this->group_obj->readGroupStatus()) {
135  case GRP_TYPE_PUBLIC:
136  $attrs['type'] = 'open';
137  break;
138 
139  case GRP_TYPE_CLOSED:
140  default:
141  $attrs['type'] = 'closed';
142  break;
143  }
144 
145  $this->xmlStartTag("group", $attrs);
146  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
const GRP_TYPE_PUBLIC
const GRP_TYPE_CLOSED
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildHeader()

ilGroupXMLWriter::__buildHeader ( )

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

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

Referenced by start().

116  {
117  $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_group_3_10.dtd\">");
118  $this->xmlSetGenCmt("Export of ILIAS group " . $this->group_obj->getId() . " of installation " . $this->ilias->getSetting('inst_id') . ".");
119  $this->xmlHeader();
120 
121 
122  return true;
123  }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
redirection script todo: (a better solution should control the processing via a xml file) ...
xmlHeader()
Writes xml header public.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildMember()

ilGroupXMLWriter::__buildMember ( )

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

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

Referenced by start().

257  {
258  $members = $this->group_obj->getGroupMemberIds();
259  $members = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
260  'manage_members',
262  $this->group_obj->getRefId(),
263  $members
264  );
265  foreach ($members as $id) {
266  if (!$this->group_obj->isAdmin($id)) {
267  $attr['id'] = 'il_' . $this->ilias->getSetting('inst_id') . '_usr_' . $id;
268 
269  $this->xmlElement('member', $attr);
270  }
271  }
272  return true;
273  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!array_key_exists('StateId', $_REQUEST)) $id
redirection script todo: (a better solution should control the processing via a xml file) ...
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ 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 165 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

166  {
167  if (
168  $this->group_obj->getStart() instanceof ilDate &&
169  $this->group_obj->getEnd() instanceof ilDate
170  ) {
171  $this->xmlStartTag('period');
172  $this->xmlElement('start', null, $this->group_obj->getStart()->get(IL_CAL_UNIX));
173  $this->xmlElement('end', null, $this->group_obj->getEnd()->get(IL_CAL_UNIX));
174  $this->xmlEndTag('period');
175  }
176  return;
177  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
const IL_CAL_UNIX
xmlEndTag($tag)
Writes an endtag.
Class for single dates.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildRegistration()

ilGroupXMLWriter::__buildRegistration ( )

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

References array, 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().

180  {
181 
182  // registration type
183  switch ($this->group_obj->getRegistrationType()) {
185  $attrs['type'] = 'direct';
186  break;
188  $attrs['type'] = 'confirmation';
189  break;
191  $attrs['type'] = 'password';
192  break;
193 
194  default:
196  $attrs['type'] = 'disabled';
197  break;
198  }
199  $attrs['waitingList'] = $this->group_obj->isWaitingListEnabled() ? 'Yes' : 'No';
200 
201  $this->xmlStartTag('registration', $attrs);
202 
203  if (strlen($pwd = $this->group_obj->getPassword())) {
204  $this->xmlElement('password', null, $pwd);
205  }
206 
207 
208  // limited registration period
209  if (!$this->group_obj->isRegistrationUnlimited()) {
210  $this->xmlStartTag('temporarilyAvailable');
211  $this->xmlElement('start', null, $this->group_obj->getRegistrationStart()->get(IL_CAL_UNIX));
212  $this->xmlElement('end', null, $this->group_obj->getRegistrationEnd()->get(IL_CAL_UNIX));
213  $this->xmlEndTag('temporarilyAvailable');
214  }
215 
216  // max members
217  $attrs = array();
218  $attrs['enabled'] = $this->group_obj->isMembershipLimited() ? 'Yes' : 'No';
219  $this->xmlElement('maxMembers', $attrs, $this->group_obj->getMaxMembers());
220  $this->xmlElement('minMembers', null, (int) $this->group_obj->getMinMembers());
221  $this->xmlElement('WaitingListAutoFill', null, (int) $this->group_obj->hasWaitingListAutoFill());
222  $this->xmlElement('CancellationEnd', null, ($this->group_obj->getCancellationEnd() && !$this->group_obj->getCancellationEnd()->isNull()) ? $this->group_obj->getCancellationEnd()->get(IL_CAL_UNIX) : null);
223 
224  $this->xmlElement('mailMembersType', null, (string) $this->group_obj->getMailToMembersType());
225 
226  $this->xmlEndTag('registration');
227  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
const GRP_REGISTRATION_DEACTIVATED
const IL_CAL_UNIX
const GRP_REGISTRATION_PASSWORD
const GRP_REGISTRATION_REQUEST
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
const GRP_REGISTRATION_DIRECT
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildTitleDescription()

ilGroupXMLWriter::__buildTitleDescription ( )

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

References ilXmlWriter\xmlElement().

Referenced by start().

149  {
150  $this->xmlElement('title', null, $this->group_obj->getTitle());
151 
152  if ($desc = $this->group_obj->getDescription()) {
153  $this->xmlElement('description', null, $desc);
154  }
155 
156  $attr['id'] = 'il_' . $this->ilias->getSetting('inst_id') . '_usr_' . $this->group_obj->getOwner();
157  $this->xmlElement('owner', $attr);
158 
159  $this->xmlElement('information', null, $this->group_obj->getInformation());
160  }
redirection script todo: (a better solution should control the processing via a xml file) ...
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMode()

ilGroupXMLWriter::getMode ( )

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

References $mode.

Referenced by start().

76  {
77  return $this->mode;
78  }
+ Here is the caller graph for this function:

◆ getXML()

ilGroupXMLWriter::getXML ( )

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

References ilXmlWriter\xmlDumpMem().

110  {
111  return $this->xmlDumpMem(false);
112  }
xmlDumpMem($format=true)
Returns xml document from memory.
+ Here is the call graph for this function:

◆ setAttachUsers()

ilGroupXMLWriter::setAttachUsers (   $value)

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

281  {
282  $this->attach_users = $value ? true : false;
283  }

◆ setMode()

ilGroupXMLWriter::setMode (   $a_mode)

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

71  {
72  $this->mode = $a_mode;
73  }

◆ start()

ilGroupXMLWriter::start ( )

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

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

81  {
82  if ($this->getMode() == self::MODE_SOAP) {
83  $this->__buildHeader();
84  $this->__buildGroup();
85  $this->__buildTitleDescription();
86  $this->__buildRegistration();
87  $this->__buildExtraSettings();
88  if ($this->attach_users) {
89  $this->__buildAdmin();
90  $this->__buildMember();
91  }
92  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
93  ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId());
94  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
95  $this->__buildFooter();
96  } elseif ($this->getMode() == self::MODE_EXPORT) {
97  $this->__buildGroup();
98  $this->__buildTitleDescription();
99  $this->__buildRegistration();
100  $this->__buildExtraSettings();
101  $this->__buildPeriod();
102  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
103  ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId());
104  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
105  $this->__buildFooter();
106  }
107  }
static _exportContainerSettings(ilXmlWriter $a_xml, $a_obj_id)
__buildPeriod()
Build group period.
__buildExtraSettings()
Build extra settings, like "show member list".
static _exportContainerSortingSettings(ilXmlWriter $xml, $obj_id)
sorting XML-export for all container objects
+ 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: