![]() |
Xataface 2.0
Xataface Application Framework
|
00001 <?php 00005 class dataface_actions_history { 00006 00007 function handle(&$params){ 00008 $app =& Dataface_Application::getInstance(); 00009 $record =& $app->getRecord(); 00010 $context = array(); 00011 if ( !$record ) return PEAR::raiseError("No record is currently selected", DATAFACE_E_ERROR); 00012 00013 $history_tablename = $record->_table->tablename.'__history'; 00014 if ( !Dataface_Table::tableExists($history_tablename) ) 00015 $context['error'] = PEAR::raiseError("This record has no history yet recorded.", DATAFACE_E_NOTICE); 00016 else { 00017 import('Dataface/HistoryTool.php'); 00018 $history_tool = new Dataface_HistoryTool(); 00019 $history_log = $history_tool->getHistoryLog($record); 00020 $context['log'] =& $history_log; 00021 00022 00023 // let's make a query string for the current record 00024 //current_record_qstr 00025 00026 $keys = array_keys($record->_table->keys()); 00027 $qstr = array(); 00028 foreach ( $keys as $key){ 00029 $qstr[] = urlencode('--__keys__['.$key.']').'='.urlencode('='.$record->strval($key)); 00030 } 00031 $context['current_record_qstr'] = implode('&',$qstr); 00032 } 00033 00034 df_display($context, 'Dataface_RecordHistory.html'); 00035 } 00036 00037 } 00038 00039 ?>