DataObjects/Core_watch.php
[Pman.Core] / DataObjects / Core_watch.php
index edc38e4..0f9b19f 100644 (file)
@@ -1,3 +1,4 @@
+
 <?php
 /**
  * Table Definition for core_watch
@@ -47,12 +48,61 @@ 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, substring_index(event, '.')) as event_left,
+                substr( event, 0, substring_index(event, '.')) as event_right        
+                             
+            ");
+            
+            
+            
+        }
+        
+    }
+    
+    function toRooArraySingle($q)
+    {
+        die("here");
+        
+    }
+    
+    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);