ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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 209 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlElement().

Referenced by start().

210  {
211  foreach($this->group_obj->getGroupAdminIds() as $id)
212  {
213  $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
214  $attr['notification'] = $this->participants->isNotificationEnabled($id) ? 'Yes' : 'No';
215 
216  $this->xmlElement('admin',$attr);
217  }
218  return true;
219  }
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 235 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

236  {
237  $this->xmlEndTag('group');
238  }
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 126 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

127  {
128  $attrs["exportVersion"] = $this->EXPORT_VERSION;
129  $attrs["id"] = "il_".$this->ilias->getSetting('inst_id').'_grp_'.$this->group_obj->getId();
130 
131  switch($this->group_obj->readGroupStatus())
132  {
133  case GRP_TYPE_PUBLIC:
134  $attrs['type'] = 'open';
135  break;
136 
137  case GRP_TYPE_CLOSED:
138  default:
139  $attrs['type'] = 'closed';
140  break;
141  }
142 
143  $this->xmlStartTag("group", $attrs);
144  }
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 112 of file class.ilGroupXMLWriter.php.

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

Referenced by start().

113  {
114  $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_group_3_10.dtd\">");
115  $this->xmlSetGenCmt("Export of ILIAS group ". $this->group_obj->getId()." of installation ".$this->ilias->getSetting('inst_id').".");
116  $this->xmlHeader();
117 
118 
119  return true;
120  }
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 221 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlElement().

Referenced by start().

222  {
223  foreach($this->group_obj->getGroupMemberIds() as $id)
224  {
225  if(!$this->group_obj->isAdmin($id))
226  {
227  $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
228 
229  $this->xmlElement('member',$attr);
230  }
231  }
232  return true;
233  }
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 161 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().

162  {
163 
164  // registration type
165  switch($this->group_obj->getRegistrationType())
166  {
168  $attrs['type'] = 'direct';
169  break;
171  $attrs['type'] = 'confirmation';
172  break;
174  $attrs['type'] = 'password';
175  break;
176 
177  default:
179  $attrs['type'] = 'disabled';
180  break;
181  }
182  $attrs['waitingList'] = $this->group_obj->isWaitingListEnabled() ? 'Yes' : 'No';
183 
184  $this->xmlStartTag('registration',$attrs);
185 
186  if(strlen($pwd = $this->group_obj->getPassword()))
187  {
188  $this->xmlElement('password',null,$pwd);
189  }
190 
191 
192  // limited registration period
193  if(!$this->group_obj->isRegistrationUnlimited())
194  {
195  $this->xmlStartTag('temporarilyAvailable');
196  $this->xmlElement('start',null,$this->group_obj->getRegistrationStart()->get(IL_CAL_UNIX));
197  $this->xmlElement('end',null,$this->group_obj->getRegistrationEnd()->get(IL_CAL_UNIX));
198  $this->xmlEndTag('temporarilyAvailable');
199  }
200 
201  // max members
202  $attrs = array();
203  $attrs['enabled'] = $this->group_obj->isMembershipLimited() ? 'Yes' : 'No';
204  $this->xmlElement('maxMembers',$attrs,$this->group_obj->getMaxMembers());
205 
206  $this->xmlEndTag('registration');
207  }
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 146 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlElement().

Referenced by start().

147  {
148  $this->xmlElement('title',null,$this->group_obj->getTitle());
149 
150  if($desc = $this->group_obj->getDescription())
151  {
152  $this->xmlElement('description',null,$desc);
153  }
154 
155  $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$this->group_obj->getOwner();
156  $this->xmlElement('owner',$attr);
157 
158  $this->xmlElement('information',null,$this->group_obj->getInformation());
159  }
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 106 of file class.ilGroupXMLWriter.php.

References ilXmlWriter\xmlDumpMem().

107  {
108  return $this->xmlDumpMem(FALSE);
109  }
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 240 of file class.ilGroupXMLWriter.php.

240  {
241  $this->attach_users = $value ? true : false;
242  }

◆ 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(), 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  $this->__buildFooter();
95  }
96  elseif($this->getMode() == self::MODE_EXPORT)
97  {
98  $this->__buildGroup();
99  $this->__buildTitleDescription();
100  $this->__buildRegistration();
101  $this->__buildFooter();
102  }
103 
104  }
+ 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: