• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilGroupXMLWriter.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004     +-----------------------------------------------------------------------------+
00005     | ILIAS open source                                                           |
00006         +-----------------------------------------------------------------------------+
00007     | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00008     |                                                                             |
00009     | This program is free software; you can redistribute it and/or               |
00010     | modify it under the terms of the GNU General Public License                 |
00011     | as published by the Free Software Foundation; either version 2              |
00012     | of the License, or (at your option) any later version.                      |
00013     |                                                                             |
00014     | This program is distributed in the hope that it will be useful,             |
00015     | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00016     | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00017     | GNU General Public License for more details.                                |
00018     |                                                                             |
00019     | You should have received a copy of the GNU General Public License           |
00020     | along with this program; if not, write to the Free Software                 |
00021     | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00022     +-----------------------------------------------------------------------------+
00023 */
00024 
00034 include_once "./classes/class.ilXmlWriter.php";
00035 
00036 class ilGroupXMLWriter extends ilXmlWriter
00037 {
00038         var $ilias;
00039 
00040         var $xml;
00041         var $group_obj;
00042 
00050         function ilGroupXMLWriter(&$group_obj)
00051         {
00052                 global $ilias;
00053 
00054                 parent::ilXmlWriter();
00055 
00056                 $this->EXPORT_VERSION = "2";
00057 
00058                 $this->ilias =& $ilias;
00059                 $this->group_obj =& $group_obj;
00060         }
00061 
00062         function start()
00063         {
00064                 $this->__buildHeader();
00065                 $this->__buildTitleDescription();
00066                 $this->__buildRegistration();
00067                 $this->__buildAdmin();
00068                 $this->__buildMember();
00069                 $this->__buildFooter();
00070         }
00071 
00072         function getXML()
00073         {
00074                 return $this->xmlDumpMem(FALSE);
00075         }
00076 
00077         // PRIVATE
00078         function __buildHeader()
00079         {
00080                 $this->xmlSetDtdDef("<!DOCTYPE group PUBLIC \"-//ILIAS//DTD Group//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_group_3_8.dtd\">");  
00081                 $this->xmlSetGenCmt("Export of ILIAS group ". $this->group_obj->getId()." of installation ".$this->ilias->getSetting('inst_id').".");
00082                 $this->xmlHeader();
00083 
00084                 $attrs["exportVersion"] = $this->EXPORT_VERSION;
00085                 $attrs["id"] = "il_".$this->ilias->getSetting('inst_id').'_grp_'.$this->group_obj->getId();
00086                 $attrs['type'] = $this->group_obj->readGroupStatus() ? 'open' : 'closed';
00087                 $this->xmlStartTag("group", $attrs);
00088 
00089                 return true;
00090         }
00091 
00092         function __buildTitleDescription()
00093         {
00094                 $this->xmlElement('title',null,$this->group_obj->getTitle());
00095                 
00096                 if($desc = $this->group_obj->getDescription())
00097                 {
00098                         $this->xmlElement('description',null,$desc);
00099                 }
00100 
00101                 $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$this->group_obj->getOwner();
00102                 $this->xmlElement('owner',$attr);
00103         }
00104 
00105         function __buildRegistration()
00106         {
00107                 switch($this->group_obj->getRegistrationFlag())
00108                 {
00109                         case '0':
00110                                 $attr['type'] = 'disabled';
00111                                 break;
00112                         case '1':
00113                                 $attr['type'] = 'enabled';
00114                                 break;
00115                         case '2':
00116                                 $attr['type'] = 'password';
00117                                 break;
00118                 }
00119                 $this->xmlStartTag('registration',$attr);
00120 
00121                 if(strlen($pwd = $this->group_obj->getPassword()))
00122                 {
00123                         $this->xmlElement('password',null,$pwd);
00124                 }
00125                 if($timest = $this->group_obj->getExpirationTimestamp())
00126                 {
00127                         $this->xmlElement('expiration',null,$timest);
00128                 }
00129                 $this->xmlEndTag('registration');
00130         }
00131                 
00132         function __buildAdmin()
00133         {
00134                 foreach($this->group_obj->getGroupAdminIds() as $id)
00135                 {
00136                         $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
00137 
00138                         $this->xmlElement('admin',$attr);
00139                 }
00140                 return true;
00141         }
00142 
00143         function __buildMember()
00144         {
00145                 foreach($this->group_obj->getGroupMemberIds() as $id)
00146                 {
00147                         if(!$this->group_obj->isAdmin($id))
00148                         {
00149                                 $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
00150                                 
00151                                 $this->xmlElement('member',$attr);
00152                         }
00153                 }
00154                 return true;
00155         }
00156 
00157         function __buildFooter()
00158         {
00159                 $this->xmlEndTag('group');
00160         }
00161 }
00162 
00163 
00164 ?>

Generated on Fri Dec 13 2013 17:56:47 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1