createFeedForNode() public static method

Creates a RSS/ATOM Feed export for a node
Since: 4.3
public static createFeedForNode ( integer $nodeID )
$nodeID integer Node ID
Beispiel #1
0
     $user = eZUser::currentUser();
     $hasAccess = $user->hasAccessTo('rss', 'edit');
     if ($hasAccess['accessWord'] === 'no') {
         return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
     }
     // Then make sure we have node id parameter
     if (!$http->hasPostVariable('NodeID')) {
         eZDebug::writeError('Create/ Remove NodeFeed: missing node ID parameter.', 'content-action-handler');
         return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
     }
     $nodeID = $http->postVariable('NodeID');
     if ($http->hasPostVariable('CreateNodeFeed')) {
         if (eZOperationHandler::operationIsAvailable('content_createnodefeed')) {
             $operationResult = eZOperationHandler::execute('content', 'createnodefeed', array('node_id' => $nodeID), null, true);
         } else {
             $operationResult = eZContentOperationCollection::createFeedForNode($nodeID);
         }
     } else {
         if (eZOperationHandler::operationIsAvailable('content_removenodefeed')) {
             $operationResult = eZOperationHandler::execute('content', 'removenodefeed', array('node_id' => $nodeID), null, true);
         } else {
             $operationResult = eZContentOperationCollection::removeFeedForNode($nodeID);
         }
     }
     if (!isset($operationResult['status']) || !$operationResult['status']) {
         return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
     }
     return $module->redirectToView('view', array('full', $nodeID));
 } else {
     // Check if there are any custom actions to handle
     $customActions = eZINI::instance('datatype.ini')->variable('ViewSettings', 'CustomActionMap');