+
<?php
/**
* Table Definition for core_watch
###END_AUTOCODE
/** make sure there is a watch for this user.. */
+
+ function applyFilters($q,$au, $roo)
+ {
+ if (!empty($q['_list_actions'])) {
+ $this->listActions($roo,$q);
+ }
+ //die("apply filters");
+ if (!empty($q['_split_event_name'])) {
+ $this->selectAdd("
+
+ substr( event, substring_index(event, '.')) as event_left,
+ substr( event, 0, substring_index(event, '.')) as event_right
+
+ ");
+
+
+
+ }
+
+ }
+ function listActions($roo, $q) {
+
+ //print_r($q);
+ $d = DB_DataObject::Factory($q['on_table']);
+ $ret = array();
+
+ foreach(get_class_methods($d) as $m) {
+ //var_dump($m);
+ if (!preg_match('/^notify/', $m)) {
+ continue;
+ }
+ $ret[] = array(
+ 'display_name' => preg_replace('/^notify/', '' , $m),
+ 'name' => $q['on_table'] .':'. $m
+ );
+ }
+ $roo->jdata($ret);
+ }
+
/**
*
* Create a watch...
*
*/
+
+
+
function ensureNotify( $ontable, $onid, $person_id, $whereAdd)
{
//DB_DAtaObject::debugLevel(1);
function notifyEvent($event)
{
//print_r($event);
- DB_DataObject::DebugLevel(1);
+ //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... -
$watches = $w->fetchAll();
- print_R($watches); //exit;
+ //print_R($watches); //exit;
$nn = DB_DataObject::Factory('core_notify');
$nn->ontable = $event->on_table;
// in which case we set the set $nn->evtype = medium..
// in that case - just let the called method generate the notify..
-
+ //print_R($dom);
$do = DB_DataObject::factory($dom[0]);
if (!method_exists($do,$dom[1])) {
continue;
continue;
}
//echo "inserting notify?";
- $n->act_start( date("Y-m-d H:i:s") );
+ $n->act_start( empty($n->act_start) ? date("Y-m-d H:i:s") : $n->act_start );
$n->insert();
-
-
}