Xataface 2.0
Xataface Application Framework
actions/feed.php
Go to the documentation of this file.
00001 <?php
00012 class dataface_actions_feed {
00013 
00017         function handle(&$params){
00018                 import('Dataface/FeedTool.php');
00019                 $app =& Dataface_Application::getInstance();
00020                 $ft = new Dataface_FeedTool();
00021                 
00022                 
00023                 $query = $app->getQuery();
00024                 if ( @$query['-relationship'] ){
00025                         $record =& $app->getRecord();
00026                         $perms = $record->getPermissions(array('relationship'=>$query['-relationship']));
00027                         if ( !@$perms['related records feed'] ) return Dataface_Error::permissionDenied('You don\'t have permission to view this relationship.');
00028 
00029                 
00030                 }
00031                 
00032                 header("Content-Type: application/xml; charset=".$app->_conf['oe']);
00033                 $conf = $ft->getConfig();
00034                 
00035                 $query['-skip'] = 0;
00036                 if ( !isset($query['-sort']) and !@$query['-relationship']){
00037                         $table =& Dataface_Table::loadTable($query['-table']);
00038                         $modifiedField = $table->getLastUpdatedField(true);
00039                         if ( $modifiedField ){
00040                                 $query['-sort'] = $modifiedField.' desc';
00041                         }
00042                 }
00043                 
00044                 if ( !isset($query['-limit']) and !@$query['-relationship']){
00045                         $default_limit = $conf['default_limit'];
00046                         if ( !$default_limit ){
00047                                 $default_limit = 60;
00048                         }
00049                         $query['-limit'] = $default_limit;
00050                 }
00051                 
00052                 if ( isset($query['--format']) ){
00053                         $format = $query['--format'];
00054                 } else {
00055                         $format = 'RSS1.0';
00056                 }
00057                 echo $ft->getFeedXML($query,$format);
00058                 exit;
00059         }
00060 }
00061 
00062 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations