ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilGroupXMLWriter Class Reference

XML writer class. More...

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

Public Member Functions

 ilGroupXMLWriter ($group_obj)
 constructor More...
 
 setMode ($a_mode)
 
 getMode ()
 
 start ()
 
 getXML ()
 
 __buildHeader ()
 
 __buildGroup ()
 Group start. More...
 
 __buildTitleDescription ()
 
 __buildRegistration ()
 
 __buildAdmin ()
 
 __buildMember ()
 
 __buildFooter ()
 
 setAttachUsers ($value)
 
- Public Member Functions inherited from ilXmlWriter
 ilXmlWriter ($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...
 
 _xmlEscapeData ($data)
 Escapes reserved characters. 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"
 

Private Attributes

 $mode = self::MODE_SOAP
 
 $ilias
 
 $xml
 
 $group_obj
 
 $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 36 of file class.ilGroupXMLWriter.php.

Member Function Documentation

◆ __buildAdmin()

ilGroupXMLWriter::__buildAdmin ( )

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

References ilXmlWriter\xmlElement().

Referenced by start().

220  {
221  foreach($this->group_obj->getGroupAdminIds() as $id)
222  {
223  $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
224  $attr['notification'] = $this->participants->isNotificationEnabled($id) ? 'Yes' : 'No';
225 
226  $this->xmlElement('admin',$attr);
227  }
228  return true;
229  }
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 245 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

246  {
247  $this->xmlEndTag('group');
248  }
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 132 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

133  {
134  $attrs["exportVersion"] = $this->EXPORT_VERSION;
135  $attrs["id"] = "il_".$this->ilias->getSetting('inst_id').'_grp_'.$this->group_obj->getId();
136 
137  switch($this->group_obj->readGroupStatus())
138  {
139  case GRP_TYPE_PUBLIC:
140  $attrs['type'] = 'open';
141  break;
142 
143  case GRP_TYPE_CLOSED:
144  default:
145  $attrs['type'] = 'closed';
146  break;
147  }
148 
149  $this->xmlStartTag("group", $attrs);
150  }
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
const GRP_TYPE_PUBLIC
const GRP_TYPE_CLOSED
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildHeader()

ilGroupXMLWriter::__buildHeader ( )

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

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

Referenced by start().

119  {
120  $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_group_3_10.dtd\">");
121  $this->xmlSetGenCmt("Export of ILIAS group ". $this->group_obj->getId()." of installation ".$this->ilias->getSetting('inst_id').".");
122  $this->xmlHeader();
123 
124 
125  return true;
126  }
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 231 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlElement().

Referenced by start().

232  {
233  foreach($this->group_obj->getGroupMemberIds() as $id)
234  {
235  if(!$this->group_obj->isAdmin($id))
236  {
237  $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
238 
239  $this->xmlElement('member',$attr);
240  }
241  }
242  return true;
243  }
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 167 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().

168  {
169 
170  // registration type
171  switch($this->group_obj->getRegistrationType())
172  {
174  $attrs['type'] = 'direct';
175  break;
177  $attrs['type'] = 'confirmation';
178  break;
180  $attrs['type'] = 'password';
181  break;
182 
183  default:
185  $attrs['type'] = 'disabled';
186  break;
187  }
188  $attrs['waitingList'] = $this->group_obj->isWaitingListEnabled() ? 'Yes' : 'No';
189 
190  $this->xmlStartTag('registration',$attrs);
191 
192  if(strlen($pwd = $this->group_obj->getPassword()))
193  {
194  $this->xmlElement('password',null,$pwd);
195  }
196 
197 
198  // limited registration period
199  if(!$this->group_obj->isRegistrationUnlimited())
200  {
201  $this->xmlStartTag('temporarilyAvailable');
202  $this->xmlElement('start',null,$this->group_obj->getRegistrationStart()->get(IL_CAL_UNIX));
203  $this->xmlElement('end',null,$this->group_obj->getRegistrationEnd()->get(IL_CAL_UNIX));
204  $this->xmlEndTag('temporarilyAvailable');
205  }
206 
207  // max members
208  $attrs = array();
209  $attrs['enabled'] = $this->group_obj->isMembershipLimited() ? 'Yes' : 'No';
210  $this->xmlElement('maxMembers',$attrs,$this->group_obj->getMaxMembers());
211 
212  $this->xmlElement('minMembers',null,(int)$this->group_obj->getMinMembers());
213  $this->xmlElement('WaitingListAutoFill',null,(int)$this->group_obj->hasWaitingListAutoFill());
214  $this->xmlElement('CancellationEnd',null,($this->group_obj->getCancellationEnd() && !$this->group_obj->getCancellationEnd()->isNull()) ? $this->group_obj->getCancellationEnd()->get(IL_CAL_UNIX) : null);
215 
216  $this->xmlEndTag('registration');
217  }
const GRP_REGISTRATION_DEACTIVATED
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
const IL_CAL_UNIX
const GRP_REGISTRATION_PASSWORD
const GRP_REGISTRATION_REQUEST
xmlEndTag($tag)
Writes an endtag.
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 152 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlElement().

Referenced by start().

153  {
154  $this->xmlElement('title',null,$this->group_obj->getTitle());
155 
156  if($desc = $this->group_obj->getDescription())
157  {
158  $this->xmlElement('description',null,$desc);
159  }
160 
161  $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$this->group_obj->getOwner();
162  $this->xmlElement('owner',$attr);
163 
164  $this->xmlElement('information',null,$this->group_obj->getInformation());
165  }
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 76 of file class.ilGroupXMLWriter.php.

References $mode.

Referenced by start().

77  {
78  return $this->mode;
79  }
+ Here is the caller graph for this function:

◆ getXML()

ilGroupXMLWriter::getXML ( )

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

References ilXmlWriter\xmlDumpMem().

113  {
114  return $this->xmlDumpMem(FALSE);
115  }
xmlDumpMem($format=TRUE)
Returns xml document from memory.
+ Here is the call graph for this function:

◆ ilGroupXMLWriter()

ilGroupXMLWriter::ilGroupXMLWriter (   $group_obj)

constructor

Parameters
stringxml version
stringoutput encoding
stringinput encoding public

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

References $group_obj, $ilias, and ilGroupParticipants\_getInstanceByObjId().

58  {
59  global $ilias;
60 
61  parent::ilXmlWriter();
62 
63  $this->EXPORT_VERSION = "3";
64 
65  $this->ilias =& $ilias;
66  $this->group_obj =& $group_obj;
67  $this->participants = ilGroupParticipants::_getInstanceByObjId($this->group_obj->getId());
68 
69  }
redirection script todo: (a better solution should control the processing via a xml file) ...
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:

◆ setAttachUsers()

ilGroupXMLWriter::setAttachUsers (   $value)

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

250  {
251  $this->attach_users = $value ? true : false;
252  }

◆ setMode()

ilGroupXMLWriter::setMode (   $a_mode)

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

72  {
73  $this->mode = $a_mode;
74  }

◆ start()

ilGroupXMLWriter::start ( )

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

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

82  {
83  if($this->getMode() == self::MODE_SOAP)
84  {
85  $this->__buildHeader();
86  $this->__buildGroup();
87  $this->__buildTitleDescription();
88  $this->__buildRegistration();
89  if ($this->attach_users)
90  {
91  $this->__buildAdmin();
92  $this->__buildMember();
93  }
94  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
95  ilContainerSortingSettings::_exportContainerSortingSettings($this,$this->group_obj->getId());
96  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
97  $this->__buildFooter();
98  }
99  elseif($this->getMode() == self::MODE_EXPORT)
100  {
101  $this->__buildGroup();
102  $this->__buildTitleDescription();
103  $this->__buildRegistration();
104  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
105  ilContainerSortingSettings::_exportContainerSortingSettings($this,$this->group_obj->getId());
106  ilContainer::_exportContainerSettings($this, $this->group_obj->getId());
107  $this->__buildFooter();
108  }
109 
110  }
static _exportContainerSettings(ilXmlWriter $a_xml, $a_obj_id)
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 48 of file class.ilGroupXMLWriter.php.

◆ $group_obj

ilGroupXMLWriter::$group_obj
private

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

Referenced by ilGroupXMLWriter().

◆ $ilias

ilGroupXMLWriter::$ilias
private

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

Referenced by ilGroupXMLWriter().

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