1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
<?php
$block_name = _("Menu Alarms");
$block_type = 'tree';
/**
* $Horde: kronolith/lib/Block/tree_alarms.php,v 1.1.2.6 2008/01/02 16:50:49 chuck Exp $
*
* @package Horde_Block
*/
class Horde_Block_kronolith_tree_alarms extends Horde_Block {
var $_app = 'kronolith';
function _buildTree(&$tree, $indent = 0, $parent = null)
{
require_once dirname(__FILE__) . '/../base.php';
$horde_alarm = null;
if (!empty($GLOBALS['conf']['alarms']['driver'])) {
require_once 'Horde/Alarm.php';
$horde_alarm = Horde_Alarm::factory();
}
$alarmCount = 0;
$alarms = Kronolith::listAlarms(new Horde_Date($_SERVER['REQUEST_TIME']),
$GLOBALS['display_calendars'],
true);
if (is_a($alarms, 'PEAR_Error')) {
return $alarms;
}
foreach ($alarms as $calId => $calAlarms) {
foreach ($calAlarms as $event) {
if ($horde_alarm && $horde_alarm->isSnoozed($event->getUID(), Auth::getAuth())) {
continue;
}
$alarmCount++;
$tree->addNode($parent . $calId . $event->getId(),
$parent,
$event->getTitle(),
$indent + 1,
false,
array('icon' => 'alarm.png',
'icondir' => $GLOBALS['registry']->getImageDir(),
'title' => $event->getTooltip(),
'url' => $event->getViewUrl()));
}
}
if ($registry->get('url', $parent)) {
$purl = $registry->get('url', $parent);
} elseif ($registry->get('status', $parent) == 'heading' ||
!$registry->get('webroot')) {
$purl = null;
} else {
$purl = Horde::url($registry->getInitialPage($parent));
}
$pnode_params = array('url' => $purl,
'icon' => $registry->get('icon', $parent),
'icondir' => '');
$pnode_name = $registry->get('name', $parent);
if ($alarmCount) {
$pnode_name = '<strong>' . $pnode_name . '</strong>';
}
$tree->addNode($parent, $registry->get('menu_parent', $parent),
$pnode_name, $indent, false, $pnode_params);
}
}
|