ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilGroupXMLWriter Class Reference

XML writer class. 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

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 29 of file class.ilGroupXMLWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilGroupXMLWriter::__construct ( ilObjGroup  $group_obj)

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

References $DIC, $group_obj, ILIAS\GlobalScreen\Provider\__construct(), ilGroupParticipants\_getInstanceByObjId(), ILIAS\Repository\access(), ILIAS\Repository\logger(), and ILIAS\Repository\settings().

46  {
47  global $DIC;
48 
49  $this->logger = $DIC->logger()->grp();
50  $this->settings = $DIC->settings();
51  $this->access = $DIC->access();
53  $this->group_obj = $group_obj;
54  $this->participants = ilGroupParticipants::_getInstanceByObjId($this->group_obj->getId());
55  }
global $DIC
Definition: shib_login.php:22
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ __buildAdmin()

ilGroupXMLWriter::__buildAdmin ( )

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

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

Referenced by start().

274  : void
275  {
276  $admins = $this->group_obj->getGroupAdminIds();
277  $admins = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
278  'manage_members',
280  $this->group_obj->getRefId(),
281  $admins
282  );
283 
284  foreach ($admins as $id) {
285  $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $id;
286  $attr['notification'] = $this->participants->isNotificationEnabled($id) ? 'Yes' : 'No';
287 
288  $this->xmlElement('admin', $attr);
289  }
290  }
$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 138 of file class.ilGroupXMLWriter.php.

References ilAdvancedMDValues\_appendXMLByObjId().

Referenced by start().

138  : void
139  {
140  ilAdvancedMDValues::_appendXMLByObjId($this, $this->group_obj->getId());
141  }
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 251 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

251  : void
252  {
253  $this->xmlElement('showMembers', null, $this->group_obj->getShowMembers());
254  $this->xmlElement('admissionNotification', null, $this->group_obj->getAutoNotification() ? 1 : 0);
255 
256  $this->xmlElement('ViewMode', null, ilObjGroup::lookupViewMode($this->group_obj->getId()));
257  $this->xmlElement(
258  'SessionLimit',
259  [
260  'active' => $this->group_obj->isSessionLimitEnabled() ? 1 : 0,
261  'previous' => $this->group_obj->getNumberOfPreviousSessions(),
262  'next' => $this->group_obj->getNumberOfNextSessions()
263  ]
264  );
265 
266  $this->xmlElement('GroupMap', [
267  'enabled' => (int) $this->group_obj->getEnableGroupMap(),
268  'latitude' => $this->group_obj->getLatitude(),
269  'longitude' => $this->group_obj->getLongitude(),
270  'location_zoom' => $this->group_obj->getLocationZoom()
271  ]);
272  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 310 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

310  : void
311  {
312  $this->xmlEndTag('group');
313  }
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 112 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

112  : void
113  {
114  $attrs["exportVersion"] = self::EXPORT_VERSION;
115  $attrs["id"] = "il_" . $this->settings->get('inst_id') . '_grp_' . $this->group_obj->getId();
116 
117  switch ($this->group_obj->readGroupStatus()) {
119  $attrs['type'] = 'open';
120  break;
121 
123  default:
124  $attrs['type'] = 'closed';
125  break;
126  }
127  $this->xmlStartTag("group", $attrs);
128  }
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 104 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

104  : bool
105  {
106  $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/components/ILIAS/Export/xml/ilias_grp_9_0.xsd\">");
107  $this->xmlSetGenCmt("Export of ILIAS group " . $this->group_obj->getId() . " of installation " . $this->settings->get('inst_id') . ".");
108  $this->xmlHeader();
109  return true;
110  }
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 292 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

292  : void
293  {
294  $members = $this->group_obj->getGroupMemberIds();
295  $members = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
296  'manage_members',
298  $this->group_obj->getRefId(),
299  $members
300  );
301  foreach ($members as $id) {
302  if (!$this->group_obj->isAdmin($id)) {
303  $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $id;
304 
305  $this->xmlElement('member', $attr);
306  }
307  }
308  }
$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 130 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

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

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

Referenced by start().

161  : void
162  {
163  if (!$this->group_obj->getStart() || !$this->group_obj->getEnd()) {
164  return;
165  }
166 
167  $this->xmlStartTag(
168  'period',
169  [
170  'withTime' => $this->group_obj->getStartTimeIndication()
171  ]
172  );
173  $this->xmlElement(
174  'start',
175  null,
176  $this->group_obj->getStart() ?
177  $this->group_obj->getStart()->get(IL_CAL_UNIX) :
178  null
179  );
180  $this->xmlElement(
181  'end',
182  null,
183  $this->group_obj->getEnd()->get(IL_CAL_UNIX) ?
184  $this->group_obj->getEnd()->get(IL_CAL_UNIX) :
185  null
186  );
187 
188  $this->xmlEndTag('period');
189  }
const IL_CAL_UNIX
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 191 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, null, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

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

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

Referenced by start().

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

References $mode.

Referenced by start().

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

◆ getXML()

ilGroupXMLWriter::getXML ( )

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

References ilXmlWriter\xmlDumpMem().

98  : string
99  {
100  return $this->xmlDumpMem(false);
101  }
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 315 of file class.ilGroupXMLWriter.php.

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

◆ setMode()

ilGroupXMLWriter::setMode ( int  $a_mode)

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

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

◆ start()

ilGroupXMLWriter::start ( )

Definition at line 67 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().

67  : void
68  {
69  if ($this->getMode() == self::MODE_SOAP) {
70  $this->logger->debug('Using soap mode');
71  $this->__buildHeader();
72  $this->__buildGroup();
73  $this->__buildMetaData();
74  $this->__buildAdvancedMetaData();
75  $this->__buildTitleDescription();
76  $this->__buildRegistration();
77  $this->__buildExtraSettings();
78  if ($this->attach_users) {
79  $this->__buildAdmin();
80  $this->__buildMember();
81  }
82  ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId());
83  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
84  $this->__buildFooter();
85  } elseif ($this->getMode() == self::MODE_EXPORT) {
86  $this->logger->debug('Using export mode');
87  $this->__buildGroup();
88  $this->__buildTitleDescription();
89  $this->__buildRegistration();
90  $this->__buildExtraSettings();
91  $this->__buildPeriod();
92  ilContainerSortingSettings::_exportContainerSortingSettings($this, $this->group_obj->getId());
93  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
94  $this->__buildFooter();
95  }
96  }
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 39 of file class.ilGroupXMLWriter.php.

◆ $attach_users

bool ilGroupXMLWriter::$attach_users = true
private

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

◆ $group_obj

ilObjGroup ilGroupXMLWriter::$group_obj
private

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

Referenced by __construct().

◆ $logger

ilLogger ilGroupXMLWriter::$logger
private

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

◆ $mode

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

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

Referenced by getMode().

◆ $participants

ilGroupParticipants ilGroupXMLWriter::$participants
private

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

◆ $settings

ilSetting ilGroupXMLWriter::$settings
private

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

◆ EXPORT_VERSION

const ilGroupXMLWriter::EXPORT_VERSION = 3

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

◆ MODE_EXPORT

const ilGroupXMLWriter::MODE_EXPORT = 2

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

Referenced by ilGroupExporter\getXmlRepresentation().

◆ MODE_SOAP

const ilGroupXMLWriter::MODE_SOAP = 1

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


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