ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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

 __buildMetaData ()
 write lom meta data More...
 
 __buildPeriod ()
 Add group period settings to xml. More...
 

Private Member Functions

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

Private Attributes

 $mode = self::MODE_SOAP
 
 $logger = null
 
 $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 67 of file class.ilGroupXMLWriter.php.

References $DIC, $group_obj, $ilias, ILIAS\GlobalScreen\Provider\__construct(), and ilGroupParticipants\_getInstanceByObjId().

68  {
69  global $DIC;
70 
71  $ilias = $DIC['ilias'];
72 
74 
75  $this->logger = $DIC->logger()->grp();
76 
77  $this->EXPORT_VERSION = "3";
78 
79  $this->ilias = $ilias;
80  $this->group_obj = $group_obj;
81  $this->participants = ilGroupParticipants::_getInstanceByObjId($this->group_obj->getId());
82  }
redirection script todo: (a better solution should control the processing via a xml file) ...
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildAdmin()

ilGroupXMLWriter::__buildAdmin ( )

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

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

Referenced by start().

301  {
302  $admins = $this->group_obj->getGroupAdminIds();
303  $admins = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
304  'manage_members',
306  $this->group_obj->getRefId(),
307  $admins
308  );
309 
310  foreach ($admins as $id) {
311  $attr['id'] = 'il_' . $this->ilias->getSetting('inst_id') . '_usr_' . $id;
312  $attr['notification'] = $this->participants->isNotificationEnabled($id) ? 'Yes' : 'No';
313 
314  $this->xmlElement('admin', $attr);
315  }
316  return true;
317  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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:

◆ __buildAdvancedMetaData()

ilGroupXMLWriter::__buildAdvancedMetaData ( )
private

Build advanced meta data.

private

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

References ilAdvancedMDValues\_appendXMLByObjId().

Referenced by start().

188  {
189  ilAdvancedMDValues::_appendXMLByObjId($this, $this->group_obj->getId());
190  }
static _appendXMLByObjId(ilXmlWriter $a_xml_writer, $a_obj_id)
Get xml of object values.
+ 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 294 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlElement().

Referenced by start().

295  {
296  $this->xmlElement('showMembers', null, $this->group_obj->getShowMembers());
297  $this->xmlElement('admissionNotification', null, $this->group_obj->getAutoNotification() ? 1 : 0);
298  }
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 338 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

339  {
340  $this->xmlEndTag('group');
341  }
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 149 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

150  {
151  $attrs["exportVersion"] = $this->EXPORT_VERSION;
152  $attrs["id"] = "il_" . $this->ilias->getSetting('inst_id') . '_grp_' . $this->group_obj->getId();
153 
154  switch ($this->group_obj->readGroupStatus()) {
155  case GRP_TYPE_OPEN:
156  $attrs['type'] = 'open';
157  break;
158 
159  case GRP_TYPE_CLOSED:
160  default:
161  $attrs['type'] = 'closed';
162  break;
163  }
164 
165  $this->xmlStartTag("group", $attrs);
166  }
const GRP_TYPE_OPEN
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
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 135 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

136  {
137  $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_group_3_10.dtd\">");
138  $this->xmlSetGenCmt("Export of ILIAS group " . $this->group_obj->getId() . " of installation " . $this->ilias->getSetting('inst_id') . ".");
139  $this->xmlHeader();
140 
141 
142  return true;
143  }
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 319 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

320  {
321  $members = $this->group_obj->getGroupMemberIds();
322  $members = $GLOBALS['DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
323  'manage_members',
325  $this->group_obj->getRefId(),
326  $members
327  );
328  foreach ($members as $id) {
329  if (!$this->group_obj->isAdmin($id)) {
330  $attr['id'] = 'il_' . $this->ilias->getSetting('inst_id') . '_usr_' . $id;
331 
332  $this->xmlElement('member', $attr);
333  }
334  }
335  return true;
336  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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:

◆ __buildMetaData()

ilGroupXMLWriter::__buildMetaData ( )
protected

write lom meta data

Returns
bool

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

References ilXmlWriter\appendXML(), and ilMD2XML\startExport().

Referenced by start().

173  {
174  $md2xml = new ilMD2XML($this->group_obj->getId(), $this->group_obj->getId(), 'grp');
175  $md2xml->startExport();
176  $this->appendXML($md2xml->getXML());
177 
178  return true;
179  }
appendXML($a_str)
append xml string to document
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildPeriod()

ilGroupXMLWriter::__buildPeriod ( )
protected

Add group period settings to xml.

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

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

Referenced by start().

211  {
212  if (!$this->group_obj->getStart() || !$this->group_obj->getEnd()) {
213  return;
214  }
215 
216  $this->xmlStartTag(
217  'period',
218  [
219  'withTime' => $this->group_obj->getStartTimeIndication()
220  ]
221  );
222  $this->xmlElement(
223  'start',
224  null,
225  $this->group_obj->getStart() ?
226  $this->group_obj->getStart()->get(IL_CAL_UNIX) :
227  null
228  );
229  $this->xmlElement(
230  'end',
231  null,
232  $this->group_obj->getEnd()->get(IL_CAL_UNIX) ?
233  $this->group_obj->getEnd()->get(IL_CAL_UNIX) :
234  null
235  );
236 
237  $this->xmlEndTag('period');
238  return;
239  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
const IL_CAL_UNIX
xmlEndTag($tag)
Writes an endtag.
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 241 of file class.ilGroupXMLWriter.php.

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().

242  {
243 
244  // registration type
245  switch ($this->group_obj->getRegistrationType()) {
247  $attrs['type'] = 'direct';
248  break;
250  $attrs['type'] = 'confirmation';
251  break;
253  $attrs['type'] = 'password';
254  break;
255 
256  default:
258  $attrs['type'] = 'disabled';
259  break;
260  }
261  $attrs['waitingList'] = $this->group_obj->isWaitingListEnabled() ? 'Yes' : 'No';
262 
263  $this->xmlStartTag('registration', $attrs);
264 
265  if (strlen($pwd = $this->group_obj->getPassword())) {
266  $this->xmlElement('password', null, $pwd);
267  }
268 
269 
270  // limited registration period
271  if (!$this->group_obj->isRegistrationUnlimited()) {
272  $this->xmlStartTag('temporarilyAvailable');
273  $this->xmlElement('start', null, $this->group_obj->getRegistrationStart()->get(IL_CAL_UNIX));
274  $this->xmlElement('end', null, $this->group_obj->getRegistrationEnd()->get(IL_CAL_UNIX));
275  $this->xmlEndTag('temporarilyAvailable');
276  }
277 
278  // max members
279  $attrs = array();
280  $attrs['enabled'] = $this->group_obj->isMembershipLimited() ? 'Yes' : 'No';
281  $this->xmlElement('maxMembers', $attrs, $this->group_obj->getMaxMembers());
282  $this->xmlElement('minMembers', null, (int) $this->group_obj->getMinMembers());
283  $this->xmlElement('WaitingListAutoFill', null, (int) $this->group_obj->hasWaitingListAutoFill());
284  $this->xmlElement('CancellationEnd', null, ($this->group_obj->getCancellationEnd() && !$this->group_obj->getCancellationEnd()->isNull()) ? $this->group_obj->getCancellationEnd()->get(IL_CAL_UNIX) : null);
285 
286  $this->xmlElement('mailMembersType', null, (string) $this->group_obj->getMailToMembersType());
287 
288  $this->xmlEndTag('registration');
289  }
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.
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 193 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlElement().

Referenced by start().

194  {
195  $this->xmlElement('title', null, $this->group_obj->getTitle());
196 
197  if ($desc = $this->group_obj->getDescription()) {
198  $this->xmlElement('description', null, $desc);
199  }
200 
201  $attr['id'] = 'il_' . $this->ilias->getSetting('inst_id') . '_usr_' . $this->group_obj->getOwner();
202  $this->xmlElement('owner', $attr);
203 
204  $this->xmlElement('information', null, $this->group_obj->getInformation());
205  }
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 89 of file class.ilGroupXMLWriter.php.

References $mode.

Referenced by start().

90  {
91  return $this->mode;
92  }
+ Here is the caller graph for this function:

◆ getXML()

ilGroupXMLWriter::getXML ( )

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

References ilXmlWriter\xmlDumpMem().

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

◆ setAttachUsers()

ilGroupXMLWriter::setAttachUsers (   $value)

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

344  {
345  $this->attach_users = $value ? true : false;
346  }

◆ setMode()

ilGroupXMLWriter::setMode (   $a_mode)

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

85  {
86  $this->mode = $a_mode;
87  }

◆ start()

ilGroupXMLWriter::start ( )

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

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

95  {
96  if ($this->getMode() == self::MODE_SOAP) {
97  $this->logger->debug('Using soap mode');
98  $this->__buildHeader();
99  $this->__buildGroup();
100  $this->__buildMetaData();
101  $this->__buildAdvancedMetaData();
102  $this->__buildTitleDescription();
103  $this->__buildRegistration();
104  $this->__buildExtraSettings();
105  if ($this->attach_users) {
106  $this->__buildAdmin();
107  $this->__buildMember();
108  }
109  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
110  ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId());
111  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
112  $this->__buildFooter();
113  } elseif ($this->getMode() == self::MODE_EXPORT) {
114  $this->logger->debug('Using export mode');
115  $this->__buildGroup();
116  $this->__buildMetaData();
117  $this->__buildAdvancedMetaData();
118  $this->__buildTitleDescription();
119  $this->__buildRegistration();
120  $this->__buildExtraSettings();
121  $this->__buildPeriod();
122  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
123  ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId());
124  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
125  $this->__buildFooter();
126  }
127  }
static _exportContainerSettings(ilXmlWriter $a_xml, $a_obj_id)
__buildMetaData()
write lom meta data
__buildAdvancedMetaData()
Build advanced meta data.
__buildPeriod()
Add group period settings to xml.
__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 58 of file class.ilGroupXMLWriter.php.

◆ $group_obj

ilGroupXMLWriter::$group_obj
private

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

Referenced by __construct().

◆ $ilias

ilGroupXMLWriter::$ilias
private

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

Referenced by __construct().

◆ $logger

ilGroupXMLWriter::$logger = null
private

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

◆ $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 51 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: