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 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 ?>