function saveEvent($event)
{
$result = $event->save();
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceof PEAR_Error) {
$GLOBALS['notification']->push($result, 'horde.error');
return true;
}
break;
}
$events = $kronolith_driver->listEvents($start, $end, true, false, true);
- if (is_a($events, 'PEAR_Error')) {
+ if ($events instanceof PEAR_Error) {
$notification->push($events, 'horde.error');
break;
}
break;
}
$event = $kronolith_driver->getEvent($id);
- if (is_a($event, 'PEAR_Error')) {
+ if ($event instanceof PEAR_Error) {
$notification->push($event, 'horde.error');
break;
}
break;
}
$event = $kronolith_driver->getEvent(Horde_Util::getFormData('id'));
- if (is_a($event, 'PEAR_Error')) {
+ if ($event instanceof PEAR_Error) {
$notification->push($event, 'horde.error');
break;
}
try {
$event = Kronolith::quickAdd(Horde_Util::getFormData('text'),
Kronolith::getDefaultCalendar(Horde_Perms::EDIT));
- if (is_a($event, 'PEAR_Error')) {
+ if ($event instanceof PEAR_Error) {
$notification->push($event, 'horde.error');
break;
}
break;
}
$event = $kronolith_driver->getEvent($id);
- if (is_a($event, 'PEAR_Error')) {
+ if ($event instanceof PEAR_Error) {
$notification->push($event, 'horde.error');
break;
}
break;
}
$event = $kronolith_driver->getEvent($id);
- if (is_a($event, 'PEAR_Error')) {
+ if ($event instanceof PEAR_Error) {
$notification->push($event, 'horde.error');
break;
}
break;
}
$deleted = $kronolith_driver->deleteEvent($event->getId());
- if (is_a($deleted, 'PEAR_Error')) {
+ if ($deleted instanceof PEAR_Error) {
$notification->push($deleted, 'horde.error');
break;
}
break;
}
$result = $kronolith_driver->search($query, true);
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceof PEAR_Error) {
$notification->push($result, 'horde.error');
break;
}
}
break;
- case 'SearchCalendars':
- $result = new stdClass;
- $result->events = 'Searched for calendars: ' . Horde_Util::getFormData('title');
- break;
-
- case 'SaveCalPref':
- break;
-
- case 'ChunkContent':
- $chunk = basename(Horde_Util::getPost('chunk'));
- if (!empty($chunk)) {
- $result = new stdClass;
- $result->chunk = Horde_Util::bufferOutput('include', KRONOLITH_TEMPLATES . '/chunks/' . $chunk . '.php');
- }
- break;
-
- case 'ListTopTags':
- $tagger = new Kronolith_Tagger();
- $result = new stdClass;
- $result->tags = array();
- $tags = $tagger->getCloud(Horde_Auth::getAuth(), 10);
- foreach ($tags as $tag) {
- $result->tags[] = $tag['tag_name'];
- }
- break;
-
case 'ListTasks':
if (!$registry->hasMethod('tasks/listTasks')) {
break;
$tasktype = Horde_Util::getFormData('type');
$tasks = $registry->call('tasks/listTasks',
array(null, null, null, $tasklist, $tasktype == 'incomplete' ? 'future_incomplete' : $tasktype, true));
- if (is_a($tasks, 'PEAR_Error')) {
+ if ($tasks instanceof PEAR_Error) {
$notification->push($tasks, 'horde.error');
break;
}
break;
}
$task = $registry->tasks->getTask($list, $id);
- if (is_a($task, 'PEAR_Error')) {
+ if ($task instanceof PEAR_Error) {
$notification->push($task, 'horde.error');
break;
}
} else {
$result = $registry->tasks->addTask($task);
}
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceof PEAR_Error) {
$notification->push($result, 'horde.error');
break;
}
$id = $result[0];
}
$task = $registry->tasks->getTask($task['tasklist'], $id);
- if (is_a($task, 'PEAR_Error')) {
+ if ($task instanceof PEAR_Error) {
$notification->push($task, 'horde.error');
break;
}
break;
}
$result = $registry->tasks->deleteTask($list, $id);
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceof PEAR_Error) {
$notification->push($result, 'horde.error');
break;
}
$taskid = Horde_Util::getFormData('id');
$saved = $registry->call('tasks/toggleCompletion',
array($taskid, $tasklist));
- if (is_a($saved, 'PEAR_Error')) {
+ if ($saved instanceof PEAR_Error) {
$notification->push($saved, 'horde.error');
break;
}
$result->toggled = true;
break;
+ case 'ListTopTags':
+ $tagger = new Kronolith_Tagger();
+ $result = new stdClass;
+ $result->tags = array();
+ $tags = $tagger->getCloud(Horde_Auth::getAuth(), 10);
+ foreach ($tags as $tag) {
+ $result->tags[] = $tag['tag_name'];
+ }
+ break;
+
+ case 'SearchCalendars':
+ $result = new stdClass;
+ $result->events = 'Searched for calendars: ' . Horde_Util::getFormData('title');
+ break;
+
+ case 'SaveCalPref':
+ break;
+
+ case 'ChunkContent':
+ $chunk = basename(Horde_Util::getPost('chunk'));
+ if (!empty($chunk)) {
+ $result = new stdClass;
+ $result->chunk = Horde_Util::bufferOutput('include', KRONOLITH_TEMPLATES . '/chunks/' . $chunk . '.php');
+ }
+ break;
+
default:
$notification->push('Unknown action ' . $action, 'horde.error');
break;