Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
history.php
Go to the documentation of this file.
1 <?php
6 
7  function handle(&$params){
9  $record =& $app->getRecord();
10  $context = array();
11  if ( !$record ) return PEAR::raiseError("No record is currently selected", DATAFACE_E_ERROR);
12 
13  $history_tablename = $record->_table->tablename.'__history';
14  if ( !Dataface_Table::tableExists($history_tablename) )
15  $context['error'] = PEAR::raiseError("This record has no history yet recorded.", DATAFACE_E_NOTICE);
16  else {
17  import('Dataface/HistoryTool.php');
18  $history_tool = new Dataface_HistoryTool();
19  $history_log = $history_tool->getHistoryLog($record);
20  $context['log'] =& $history_log;
21 
22 
23  // let's make a query string for the current record
24  //current_record_qstr
25 
26  $keys = array_keys($record->_table->keys());
27  $qstr = array();
28  foreach ( $keys as $key){
29  $qstr[] = urlencode('--__keys__['.$key.']').'='.urlencode($record->strval($key));
30  }
31  $context['current_record_qstr'] = implode('&',$qstr);
32  }
33 
34  df_display($context, 'Dataface_RecordHistory.html');
35  }
36 
37 }
38 
39 ?>