3 * Table Definition for core_event_audit
5 require_once 'DB/DataObject.php';
7 class Pman_Core_DataObjects_Core_event_audit extends DB_DataObject
10 /* the code below is auto generated do not remove the above tag */
12 public $__table = 'core_event_audit'; // table name
13 public $id; // int(11) not_null primary_key auto_increment
14 public $event_id; // int(11) not_null multiple_key
15 public $name; // string(128)
16 public $old_audit_id; // int(11) blob
17 public $newvalue; // blob(65535) blob
20 /* the code above is auto generated do not remove the tag below */
28 function newvalue($event)
30 $x = DB_DataObject::factory($event->on_table);
32 // is the name a link..
33 if (!isset($ar[$this->name])) {
36 if (empty($this->value) ) {
40 // get the current value of that...
41 $lr = explode(':', $ar[$this->name]);
42 $x = DB_DataObject::factory($lr[0]);
43 if (!method_exists($x, 'toEventString')) {
44 return $lr[0] .':'. $this->value;
46 $x->get($this->value);
48 return $x->toEventString(); // big assumption..
51 function oldvalue($event)
53 if (!$this->old_audit_id) {
56 //var_dump($cg->ontable);
57 $x = DB_DataObject::factory('core_event_audit');
58 $x->get($this->old_audit_id);
59 return $x->newvalue($event);
62 function findLast($event, $name)
64 //DB_DataObject::debugLevel(1);
65 $x = DB_DataObject::factory('core_event_audit');
70 $x->selectAdd('core_event_audit.id as id');
74 join_event_id_id.on_table = '{$event->on_table}' AND
75 join_event_id_id.on_id = {$event->on_id}
77 $x->orderBy('join_event_id_id.event_when DESC');
79 if (!$x->find(true)) {