User management for the world wide web

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

XMLExport.php

00001 <?php
00007 class GenieGate_View_XMLExport extends GenieGate_View {
00008     
00016     function GenieGate_View_XMLExport(&$xml,$u,$g,$p){
00017         $this->XML = $xml;
00018         $this->UA = $u;
00019         $this->GM = $g;
00020         $this->PM = $p;
00021     }
00027     function display(){
00028         header("Content-Type: application/x-geniegate-xml");
00029         header("Content-Disposition: attachment; filename=\"members.xml\"");
00030         $key = $this->param("KEY");
00031         if(! $key){
00032             $key = "*";
00033         }
00034         $assoc = $this->UA->scanUsers($key);
00035         $this->XML->start("GenieGate");
00036         $this->_export_groups($this->XML);
00037         $this->_export_sections($this->XML);     
00038         $this->XML->start("Users");
00039         foreach($assoc as $user){
00040             $this->_export_user($user,$this->XML);
00041         }  
00042         $this->XML->close();        
00043         $this->XML->close();
00044         $this->XML->finish();
00045     }
00046     function _export_sections(&$xml){
00047         $sect = $this->PM->getSections(TRUE);      
00048         $xml->start("PropertyDefinitions");
00049         foreach($sect as $key => $info){
00050             $title = $info[0];
00051             $xml->start("PropertySection", array(id => $key, title => $title));
00052             $defs = $info[1];
00053             foreach($info[1] as $prop => $t){
00054                 $xml->atom("PropertyDefinition",array(property => $prop, title => $t));
00055             }
00056             $xml->close();
00057         }   
00058         $xml->close();
00059     }
00060     function _export_groups(&$xml){
00061         $all = $this->GM->getAllGroups();
00062         $xml->start("GroupDefinitions");     
00063         foreach($all as $gid => $inf){       
00064             $xml->atom("GroupDefinition",$inf);
00065         }    
00066         $xml->close();
00067     }
00068 
00069     function _export_user($user,&$xml){
00070         $sect = $this->PM->getSections();      
00071         unset($user[id]);
00072         $xml->start("User",$user);      
00073         $xml->start("Groups");
00074         $groups = $this->GM->getMemberGroups($user[uid]);
00075         foreach($groups as $gid => $diz){
00076             $xml->atom("Group",array(gid => $gid));
00077         }
00078         $xml->close();
00079         
00080         foreach($sect as $id => $name){
00081             $this->_export_section($id,$user[uid],$xml);            
00082         }          
00083         $xml->close();
00084     }
00085 
00086     function _export_section($sid,$uid,&$xml){
00087         $sect = $this->PM->getSection($sid,$uid);              
00088         $xml->start("UserProperties",array(section => $sid));
00089         foreach($sect->getPropertyNames() as $n){
00090             $v = $sect->getProperty($n);
00091             if($v){
00092                 $xml->start("UserProperty",array(property => $n));           
00093                 $xml->text($v);
00094                 $xml->close();
00095             }
00096         }  
00097         $xml->close();
00098     }
00099 }
00100 ?>

DoxyGen Documentation generated by DoxyGen