4 * Table is designed to be used with a mailer to notify or issue
5 * emails (or maybe others later??)
8 CREATE TABLE core_notify (
9 `id` int(11) NOT NULL AUTO_INCREMENT,
10 `recur_id` INT(11) NOT NULL;
11 `act_when` DATETIME NOT NULL,
12 `onid` int(11) NOT NULL DEFAULT 0,
13 `ontable` varchar(128) NOT NULL DEFAULT '',
14 `person_id` int(11) NOT NULL DEFAULT 0,
15 `msgid` varchar(128) NOT NULL DEFAULT '',
16 `sent` DATETIME NOT NULL,
17 `event_id` int(11) NOT NULL DEFAULT 0,
19 INDEX `lookup`(`act_when`, `msgid`)
23 require_once 'DB/DataObject.php';
25 class Pman_Core_DataObjects_Core_notify extends DB_DataObject
28 /* the code below is auto generated do not remove the above tag */
30 public $__table = 'core_notify'; // table name
31 public $id; // int(11) not_null primary_key auto_increment
32 public $recur_id; // int(11) not_null
33 public $act_when; // datetime(19) not_null multiple_key binary
34 public $onid; // int(11) not_null
35 public $ontable; // string(128) not_null
36 public $person_id; // int(11) not_null
37 public $msgid; // string(128) not_null
38 public $sent; // datetime(19) not_null binary
39 public $event_id; // int(11)
40 public $watch_id; // int(11)
41 public $trigger_person_id; // int(11)
42 public $trigger_event_id; // int(11)
43 public $evtype; // event type (or method to call)fall
45 /* the code above is auto generated do not remove the tag below */
48 function person($set = false)
51 $this->person_id = is_object($set) ? $set->id : $set;
54 $c = DB_DataObject::Factory('Person');
55 $c->get($this->person_id);
59 function object($set = false)
62 $this->ontable = $set->tableName();
63 $this->onid = $set->id;
66 $c = DB_DataObject::factory($this->ontable);
67 if ($this->onid == 0) {
68 return $c; // empty dataobject.
72 if ($c->get($this->onid)) {
80 function act_start($set = false)
83 return $this->act_start;
85 $this->act_when = $set;
86 $this->act_start = $set;
93 $c = DB_DataObject::factory('Events');
95 if ($c->get($this->event_id)) {
103 return !empty($msgid);
106 function status() // used by commandline reporting at present..
108 switch($this->event_id) {
115 if (strtotime($this->act_when) > time()) {
116 $p = "RETRY: {$this->act_when} ";
118 return $p. $this->event()->remarks;
123 function applyFilters($q, $au, $roo)
125 // if (isset($q['ontable']) && !in_array($q['ontable'], array('Person', 'Events' . 'core_watch'))) {
126 // // this will only work on tables not joined to ours.
128 // //DB_DAtaObject::DebugLevel(1);
129 // // then we can build a join..
130 // $d = DB_DataObject::Factory($q['ontable']);
132 // $this->selectAdd($d->_query['data_select']);
134 // LEFT JOIN {$d->tableName()} ON {$this->tableName()}.onid = {$d->tableName()}.id
138 // if (isset($q['query']['person_id_name']) ) {
139 // $this->whereAdd( "join_person_id_id.name LIKE '{$this->escape($q['query']['person_id_name'])}%'");