• Main Page
  • Related Pages
  • 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();
00075         }
00076 
00077         // PRIVATE
00078         function __buildHeader()
00079         {
00080                 $this->xmlSetDtdDef("<!DOCTYPE Group SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_group_0_1.dtd\">");
00081                 $this->xmlSetGenCmt("Export of ILIAS group ".
00082                                                         $this->group_obj->getId()." of installation ".$this->ilias->getSetting('inst_id').".");
00083                 $this->xmlHeader();
00084 
00085                 $attrs["exportVersion"] = $this->EXPORT_VERSION;
00086                 $attrs["id"] = "il_".$this->ilias->getSetting('inst_id').'_grp_'.$this->group_obj->getId();
00087                 $attrs['type'] = $this->group_obj->getGroupStatus() ? 'open' : 'closed';
00088                 $this->xmlStartTag("group", $attrs);
00089 
00090                 return true;
00091         }
00092 
00093         function __buildTitleDescription()
00094         {
00095                 $this->xmlElement('title',null,$this->group_obj->getTitle());
00096                 
00097                 if($desc = $this->group_obj->getDescription())
00098                 {
00099                         $this->xmlElement('description',null,$desc);
00100                 }
00101 
00102                 $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$this->group_obj->getOwner();
00103                 $this->xmlElement('owner',$attr);
00104         }
00105 
00106         function __buildRegistration()
00107         {
00108                 switch($this->group_obj->getRegistrationFlag())
00109                 {
00110                         case '0':
00111                                 $attr['type'] = 'disabled';
00112                                 break;
00113                         case '1':
00114                                 $attr['type'] = 'enabled';
00115                                 break;
00116                         case '2':
00117                                 $attr['type'] = 'password';
00118                                 break;
00119                 }
00120                 $this->xmlStartTag('registration',$attr);
00121 
00122                 if(strlen($pwd = $this->group_obj->getPassword()))
00123                 {
00124                         $this->xmlElement('password',null,$pwd);
00125                 }
00126                 if($timest = $this->group_obj->getExpirationTimestamp())
00127                 {
00128                         $this->xmlElement('expiration',null,$timest);
00129                 }
00130                 $this->xmlEndTag('registration');
00131         }
00132                 
00133         function __buildAdmin()
00134         {
00135                 foreach($this->group_obj->getGroupAdminIds() as $id)
00136                 {
00137                         $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
00138 
00139                         $this->xmlElement('admin',$attr);
00140                 }
00141                 return true;
00142         }
00143 
00144         function __buildMember()
00145         {
00146                 foreach($this->group_obj->getGroupMemberIds() as $id)
00147                 {
00148                         if(!$this->group_obj->isAdmin($id))
00149                         {
00150                                 $attr['id'] = 'il_'.$this->ilias->getSetting('inst_id').'_usr_'.$id;
00151                                 
00152                                 $this->xmlElement('member',$attr);
00153                         }
00154                 }
00155                 return true;
00156         }
00157 
00158         function __buildFooter()
00159         {
00160                 $this->xmlEndTag('group');
00161         }
00162 }
00163 
00164 
00165 ?>

Generated on Fri Dec 13 2013 11:57:54 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1