From: Jan Schneider Date: Tue, 6 Jul 2010 14:03:00 +0000 (+0200) Subject: Show future alarms in the alarm management screen too. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7a2d81fd76e0612c270c8250c9ea50131e1b421f;p=horde.git Show future alarms in the alarm management screen too. --- diff --git a/framework/Alarm/lib/Horde/Alarm.php b/framework/Alarm/lib/Horde/Alarm.php index eeca8604b..c5a836504 100644 --- a/framework/Alarm/lib/Horde/Alarm.php +++ b/framework/Alarm/lib/Horde/Alarm.php @@ -200,6 +200,30 @@ abstract class Horde_Alarm abstract protected function _list($user, Horde_Date $time); /** + * Returns a list of all global alarms from the backend. + * + * @return array A list of alarm hashes. + * @throws Horde_Alarm_Exception + */ + public function globalAlarms() + { + $alarms = $this->_global(); + foreach (array_keys($alarms) as $alarm) { + if (isset($alarms[$alarm]['mail']['body'])) { + $alarms[$alarm]['mail']['body'] = $this->_fromDriver($alarms[$alarm]['mail']['body']); + } + } + return $alarms; + } + + /** + * Returns a list of all global alarms from the backend. + * + * @return array A list of alarm hashes. + */ + abstract protected function _global(); + + /** * Returns an alarm hash from the backend. * * @param string $id The alarm's unique id. diff --git a/framework/Alarm/lib/Horde/Alarm/Sql.php b/framework/Alarm/lib/Horde/Alarm/Sql.php index 8e50f1bfe..bfbaa6950 100644 --- a/framework/Alarm/lib/Horde/Alarm/Sql.php +++ b/framework/Alarm/lib/Horde/Alarm/Sql.php @@ -92,6 +92,31 @@ class Horde_Alarm_Sql extends Horde_Alarm } /** + * Returns a list of all global alarms from the backend. + * + * @return array A list of alarm hashes. + * @throws Horde_Alarm_Exception + */ + protected function _global() + { + $query = sprintf('SELECT alarm_id, alarm_uid, alarm_start, alarm_end, alarm_methods, alarm_params, alarm_title, alarm_text, alarm_snooze, alarm_internal FROM %s WHERE alarm_uid IS NULL OR alarm_uid = \'\' ORDER BY alarm_start, alarm_end', + $this->_params['table']); + + try { + $result = $this->_db->selectAll($query); + } catch (Horde_Db_Exception $e) { + throw new Horde_Alarm_Exception($e); + } + + $alarms = array(); + foreach ($result as $val) { + $alarms[] = $this->_getHash($val); + } + + return $alarms; + } + + /** */ protected function _getHash(array $alarm) { diff --git a/horde/admin/alarms.php b/horde/admin/alarms.php index ebd5446b2..fab67d5fb 100644 --- a/horde/admin/alarms.php +++ b/horde/admin/alarms.php @@ -109,7 +109,7 @@ if ($id) { } try { - $alarms = $horde_alarm->listAlarms(''); + $alarms = $horde_alarm->globalAlarms(); } catch (Horde_Alarm_Exception $e) { $alarms = $e; } diff --git a/horde/docs/CHANGES b/horde/docs/CHANGES index 6fabb531c..69226c73e 100644 --- a/horde/docs/CHANGES +++ b/horde/docs/CHANGES @@ -45,6 +45,7 @@ v4.0-cvs v3.3.9-cvs ---------- +[jan] Show future alarms in the alarm management screen too. [mjr] Fix bug in Horde_Cache that would prevent cache entries from being expired in certain cases, and prevent cache key collisions.