ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilGroupXMLWriter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (ilObjGroup $group_obj)
 
 setMode (int $a_mode)
 
 getMode ()
 
 start ()
 
 getXML ()
 
 __buildHeader ()
 
 __buildGroup ()
 
 __buildTitleDescription ()
 
 __buildRegistration ()
 
 __buildExtraSettings ()
 Build extra settings, like "show member list". More...
 
 __buildAdmin ()
 
 __buildMember ()
 
 __buildFooter ()
 
 setAttachUsers (bool $value)
 
- Public Member Functions inherited from ilXmlWriter
 __construct (string $version="1.0", string $outEnc="utf-8", string $inEnc="utf-8")
 
 xmlSetDtdDef (string $dtdDef)
 Sets dtd definition. More...
 
 xmlSetGenCmt (string $genCmt)
 Sets generated comment. More...
 
 xmlFormatData (string $data)
 Indents text for better reading. More...
 
 xmlHeader ()
 Writes xml header. More...
 
 xmlStartTag (string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
 Writes a starttag. More...
 
 xmlEndTag (string $tag)
 Writes an endtag. More...
 
 xmlData (string $data, bool $encode=true, bool $escape=true)
 Writes data. More...
 
 xmlElement (string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile (string $file, bool $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem (bool $format=true)
 Returns xml document from memory. More...
 
 appendXML (string $a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr More...
 

Data Fields

const MODE_SOAP = 1
 
const MODE_EXPORT = 2
 
const EXPORT_VERSION = 3
 

Protected Member Functions

 __buildMetaData ()
 
 __buildPeriod ()
 Add group period settings to xml. More...
 

Private Member Functions

 __buildAdvancedMetaData ()
 

Private Attributes

int $mode = self::MODE_SOAP
 
ilLogger $logger
 
ilSetting $settings
 
ilAccessHandler $access
 
ilObjGroup $group_obj
 
ilGroupParticipants $participants
 
bool $attach_users = true
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 28 of file class.ilGroupXMLWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilGroupXMLWriter::__construct ( ilObjGroup  $group_obj)

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

References $DIC, $group_obj, ILIAS\MetaData\Repository\Validation\Data\__construct(), ilGroupParticipants\_getInstanceByObjId(), ILIAS\Repository\access(), ILIAS\Repository\logger(), and ILIAS\Repository\settings().

45  {
46  global $DIC;
47 
48  $this->logger = $DIC->logger()->grp();
49  $this->settings = $DIC->settings();
50  $this->access = $DIC->access();
52  $this->group_obj = $group_obj;
53  $this->participants = ilGroupParticipants::_getInstanceByObjId($this->group_obj->getId());
54  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildAdmin()

ilGroupXMLWriter::__buildAdmin ( )

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

References $id, ILIAS\Repository\access(), ilOrgUnitOperation\OP_MANAGE_MEMBERS, ILIAS\Repository\settings(), and ilXmlWriter\xmlElement().

Referenced by start().

273  : void
274  {
275  $admins = $this->group_obj->getGroupAdminIds();
276  $admins = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
277  'manage_members',
279  $this->group_obj->getRefId(),
280  $admins
281  );
282 
283  foreach ($admins as $id) {
284  $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $id;
285  $attr['notification'] = $this->participants->isNotificationEnabled($id) ? 'Yes' : 'No';
286 
287  $this->xmlElement('admin', $attr);
288  }
289  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
xmlElement(string $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

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

References ilAdvancedMDValues\_appendXMLByObjId().

Referenced by start().

137  : void
138  {
139  ilAdvancedMDValues::_appendXMLByObjId($this, $this->group_obj->getId());
140  }
static _appendXMLByObjId(ilXmlWriter $a_xml_writer, int $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 250 of file class.ilGroupXMLWriter.php.

References ilObjGroup\lookupViewMode(), and ilXmlWriter\xmlElement().

Referenced by start().

250  : void
251  {
252  $this->xmlElement('showMembers', null, $this->group_obj->getShowMembers());
253  $this->xmlElement('admissionNotification', null, $this->group_obj->getAutoNotification() ? 1 : 0);
254 
255  $this->xmlElement('ViewMode', null, ilObjGroup::lookupViewMode($this->group_obj->getId()));
256  $this->xmlElement(
257  'SessionLimit',
258  [
259  'active' => $this->group_obj->isSessionLimitEnabled() ? 1 : 0,
260  'previous' => $this->group_obj->getNumberOfPreviousSessions(),
261  'next' => $this->group_obj->getNumberOfNextSessions()
262  ]
263  );
264 
265  $this->xmlElement('GroupMap', [
266  'enabled' => (int) $this->group_obj->getEnableGroupMap(),
267  'latitude' => $this->group_obj->getLatitude(),
268  'longitude' => $this->group_obj->getLongitude(),
269  'location_zoom' => $this->group_obj->getLocationZoom()
270  ]);
271  }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static lookupViewMode($a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildFooter()

ilGroupXMLWriter::__buildFooter ( )

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

References ilXmlWriter\xmlEndTag().

Referenced by start().

309  : void
310  {
311  $this->xmlEndTag('group');
312  }
xmlEndTag(string $tag)
Writes an endtag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildGroup()

ilGroupXMLWriter::__buildGroup ( )

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

References ilGroupConstants\GRP_TYPE_CLOSED, ilGroupConstants\GRP_TYPE_OPEN, ILIAS\Repository\settings(), and ilXmlWriter\xmlStartTag().

Referenced by start().

111  : void
112  {
113  $attrs["exportVersion"] = self::EXPORT_VERSION;
114  $attrs["id"] = "il_" . $this->settings->get('inst_id') . '_grp_' . $this->group_obj->getId();
115 
116  switch ($this->group_obj->readGroupStatus()) {
118  $attrs['type'] = 'open';
119  break;
120 
122  default:
123  $attrs['type'] = 'closed';
124  break;
125  }
126  $this->xmlStartTag("group", $attrs);
127  }
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildHeader()

ilGroupXMLWriter::__buildHeader ( )

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

References ILIAS\Repository\settings(), ilXmlWriter\xmlHeader(), ilXmlWriter\xmlSetDtdDef(), and ilXmlWriter\xmlSetGenCmt().

Referenced by start().

103  : bool
104  {
105  $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_grp_9_0.xsd\">");
106  $this->xmlSetGenCmt("Export of ILIAS group " . $this->group_obj->getId() . " of installation " . $this->settings->get('inst_id') . ".");
107  $this->xmlHeader();
108  return true;
109  }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.
xmlHeader()
Writes xml header.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildMember()

ilGroupXMLWriter::__buildMember ( )

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

References $id, ILIAS\Repository\access(), ilOrgUnitOperation\OP_MANAGE_MEMBERS, ILIAS\Repository\settings(), and ilXmlWriter\xmlElement().

Referenced by start().

291  : void
292  {
293  $members = $this->group_obj->getGroupMemberIds();
294  $members = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
295  'manage_members',
297  $this->group_obj->getRefId(),
298  $members
299  );
300  foreach ($members as $id) {
301  if (!$this->group_obj->isAdmin($id)) {
302  $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $id;
303 
304  $this->xmlElement('member', $attr);
305  }
306  }
307  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
xmlElement(string $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

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

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

Referenced by start().

129  : bool
130  {
131  $md2xml = new ilMD2XML($this->group_obj->getId(), $this->group_obj->getId(), 'grp');
132  $md2xml->startExport();
133  $this->appendXML($md2xml->getXML());
134  return true;
135  }
appendXML(string $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 160 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

160  : void
161  {
162  if (!$this->group_obj->getStart() || !$this->group_obj->getEnd()) {
163  return;
164  }
165 
166  $this->xmlStartTag(
167  'period',
168  [
169  'withTime' => $this->group_obj->getStartTimeIndication()
170  ]
171  );
172  $this->xmlElement(
173  'start',
174  null,
175  $this->group_obj->getStart() ?
176  $this->group_obj->getStart()->get(IL_CAL_UNIX) :
177  null
178  );
179  $this->xmlElement(
180  'end',
181  null,
182  $this->group_obj->getEnd()->get(IL_CAL_UNIX) ?
183  $this->group_obj->getEnd()->get(IL_CAL_UNIX) :
184  null
185  );
186 
187  $this->xmlEndTag('period');
188  }
const IL_CAL_UNIX
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $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 190 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

190  : void
191  {
192  // registration type
193  switch ($this->group_obj->getRegistrationType()) {
195  $attrs['type'] = 'direct';
196  break;
198  $attrs['type'] = 'confirmation';
199  break;
201  $attrs['type'] = 'password';
202  break;
203 
204  default:
206  $attrs['type'] = 'disabled';
207  break;
208  }
209  $attrs['waitingList'] = $this->group_obj->isWaitingListEnabled() ? 'Yes' : 'No';
210 
211  $this->xmlStartTag('registration', $attrs);
212 
213  if (strlen($pwd = $this->group_obj->getPassword())) {
214  $this->xmlElement('password', null, $pwd);
215  }
216 
217 
218  // limited registration period
219  if (!$this->group_obj->isRegistrationUnlimited()) {
220  $this->xmlStartTag('temporarilyAvailable');
221  $this->xmlElement('start', null, $this->group_obj->getRegistrationStart()->get(IL_CAL_UNIX));
222  $this->xmlElement('end', null, $this->group_obj->getRegistrationEnd()->get(IL_CAL_UNIX));
223  $this->xmlEndTag('temporarilyAvailable');
224  }
225 
226  // max members
227  $attrs = array();
228  $attrs['enabled'] = $this->group_obj->isMembershipLimited() ? 'Yes' : 'No';
229  $this->xmlElement('maxMembers', $attrs, $this->group_obj->getMaxMembers());
230  $this->xmlElement('minMembers', null, $this->group_obj->getMinMembers());
231  $this->xmlElement('WaitingListAutoFill', null, (int) $this->group_obj->hasWaitingListAutoFill());
232  $this->xmlElement('CancellationEnd', null, ($this->group_obj->getCancellationEnd() && !$this->group_obj->getCancellationEnd()->isNull()) ? $this->group_obj->getCancellationEnd()->get(IL_CAL_UNIX) : null);
233 
234  $this->xmlElement('mailMembersType', null, (string) $this->group_obj->getMailToMembersType());
235 
236  $this->xmlElement(
237  'RegistrationAccessCode',
238  [
239  'enabled' => (int) $this->group_obj->isRegistrationAccessCodeEnabled(),
240  'code' => $this->group_obj->getRegistrationAccessCode()
241  ]
242  );
243 
244  $this->xmlEndTag('registration');
245  }
const IL_CAL_UNIX
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $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:

◆ __buildTitleDescription()

ilGroupXMLWriter::__buildTitleDescription ( )

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

References ILIAS\Repository\settings(), and ilXmlWriter\xmlElement().

Referenced by start().

143  : void
144  {
145  $this->xmlElement('title', null, $this->group_obj->getTitle());
146 
147  if ($desc = $this->group_obj->getDescription()) {
148  $this->xmlElement('description', null, $desc);
149  }
150 
151  $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $this->group_obj->getOwner();
152  $this->xmlElement('owner', $attr);
153 
154  $this->xmlElement('information', null, $this->group_obj->getInformation());
155  }
xmlElement(string $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 61 of file class.ilGroupXMLWriter.php.

References $mode.

Referenced by start().

61  : int
62  {
63  return $this->mode;
64  }
+ Here is the caller graph for this function:

◆ getXML()

ilGroupXMLWriter::getXML ( )

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

References ilXmlWriter\xmlDumpMem().

97  : string
98  {
99  return $this->xmlDumpMem(false);
100  }
xmlDumpMem(bool $format=true)
Returns xml document from memory.
+ Here is the call graph for this function:

◆ setAttachUsers()

ilGroupXMLWriter::setAttachUsers ( bool  $value)

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

315  {
316  $this->attach_users = $value;
317  }

◆ setMode()

ilGroupXMLWriter::setMode ( int  $a_mode)

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

56  : void
57  {
58  $this->mode = $a_mode;
59  }

◆ start()

ilGroupXMLWriter::start ( )

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

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

66  : void
67  {
68  if ($this->getMode() == self::MODE_SOAP) {
69  $this->logger->debug('Using soap mode');
70  $this->__buildHeader();
71  $this->__buildGroup();
72  $this->__buildMetaData();
73  $this->__buildAdvancedMetaData();
74  $this->__buildTitleDescription();
75  $this->__buildRegistration();
76  $this->__buildExtraSettings();
77  if ($this->attach_users) {
78  $this->__buildAdmin();
79  $this->__buildMember();
80  }
81  ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId());
82  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
83  $this->__buildFooter();
84  } elseif ($this->getMode() == self::MODE_EXPORT) {
85  $this->logger->debug('Using export mode');
86  $this->__buildGroup();
87  $this->__buildTitleDescription();
88  $this->__buildRegistration();
89  $this->__buildExtraSettings();
90  $this->__buildPeriod();
91  ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId());
92  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
93  $this->__buildFooter();
94  }
95  }
static _exportContainerSortingSettings(ilXmlWriter $xml, int $obj_id)
sorting XML-export for all container objects
static _exportContainerSettings(ilXmlWriter $a_xml, int $a_obj_id)
__buildPeriod()
Add group period settings to xml.
__buildExtraSettings()
Build extra settings, like "show member list".
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilGroupXMLWriter::$access
private

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

◆ $attach_users

bool ilGroupXMLWriter::$attach_users = true
private

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

◆ $group_obj

ilObjGroup ilGroupXMLWriter::$group_obj
private

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

Referenced by __construct().

◆ $logger

ilLogger ilGroupXMLWriter::$logger
private

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

◆ $mode

int ilGroupXMLWriter::$mode = self::MODE_SOAP
private

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

Referenced by getMode().

◆ $participants

ilGroupParticipants ilGroupXMLWriter::$participants
private

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

◆ $settings

ilSetting ilGroupXMLWriter::$settings
private

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

◆ EXPORT_VERSION

const ilGroupXMLWriter::EXPORT_VERSION = 3

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

◆ MODE_EXPORT

const ilGroupXMLWriter::MODE_EXPORT = 2

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

Referenced by ilGroupExporter\getXmlRepresentation().

◆ MODE_SOAP

const ilGroupXMLWriter::MODE_SOAP = 1

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


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