From 2ecf34d104d2a9a4b7f693eccaf6cc4017a5b859 Mon Sep 17 00:00:00 2001 From: edward Date: Wed, 30 Mar 2016 18:28:34 +0800 Subject: [PATCH] RooTrait.php --- RooTrait.php | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/RooTrait.php b/RooTrait.php index e4c5e1ce..cb5f2127 100644 --- a/RooTrait.php +++ b/RooTrait.php @@ -328,8 +328,6 @@ trait Pman_Core_RooTrait { exit; } - - /** a daily cache **/ function jdataCache($cachekey) { @@ -342,4 +340,33 @@ trait Pman_Core_RooTrait { return false; } + + function addEvent($act, $obj = false, $remarks = '') + { + + if (!empty(HTML_FlexyFramework::get()->Pman['disable_events'])) { + return; + } + $au = $this->getAuthUser(); + + $e = DB_DataObject::factory('Events'); + $e->init($act,$obj,$remarks); + + $e->event_when = date('Y-m-d H:i:s'); + + $eid = $e->insert(); + + // fixme - this should be in onInsert.. + $wa = DB_DataObject::factory('core_watch'); + if (method_exists($wa,'notifyEvent')) { + $wa->notifyEvent($e); // trigger any actions.. + } + + + $e->onInsert(isset($_REQUEST) ? $_REQUEST : array() , $this); + + + return $e; + + } } -- 2.39.2