if (is_a($event, 'PEAR_Error')) {
$notification->push($event, 'horde.error');
} else {
- Kronolith::sendITipNotifications($event, $notification, KRONOLITH_ITIP_REQUEST);
+ Kronolith::sendITipNotifications($event, $notification, Kronolith::ITIP_REQUEST);
}
}
}
switch (Util::getFormData('a')) {
case 'accept':
- $action = KRONOLITH_RESPONSE_ACCEPTED;
+ $action = Kronolith::RESPONSE_ACCEPTED;
$msg = _("You have successfully accepted attendence to this event.");
break;
case 'decline':
- $action = KRONOLITH_RESPONSE_DECLINED;
+ $action = Kronolith::RESPONSE_DECLINED;
$msg = _("You have successfully declined attendence to this event.");
break;
case 'tentative':
- $action = KRONOLITH_RESPONSE_TENTATIVE;
+ $action = Kronolith::RESPONSE_TENTATIVE;
$msg = _("You have tentatively accepted attendence to this event.");
break;
default:
- $action = KRONOLITH_RESPONSE_NONE;
+ $action = Kronolith::RESPONSE_NONE;
$msg = '';
break;
}
$notification->push(_("You are not an attendee of the specified event."), 'horde.error');
$title = $event->getTitle();
} else {
- $event->addAttendee($user, KRONOLITH_PART_IGNORE, $action);
+ $event->addAttendee($user, Kronolith::PART_IGNORE, $action);
$result = $event->save();
if (is_a($result, 'PEAR_Error')) {
$notification->push($result, 'horde.error');
// If there is only a mailbox part, then it is just a local name.
if (empty($newAttendeeParsedPart->host)) {
$attendees[] = array(
- 'attendance' => KRONOLITH_PART_REQUIRED,
- 'response' => KRONOLITH_RESPONSE_NONE,
+ 'attendance' => Kronolith::PART_REQUIRED,
+ 'response' => Kronolith::RESPONSE_NONE,
'name' => $newAttendee,
);
continue;
// values.
if (!isset($attendees[$email]))
$attendees[$email] = array(
- 'attendance' => KRONOLITH_PART_REQUIRED,
- 'response' => KRONOLITH_RESPONSE_NONE,
+ 'attendance' => Kronolith::PART_REQUIRED,
+ 'response' => Kronolith::RESPONSE_NONE,
'name' => $name,
);
} catch (Horde_Mime_Exception $e) {
// Add the Free/Busy information for each attendee.
foreach ($attendees as $email => $status) {
if (strpos($email, '@') !== false &&
- ($status['attendance'] == KRONOLITH_PART_REQUIRED ||
- $status['attendance'] == KRONOLITH_PART_OPTIONAL)) {
+ ($status['attendance'] == Kronolith::PART_REQUIRED ||
+ $status['attendance'] == Kronolith::PART_OPTIONAL)) {
$vfb = Kronolith_Freebusy::get($email);
if (!is_a($vfb, 'PEAR_Error')) {
$organizer = $vfb->getAttribute('ORGANIZER');
$vfb->setAttribute('ORGANIZER', 'mailto:' . $email, array(),
false);
}
- if ($status['attendance'] == KRONOLITH_PART_REQUIRED) {
+ if ($status['attendance'] == Kronolith::PART_REQUIRED) {
$attendee_view->addRequiredMember($vfb);
} else {
$attendee_view->addOptionalMember($vfb);
if (!$share->hasPermission(Auth::getAuth(), PERMS_DELETE, $event->getCreatorID())) {
$notification->push(_("You do not have permission to delete this event."), 'horde.warning');
} else {
- $notification_type = KRONOLITH_ITIP_CANCEL;
+ $notification_type = Kronolith::ITIP_CANCEL;
$instance = null;
if (Util::getFormData('future')) {
$recurEnd = new Horde_Date(array('hour' => 0, 'min' => 0, 'sec' => 0,
$event->recurrence->setRecurEnd($recurEnd);
$event->save();
}
- $notification_type = KRONOLITH_ITIP_REQUEST;
+ $notification_type = Kronolith::ITIP_REQUEST;
} elseif (Util::getFormData('current')) {
$event->recurrence->addException(Util::getFormData('year'),
Util::getFormData('month'),
if (is_a($res, 'PEAR_Error')) {
$GLOBALS['notification']->push(sprintf(_("There was an error editing the event: %s"), $res->getMessage()), 'horde.error');
} elseif (Util::getFormData('sendupdates', false)) {
- Kronolith::sendITipNotifications($event, $GLOBALS['notification'], KRONOLITH_ITIP_REQUEST);
+ Kronolith::sendITipNotifications($event, $GLOBALS['notification'], Kronolith::ITIP_REQUEST);
}
}
*
* @var integer
*/
- var $status = KRONOLITH_STATUS_CONFIRMED;
+ var $status = Kronolith::STATUS_CONFIRMED;
/**
* The description for this event
// Status.
switch ($this->getStatus()) {
- case KRONOLITH_STATUS_FREE:
+ case Kronolith::STATUS_FREE:
// This is not an official iCalendar value, but we need it for
// synchronization.
$vEvent->setAttribute('STATUS', 'FREE');
$vEvent->setAttribute('TRANSP', $v1 ? 1 : 'TRANSPARENT');
break;
- case KRONOLITH_STATUS_TENTATIVE:
+ case Kronolith::STATUS_TENTATIVE:
$vEvent->setAttribute('STATUS', 'TENTATIVE');
$vEvent->setAttribute('TRANSP', $v1 ? 0 : 'OPAQUE');
break;
- case KRONOLITH_STATUS_CONFIRMED:
+ case Kronolith::STATUS_CONFIRMED:
$vEvent->setAttribute('STATUS', 'CONFIRMED');
$vEvent->setAttribute('TRANSP', $v1 ? 0 : 'OPAQUE');
break;
- case KRONOLITH_STATUS_CANCELLED:
+ case Kronolith::STATUS_CANCELLED:
if ($v1) {
$vEvent->setAttribute('STATUS', 'DECLINED');
$vEvent->setAttribute('TRANSP', 1);
foreach ($this->getAttendees() as $email => $status) {
$params = array();
switch ($status['attendance']) {
- case KRONOLITH_PART_REQUIRED:
+ case Kronolith::PART_REQUIRED:
if ($v1) {
$params['EXPECT'] = 'REQUIRE';
} else {
}
break;
- case KRONOLITH_PART_OPTIONAL:
+ case Kronolith::PART_OPTIONAL:
if ($v1) {
$params['EXPECT'] = 'REQUEST';
} else {
}
break;
- case KRONOLITH_PART_NONE:
+ case Kronolith::PART_NONE:
if ($v1) {
$params['EXPECT'] = 'FYI';
} else {
}
switch ($status['response']) {
- case KRONOLITH_RESPONSE_NONE:
+ case Kronolith::RESPONSE_NONE:
if ($v1) {
$params['STATUS'] = 'NEEDS ACTION';
$params['RSVP'] = 'YES';
}
break;
- case KRONOLITH_RESPONSE_ACCEPTED:
+ case Kronolith::RESPONSE_ACCEPTED:
if ($v1) {
$params['STATUS'] = 'ACCEPTED';
} else {
}
break;
- case KRONOLITH_RESPONSE_DECLINED:
+ case Kronolith::RESPONSE_DECLINED:
if ($v1) {
$params['STATUS'] = 'DECLINED';
} else {
}
break;
- case KRONOLITH_RESPONSE_TENTATIVE:
+ case Kronolith::RESPONSE_TENTATIVE:
if ($v1) {
$params['STATUS'] = 'TENTATIVE';
} else {
if ($status == 'DECLINED') {
$status = 'CANCELLED';
}
- if (defined('KRONOLITH_STATUS_' . $status)) {
- $this->setStatus(constant('KRONOLITH_STATUS_' . $status));
+ if (defined('Kronolith::STATUS_' . $status)) {
+ $this->setStatus(constant('Kronolith::STATUS_' . $status));
}
}
$attendee[$i]);
$email = Horde_Mime_Address::bareAddress($attendee[$i]);
// Default according to rfc2445:
- $attendance = KRONOLITH_PART_REQUIRED;
+ $attendance = Kronolith::PART_REQUIRED;
// vCalendar 2.0 style:
if (!empty($params[$i]['ROLE'])) {
switch($params[$i]['ROLE']) {
case 'OPT-PARTICIPANT':
- $attendance = KRONOLITH_PART_OPTIONAL;
+ $attendance = Kronolith::PART_OPTIONAL;
break;
case 'NON-PARTICIPANT':
- $attendance = KRONOLITH_PART_NONE;
+ $attendance = Kronolith::PART_NONE;
break;
}
}
if (!empty($params[$i]['EXPECT'])) {
switch($params[$i]['EXPECT']) {
case 'REQUEST':
- $attendance = KRONOLITH_PART_OPTIONAL;
+ $attendance = Kronolith::PART_OPTIONAL;
break;
case 'FYI':
- $attendance = KRONOLITH_PART_NONE;
+ $attendance = Kronolith::PART_NONE;
break;
}
}
- $response = KRONOLITH_RESPONSE_NONE;
+ $response = Kronolith::RESPONSE_NONE;
if (empty($params[$i]['PARTSTAT']) &&
!empty($params[$i]['STATUS'])) {
$params[$i]['PARTSTAT'] = $params[$i]['STATUS'];
if (!empty($params[$i]['PARTSTAT'])) {
switch($params[$i]['PARTSTAT']) {
case 'ACCEPTED':
- $response = KRONOLITH_RESPONSE_ACCEPTED;
+ $response = Kronolith::RESPONSE_ACCEPTED;
break;
case 'DECLINED':
- $response = KRONOLITH_RESPONSE_DECLINED;
+ $response = Kronolith::RESPONSE_DECLINED;
break;
case 'TENTATIVE':
- $response = KRONOLITH_RESPONSE_TENTATIVE;
+ $response = Kronolith::RESPONSE_TENTATIVE;
break;
}
}
function addAttendee($email, $attendance, $response, $name = null)
{
$email = String::lower($email);
- if ($attendance == KRONOLITH_PART_IGNORE) {
+ if ($attendance == Kronolith::PART_IGNORE) {
if (isset($this->attendees[$email])) {
$attendance = $this->attendees[$email]['attendance'];
} else {
- $attendance = KRONOLITH_PART_REQUIRED;
+ $attendance = Kronolith::PART_REQUIRED;
}
}
if (empty($name) && isset($this->attendees[$email]) &&
function getStatusClass()
{
switch ($this->status) {
- case KRONOLITH_STATUS_CANCELLED:
+ case Kronolith::STATUS_CANCELLED:
return 'event-cancelled';
- case KRONOLITH_STATUS_TENTATIVE:
- case KRONOLITH_STATUS_FREE:
+ case Kronolith::STATUS_TENTATIVE:
+ case Kronolith::STATUS_FREE:
return 'event-tentative';
}
*
* @var integer
*/
- var $status = KRONOLITH_STATUS_FREE;
+ var $status = Kronolith::STATUS_FREE;
/**
* Whether this is an all-day event.
$component = $components[$i];
if ($component->getType() == 'vEvent') {
$event = new Kronolith_Event_ical($this);
- $event->status = KRONOLITH_STATUS_FREE;
+ $event->status = Kronolith::STATUS_FREE;
$event->fromiCalendar($component);
$event->remoteCal = $this->_params['url'];
$event->eventID = $i;
if (isset($components[$eventId]) &&
$components[$eventId]->getType() == 'vEvent') {
$event = new Kronolith_Event_ical($this);
- $event->status = KRONOLITH_STATUS_FREE;
+ $event->status = Kronolith::STATUS_FREE;
$event->fromiCalendar($components[$eventId]);
$event->remoteCal = $url;
$event->eventID = $eventId;
}
switch ($event->status) {
- case KRONOLITH_STATUS_FREE:
- case KRONOLITH_STATUS_CANCELLED:
+ case Kronolith::STATUS_FREE:
+ case Kronolith::STATUS_CANCELLED:
$this->_kolab->setVal('show-time-as', 'free');
break;
- case KRONOLITH_STATUS_TENTATIVE:
+ case Kronolith::STATUS_TENTATIVE:
$this->_kolab->setVal('show-time-as', 'tentative');
break;
- case KRONOLITH_STATUS_CONFIRMED:
+ case Kronolith::STATUS_CONFIRMED:
default:
$this->_kolab->setVal('show-time-as', 'busy');
break;
$this->_kolab->setElemVal($attendee, 'smtp-address', $email);
switch ($status['response']) {
- case KRONOLITH_RESPONSE_ACCEPTED:
+ case Kronolith::RESPONSE_ACCEPTED:
$this->_kolab->setElemVal($attendee, 'status', 'accepted');
break;
- case KRONOLITH_RESPONSE_DECLINED:
+ case Kronolith::RESPONSE_DECLINED:
$this->_kolab->setElemVal($attendee, 'status', 'declined');
break;
- case KRONOLITH_RESPONSE_TENTATIVE:
+ case Kronolith::RESPONSE_TENTATIVE:
$this->_kolab->setElemVal($attendee, 'status', 'tentative');
break;
- case KRONOLITH_RESPONSE_NONE:
+ case Kronolith::RESPONSE_NONE:
default:
$this->_kolab->setElemVal($attendee, 'status', 'none');
}
switch ($status['attendance']) {
- case KRONOLITH_PART_OPTIONAL:
+ case Kronolith::PART_OPTIONAL:
$this->_kolab->setElemVal($attendee, 'role', 'optional');
break;
- case KRONOLITH_PART_NONE:
+ case Kronolith::PART_NONE:
$this->_kolab->setElemVal($attendee, 'role', 'resource');
break;
- case KRONOLITH_PART_REQUIRED:
+ case Kronolith::PART_REQUIRED:
default:
$this->_kolab->setElemVal($attendee, 'role', 'required');
}
$status = $kolab->getVal('show-time-as');
switch ($status) {
case 'free':
- $this->status = KRONOLITH_STATUS_FREE;
+ $this->status = Kronolith::STATUS_FREE;
break;
case 'tentative':
- $this->status = KRONOLITH_STATUS_TENTATIVE;
+ $this->status = Kronolith::STATUS_TENTATIVE;
break;
case 'busy':
case 'outofoffice':
default:
- $this->status = KRONOLITH_STATUS_CONFIRMED;
+ $this->status = Kronolith::STATUS_CONFIRMED;
}
$attendees = array_change_key_case($kolab->getAllRootElems('attendee'));
$role = $kolab->getElemVal($attendee, 'role');
switch ($role) {
case 'optional':
- $role = KRONOLITH_PART_OPTIONAL;
+ $role = Kronolith::PART_OPTIONAL;
break;
case 'resource':
- $role = KRONOLITH_PART_NONE;
+ $role = Kronolith::PART_NONE;
break;
case 'required':
default:
- $role = KRONOLITH_PART_REQUIRED;
+ $role = Kronolith::PART_REQUIRED;
break;
}
$status = $kolab->getElemVal($attendee, 'status');
switch ($status) {
case 'accepted':
- $status = KRONOLITH_RESPONSE_ACCEPTED;
+ $status = Kronolith::RESPONSE_ACCEPTED;
break;
case 'declined':
- $status = KRONOLITH_RESPONSE_DECLINED;
+ $status = Kronolith::RESPONSE_DECLINED;
break;
case 'tentative':
- $status = KRONOLITH_RESPONSE_TENTATIVE;
+ $status = Kronolith::RESPONSE_TENTATIVE;
break;
case 'none':
default:
- $status = KRONOLITH_RESPONSE_NONE;
+ $status = Kronolith::RESPONSE_NONE;
break;
}
if (isset($event['show-time-as'])) {
switch ($event['show-time-as']) {
case 'free':
- $this->status = KRONOLITH_STATUS_FREE;
+ $this->status = Kronolith::STATUS_FREE;
break;
case 'tentative':
- $this->status = KRONOLITH_STATUS_TENTATIVE;
+ $this->status = Kronolith::STATUS_TENTATIVE;
break;
case 'busy':
case 'outofoffice':
default:
- $this->status = KRONOLITH_STATUS_CONFIRMED;
+ $this->status = Kronolith::STATUS_CONFIRMED;
}
} else {
- $this->status = KRONOLITH_STATUS_CONFIRMED;
+ $this->status = Kronolith::STATUS_CONFIRMED;
}
// Recurrence
$role = $attendee['role'];
switch ($role) {
case 'optional':
- $role = KRONOLITH_PART_OPTIONAL;
+ $role = Kronolith::PART_OPTIONAL;
break;
case 'resource':
- $role = KRONOLITH_PART_NONE;
+ $role = Kronolith::PART_NONE;
break;
case 'required':
default:
- $role = KRONOLITH_PART_REQUIRED;
+ $role = Kronolith::PART_REQUIRED;
break;
}
$status = $attendee['status'];
switch ($status) {
case 'accepted':
- $status = KRONOLITH_RESPONSE_ACCEPTED;
+ $status = Kronolith::RESPONSE_ACCEPTED;
break;
case 'declined':
- $status = KRONOLITH_RESPONSE_DECLINED;
+ $status = Kronolith::RESPONSE_DECLINED;
break;
case 'tentative':
- $status = KRONOLITH_RESPONSE_TENTATIVE;
+ $status = Kronolith::RESPONSE_TENTATIVE;
break;
case 'none':
default:
- $status = KRONOLITH_RESPONSE_NONE;
+ $status = Kronolith::RESPONSE_NONE;
break;
}
$event['_is_all_day'] = $this->isAllDay();
switch ($this->status) {
- case KRONOLITH_STATUS_FREE:
- case KRONOLITH_STATUS_CANCELLED:
+ case Kronolith::STATUS_FREE:
+ case Kronolith::STATUS_CANCELLED:
$event['show-time-as'] = 'free';
break;
- case KRONOLITH_STATUS_TENTATIVE:
+ case Kronolith::STATUS_TENTATIVE:
$event['show-time-as'] = 'tentative';
break;
// No mapping for outofoffice
- case KRONOLITH_STATUS_CONFIRMED:
+ case Kronolith::STATUS_CONFIRMED:
default:
$event['show-time-as'] = 'busy';
}
}
switch ($attendee['attendance']) {
- case KRONOLITH_PART_OPTIONAL:
+ case Kronolith::PART_OPTIONAL:
$new_attendee['role'] = 'optional';
break;
- case KRONOLITH_PART_NONE:
+ case Kronolith::PART_NONE:
$new_attendee['role'] = 'resource';
break;
- case KRONOLITH_PART_REQUIRED:
+ case Kronolith::PART_REQUIRED:
default:
$new_attendee['role'] = 'required';
break;
$new_attendee['request-response'] = '0';
switch ($attendee['response']) {
- case KRONOLITH_RESPONSE_ACCEPTED:
+ case Kronolith::RESPONSE_ACCEPTED:
$new_attendee['status'] = 'accepted';
break;
- case KRONOLITH_RESPONSE_DECLINED:
+ case Kronolith::RESPONSE_DECLINED:
$new_attendee['status'] = 'declined';
break;
- case KRONOLITH_RESPONSE_TENTATIVE:
+ case Kronolith::RESPONSE_TENTATIVE:
$new_attendee['status'] = 'tentative';
break;
- case KRONOLITH_RESPONSE_NONE:
+ case Kronolith::RESPONSE_NONE:
default:
$new_attendee['status'] = 'none';
break;
/* Add all the busy periods. */
foreach ($busy as $events) {
foreach ($events as $event) {
- if ($event->hasStatus(KRONOLITH_STATUS_FREE)) {
+ if ($event->hasStatus(Kronolith::STATUS_FREE)) {
continue;
}
- if ($event->hasStatus(KRONOLITH_STATUS_CANCELLED)) {
+ if ($event->hasStatus(Kronolith::STATUS_CANCELLED)) {
continue;
}
$fb = $storage->search($email);
if (!is_a($fb, 'PEAR_Error')) {
return $fb;
- } elseif ($fb->getCode() == KRONOLITH_ERROR_FB_NOT_FOUND) {
+ } elseif ($fb->getCode() == Kronolith::ERROR_FB_NOT_FOUND) {
return $url ?
PEAR::raiseError(sprintf(_("No free/busy information found at the free/busy url of %s."), $email)) :
PEAR::raiseError(sprintf(_("No free/busy url found for %s."), $email));
* @package Kronolith
*/
-/** Event status */
-define('KRONOLITH_STATUS_NONE', 0);
-define('KRONOLITH_STATUS_TENTATIVE', 1);
-define('KRONOLITH_STATUS_CONFIRMED', 2);
-define('KRONOLITH_STATUS_CANCELLED', 3);
-define('KRONOLITH_STATUS_FREE', 4);
-
-/** Invitation responses */
-define('KRONOLITH_RESPONSE_NONE', 1);
-define('KRONOLITH_RESPONSE_ACCEPTED', 2);
-define('KRONOLITH_RESPONSE_DECLINED', 3);
-define('KRONOLITH_RESPONSE_TENTATIVE', 4);
-
-/** Attendee status */
-define('KRONOLITH_PART_REQUIRED', 1);
-define('KRONOLITH_PART_OPTIONAL', 2);
-define('KRONOLITH_PART_NONE', 3);
-define('KRONOLITH_PART_IGNORE', 4);
-
-/** iTip requests */
-define('KRONOLITH_ITIP_REQUEST', 1);
-define('KRONOLITH_ITIP_CANCEL', 2);
-
-/** Free/Busy not found */
-define('KRONOLITH_ERROR_FB_NOT_FOUND', 1);
-
/** The event can be delegated. */
define('PERMS_DELEGATE', 1024);
*/
class Kronolith
{
+ /** Event status */
+ const STATUS_NONE = 0;
+ const STATUS_TENTATIVE = 1;
+ const STATUS_CONFIRMED = 2;
+ const STATUS_CANCELLED = 3;
+ const STATUS_FREE = 4;
+
+ /** Invitation responses */
+ const RESPONSE_NONE = 1;
+ const RESPONSE_ACCEPTED = 2;
+ const RESPONSE_DECLINED = 3;
+ const RESPONSE_TENTATIVE = 4;
+
+ /** Attendee status */
+ const PART_REQUIRED = 1;
+ const PART_OPTIONAL = 2;
+ const PART_NONE = 3;
+ const PART_IGNORE = 4;
+
+ /** iTip requests */
+ const ITIP_REQUEST = 1;
+ const ITIP_CANCEL = 2;
+
+ /** Free/Busy not found */
+ const ERROR_FB_NOT_FOUND = 1;
+
/**
* Driver singleton instances.
*
* @var array
*/
- static protected $_instances = array();
+ static private $_instances = array();
+
+ /**
+ * @var Kronolith_Tagger
+ */
+ static private $_tagger;
/**
* Output everything up to but not including the <body> tag.
* Each entry contains the three elements necessary
* for a Horde::addScriptFile() call.
*/
- function header($title, $scripts = array())
+ public static function header($title, $scripts = array())
{
// Don't autoload any javascript files.
Horde::disableAutoloadHordeJS();
*
* @return string
*/
- function includeJSVars()
+ public static function includeJSVars()
{
global $browser, $conf, $prefs, $registry;
* @return string The javascript text to output, or empty if the page
* headers have not yet been sent.
*/
- function addInlineScript($script, $onload = false)
+ public static function addInlineScript($script, $onload = false)
{
if (is_array($script)) {
$script = implode(';', $script);
*
* @return string The javascript text to output.
*/
- function outputInlineScript()
+ public static function outputInlineScript()
{
if (!empty($GLOBALS['__kronolith_inline_script'])) {
echo '<script type="text/javascript">//<![CDATA[' . "\n";
* @return string The script with the necessary HTML javascript tags
* appended.
*/
- function wrapInlineScript($script)
+ public static function wrapInlineScript($script)
{
return '<script type="text/javascript">//<![CDATA[' . "\n" . implode("\n", $script) . "\n//]]></script>\n";
}
* Outputs the necessary script tags, honoring local configuration choices
* as to script caching.
*/
- function includeScriptFiles()
+ public static function includeScriptFiles()
{
global $conf;
*
* @param boolean $print Include print CSS?
*/
- function includeStylesheetFiles($print = false)
+ public static function includeStylesheetFiles($print = false)
{
global $conf, $prefs, $registry;
*
* @return string The URL to the cache page.
*/
- function getCacheURL($type, $cid)
+ public static function getCacheURL($type, $cid)
{
$parts = array(
$GLOBALS['registry']->get('webroot'),
*
* @param string $type Either 'css' or 'js'.
*/
- function _filesystemGC($type)
+ public static function _filesystemGC($type)
{
static $dir_list = array();
*
* @return array The events happening in this time period.
*/
- function listEventIds($startDate = null, $endDate = null,
+ public static function listEventIds($startDate = null, $endDate = null,
$calendars = null, $alarmsOnly = false)
{
global $kronolith_driver;
*
* @return array The alarms active on $date.
*/
- function listAlarms($date, $calendars, $fullevent = false)
+ public static function listAlarms($date, $calendars, $fullevent = false)
{
global $kronolith_driver;
*
* @return array The events
*/
- function search($query)
+ public static function search($query)
{
global $kronolith_driver;
/**
* Initial app setup code.
*/
- function initialize()
+ public static function initialize()
{
/* Store the request timestamp if it's not already present. */
if (!isset($_SERVER['REQUEST_TIME'])) {
* 1 = Login tasks pending
* 2 = Login tasks pending, previous tasks interrupted
*/
- function loginTasksFlag($set = null)
+ public static function loginTasksFlag($set = null)
{
if (($set !== null)) {
$_SESSION['kronolith_session']['_logintasks'] = $set;
*
* @return array The matching holidays as an array.
*/
- function listHolidayEvents($startDate = null, $endDate = null)
+ public static function listHolidayEvents($startDate = null, $endDate = null)
{
if (!@include_once('Date/Holidays.php')) {
Horde::logMessage('Support for Date_Holidays has been enabled but the package seems to be missing.',
*
* @return array The events happening in this time period.
*/
- function listEvents($startDate = null, $endDate = null, $calendars = null,
+ public static function listEvents($startDate = null, $endDate = null, $calendars = null,
$showRecurrence = true, $alarmsOnly = false,
$showRemote = true)
{
$event->description = isset($eventsListItem['description']) ? $eventsListItem['description'] : '';
$event->start = $eventStart;
$event->end = $eventEnd;
- $event->status = KRONOLITH_STATUS_FREE;
+ $event->status = Kronolith::STATUS_FREE;
if (isset($eventsListItem['recurrence'])) {
$recurrence = new Horde_Date_Recurrence($eventStart);
$recurrence->setRecurType($eventsListItem['recurrence']['type']);
*
* @access private
*/
- function _getEvents(&$results, &$event, $startDate, $endDate,
+ public static function _getEvents(&$results, &$event, $startDate, $endDate,
$startOfPeriod, $endOfPeriod,
$showRecurrence)
{
* recurrence.
* @param Horde_Date $eventEnd The event's end at the actual recurrence.
*/
- function _addCoverDates(&$results, $event, $eventStart, $eventEnd)
+ public static function _addCoverDates(&$results, $event, $eventStart, $eventEnd)
{
$i = $eventStart->mday;
$loopDate = new Horde_Date(array('month' => $eventStart->month,
*
* @return integer The number of events.
*/
- function countEvents()
+ public static function countEvents()
{
global $kronolith_driver;
/**
* Returns the real name, if available, of a user.
*/
- function getUserName($uid)
+ public static function getUserName($uid)
{
static $names = array();
/**
* Returns the email address, if available, of a user.
*/
- function getUserEmail($uid)
+ public static function getUserEmail($uid)
{
static $emails = array();
/**
* Checks if an email address belongs to a user.
*/
- function isUserEmail($uid, $email)
+ public static function isUserEmail($uid, $email)
{
static $emails = array();
*
* @return string The translated displayable recurrence value string.
*/
- function recurToString($type)
+ public static function recurToString($type)
{
switch ($type) {
case Horde_Date_Recurrence::RECUR_NONE:
* for display.
*
* @param integer $status The meeting status; one of the
- * KRONOLITH_STATUS_XXX constants.
+ * Kronolith::STATUS_XXX constants.
*
* @return string The translated displayable meeting status string.
*/
- function statusToString($status)
+ public static function statusToString($status)
{
switch ($status) {
- case KRONOLITH_STATUS_CONFIRMED:
+ case Kronolith::STATUS_CONFIRMED:
return _("Confirmed");
- case KRONOLITH_STATUS_CANCELLED:
+ case Kronolith::STATUS_CANCELLED:
return _("Cancelled");
- case KRONOLITH_STATUS_FREE:
+ case Kronolith::STATUS_FREE:
return _("Free");
- case KRONOLITH_STATUS_TENTATIVE:
+ case Kronolith::STATUS_TENTATIVE:
default:
return _("Tentative");
}
* suitable for display.
*
* @param integer $response The attendee response; one of the
- * KRONOLITH_RESPONSE_XXX constants.
+ * Kronolith::RESPONSE_XXX constants.
*
* @return string The translated displayable attendee response string.
*/
- function responseToString($response)
+ public static function responseToString($response)
{
switch ($response) {
- case KRONOLITH_RESPONSE_ACCEPTED:
+ case Kronolith::RESPONSE_ACCEPTED:
return _("Accepted");
- case KRONOLITH_RESPONSE_DECLINED:
+ case Kronolith::RESPONSE_DECLINED:
return _("Declined");
- case KRONOLITH_RESPONSE_TENTATIVE:
+ case Kronolith::RESPONSE_TENTATIVE:
return _("Tentative");
- case KRONOLITH_RESPONSE_NONE:
+ case Kronolith::RESPONSE_NONE:
default:
return _("None");
}
* suitable for display.
*
* @param integer $part The attendee participation; one of the
- * KRONOLITH_PART_XXX constants.
+ * Kronolith::PART_XXX constants.
*
* @return string The translated displayable attendee participation
* string.
*/
- function partToString($part)
+ public static function partToString($part)
{
switch ($part) {
- case KRONOLITH_PART_OPTIONAL:
+ case Kronolith::PART_OPTIONAL:
return _("Optional");
- case KRONOLITH_PART_NONE:
+ case Kronolith::PART_NONE:
return _("None");
- case KRONOLITH_PART_REQUIRED:
+ case Kronolith::PART_REQUIRED:
default:
return _("Required");
}
*
* @return string The Kronolith response value.
*/
- function responseFromICal($response)
+ public static function responseFromICal($response)
{
switch (String::upper($response)) {
case 'ACCEPTED':
- return KRONOLITH_RESPONSE_ACCEPTED;
+ return Kronolith::RESPONSE_ACCEPTED;
case 'DECLINED':
- return KRONOLITH_RESPONSE_DECLINED;
+ return Kronolith::RESPONSE_DECLINED;
case 'TENTATIVE':
- return KRONOLITH_RESPONSE_TENTATIVE;
+ return Kronolith::RESPONSE_TENTATIVE;
case 'NEEDS-ACTION':
default:
- return KRONOLITH_RESPONSE_NONE;
+ return Kronolith::RESPONSE_NONE;
}
}
*
* @return string The HTML <select> widget.
*/
- function buildStatusWidget($name, $current = KRONOLITH_STATUS_CONFIRMED,
+ public static function buildStatusWidget($name, $current = Kronolith::STATUS_CONFIRMED,
$any = false)
{
$html = "<select id=\"$name\" name=\"$name\">";
$statii = array(
- KRONOLITH_STATUS_FREE,
- KRONOLITH_STATUS_TENTATIVE,
- KRONOLITH_STATUS_CONFIRMED,
- KRONOLITH_STATUS_CANCELLED
+ Kronolith::STATUS_FREE,
+ Kronolith::STATUS_TENTATIVE,
+ Kronolith::STATUS_CONFIRMED,
+ Kronolith::STATUS_CANCELLED
);
if (!isset($current)) {
- $current = KRONOLITH_STATUS_NONE;
+ $current = Kronolith::STATUS_NONE;
}
if ($any) {
- $html .= "<option value=\"" . KRONOLITH_STATUS_NONE . "\"";
- $html .= ($current == KRONOLITH_STATUS_NONE) ? ' selected="selected">' : '>';
+ $html .= "<option value=\"" . Kronolith::STATUS_NONE . "\"";
+ $html .= ($current == Kronolith::STATUS_NONE) ? ' selected="selected">' : '>';
$html .= _("Any") . "</option>";
}
*
* @return array The calendar list.
*/
- function listCalendars($owneronly = false, $permission = PERMS_SHOW)
+ public static function listCalendars($owneronly = false, $permission = PERMS_SHOW)
{
$calendars = $GLOBALS['kronolith_shares']->listShares(Auth::getAuth(), $permission, $owneronly ? Auth::getAuth() : null, 0, 0, 'name');
if (is_a($calendars, 'PEAR_Error')) {
* Returns the default calendar for the current user at the specified
* permissions level.
*/
- function getDefaultCalendar($permission = PERMS_SHOW)
+ public static function getDefaultCalendar($permission = PERMS_SHOW)
{
global $prefs;
*
* @return string The calendar's feed URL.
*/
- function feedUrl($calendar)
+ public static function feedUrl($calendar)
{
if (isset($GLOBALS['conf']['urls']['pretty']) &&
$GLOBALS['conf']['urls']['pretty'] == 'rewrite') {
*
* @return string The calendar's embed snippit.
*/
- function embedCode($calendar)
+ public static function embedCode($calendar)
{
/* Get the base url */
$url = Horde::applicationURL('imple.php', true, -1);
*
* @return string Attendee list.
*/
- function attendeeList()
+ public static function attendeeList()
{
if (!isset($_SESSION['kronolith']['attendees']) ||
!is_array($_SESSION['kronolith']['attendees'])) {
* @param Notification $notification A notification object used to show
* result status.
* @param integer $action The type of notification to send.
- * One of the KRONOLITH_ITIP_* values.
+ * One of the Kronolith::ITIP_* values.
* @param Horde_Date $instance If cancelling a single instance of a
* recurring event, the date of this
* intance.
*/
- function sendITipNotifications(&$event, &$notification, $action,
+ public static function sendITipNotifications(&$event, &$notification, $action,
$instance = null)
{
global $conf;
* not need to participate, or has declined participating, or
* doesn't have an email address. */
if (strpos($email, '@') === false ||
- $status['attendance'] == KRONOLITH_PART_NONE ||
- $status['response'] == KRONOLITH_RESPONSE_DECLINED) {
+ $status['attendance'] == Kronolith::PART_NONE ||
+ $status['response'] == Kronolith::RESPONSE_DECLINED) {
continue;
}
/* Determine all notification-specific strings. */
switch ($action) {
- case KRONOLITH_ITIP_CANCEL:
+ case Kronolith::ITIP_CANCEL:
/* Cancellation. */
$method = 'CANCEL';
$filename = 'event-cancellation.ics';
$subject = sprintf(_("Cancelled: %s"), $event->getTitle());
break;
- case KRONOLITH_ITIP_REQUEST:
+ case Kronolith::ITIP_REQUEST:
default:
- if ($status['response'] == KRONOLITH_RESPONSE_NONE) {
+ if ($status['response'] == Kronolith::RESPONSE_NONE) {
/* Invitation. */
$method = 'REQUEST';
$filename = 'event-invitation.ics';
}
$message .= _("Attached is an iCalendar file with more information about the event. If your mail client supports iTip requests you can use this file to easily update your local copy of the event.");
- if ($action == KRONOLITH_ITIP_REQUEST) {
+ if ($action == Kronolith::ITIP_REQUEST) {
$attend_link = Util::addParameter(Horde::applicationUrl('attend.php', true, -1), array('c' => $event->getCalendar(), 'e' => $event->getId(), 'u' => $email), null, false);
$message .= "\n\n" . sprintf(_("If your email client doesn't support iTip requests you can use one of the following links to accept or decline the event.\n\nTo accept the event:\n%s\n\nTo accept the event tentatively:\n%s\n\nTo decline the event:\n%s\n"), Util::addParameter($attend_link, 'a', 'accept', false), Util::addParameter($attend_link, 'a', 'tentative', false), Util::addParameter($attend_link, 'a', 'decline', false));
}
$iCal->setAttribute('METHOD', $method);
$iCal->setAttribute('X-WR-CALNAME', String::convertCharset($share->get('name'), NLS::getCharset(), 'utf-8'));
$vevent = $event->toiCalendar($iCal);
- if ($action == KRONOLITH_ITIP_CANCEL && !empty($instance)) {
+ if ($action == Kronolith::ITIP_CANCEL && !empty($instance)) {
$vevent->setAttribute('RECURRENCE-ID', $instance, array('VALUE' => 'DATE'));
}
$iCal->addComponent($vevent);
* @param string $action The event action. One of "add", "edit",
* or "delete".
*/
- function sendNotification(&$event, $action)
+ public static function sendNotification(&$event, $action)
{
global $conf;
* @return mixed The user's email, time, and language preferences if they
* want a notification for this calendar.
*/
- function _notificationPref($user, $mode, $calendar = null)
+ public static function _notificationPref($user, $mode, $calendar = null)
{
$prefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
'kronolith', $user, '', null,
/**
* @return Horde_Date
*/
- function currentDate()
+ public static function currentDate()
{
if ($date = Util::getFormData('date')) {
return new Horde_Date($date . '000000');
*
* @return mixed The value of the specified permission.
*/
- function hasPermission($permission)
+ public static function hasPermission($permission)
{
global $perms;
/**
* @param string $tabname
*/
- function tabs($tabname = null)
+ public static function tabs($tabname = null)
{
$date = Kronolith::currentDate();
$date_stamp = $date->dateString();
* @param string $tabname
* @param Kronolith_Event $event
*/
- function eventTabs($tabname, $event)
+ public static function eventTabs($tabname, $event)
{
if (!$event->isInitialized()) {
return;
*
* @param string $view The name of the view.
*/
- function getView($view)
+ public static function getView($view)
{
switch ($view) {
case 'Day':
* Should we show event location, based on the show_location
* preference and $print_view?
*/
- function viewShowLocation()
+ public static function viewShowLocation()
{
$show = @unserialize($GLOBALS['prefs']->getValue('show_location'));
if (!empty($GLOBALS['print_view'])) {
* Should we show event time, based on the show_time preference
* and $print_view?
*/
- function viewShowTime()
+ public static function viewShowTime()
{
$show = @unserialize($GLOBALS['prefs']->getValue('show_time'));
if (!empty($GLOBALS['print_view'])) {
*
* @return string A HTML color code.
*/
- function backgroundColor($calendar)
+ public static function backgroundColor($calendar)
{
$color = is_array($calendar) ? @$calendar['color'] : $calendar->get('color');
return empty($color) ? '#dddddd' : $color;
* definition.
* @return string A HTML color code.
*/
- function foregroundColor($calendar)
+ public static function foregroundColor($calendar)
{
return Horde_Image::brightness(Kronolith::backgroundColor($calendar)) < 128 ? '#f6f6f6' : '#000';
}
*
* @return string A CSS string with color definitions.
*/
- function getCSSColors($calendar, $with_attribute = true)
+ public static function getCSSColors($calendar, $with_attribute = true)
{
$css = 'background-color:' . Kronolith::backgroundColor($calendar) . ';color:' . Kronolith::foregroundColor($calendar);
if ($with_attribute) {
/**
* Builds Kronolith's list of menu items.
*/
- function getMenu($returnType = 'object')
+ public static function getMenu($returnType = 'object')
{
global $conf, $registry, $browser, $prefs;
/**
* Used with usort() to sort events based on their start times.
*/
- function _sortEventStartTime($a, $b)
+ public static function _sortEventStartTime($a, $b)
{
$diff = $a->start->compareDateTime($b->start);
if ($diff == 0) {
}
}
- function getTagger()
+ public static function getTagger()
{
- static $_tagger;
-
- if (empty($_tagger)) {
- $_tagger = new Kronolith_Tagger();
+ if (empty(self::$_tagger)) {
+ self::$_tagger = new Kronolith_Tagger();
}
- return $_tagger;
+ return self::$_tagger;
}
-
}
@$http->sendRequest();
if ($http->getResponseCode() != 200) {
return PEAR::raiseError(sprintf(_("Unable to retrieve free/busy information for %s"),
- $email), KRONOLITH_ERROR_FB_NOT_FOUND);
+ $email), Kronolith::ERROR_FB_NOT_FOUND);
}
$vfb_text = $http->getResponseBody();
$vfb = &$iCal->findComponent('VFREEBUSY');
if ($vfb === false) {
return PEAR::raiseError(sprintf(_("No free/busy information is available for %s"),
- $email), KRONOLITH_ERROR_FB_NOT_FOUND);
+ $email), Kronolith::ERROR_FB_NOT_FOUND);
}
return $vfb;
return $vfb;
}
}
- return PEAR::raiseError(_("Not found"), KRONOLITH_ERROR_FB_NOT_FOUND);
+ return PEAR::raiseError(_("Not found"), Kronolith::ERROR_FB_NOT_FOUND);
}
/**
* them. */
$day_events = '';
foreach ($this->_events[$date->dateString()] as $event) {
- if ($event->getStatus() == KRONOLITH_STATUS_CONFIRMED) {
+ if ($event->getStatus() == Kronolith::STATUS_CONFIRMED) {
/* Set the background color to distinguish the day */
$style = 'year-event';
}
$name = isset($atparms[$index]['CN']) ? $atparms[$index]['CN'] : null;
if ($event->hasAttendee($attendee)) {
if (is_null($sender) || $sender_lcase == $attendee) {
- $event->addAttendee($attendee, KRONOLITH_PART_IGNORE, Kronolith::responseFromICal($atparms[$index]['PARTSTAT']), $name);
+ $event->addAttendee($attendee, Kronolith::PART_IGNORE, Kronolith::responseFromICal($atparms[$index]['PARTSTAT']), $name);
$found = true;
} else {
$error = _("The attendee hasn't been updated because the update was not sent from the attendee.");
echo $ical->exportvCalendar() . "\n";
$object->setPrivate(true);
-$object->setStatus(KRONOLITH_STATUS_TENTATIVE);
+$object->setStatus(Kronolith::STATUS_TENTATIVE);
$object->recurrence = new Horde_Date_Recurrence($object->start);
$object->recurrence->setRecurType(Horde_Date_Recurrence::RECUR_MONTHLY_DATE);
$object->recurrence->setRecurInterval(1);
$object->recurrence->addException(2007, 4, 15);
$object->setAttendees(
array('juergen@example.com' =>
- array('attendance' => KRONOLITH_PART_REQUIRED,
- 'response' => KRONOLITH_RESPONSE_NONE,
+ array('attendance' => Kronolith::PART_REQUIRED,
+ 'response' => Kronolith::RESPONSE_NONE,
'name' => 'Jürgen Doe'),
0 =>
- array('attendance' => KRONOLITH_PART_OPTIONAL,
- 'response' => KRONOLITH_RESPONSE_ACCEPTED,
+ array('attendance' => Kronolith::PART_OPTIONAL,
+ 'response' => Kronolith::RESPONSE_ACCEPTED,
'name' => 'Jane Doe'),
'jack@example.com' =>
- array('attendance' => KRONOLITH_PART_NONE,
- 'response' => KRONOLITH_RESPONSE_DECLINED,
+ array('attendance' => Kronolith::PART_NONE,
+ 'response' => Kronolith::RESPONSE_DECLINED,
'name' => 'Jack Doe'),
'jenny@example.com' =>
- array('attendance' => KRONOLITH_PART_NONE,
- 'response' => KRONOLITH_RESPONSE_TENTATIVE)));
+ array('attendance' => Kronolith::PART_NONE,
+ 'response' => Kronolith::RESPONSE_TENTATIVE)));
$ical = new Horde_iCalendar('1.0');
$cal = $object->toiCalendar($ical);
if (isset($q_title)) {
/* We're returning from a previous search. */
$event->readForm();
- if (Util::getFormData('status') == KRONOLITH_STATUS_NONE) {
+ if (Util::getFormData('status') == Kronolith::STATUS_NONE) {
$event->status = null;
}
}
<td>
<label for="<?php echo "attendance_$i" ?>" class="hidden"><?php echo _("Attendance") ?></label>
<select id="<?php echo "attendance_$i" ?>" name="<?php echo "attendance_$i" ?>" onchange="performAction('changeatt', document.attendeesForm.<?php echo "attendance_$i" ?>.value + ' ' + decodeURIComponent('<?php echo rawurlencode($email) ?>'));">
- <option value="<?php echo KRONOLITH_PART_REQUIRED ?>"<?php if ($status['attendance'] == KRONOLITH_PART_REQUIRED) echo ' selected="selected"' ?>><?php echo Kronolith::partToString(KRONOLITH_PART_REQUIRED) ?></option>
- <option value="<?php echo KRONOLITH_PART_OPTIONAL ?>"<?php if ($status['attendance'] == KRONOLITH_PART_OPTIONAL) echo ' selected="selected"' ?>><?php echo Kronolith::partToString(KRONOLITH_PART_OPTIONAL) ?></option>
- <option value="<?php echo KRONOLITH_PART_NONE ?>"<?php if ($status['attendance'] == KRONOLITH_PART_NONE) echo ' selected="selected"' ?>><?php echo Kronolith::partToString(KRONOLITH_PART_NONE) ?></option>
+ <option value="<?php echo Kronolith::PART_REQUIRED ?>"<?php if ($status['attendance'] == Kronolith::PART_REQUIRED) echo ' selected="selected"' ?>><?php echo Kronolith::partToString(Kronolith::PART_REQUIRED) ?></option>
+ <option value="<?php echo Kronolith::PART_OPTIONAL ?>"<?php if ($status['attendance'] == Kronolith::PART_OPTIONAL) echo ' selected="selected"' ?>><?php echo Kronolith::partToString(Kronolith::PART_OPTIONAL) ?></option>
+ <option value="<?php echo Kronolith::PART_NONE ?>"<?php if ($status['attendance'] == Kronolith::PART_NONE) echo ' selected="selected"' ?>><?php echo Kronolith::partToString(Kronolith::PART_NONE) ?></option>
</select>
</td>
<td>
<select name="<?php echo "response_$i" ?>" onchange="performAction('changeresp', document.attendeesForm.<?php echo "response_$i" ?>.value + ' ' + decodeURIComponent('<?php echo rawurlencode($email) ?>'));">
- <option value="<?php echo KRONOLITH_RESPONSE_ACCEPTED ?>"<?php if ($status['response'] == KRONOLITH_RESPONSE_ACCEPTED) echo ' selected="selected"' ?>><?php echo Kronolith::responseToString(KRONOLITH_RESPONSE_ACCEPTED) ?></option>
- <option value="<?php echo KRONOLITH_RESPONSE_DECLINED ?>"<?php if ($status['response'] == KRONOLITH_RESPONSE_DECLINED) echo ' selected="selected"' ?>><?php echo Kronolith::responseToString(KRONOLITH_RESPONSE_DECLINED) ?></option>
- <option value="<?php echo KRONOLITH_RESPONSE_TENTATIVE ?>"<?php if ($status['response'] == KRONOLITH_RESPONSE_TENTATIVE) echo ' selected="selected"' ?>><?php echo Kronolith::responseToString(KRONOLITH_RESPONSE_TENTATIVE) ?></option>
- <option value="<?php echo KRONOLITH_RESPONSE_NONE ?>"<?php if ($status['response'] == KRONOLITH_RESPONSE_NONE) echo ' selected="selected"' ?>><?php echo Kronolith::responsetoString(KRONOLITH_RESPONSE_NONE) ?></option>
+ <option value="<?php echo Kronolith::RESPONSE_ACCEPTED ?>"<?php if ($status['response'] == Kronolith::RESPONSE_ACCEPTED) echo ' selected="selected"' ?>><?php echo Kronolith::responseToString(Kronolith::RESPONSE_ACCEPTED) ?></option>
+ <option value="<?php echo Kronolith::RESPONSE_DECLINED ?>"<?php if ($status['response'] == Kronolith::RESPONSE_DECLINED) echo ' selected="selected"' ?>><?php echo Kronolith::responseToString(Kronolith::RESPONSE_DECLINED) ?></option>
+ <option value="<?php echo Kronolith::RESPONSE_TENTATIVE ?>"<?php if ($status['response'] == Kronolith::RESPONSE_TENTATIVE) echo ' selected="selected"' ?>><?php echo Kronolith::responseToString(Kronolith::RESPONSE_TENTATIVE) ?></option>
+ <option value="<?php echo Kronolith::RESPONSE_NONE ?>"<?php if ($status['response'] == Kronolith::RESPONSE_NONE) echo ' selected="selected"' ?>><?php echo Kronolith::responsetoString(Kronolith::RESPONSE_NONE) ?></option>
</select>
</td>
</tr>