DataObjects/Core_notify.php
[Pman.Core] / DataObjects / Core_notify.php
index 3b174ed..790d475 100644 (file)
@@ -105,11 +105,34 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject
         return false;
         
     }
+    
+    function triggerEvent()
+    {
+
+        $c = DB_DataObject::factory('Events');
+        
+        if ($c->get($this->trigger_event_id)) {
+            return $c;
+        }
+        return false;
+        
+    }
+    
     function delivered()
     {
         return !empty($this->msgid);
     }
     
+    function whereAddDeliveryStatus($delivered = false)
+    {
+        $tn = $this->tableName();
+        if ($delivered) {
+            $this->whereAdd("$tn.msgid IS NOT NULL AND $tn.msgid != ''");
+        } else {
+            $this->whereAdd("$tn.msgid IS NULL OR $tn.msgid = ''");    
+        }
+    }
+    
     function status() // used by commandline reporting at present..
     {
         switch($this->event_id) {
@@ -167,6 +190,9 @@ class Pman_Core_DataObjects_Core_notify extends DB_DataObject
                 case 'PENDING';
                     $this->whereAdd('event_id = 0 OR (event_id  > 0 AND act_when > NOW() )');
                     break;
+                case 'OPENED';
+                    $this->whereAdd('is_open > 0');
+                    break;
                 case 'ALL':
                 default:
                     break;