/**
* Returns the driver object for a calendar.
*
* @param string $cal A calendar string in the format "type|name".
*
* @return Kronolith_Driver|boolean A driver instance or false on failure.
*/
protected function _getDriver($cal)
{
list($driver, $calendar) = explode('|', $cal);
if ($driver == 'internal' && !Kronolith::hasPermission($calendar, Horde_Perms::SHOW)) {
$GLOBALS['notification']->push(_("Permission Denied"), 'horde.error');
return false;
}
try {
$kronolith_driver = Kronolith::getDriver($driver, $calendar);
} catch (Exception $e) {
$GLOBALS['notification']->push($e, 'horde.error');
return false;
}
if ($driver == 'remote') {
$kronolith_driver->setParam('timeout', 15);
}
return $kronolith_driver;
}