ILIAS  release_8 Revision v8.24
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.

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 }
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __buildAdmin()

ilGroupXMLWriter::__buildAdmin ( )

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

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

References $id, ILIAS\Repository\access(), ilOrgUnitOperation\OP_MANAGE_MEMBERS, ILIAS\Repository\settings(), 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

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

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

253 : void
254 {
255 $this->xmlElement('showMembers', null, $this->group_obj->getShowMembers());
256 $this->xmlElement('admissionNotification', null, $this->group_obj->getAutoNotification() ? 1 : 0);
257
258 $this->xmlElement('ViewMode', null, ilObjGroup::lookupViewMode($this->group_obj->getId()));
259 $this->xmlElement(
260 'SessionLimit',
261 [
262 'active' => $this->group_obj->isSessionLimitEnabled() ? 1 : 0,
263 'previous' => $this->group_obj->getNumberOfPreviousSessions(),
264 'next' => $this->group_obj->getNumberOfNextSessions()
265 ]
266 );
267
268 $this->xmlElement('GroupMap', [
269 'enabled' => (int) $this->group_obj->getEnableGroupMap(),
270 'latitude' => $this->group_obj->getLatitude(),
271 'longitude' => $this->group_obj->getLongitude(),
272 'location_zoom' => $this->group_obj->getLocationZoom()
273 ]);
274 }
static lookupViewMode($a_obj_id)

References ilObjGroup\lookupViewMode(), and 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 312 of file class.ilGroupXMLWriter.php.

312 : void
313 {
314 $this->xmlEndTag('group');
315 }
xmlEndTag(string $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 ( )

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

113 : void
114 {
115 $attrs["exportVersion"] = self::EXPORT_VERSION;
116 $attrs["id"] = "il_" . $this->settings->get('inst_id') . '_grp_' . $this->group_obj->getId();
117
118 switch ($this->group_obj->readGroupStatus()) {
120 $attrs['type'] = 'open';
121 break;
122
124 default:
125 $attrs['type'] = 'closed';
126 break;
127 }
128 $this->xmlStartTag("group", $attrs);
129 }
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

References EXPORT_VERSION, ilGroupConstants\GRP_TYPE_CLOSED, ilGroupConstants\GRP_TYPE_OPEN, ILIAS\Repository\settings(), 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 105 of file class.ilGroupXMLWriter.php.

105 : bool
106 {
107 $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_group_3_10.dtd\">");
108 $this->xmlSetGenCmt("Export of ILIAS group " . $this->group_obj->getId() . " of installation " . $this->settings->get('inst_id') . ".");
109 $this->xmlHeader();
110 return true;
111 }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlHeader()
Writes xml header.
xmlSetDtdDef(string $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 294 of file class.ilGroupXMLWriter.php.

294 : void
295 {
296 $members = $this->group_obj->getGroupMemberIds();
297 $members = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
298 'manage_members',
300 $this->group_obj->getRefId(),
301 $members
302 );
303 foreach ($members as $id) {
304 if (!$this->group_obj->isAdmin($id)) {
305 $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $id;
306
307 $this->xmlElement('member', $attr);
308 }
309 }
310 }

References $id, ILIAS\Repository\access(), ilOrgUnitOperation\OP_MANAGE_MEMBERS, ILIAS\Repository\settings(), 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

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

131 : bool
132 {
133 $md2xml = new ilMD2XML($this->group_obj->getId(), $this->group_obj->getId(), 'grp');
134 $md2xml->startExport();
135 $this->appendXML($md2xml->getXML());
136 return true;
137 }
appendXML(string $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

Add group period settings to xml.

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

162 : void
163 {
164 if (!$this->group_obj->getStart() || !$this->group_obj->getEnd()) {
165 return;
166 }
167
168 $this->xmlStartTag(
169 'period',
170 [
171 'withTime' => $this->group_obj->getStartTimeIndication()
172 ]
173 );
174 $this->xmlElement(
175 'start',
176 null,
177 $this->group_obj->getStart() ?
178 $this->group_obj->getStart()->get(IL_CAL_UNIX) :
179 null
180 );
181 $this->xmlElement(
182 'end',
183 null,
184 $this->group_obj->getEnd()->get(IL_CAL_UNIX) ?
185 $this->group_obj->getEnd()->get(IL_CAL_UNIX) :
186 null
187 );
188
189 $this->xmlEndTag('period');
190 }
const IL_CAL_UNIX

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

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

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

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

◆ __buildTitleDescription()

ilGroupXMLWriter::__buildTitleDescription ( )

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

145 : void
146 {
147 $this->xmlElement('title', null, $this->group_obj->getTitle());
148
149 if ($desc = $this->group_obj->getDescription()) {
150 $this->xmlElement('description', null, $desc);
151 }
152
153 $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $this->group_obj->getOwner();
154 $this->xmlElement('owner', $attr);
155
156 $this->xmlElement('information', null, $this->group_obj->getInformation());
157 }

References ILIAS\Repository\settings(), and 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 61 of file class.ilGroupXMLWriter.php.

61 : int
62 {
63 return $this->mode;
64 }

References $mode.

Referenced by start().

+ Here is the caller graph for this function:

◆ getXML()

ilGroupXMLWriter::getXML ( )

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

99 : string
100 {
101 return $this->xmlDumpMem(false);
102 }
xmlDumpMem(bool $format=true)
Returns xml document from memory.

References ilXmlWriter\xmlDumpMem().

+ Here is the call graph for this function:

◆ setAttachUsers()

ilGroupXMLWriter::setAttachUsers ( bool  $value)

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

318 {
319 $this->attach_users = $value;
320 }

◆ 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.

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();
75 $this->__buildRegistration();
76 $this->__buildExtraSettings();
77 if ($this->attach_users) {
78 $this->__buildAdmin();
79 $this->__buildMember();
80 }
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->__buildMetaData();
90 $this->__buildRegistration();
91 $this->__buildExtraSettings();
92 $this->__buildPeriod();
94 ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
95 $this->__buildFooter();
96 }
97 }
static _exportContainerSortingSettings(ilXmlWriter $xml, int $obj_id)
sorting XML-export for all container objects
static _exportContainerSettings(ilXmlWriter $a_xml, int $a_obj_id)
__buildExtraSettings()
Build extra settings, like "show member list".
__buildPeriod()
Add group period settings to xml.

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

+ 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.

Referenced by __buildGroup().

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