$nw->insert();
}
-
+ /**
+ * Generate a notify event based on watches (matching whereAdd)
+ *
+ */
function notify($ontable , $onid, $whereAdd)
{
$w = DB_DataObject::factory('core_watch');
// static really...
function notifyEvent($event)
{
+ //DB_DataObject::DebugLevel(1);
// see if there are any watches on events..
-
+ // notify everyone flagged except the person doing it...
+ // this is very basic logic... -
+ // if more intelligence is needed...
+ // then it 'rules' will have to be added by the watched object....
+ // anyway leave that for another day..
+ if (empty($event->action)) {
+ return;
+ }
$w = DB_DataObject::factory('core_watch');
$w->ontable = $event->on_table;
$w->whereAdd('onid = 0 OR onid='. ((int) $event->on_id));
+
$w->event = $event->action;
+ $w->active = 1;
+
+ $w->whereAdd('person_id != '. (int) $event->person_id);
+
$watches = $w->fetchAll();
}
$n = clone($nn);
- $n->person_id = $p;
+ $n->trigger_person_id = $event->person_id;
+ $n->trigger_event_id = $event->id;
+ $n->person_id = $watch->person_id;
$n->watch_id = $watch->id;
+ // does this watch already have a flag...
$nf = clone($n);
$nf->whereAdd('sent < act_when');
if ($nf->count()) {
-
}