Xataface 2.0
Xataface Application Framework
actions/invalidate_translations.php
Go to the documentation of this file.
00001 <?php
00010 class dataface_actions_invalidate_translations {
00011 
00012 
00013         function handle(&$params){
00014         
00015                 $app =& Dataface_Application::getInstance();
00016                 if ( !isset($_POST['--confirm_invalidate']) ){
00017                         return PEAR::raiseError("Cannot invalidate translations with a GET request.  Please provide the POST parameter '--confirm_invalidate'");
00018                 }
00019                 
00020                 $record =& $app->getRecord();
00021                 if ( !$record ){
00022                         return PEAR::raiseError("Attempt to invalidate translations on null record.  No record could be found to match the query parameters.");
00023                 }
00024                 
00025                 import('Dataface/TranslationTool.php');
00026                 $tt = new Dataface_TranslationTool();
00027                 $res = $tt->markNewCanonicalVersion($record, basename($app->_conf['default_language']));
00028                 if ( PEAR::isError($res) ){
00029                         return $res;
00030                 }
00031                 
00032                 $query =& $app->getQuery();
00033                 if ( isset($query['--redirect']) ){
00034                         $app->redirect($query['--redirect'].'&--msg='.urlencode("Translations successfully invalidated."));
00035                 } else {
00036                         $app->redirect($record->getURL('-action=edit').'&--msg='.urlencode('Translations successfully invalidated.'));
00037                 }
00038         }
00039 }
00040 
00041 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations