DataObjects/Core_notify.php
[Pman.Core] / DataObjects / Core_notify.php
1 <?php
2 /**
3  *
4  * Table is designed to be used with a mailer to notify or issue
5  * emails (or maybe others later??)
6  *
7  *
8 CREATE TABLE  core_notify  (
9   `id` int(11)  NOT NULL AUTO_INCREMENT,
10   `act_when` DATETIME NOT NULL,
11   `onid` int(11)  NOT NULL DEFAULT 0,
12   `ontable` varchar(128)  NOT NULL DEFAULT '',
13   `person_id` int(11)  NOT NULL DEFAULT 0,
14   `msgid` varchar(128)  NOT NULL  DEFAULT '',
15   `sent` DATETIME  NOT NULL,
16   `event_id` int(11)  NOT NULL DEFAULT 0,
17   PRIMARY KEY (`id`),
18   INDEX `lookup`(`act_when`, `msgid`)
19 );
20 */
21 require_once 'DB/DataObject.php';
22
23 class Pman_Core_DataObjects_Core_notify extends DB_DataObject 
24 {
25     ###START_AUTOCODE
26     /* the code below is auto generated do not remove the above tag */
27
28     public $__table = 'core_notify';                     // table name
29     public $id;                              // int(11)  not_null primary_key auto_increment
30     public $act_when;                        // datetime(19)  not_null multiple_key binary
31     public $onid;                            // int(11)  not_null
32     public $ontable;                         // string(128)  not_null
33     public $person_id;                       // int(11)  not_null
34     public $msgid;                           // string(128)  not_null
35     public $sent;                            // datetime(19)  not_null binary
36     public $event_id;                        // int(11)  
37
38     
39     /* the code above is auto generated do not remove the tag below */
40     ###END_AUTOCODE
41     
42     function person()
43     {
44         $c = DB_DataObject::Factory('Person');
45         $c->get($this->person_id);
46         return $c;
47         
48     }
49     function object()
50     {
51         $c = DB_DataObject::factory($this->ontable);
52         $c->autoJoin();
53         if ($c->get($this->onid)) {
54             return $c;
55         }
56         return false;
57         
58     }
59     
60     function delivered()
61     {
62         return !empty($msgid);
63     }
64     
65 }
66 }