phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property/inc/class.boalarm.inc.php, 1.7.2.5


From: nomail
Subject: [Phpgroupware-cvs] property/inc/class.boalarm.inc.php, 1.7.2.5
Date: Mon, 13 Dec 2004 17:09:09 +0100

Update of /property/inc
Modified Files:
        Branch: proposed-0_9_18-branch
          class.boalarm.inc.php

date: 2004/12/13 16:09:09;  author: sigurdne;  state: Exp;  lines: +35 -24

Log Message:
no message
=====================================================================
Index: property/inc/class.boalarm.inc.php
diff -u property/inc/class.boalarm.inc.php:1.7.2.4 
property/inc/class.boalarm.inc.php:1.7.2.5
--- property/inc/class.boalarm.inc.php:1.7.2.4  Sun Dec 12 22:38:38 2004
+++ property/inc/class.boalarm.inc.php  Mon Dec 13 16:09:09 2004
@@ -187,14 +187,13 @@
                        {
                                return False;
                        }
-                       list($id,$job) = each($jobs);
-                       $alarm         = $job['data'];  // text, enabled
-                       $alarm['id']   = $id;
-                       $alarm['time'] = $job['next'];
-                       $alarm['times'] = $job['times'];
 
+                       $alarm         = $jobs[$id]['data'];    // text, enabled
+                       $alarm['id']   = $id;
+                       $alarm['time'] = $jobs[$id]['next'];
+                       $alarm['times'] = $jobs[$id]['times'];
 
-                       //echo "<p>read_alarm('$id')="; print_r($alarm); echo 
"</p>\n";
+//                     echo "<p>read_alarm('$id')="; print_r($alarm); echo 
"</p>\n";
                        return $alarm;
                }
 
@@ -210,7 +209,6 @@
                */
                function enable_alarm($alarm_type,$alarms,$enable=True)
                {
-//_debug_array($alarms);
                        $enabled = 0;
                        foreach ($alarms as $id => $field)
                        {
@@ -232,8 +230,8 @@
                                }
 */
                                $alarm['enabled'] = intval(!$alarm['enabled']);
-//_debug_array($alarm['entity_id']);
-                               if 
($this->save_alarm($alarm_type,$alarm['entity_id'],$alarm))
+
+                               if 
($this->save_alarm($alarm_type,$alarm['event_id'],$alarm))
                                {
                                        ++$enabled;
                                }
@@ -249,36 +247,43 @@
                @param $cal_id Id of the calendar-entry
                @param $alarm array with fields: text, owner, enabled, ..
                */
-               function save_alarm($alarm_type,$entity_id,$alarm,$method='')
+               function save_alarm($alarm_type,$event_id,$alarm,$method='')
                {
+
+//_debug_array($alarm);
                        if(!$method)
                        {
                                $method = $this->currentapp 
.'.boalarm.send_alarm';
                        }
-//                     echo "<p>save_alarm(entity_id=$entity_id, alarm="; 
print_r($alarm); echo ")</p>\n";
-                       if (!($id = $alarm['id']))
+//                     echo "<p>save_alarm(event_id=$event_id, alarm="; 
print_r($alarm); echo ")</p>\n";
+
+                       if (!$alarm['id'])
                        {
-                               $alarms = 
$this->read_alarms($alarm_type,$entity_id);   // find a free alarm#
+                               $alarms = 
$this->read_alarms($alarm_type,$event_id);    // find a free alarm#
                                $n = count($alarms);
                                do
                                {
-                                       $id = $alarm_type 
.':'.intval($entity_id).':'.$n;
+                                       $id = $alarm_type 
.':'.intval($event_id).':'.$n;
                                        ++$n;
                                }
                                while (@isset($alarms[$id]));
+
+                               $alarm[$alarm_type.'_id'] = $event_id;          
// we need the back-reference
+
+                               $alarm['id'] = $id;
+
+                               if 
(!$this->async->set_timer($alarm['times'],$id,$method,$alarm))
+                               {
+                                       return False;
+                               }
+                               return $id;
                        }
                        else
                        {
-                               $this->async->cancel_timer($id);
-                       }
-                       $alarm[$alarm_type.'_id'] = $entity_id;         // we 
need the back-reference
-                       $alarm['id'] = $id;
-
-                       if 
(!$this->async->set_timer($alarm['time'],$id,$method,$alarm))
-                       {
-                               return False;
+                               $this->async->cancel_timer($alarm['id']);
+                               
$this->async->set_timer($alarm['times'],$alarm['id'],$method,$alarm);
+                               return $alarm['id'];
                        }
-                       return $id;
                }
 
                /*!
@@ -351,6 +356,12 @@
                }
 
 
+               function test_cron()
+               {
+                       $this->async->check_run('crontab');
+               }
+
+
                function send_alarm($alarm)
                {
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]