public static function addShare($info)
{
global $calendar_manager, $injector, $prefs, $registry;
$kronolith_shares = $injector->getInstance('Kronolith_Shares');
try {
$calendar = $kronolith_shares->newShare($registry->getAuth(), strval(new Horde_Support_Randomid()), $info['name']);
} catch (Horde_Share_Exception $e) {
throw new Kronolith_Exception($e);
}
$calendar->set('color', $info['color']);
$calendar->set('desc', $info['description']);
if (!empty($info['system'])) {
$calendar->set('owner', null);
}
$calendar->set('calendar_type', Kronolith::SHARE_TYPE_USER);
$tagger = self::getTagger();
$tagger->tag($calendar->getName(), $info['tags'], $calendar->get('owner'), Kronolith_Tagger::TYPE_CALENDAR);
try {
$kronolith_shares->addShare($calendar);
} catch (Horde_Share_Exception $e) {
throw new Kronolith_Exception($e);
}
$all_cals = $calendar_manager->get(Kronolith::ALL_CALENDARS);
$all_cals[$calendar->getName()] = new Kronolith_Calendar_Internal(array('share' => $calendar));
$calendar_manager->set(Kronolith::ALL_CALENDARS, $all_cals);
$display_cals = $calendar_manager->get(Kronolith::DISPLAY_CALENDARS);
$display_cals[] = $calendar->getName();
$calendar_manager->set(Kronolith::DISPLAY_CALENDARS, $display_cals);
$prefs->setValue('display_cals', serialize($display_cals));
return $calendar;
}