ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilGroupXMLWriter Class Reference
+ 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 int MODE_SOAP = 1
 
const int MODE_EXPORT = 2
 
const int EXPORT_VERSION = 3
 

Protected Member Functions

 __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

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Constructor & Destructor Documentation

◆ __construct()

ilGroupXMLWriter::__construct ( ilObjGroup  $group_obj)

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

41 {
42 global $DIC;
43
44 $this->logger = $DIC->logger()->grp();
45 $this->settings = $DIC->settings();
46 $this->access = $DIC->access();
48 $this->group_obj = $group_obj;
49 $this->participants = ilGroupParticipants::_getInstanceByObjId($this->group_obj->getId());
50 }
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

258 : void
259 {
260 $admins = $this->group_obj->getGroupAdminIds();
261 $admins = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
262 'manage_members',
264 $this->group_obj->getRefId(),
265 $admins
266 );
267
268 foreach ($admins as $id) {
269 $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $id;
270 $attr['notification'] = $this->participants->isNotificationEnabled($id) ? 'Yes' : 'No';
271
272 $this->xmlElement('admin', $attr);
273 }
274 }
$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 124 of file class.ilGroupXMLWriter.php.

124 : void
125 {
126 ilAdvancedMDValues::_appendXMLByObjId($this, $this->group_obj->getId());
127 }
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 235 of file class.ilGroupXMLWriter.php.

235 : void
236 {
237 $this->xmlElement('showMembers', null, $this->group_obj->getShowMembers());
238 $this->xmlElement('admissionNotification', null, $this->group_obj->getAutoNotification() ? 1 : 0);
239
240 $this->xmlElement('ViewMode', null, ilObjGroup::lookupViewMode($this->group_obj->getId()));
241 $this->xmlElement(
242 'SessionLimit',
243 [
244 'active' => $this->group_obj->isSessionLimitEnabled() ? 1 : 0,
245 'previous' => $this->group_obj->getNumberOfPreviousSessions(),
246 'next' => $this->group_obj->getNumberOfNextSessions()
247 ]
248 );
249
250 $this->xmlElement('GroupMap', [
251 'enabled' => (int) $this->group_obj->getEnableGroupMap(),
252 'latitude' => $this->group_obj->getLatitude(),
253 'longitude' => $this->group_obj->getLongitude(),
254 'location_zoom' => $this->group_obj->getLocationZoom()
255 ]);
256 }
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 294 of file class.ilGroupXMLWriter.php.

294 : void
295 {
296 $this->xmlEndTag('group');
297 }
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 106 of file class.ilGroupXMLWriter.php.

106 : void
107 {
108 $attrs["exportVersion"] = self::EXPORT_VERSION;
109 $attrs["id"] = "il_" . $this->settings->get('inst_id') . '_grp_' . $this->group_obj->getId();
110
111 switch ($this->group_obj->readGroupStatus()) {
113 $attrs['type'] = 'open';
114 break;
115
117 default:
118 $attrs['type'] = 'closed';
119 break;
120 }
121 $this->xmlStartTag("group", $attrs);
122 }
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 98 of file class.ilGroupXMLWriter.php.

98 : bool
99 {
100 $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/components/ILIAS/Export/xml/ilias_grp_9_0.xsd\">");
101 $this->xmlSetGenCmt("Export of ILIAS group " . $this->group_obj->getId() . " of installation " . $this->settings->get('inst_id') . ".");
102 $this->xmlHeader();
103 return true;
104 }
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 276 of file class.ilGroupXMLWriter.php.

276 : void
277 {
278 $members = $this->group_obj->getGroupMemberIds();
279 $members = $this->access->filterUserIdsByRbacOrPositionOfCurrentUser(
280 'manage_members',
282 $this->group_obj->getRefId(),
283 $members
284 );
285 foreach ($members as $id) {
286 if (!$this->group_obj->isAdmin($id)) {
287 $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $id;
288
289 $this->xmlElement('member', $attr);
290 }
291 }
292 }

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:

◆ __buildPeriod()

ilGroupXMLWriter::__buildPeriod ( )
protected

Add group period settings to xml.

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

147 : void
148 {
149 if (!$this->group_obj->getStart() || !$this->group_obj->getEnd()) {
150 return;
151 }
152
153 $this->xmlStartTag(
154 'period',
155 [
156 'withTime' => $this->group_obj->getStartTimeIndication()
157 ]
158 );
159 $this->xmlElement(
160 'start',
161 null,
162 $this->group_obj->getStart()?->get(IL_CAL_UNIX)
163 );
164 $this->xmlElement(
165 'end',
166 null,
167 $this->group_obj->getEnd()->get(IL_CAL_UNIX) ?
168 $this->group_obj->getEnd()->get(IL_CAL_UNIX) :
169 null
170 );
171
172 $this->xmlEndTag('period');
173 }
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 175 of file class.ilGroupXMLWriter.php.

175 : void
176 {
177 // registration type
178 switch ($this->group_obj->getRegistrationType()) {
180 $attrs['type'] = 'direct';
181 break;
183 $attrs['type'] = 'confirmation';
184 break;
186 $attrs['type'] = 'password';
187 break;
188
189 default:
191 $attrs['type'] = 'disabled';
192 break;
193 }
194 $attrs['waitingList'] = $this->group_obj->isWaitingListEnabled() ? 'Yes' : 'No';
195
196 $this->xmlStartTag('registration', $attrs);
197
198 if (strlen($pwd = $this->group_obj->getPassword())) {
199 $this->xmlElement('password', null, $pwd);
200 }
201
202
203 // limited registration period
204 if (!$this->group_obj->isRegistrationUnlimited()) {
205 $this->xmlStartTag('temporarilyAvailable');
206 $this->xmlElement('start', null, $this->group_obj->getRegistrationStart()->get(IL_CAL_UNIX));
207 $this->xmlElement('end', null, $this->group_obj->getRegistrationEnd()->get(IL_CAL_UNIX));
208 $this->xmlEndTag('temporarilyAvailable');
209 }
210
211 // max members
212 $attrs = array();
213 $attrs['enabled'] = $this->group_obj->isMembershipLimited() ? 'Yes' : 'No';
214 $this->xmlElement('maxMembers', $attrs, $this->group_obj->getMaxMembers());
215 $this->xmlElement('minMembers', null, $this->group_obj->getMinMembers());
216 $this->xmlElement('WaitingListAutoFill', null, (int) $this->group_obj->hasWaitingListAutoFill());
217 $this->xmlElement('CancellationEnd', null, ($this->group_obj->getCancellationEnd() && !$this->group_obj->getCancellationEnd()->isNull()) ? $this->group_obj->getCancellationEnd()->get(IL_CAL_UNIX) : null);
218
219 $this->xmlElement('mailMembersType', null, (string) $this->group_obj->getMailToMembersType());
220
221 $this->xmlElement(
222 'RegistrationAccessCode',
223 [
224 'enabled' => (int) $this->group_obj->isRegistrationAccessCodeEnabled(),
225 'code' => $this->group_obj->getRegistrationAccessCode()
226 ]
227 );
228
229 $this->xmlEndTag('registration');
230 }

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

130 : void
131 {
132 $this->xmlElement('title', null, $this->group_obj->getTitle());
133
134 if ($desc = $this->group_obj->getDescription()) {
135 $this->xmlElement('description', null, $desc);
136 }
137
138 $attr['id'] = 'il_' . $this->settings->get('inst_id') . '_usr_' . $this->group_obj->getOwner();
139 $this->xmlElement('owner', $attr);
140
141 $this->xmlElement('information', null, $this->group_obj->getInformation());
142 }

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

57 : int
58 {
59 return $this->mode;
60 }

References $mode.

Referenced by start().

+ Here is the caller graph for this function:

◆ getXML()

ilGroupXMLWriter::getXML ( )

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

92 : string
93 {
94 return $this->xmlDumpMem(false);
95 }
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 299 of file class.ilGroupXMLWriter.php.

300 {
301 $this->attach_users = $value;
302 }

◆ setMode()

ilGroupXMLWriter::setMode ( int  $a_mode)

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

52 : void
53 {
54 $this->mode = $a_mode;
55 }

◆ start()

ilGroupXMLWriter::start ( )

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

62 : void
63 {
64 if ($this->getMode() == self::MODE_SOAP) {
65 $this->logger->debug('Using soap mode');
66 $this->__buildHeader();
67 $this->__buildGroup();
70 $this->__buildRegistration();
71 $this->__buildExtraSettings();
72 if ($this->attach_users) {
73 $this->__buildAdmin();
74 $this->__buildMember();
75 }
77 ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
78 $this->__buildFooter();
79 } elseif ($this->getMode() == self::MODE_EXPORT) {
80 $this->logger->debug('Using export mode');
81 $this->__buildGroup();
83 $this->__buildRegistration();
84 $this->__buildExtraSettings();
85 $this->__buildPeriod();
87 ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
88 $this->__buildFooter();
89 }
90 }
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(), __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 34 of file class.ilGroupXMLWriter.php.

◆ $attach_users

bool ilGroupXMLWriter::$attach_users = true
private

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

◆ $group_obj

ilObjGroup ilGroupXMLWriter::$group_obj
private

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

Referenced by __construct().

◆ $logger

ilLogger ilGroupXMLWriter::$logger
private

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

◆ $mode

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

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

Referenced by getMode().

◆ $participants

ilGroupParticipants ilGroupXMLWriter::$participants
private

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

◆ $settings

ilSetting ilGroupXMLWriter::$settings
private

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

◆ EXPORT_VERSION

const int ilGroupXMLWriter::EXPORT_VERSION = 3

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

Referenced by __buildGroup().

◆ MODE_EXPORT

const int ilGroupXMLWriter::MODE_EXPORT = 2

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

Referenced by ilGroupExporter\getXmlRepresentation().

◆ MODE_SOAP

const int ilGroupXMLWriter::MODE_SOAP = 1

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


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