Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
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 ?>