DataObjects/Core_notify.php
authorAlan Knowles <alan@akbkhome.com>
Tue, 14 Jun 2011 03:17:08 +0000 (11:17 +0800)
committerAlan Knowles <alan@akbkhome.com>
Tue, 14 Jun 2011 03:17:08 +0000 (11:17 +0800)
DataObjects/Core_notify.php [new file with mode: 0644]

diff --git a/DataObjects/Core_notify.php b/DataObjects/Core_notify.php
new file mode 100644 (file)
index 0000000..3951d5c
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/**
+ *
+ * Table is designed to be used with a mailer to notify or issue
+ * emails (or maybe others later??)
+ *
+ *
+CREATE TABLE  core_notify  (
+  `id` int(11)  NOT NULL AUTO_INCREMENT,
+  `act_when` DATETIME NOT NULL,
+  `onid` int(11)  NOT NULL DEFAULT 0,
+  `ontable` varchar(128)  NOT NULL DEFAULT '',
+  `person_id` int(11)  NOT NULL DEFAULT 0,
+  `msgid` varchar(128)  NOT NULL  DEFAULT '',
+  `sent` DATETIME  NOT NULL,
+  `event_id` int(11)  NOT NULL DEFAULT 0,
+  PRIMARY KEY (`id`),
+  INDEX `lookup`(`act_when`, `msgid`)
+);
+**/
+
+require_once 'DB/DataObject.php';
+
+class Pman_Core_DataObjects_Core_notify extends DB_DataObject 
+{
+    ###START_AUTOCODE
+    /* the code below is auto generated do not remove the above tag */
+
+    public $__table = 'core_notify';                     // table name
+    public $id;                              // int(11)  not_null primary_key auto_increment
+    public $act_when;                        // datetime(19)  not_null multiple_key binary
+    public $onid;                            // int(11)  not_null
+    public $ontable;                         // string(128)  not_null
+    public $person_id;                       // int(11)  not_null
+    public $msgid;                           // string(128)  not_null
+    public $sent;                            // datetime(19)  not_null binary
+    public $event_id;                        // int(11)  
+
+    
+    /* the code above is auto generated do not remove the tag below */
+    ###END_AUTOCODE
+    
+    function person()
+    {
+        $c = DB_DataObject::Factory('Person');
+        $c->get($this->person_id);
+        return $c;
+        
+    }
+    function object()
+    {
+        $c = DB_DataObject::factory($this->ontable);
+        $c->autoJoin();
+        if ($c->get($this->onid)) {
+            return $c;
+        }
+        return false;
+        
+    }
+    
+    function delivered()
+    {
+        return !empty($msgid);
+    }
+    
+
+}