X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=DataObjects%2FCore_watch.php;h=c8edc1a7408045843112bc2909b15b983d26a267;hp=edc38e4f8cb41fc695f93452eb20670febb9716c;hb=7eb719bb92e1632dddf2ea250016038d905bf188;hpb=58f497e06f220823bb854277160de7caf1888375 diff --git a/DataObjects/Core_watch.php b/DataObjects/Core_watch.php index edc38e4f..c8edc1a7 100644 --- a/DataObjects/Core_watch.php +++ b/DataObjects/Core_watch.php @@ -47,12 +47,75 @@ class Pman_Core_DataObjects_Core_watch extends DB_DataObject ###END_AUTOCODE /** make sure there is a watch for this user.. */ + + function applyFilters($q,$au, $roo) + { + if (!empty($q['_list_actions'])) { + $this->listActions($roo,$q); + } + //die("apply filters"); + if (!empty($q['_split_event_name'])) { + $this->selectAdd(" + + substr( event, 1, LOCATE( '.',event)) as event_left, + substr( event, LOCATE( '.',event)) as event_right + + "); + + + + } + + } + + function toRooSingleArray($au,$q) + { + $ret = $this->toArray(); + if (empty($q['_split_event_name'])) { + return $ret; + } + $bits = explode('.', $this->event); + $ret['event_left'] = $bits[0]; + $ret['event_right'] = $bits[1]; + // check core enu. + if (!empty($ret['event_right'])) { + $ce = DB_DataObject::factory('core_enum')->lookupObject($q['_split_event_name'], $ret['event_right']); + $ret['event_right_display_name'] = $ce->display_name; + } + + return $ret; + + + } + + function listActions($roo, $q) { + + //print_r($q); + $d = DB_DataObject::Factory($q['on_table']); + $ret = array(); + + foreach(get_class_methods($d) as $m) { + //var_dump($m); + if (!preg_match('/^notify/', $m)) { + continue; + } + $ret[] = array( + 'display_name' => preg_replace('/^notify/', '' , $m), + 'name' => $q['on_table'] .':'. $m + ); + } + $roo->jdata($ret); + } + /** * * Create a watch... * */ + + + function ensureNotify( $ontable, $onid, $person_id, $whereAdd) { //DB_DAtaObject::debugLevel(1);