Xataface 2.0
Xataface Application Framework
actions/export_xml.php
Go to the documentation of this file.
00001 <?php
00002 import('Dataface/XMLTool.php');
00003 class dataface_actions_export_xml {
00004         function handle(&$params){
00005                 import('Dataface/XMLTool/default.php');
00006                 $xml = new Dataface_XMLTool_default();
00007                 $xml->expanded = true;
00008                 
00009                 $app =& Dataface_Application::getInstance();
00010                 $query =& $app->getQuery();
00011                 
00012                 $input = array();
00013                 
00014                 if ( isset($query['--single-record-only']) ){
00015                         $record =& $app->getRecord();
00016                         if ( $record->checkPermission('view xml') ){
00017                                 $input[] = $record;
00018                         }
00019                         
00020                 } else if ( @$query['-relationship'] ) {
00021                         $query['-related:limit'] = 9999;
00022                         $query['-related:start'] = 0;
00023                         $record =& $app->getRecord();
00024                         
00025                         $rrecords =& df_get_related_records($query); // $record->getRelatedRecordObjects( $query['-relationship'], 'all' );
00026                         foreach ($rrecords as $rrecord){
00027                                 $drecord =& $rrecord->toRecord();
00028                                 if ( $drecord->checkPermission('view xml') ){
00029                                         $input[] = $drecord;
00030                                 }
00031                                 unset($drecord);
00032                                 unset($rrecord);
00033                         }
00034                 
00035                 } else {
00036                         $records = df_get_records_array($query['-table'], $query,null,null,false);
00037                         foreach ($records as $record){
00038                                 if ( $record->checkPermission('view xml') ){
00039                                         $input[] = $record;
00040                                 }
00041                         }       
00042                 }
00043                 
00044                 echo $xml->header();
00045                 echo $xml->toXML($input);
00046                 echo $xml->footer();
00047                 exit;
00048                 
00049         }
00050 
00051 }
00052 
All Data Structures Namespaces Files Functions Variables Enumerations