From 6dbfe1cecfab4f4ecfa9eea24b36e10cf7781596 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 15 Dec 2009 15:53:05 +0100 Subject: [PATCH] Remove unncessary getters and setters. --- kronolith/ajax.php | 4 +- kronolith/attendees.php | 10 +- kronolith/data.php | 4 +- kronolith/delete.php | 8 +- kronolith/edit.php | 10 +- kronolith/event.php | 4 +- kronolith/feed/index.php | 14 +- kronolith/lib/Api.php | 50 +-- kronolith/lib/Block/month.php | 2 +- kronolith/lib/Block/monthlist.php | 4 +- kronolith/lib/Block/prevmonthlist.php | 4 +- kronolith/lib/Block/summary.php | 4 +- kronolith/lib/Block/tree_alarms.php | 4 +- kronolith/lib/Driver.php | 24 +- kronolith/lib/Driver/Holidays.php | 8 +- kronolith/lib/Driver/Horde.php | 4 +- kronolith/lib/Driver/Ical.php | 14 +- kronolith/lib/Driver/Kolab.php | 44 +-- kronolith/lib/Driver/Resource.php | 4 +- kronolith/lib/Driver/Sql.php | 88 ++--- kronolith/lib/Event.php | 524 +++++++------------------ kronolith/lib/Event/Holidays.php | 6 +- kronolith/lib/Event/Horde.php | 4 +- kronolith/lib/Event/Ical.php | 2 +- kronolith/lib/Event/Kolab.php | 29 +- kronolith/lib/Event/Resource.php | 22 +- kronolith/lib/Event/Sql.php | 22 +- kronolith/lib/FreeBusy.php | 4 +- kronolith/lib/Kronolith.php | 57 ++- kronolith/lib/LoginTasks/Task/PurgeEvents.php | 8 +- kronolith/lib/Resource/Group.php | 8 +- kronolith/lib/Resource/Single.php | 14 +- kronolith/lib/View/Day.php | 8 +- kronolith/lib/View/EditEvent.php | 10 +- kronolith/lib/View/Event.php | 18 +- kronolith/lib/View/ExportEvent.php | 4 +- kronolith/lib/View/Month.php | 4 +- kronolith/lib/View/Week.php | 6 +- kronolith/lib/View/Year.php | 7 +- kronolith/lib/tests/bug6031.phpt | 2 +- kronolith/lib/tests/toicalendar.phpt | 24 +- kronolith/new.php | 2 +- kronolith/search.php | 4 +- kronolith/templates/delete/delete.inc | 4 +- kronolith/templates/delete/one.inc | 2 +- kronolith/templates/edit/edit.inc | 27 +- kronolith/templates/search/event_summaries.inc | 4 +- kronolith/templates/view/view.inc | 2 +- 48 files changed, 448 insertions(+), 688 deletions(-) diff --git a/kronolith/ajax.php b/kronolith/ajax.php index 47240c7fa..b3778982f 100644 --- a/kronolith/ajax.php +++ b/kronolith/ajax.php @@ -46,7 +46,7 @@ function saveEvent($event) $end->min = $end->sec = 59; Kronolith::addEvents($events, $event, $start, $end, true, true); $result = new stdClass; - $result->cal = $event->getCalendarType() . '|' . $event->getCalendar(); + $result->cal = $event->calendarType . '|' . $event->calendar; $result->view = Horde_Util::getFormData('view'); $result->sig = $start->dateString() . $end->dateString(); if (count($events)) { @@ -245,7 +245,7 @@ try { $notification->push(_("You do not have permission to delete this event."), 'horde.warning'); break; } - $deleted = $kronolith_driver->deleteEvent($event->getId()); + $deleted = $kronolith_driver->deleteEvent($event->id); if ($deleted instanceof PEAR_Error) { $notification->push($deleted, 'horde.error'); break; diff --git a/kronolith/attendees.php b/kronolith/attendees.php index 3cc9fd691..ebf2c9b9a 100644 --- a/kronolith/attendees.php +++ b/kronolith/attendees.php @@ -68,6 +68,7 @@ case 'add': case 'edit': // Edit the specified attendee. + $actionValue = Horde_String::lower($actionValue); if (isset($attendees[$actionValue])) { if (empty($attendees[$actionValue]['name'])) { $editAttendee = $actionValue; @@ -85,6 +86,7 @@ case 'edit': case 'remove': // Remove the specified attendee. + $actionValue = Horde_String::lower($actionValue); if (isset($attendees[$actionValue])) { unset($attendees[$actionValue]); $_SESSION['kronolith']['attendees'] = $attendees; @@ -111,6 +113,7 @@ case 'changeResourceResp': case 'changeatt': // Change the attendance status of an attendee list($partval, $partname) = explode(' ', $actionValue, 2); + $partname = Horde_String::lower($partname); if (isset($attendees[$partname])) { $attendees[$partname]['attendance'] = $partval; $_SESSION['kronolith']['attendees'] = $attendees; @@ -120,6 +123,7 @@ case 'changeatt': case 'changeResourceAtt': // Change attendance status of a resource list($partval, $partname) = explode(' ', $actionValue, 2); + $partname = Horde_String::lower($partname); if (isset($resources[$partname])) { $resources[$partname]['attendance'] = $partval; $_SESSION['kronolith']['resources'] = $resources; @@ -129,6 +133,7 @@ case 'changeResourceAtt': case 'changeresp': // Change the response status of an attendee list($partval, $partname) = explode(' ', $actionValue, 2); + $partname = Horde_String::lower($partname); if (isset($attendees[$partname])) { $attendees[$partname]['response'] = $partval; $_SESSION['kronolith']['attendees'] = $attendees; @@ -157,10 +162,7 @@ case 'dismiss': case 'clear': // Remove all the attendees and resources. - $attendees = array(); - $resources = array(); - $_SESSION['kronolith']['attendees'] = $attendees; - $_SESSION['kronolith']['resources'] = $resources; + $_SESSION['kronolith']['attendees'] = $_SESSION['kronolith']['resources'] = array(); break; } diff --git a/kronolith/data.php b/kronolith/data.php index e5518905e..7caa039d6 100644 --- a/kronolith/data.php +++ b/kronolith/data.php @@ -96,7 +96,7 @@ case 'export': $calendars = array($calendars); } foreach ($calendars as $cal) { - if ($kronolith_driver->getCalendar() != $cal) { + if ($kronolith_driver->calendar != $cal) { $kronolith_driver->open($cal); } $events[$cal] = $kronolith_driver->listEvents($start, $end); @@ -153,7 +153,7 @@ case 'export': $calNames = array(); foreach ($events as $cal => $calevents) { - if ($kronolith_driver->getCalendar() != $cal) { + if ($kronolith_driver->calendar != $cal) { $kronolith_driver->open($cal); } diff --git a/kronolith/delete.php b/kronolith/delete.php index a415178d0..e90158daf 100644 --- a/kronolith/delete.php +++ b/kronolith/delete.php @@ -28,8 +28,8 @@ if ($eventID = Horde_Util::getFormData('eventID')) { exit; } if ($driver != 'Resource') { - $share = &$kronolith_shares->getShare($event->getCalendar()); - if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE, $event->getCreatorID())) { + $share = &$kronolith_shares->getShare($event->calendar); + if (!$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE, $event->creator)) { $notification->push(_("You do not have permission to delete this event."), 'horde.warning'); } else { $have_perms = true; @@ -51,7 +51,7 @@ if ($eventID = Horde_Util::getFormData('eventID')) { 'mday' => Horde_Util::getFormData('mday', date('j')) - 1, 'year' => Horde_Util::getFormData('year', date('Y')))); if ($event->end->compareDate($recurEnd) > 0) { - $result = $kronolith_driver->deleteEvent($event->getId()); + $result = $kronolith_driver->deleteEvent($event->id); if (is_a($result, 'PEAR_Error')) { $notification->push($result, 'horde.error'); } @@ -73,7 +73,7 @@ if ($eventID = Horde_Util::getFormData('eventID')) { if (!$event->recurs() || Horde_Util::getFormData('all') || !$event->recurrence->hasActiveRecurrence()) { - $result = $kronolith_driver->deleteEvent($event->getId()); + $result = $kronolith_driver->deleteEvent($event->id); if (is_a($result, 'PEAR_Error')) { $notification->push($result, 'horde.error'); } diff --git a/kronolith/edit.php b/kronolith/edit.php index 5f9449a9f..c4021e735 100644 --- a/kronolith/edit.php +++ b/kronolith/edit.php @@ -13,7 +13,7 @@ function _save(&$event) { $res = $event->save(); $tagger = Kronolith::getTagger(); - $tagger->replaceTags($event->getUID(), Horde_Util::getFormData('tags')); + $tagger->replaceTags($event->uid, Horde_Util::getFormData('tags')); if (is_a($res, 'PEAR_Error')) { $GLOBALS['notification']->push(sprintf(_("There was an error editing the event: %s"), $res->getMessage()), 'horde.error'); } elseif (Horde_Util::getFormData('sendupdates', false)) { @@ -100,7 +100,7 @@ if ($exception = Horde_Util::getFormData('del_exception')) { /* Set recurrence end. */ $exception->mday--; if ($event->end->compareDate($exception) > 0) { - $result = $kronolith_driver->deleteEvent($event->getId()); + $result = $kronolith_driver->deleteEvent($event->id); if (is_a($result, 'PEAR_Error')) { $notification->push($result, 'horde.error'); } @@ -117,7 +117,7 @@ if ($exception = Horde_Util::getFormData('del_exception')) { break; } - $event->setUID(null); + $event->uid = null; _save($event); $event = null; } elseif (Horde_Util::getFormData('saveAsNew') || @@ -159,10 +159,10 @@ if ($exception = Horde_Util::getFormData('del_exception')) { && !$sourceShare->hasPermission(Horde_Auth::getAuth(), Horde_Perms::DELETE)) { $notification->push(_("You do not have permission to move this event."), 'horde.warning'); } elseif ($user != Horde_Auth::getAuth() && - !$share->hasPermission(Horde_Auth::getAuth(), Kronolith::PERMS_DELEGATE, $event->getCreatorID())) { + !$share->hasPermission(Horde_Auth::getAuth(), Kronolith::PERMS_DELEGATE, $event->creator)) { $notification->push(sprintf(_("You do not have permission to delegate events to %s."), Kronolith::getUserName($user)), 'horde.warning'); } elseif ($user == Horde_Auth::getAuth() && - !$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT, $event->getCreatorID())) { + !$share->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT, $event->creator)) { $notification->push(_("You do not have permission to edit this event."), 'horde.warning'); } else { $event->readForm(); diff --git a/kronolith/event.php b/kronolith/event.php index cfb7de8ab..d71de302e 100644 --- a/kronolith/event.php +++ b/kronolith/event.php @@ -31,8 +31,8 @@ case 'DeleteEvent': break; case 'EditEvent': - if ($view->event->isPrivate() && - $view->event->getCreatorId() != Horde_Auth::getAuth()) { + if ($view->event->private && + $view->event->creator != Horde_Auth::getAuth()) { $url = $url = Horde_Util::getFormData('url'); if (!empty($url)) { $url = new Horde_Url($url, true); diff --git a/kronolith/feed/index.php b/kronolith/feed/index.php index 62b70aed7..99c2f574e 100644 --- a/kronolith/feed/index.php +++ b/kronolith/feed/index.php @@ -109,14 +109,14 @@ foreach ($events as $day_events) { foreach ($day_events as $id => $event) { /* Modification date. */ $modified = $history->getActionTimestamp('kronolith:' . $calendar . ':' - . $event->getUID(), 'modify'); + . $event->uid, 'modify'); if (!$modified) { $modified = $history->getActionTimestamp('kronolith:' . $calendar . ':' - . $event->getUID(), 'add'); + . $event->uid, 'add'); } $modified = new Horde_Date($modified); /* Description. */ - $desc = @htmlspecialchars($event->getDescription(), ENT_COMPAT, Horde_Nls::getCharset()); + $desc = @htmlspecialchars($event->description, ENT_COMPAT, Horde_Nls::getCharset()); if (strlen($desc)) { $desc .= '

'; } @@ -129,16 +129,16 @@ foreach ($events as $day_events) { } /* Attendees. */ $attendees = array(); - foreach ($event->getAttendees() as $attendee => $status) { + foreach ($event->attendees as $attendee => $status) { $attendees[] = empty($status['name']) ? $attendee : Horde_Mime_Address::trimAddress($status['name'] . (strpos($attendee, '@') === false ? '' : ' <' . $attendee . '>')); } if (count($attendees)) { $desc .= '
' . _("Who:") . ' ' . @htmlspecialchars(implode(', ', $attendees), ENT_COMPAT, Horde_Nls::getCharset()); } - if (strlen($event->getLocation())) { - $desc .= '
' . _("Where:") . ' ' . @htmlspecialchars($event->getLocation(), ENT_COMPAT, Horde_Nls::getCharset()); + if (strlen($event->location)) { + $desc .= '
' . _("Where:") . ' ' . @htmlspecialchars($event->location, ENT_COMPAT, Horde_Nls::getCharset()); } - $desc .= '
' . _("Event Status:") . ' ' . Kronolith::statusToString($event->getStatus()); + $desc .= '
' . _("Event Status:") . ' ' . Kronolith::statusToString($event->status); $entries[$id]['title'] = @htmlspecialchars($event->getTitle(), ENT_COMPAT, Horde_Nls::getCharset()); $entries[$id]['desc'] = @htmlspecialchars($desc, ENT_COMPAT, Horde_Nls::getCharset()); diff --git a/kronolith/lib/Api.php b/kronolith/lib/Api.php index 3f5b5d679..9d0bd61f6 100644 --- a/kronolith/lib/Api.php +++ b/kronolith/lib/Api.php @@ -186,7 +186,7 @@ class Kronolith_Api extends Horde_Registry_Api $results = array(); foreach ($events as $dayevents) { foreach ($dayevents as $event) { - $key = 'kronolith/' . $path . '/' . $event->getId(); + $key = 'kronolith/' . $path . '/' . $event->id; if (in_array('name', $properties)) { $results[$key]['name'] = $event->getTitle(); } @@ -210,10 +210,10 @@ class Kronolith_Api extends Horde_Registry_Api $results[$key]['contentlength'] = 1; } if (in_array('modified', $properties)) { - $results[$key]['modified'] = $this->modified($event->getUID()); + $results[$key]['modified'] = $this->modified($event->uid); } if (in_array('created', $properties)) { - $results[$key]['created'] = $this->getActionTimestamp($event->getUID(), 'add'); + $results[$key]['created'] = $this->getActionTimestamp($event->uid, 'add'); } } } @@ -230,9 +230,9 @@ class Kronolith_Api extends Horde_Registry_Api } $result = array( - 'data' => $this->export($event->getUID(), 'text/calendar'), + 'data' => $this->export($event->uid, 'text/calendar'), 'mimetype' => 'text/calendar'); - $modified = $this->modified($event->getUID()); + $modified = $this->modified($event->uid); if (!empty($modified)) { $result['mtime'] = $modified; } @@ -322,8 +322,8 @@ class Kronolith_Api extends Horde_Registry_Api if (is_a($content, 'Horde_iCalendar_vevent')) { $event = $kronolith_driver->getEvent(); $event->fromiCalendar($content); - $event->setCalendar($calendar); - $uid = $event->getUID(); + $event->calendar = $calendar; + $uid = $event->uid; // Remove from uids_remove list so we won't delete in the // end. if (isset($uids_remove[$uid])) { @@ -361,7 +361,7 @@ class Kronolith_Api extends Horde_Registry_Api } // Don't change creator/owner. - $event->setCreatorId($existing_event->getCreatorId()); + $event->creator = $existing_event->creator; } // Save entry. @@ -369,7 +369,7 @@ class Kronolith_Api extends Horde_Registry_Api if (is_a($saved, 'PEAR_Error')) { return $saved; } - $ids[] = $event->getUID(); + $ids[] = $event->uid; } } break; @@ -490,7 +490,7 @@ class Kronolith_Api extends Horde_Registry_Api $uids = array(); foreach ($events as $dayevents) { foreach ($dayevents as $event) { - $uids[] = $event->getUID(); + $uids[] = $event->uid; } } @@ -608,10 +608,10 @@ class Kronolith_Api extends Horde_Registry_Api if (is_a($content, 'Horde_iCalendar_vevent')) { $event = $kronolith_driver->getEvent(); $event->fromiCalendar($content); - $event->setCalendar($calendar); + $event->calendar = $calendar; // Check if the entry already exists in the data source, first // by UID. - $uid = $event->getUID(); + $uid = $event->uid; $existing_event = $kronolith_driver->getByUID($uid, array($calendar)); if (!is_a($existing_event, 'PEAR_Error')) { return PEAR::raiseError(_("Already Exists"), @@ -626,7 +626,7 @@ class Kronolith_Api extends Horde_Registry_Api $match->title == $event->title && $match->location == $event->location && $match->hasPermission(Horde_Perms::EDIT)) { - return PEAR::raiseError(_("Already Exists"), 'horde.message', null, null, $match->getUID()); + return PEAR::raiseError(_("Already Exists"), 'horde.message', null, null, $match->uid); } } } @@ -635,7 +635,7 @@ class Kronolith_Api extends Horde_Registry_Api if (is_a($eventId, 'PEAR_Error')) { return $eventId; } - $ids[] = $event->getUID(); + $ids[] = $event->uid; } } if (count($ids) == 0) { @@ -678,7 +678,7 @@ class Kronolith_Api extends Horde_Registry_Api return $event; } - return $event->getUID(); + return $event->uid; } /** @@ -715,7 +715,7 @@ class Kronolith_Api extends Horde_Registry_Api case 'text/x-vcalendar': $version = '1.0'; case 'text/calendar': - $share = $kronolith_shares->getShare($event->getCalendar()); + $share = $kronolith_shares->getShare($event->calendar); $iCal = new Horde_iCalendar($version); $iCal->setAttribute('X-WR-CALNAME', Horde_String::convertCharset($share->get('name'), Horde_Nls::getCharset(), 'utf-8')); @@ -824,7 +824,7 @@ class Kronolith_Api extends Horde_Registry_Api if (empty($event)) { $ownerCalendars = Kronolith::listCalendars(true, Horde_Perms::DELETE); foreach ($events as $ev) { - if (Horde_Auth::isAdmin() || isset($ownerCalendars[$ev->getCalendar()])) { + if (Horde_Auth::isAdmin() || isset($ownerCalendars[$ev->calendar])) { $event = $ev; break; } @@ -835,8 +835,8 @@ class Kronolith_Api extends Horde_Registry_Api if (empty($event)) { $deletableCalendars = Kronolith::listCalendars(false, Horde_Perms::DELETE); foreach ($events as $ev) { - if (isset($deletableCalendars[$ev->getCalendar()])) { - $kronolith_driver->open($ev->getCalendar()); + if (isset($deletableCalendars[$ev->calendar])) { + $kronolith_driver->open($ev->calendar); $event = $ev; break; } @@ -847,7 +847,7 @@ class Kronolith_Api extends Horde_Registry_Api return PEAR::raiseError(_("Permission Denied")); } - return $kronolith_driver->deleteEvent($event->getId()); + return $kronolith_driver->deleteEvent($event->id); } /** @@ -875,7 +875,7 @@ class Kronolith_Api extends Horde_Registry_Api } if (!$event->hasPermission(Horde_Perms::EDIT) || - ($event->isPrivate() && $event->getCreatorId() != Horde_Auth::getAuth())) { + ($event->private && $event->creator != Horde_Auth::getAuth())) { return PEAR::raiseError(_("Permission Denied")); } @@ -916,7 +916,7 @@ class Kronolith_Api extends Horde_Registry_Api $event->fromiCalendar($component); // Ensure we keep the original UID, even when content does not // contain one and fromiCalendar creates a new one. - $event->setUID($uid); + $event->uid = $uid; $eventId = $event->save(); return is_a($eventId, 'PEAR_Error') ? $eventId : true; @@ -1008,7 +1008,7 @@ class Kronolith_Api extends Horde_Registry_Api $ownerCalendars = Kronolith::listCalendars(true, Horde_Perms::EDIT); $event = null; foreach ($events as $ev) { - if (isset($ownerCalendars[$ev->getCalendar()])) { + if (isset($ownerCalendars[$ev->calendar])) { $event = $ev; break; } @@ -1018,7 +1018,7 @@ class Kronolith_Api extends Horde_Registry_Api if (empty($event)) { $editableCalendars = Kronolith::listCalendars(false, Horde_Perms::EDIT); foreach ($events as $ev) { - if (isset($editableCalendars[$ev->getCalendar()])) { + if (isset($editableCalendars[$ev->calendar])) { $event = $ev; break; } @@ -1026,7 +1026,7 @@ class Kronolith_Api extends Horde_Registry_Api } if (empty($event) || - ($event->isPrivate() && $event->getCreatorId() != Horde_Auth::getAuth())) { + ($event->private && $event->creator != Horde_Auth::getAuth())) { return PEAR::raiseError(_("Permission Denied")); } diff --git a/kronolith/lib/Block/month.php b/kronolith/lib/Block/month.php index f443b3147..5646e84e4 100644 --- a/kronolith/lib/Block/month.php +++ b/kronolith/lib/Block/month.php @@ -191,7 +191,7 @@ class Horde_Block_Kronolith_month extends Horde_Block { $day_events .= $event->start->strftime($prefs->getValue('twentyFour') ? '%R' : '%I:%M%p') . '-' . $event->end->strftime($prefs->getValue('twentyFour') ? '%R' : '%I:%M%p'); } $day_events .= ':' - . (($event->getLocation()) ? ' (' . $event->getLocation() . ')' : '') + . (($event->location) ? ' (' . $event->location . ')' : '') . ' ' . $event->getTitle() . "\n"; } $cell = Horde::linkTooltip($url, _("View Day"), '', '', '', $day_events) . $date_ob->mday . ''; diff --git a/kronolith/lib/Block/monthlist.php b/kronolith/lib/Block/monthlist.php index 14d2134c1..9d2df7546 100644 --- a/kronolith/lib/Block/monthlist.php +++ b/kronolith/lib/Block/monthlist.php @@ -144,9 +144,9 @@ class Horde_Block_Kronolith_monthlist extends Horde_Block { $html .= ''; if ($event->start->compareDate($now) < 0 && $event->end->compareDate($now) > 0) { - $html .= '' . $event->getLocation() . ''; + $html .= '' . $event->location . ''; } else { - $html .= $event->getLocation(); + $html .= $event->location; } if ($event->start->compareDate($now) < 0 && $event->end->compareDate($now) > 0) { diff --git a/kronolith/lib/Block/prevmonthlist.php b/kronolith/lib/Block/prevmonthlist.php index 169355403..110ea8e3d 100644 --- a/kronolith/lib/Block/prevmonthlist.php +++ b/kronolith/lib/Block/prevmonthlist.php @@ -138,9 +138,9 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block { $html .= ''; if ($event->start->compareDate($startDate) < 0 && $event->end->compareDate($startDate) > 0) { - $html .= '' . $event->getLocation() . ''; + $html .= '' . $event->location . ''; } else { - $html .= $event->getLocation(); + $html .= $event->location; } if ($event->start->compareDate($startDate) < 0 && $event->end->compareDate($startDate) > 0) { diff --git a/kronolith/lib/Block/summary.php b/kronolith/lib/Block/summary.php index f247ded40..6d342888d 100644 --- a/kronolith/lib/Block/summary.php +++ b/kronolith/lib/Block/summary.php @@ -187,8 +187,8 @@ class Horde_Block_Kronolith_summary extends Horde_Block { } $text = $event->getTitle(); - if ($location = $event->getLocation()) { - $text .= ' (' . $location . ')'; + if ($event->location) { + $text .= ' (' . $event->location . ')'; } $html .= $time; if ($event_active) { diff --git a/kronolith/lib/Block/tree_alarms.php b/kronolith/lib/Block/tree_alarms.php index b9470b144..931ce905d 100644 --- a/kronolith/lib/Block/tree_alarms.php +++ b/kronolith/lib/Block/tree_alarms.php @@ -28,11 +28,11 @@ class Horde_Block_kronolith_tree_alarms extends Horde_Block { } foreach ($alarms as $calId => $calAlarms) { foreach ($calAlarms as $event) { - if ($horde_alarm && $horde_alarm->isSnoozed($event->getUID(), Horde_Auth::getAuth())) { + if ($horde_alarm && $horde_alarm->isSnoozed($event->uid, Horde_Auth::getAuth())) { continue; } $alarmCount++; - $tree->addNode($parent . $calId . $event->getId(), + $tree->addNode($parent . $calId . $event->id, $parent, $event->getTitle(), $indent + 1, diff --git a/kronolith/lib/Driver.php b/kronolith/lib/Driver.php index e0e5f306c..a69d7f37a 100644 --- a/kronolith/lib/Driver.php +++ b/kronolith/lib/Driver.php @@ -26,7 +26,7 @@ class Kronolith_Driver * * @var string */ - protected $_calendar; + public $calendar; /** * An error message to throw when something is wrong. @@ -78,17 +78,7 @@ class Kronolith_Driver public function open($calendar) { - $this->_calendar = $calendar; - } - - /** - * Returns the currently open calendar. - * - * @return string The current calendar name. - */ - public function getCalendar() - { - return $this->_calendar; + $this->calendar = $calendar; } /** @@ -137,13 +127,13 @@ class Kronolith_Driver (empty($query->title) || stristr($event->getTitle(), $query->title)) && (empty($query->location) || - stristr($event->getLocation(), $query->location)) && + stristr($event->location, $query->location)) && (empty($query->description) || - stristr($event->getDescription(), $query->description)) && - (empty($query->creatorID) || - stristr($event->getCreatorID(), $query->creatorID)) && + stristr($event->description, $query->description)) && + (empty($query->creator) || + stristr($event->creator, $query->creator)) && (!isset($query->status) || - $event->getStatus() == $query->status)) { + $event->status == $query->status)) { Kronolith::addEvents($results, $event, $event->start, $event->end, false, $json, false); } } diff --git a/kronolith/lib/Driver/Holidays.php b/kronolith/lib/Driver/Holidays.php index fc500a08b..925aa69ac 100644 --- a/kronolith/lib/Driver/Holidays.php +++ b/kronolith/lib/Driver/Holidays.php @@ -69,10 +69,10 @@ class Kronolith_Driver_Holidays extends Kronolith_Driver $results = array(); for ($year = $startDate->year; $year <= $endDate->year; $year++) { - $dh = Date_Holidays::factory($this->_calendar, $year, $this->_params['language']); + $dh = Date_Holidays::factory($this->calendar, $year, $this->_params['language']); if (Date_Holidays::isError($dh)) { Horde::logMessage(sprintf('Factory was unable to produce driver object for driver %s in year %s with locale %s', - $this->_calendar, $year, $this->_params['language']), + $this->calendar, $year, $this->_params['language']), __FILE__, __LINE__, PEAR_LOG_ERR); continue; } @@ -97,10 +97,10 @@ class Kronolith_Driver_Holidays extends Kronolith_Driver list($id, $date) = explode('-', $eventId, 2); $year = substr($date, 0, 4); - $dh = Date_Holidays::factory($this->_calendar, $year, $this->_params['language']); + $dh = Date_Holidays::factory($this->calendar, $year, $this->_params['language']); if (Date_Holidays::isError($dh)) { Horde::logMessage(sprintf('Factory was unable to produce driver object for driver %s in year %s with locale %s', - $this->_calendar, $year, $this->_params['language']), + $this->calendar, $year, $this->_params['language']), __FILE__, __LINE__, PEAR_LOG_ERR); return false; } diff --git a/kronolith/lib/Driver/Horde.php b/kronolith/lib/Driver/Horde.php index ca08175bb..1f960cc07 100644 --- a/kronolith/lib/Driver/Horde.php +++ b/kronolith/lib/Driver/Horde.php @@ -25,7 +25,7 @@ class Kronolith_Driver_Horde extends Kronolith_Driver public function open($calendar) { parent::open($calendar); - list($this->api,) = explode('/', $this->_calendar, 2); + list($this->api,) = explode('/', $this->calendar, 2); } public function listAlarms($date, $fullevent = false) @@ -54,7 +54,7 @@ class Kronolith_Driver_Horde extends Kronolith_Driver $showRecurrence = false, $hasAlarm = false, $json = false) { - list($this->api, $category) = explode('/', $this->_calendar, 2); + list($this->api, $category) = explode('/', $this->calendar, 2); if (!$this->_params['registry']->hasMethod($this->api . '/listTimeObjects')) { return array(); } diff --git a/kronolith/lib/Driver/Ical.php b/kronolith/lib/Driver/Ical.php index a047cecf5..badcfda31 100644 --- a/kronolith/lib/Driver/Ical.php +++ b/kronolith/lib/Driver/Ical.php @@ -87,9 +87,9 @@ class Kronolith_Driver_Ical extends Kronolith_Driver $event = new Kronolith_Event_Ical($this); $event->status = Kronolith::STATUS_FREE; $event->fromiCalendar($component); - $event->setCalendar($this->_calendar); + $event->calendar = $this->calendar; // Force string so JSON encoding is consistent across drivers. - $event->eventID = 'ical' . $i; + $event->id = 'ical' . $i; /* Catch RECURRENCE-ID attributes which mark single recurrence * instances. */ @@ -124,8 +124,8 @@ class Kronolith_Driver_Ical extends Kronolith_Driver $results = array(); foreach ($events as $key => $event) { if ($event->recurs() && - isset($exceptions[$event->getUID()][$event->getSequence()])) { - $timestamp = $exceptions[$event->getUID()][$event->getSequence()]; + isset($exceptions[$event->uid][$event->sequence])) { + $timestamp = $exceptions[$event->uid][$event->sequence]; $events[$key]->recurrence->addException(date('Y', $timestamp), date('m', $timestamp), date('d', $timestamp)); } Kronolith::addEvents($results, $event, $startDate, $endDate, @@ -152,8 +152,8 @@ class Kronolith_Driver_Ical extends Kronolith_Driver $event = new Kronolith_Event_Ical($this); $event->status = Kronolith::STATUS_FREE; $event->fromiCalendar($components[$eventId]); - $event->setCalendar($this->_calendar); - $event->eventID = 'ical' . $eventId; + $event->calendar = $this->calendar; + $event->id = 'ical' . $eventId; return $event; } @@ -170,7 +170,7 @@ class Kronolith_Driver_Ical extends Kronolith_Driver */ public function getRemoteCalendar($cache = true) { - $url = trim($this->_calendar); + $url = trim($this->calendar); /* Treat webcal:// URLs as http://. */ if (substr($url, 0, 9) == 'webcal://') { diff --git a/kronolith/lib/Driver/Kolab.php b/kronolith/lib/Driver/Kolab.php index fb90f91f4..1da76c84e 100644 --- a/kronolith/lib/Driver/Kolab.php +++ b/kronolith/lib/Driver/Kolab.php @@ -62,8 +62,8 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver */ public function open($calendar) { - if ($this->_calendar != $calendar) { - $this->_calendar = $calendar; + if ($this->calendar != $calendar) { + $this->calendar = $calendar; $this->reset(); } @@ -89,7 +89,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver } // Connect to the Kolab backend - $result = $this->_kolab->open($this->_calendar, 1); + $result = $this->_kolab->open($this->calendar, 1); if (is_a($result, 'PEAR_Error')) { return $result; } @@ -118,7 +118,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver if (!$event->recurs()) { $start = new Horde_Date($event->start); - $start->min -= $event->getAlarm(); + $start->min -= $event->alarm; if ($start->compareDateTime($date) <= 0 && $date->compareDateTime($event->end) <= -1) { $events[] = $fullevent ? $event : $eventId; @@ -129,7 +129,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver continue; } $start = new Horde_Date($next); - $start->min -= $event->getAlarm(); + $start->min -= $event->alarm; $end = new Horde_Date(array('year' => $next->year, 'month' => $next->month, 'mday' => $next->mday, @@ -166,9 +166,9 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver public function exists($uid, $calendar_id = null) { // Log error if someone uses this function in an unsupported way - if ($calendar_id != $this->_calendar) { - Horde::logMessage(sprintf("Kolab::exists called for calendar %s. Currently active is %s.", $calendar_id, $this->_calendar), __FILE__, __LINE__, PEAR_LOG_ERR); - return PEAR::raiseError(sprintf("Kolab::exists called for calendar %s. Currently active is %s.", $calendar_id, $this->_calendar)); + if ($calendar_id != $this->calendar) { + Horde::logMessage(sprintf("Kolab::exists called for calendar %s. Currently active is %s.", $calendar_id, $this->calendar), __FILE__, __LINE__, PEAR_LOG_ERR); + return PEAR::raiseError(sprintf("Kolab::exists called for calendar %s. Currently active is %s.", $calendar_id, $this->calendar)); } $result = $this->synchronize(); @@ -227,7 +227,7 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver $events = array(); foreach($this->_events_cache as $event) { - if ($hasAlarm && !$event->getAlarm()) { + if ($hasAlarm && !$event->alarm) { continue; } @@ -325,16 +325,16 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver return $result; } - $uid = $event->getUID(); + $uid = $event->uid; if ($uid == null) { - $event->setUID($this->_store->generateUID()); + $event->uid = $this->_store->generateUID(); } $attributes = $event->toDriver(); $edit = false; $stored_uid = null; - if ($event->isStored() || $event->exists()) { + if ($event->stored || $event->exists()) { $stored_uid = $attributes['uid']; $action = array('action' => 'modify'); $edit = true; @@ -350,9 +350,9 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver /* Deal with tags */ $tagger = Kronolith::getTagger(); if (!empty($edit)) { - $tagger->replaceTags($event->getUID(), $event->tags, 'event'); + $tagger->replaceTags($event->uid, $event->tags, 'event'); } else { - $tagger->tag($event->getUID(), $event->tags, 'event'); + $tagger->tag($event->uid, $event->tags, 'event'); } /* Notify about the changed event. */ @@ -363,16 +363,16 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver /* Log the creation/modification of this item in the history log. */ $history = Horde_History::singleton(); - $history->log('kronolith:' . $event->getCalendar() . ':' . $event->getUID(), $action, true); + $history->log('kronolith:' . $event->calendar . ':' . $event->uid, $action, true); // refresh IMAP cache $this->synchronize(true); if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { - Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($event->getCalendar())); + Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($event->calendar)); } - return $event->getUID(); + return $event->uid; } /** @@ -400,14 +400,14 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver } if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { - Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($this->_calendar)); + Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($this->calendar)); Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($newCalendar)); } /* Log the moving of this item in the history log. */ - $uid = $event->getUID(); + $uid = $event->uid; $history = Horde_History::singleton(); - $history->log('kronolith:' . $event->getCalendar() . ':' . $uid, array('action' => 'delete'), true); + $history->log('kronolith:' . $event->calendar . ':' . $uid, array('action' => 'delete'), true); $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true); return $result; @@ -483,10 +483,10 @@ class Kronolith_Driver_Kolab extends Kronolith_Driver /* Log the deletion of this item in the history log. */ $history = Horde_History::singleton(); - $history->log('kronolith:' . $event->getCalendar() . ':' . $event->getUID(), array('action' => 'delete'), true); + $history->log('kronolith:' . $event->calendar . ':' . $event->uid, array('action' => 'delete'), true); if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { - Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($event->getCalendar())); + Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($event->calendar)); } unset($this->_events_cache[$eventId]); diff --git a/kronolith/lib/Driver/Resource.php b/kronolith/lib/Driver/Resource.php index 5ae79b3a9..f6a32b290 100644 --- a/kronolith/lib/Driver/Resource.php +++ b/kronolith/lib/Driver/Resource.php @@ -38,14 +38,14 @@ class Kronolith_Driver_Resource extends Kronolith_Driver_Sql * it is attached to. Not sure if there is a better way to do this... */ $delete_event = $this->getEvent($event); - $uid = $delete_event->getUID(); + $uid = $delete_event->uid; $driver = Kronolith::getDriver(); $events = $driver->getByUID($uid, null, true); foreach ($events as $e) { $resources = $e->getResources(); if (count($resources)) { // found the right entry - $r = $this->getResource($this->getResourceIdByCalendar($delete_event->getCalendar())); + $r = $this->getResource($this->getResourceIdByCalendar($delete_event->calendar)); $e->removeResource($r); $e->save(); } diff --git a/kronolith/lib/Driver/Sql.php b/kronolith/lib/Driver/Sql.php index a48503fee..a85557fa5 100644 --- a/kronolith/lib/Driver/Sql.php +++ b/kronolith/lib/Driver/Sql.php @@ -59,10 +59,10 @@ class Kronolith_Driver_Sql extends Kronolith_Driver foreach ($dayevents as $event) { if (!$event->recurs()) { $start = new Horde_Date($event->start); - $start->min -= $event->getAlarm(); + $start->min -= $event->alarm; if ($start->compareDateTime($date) <= 0 && $date->compareDateTime($event->end) <= -1) { - $events[] = $fullevent ? $event : $event->getId(); + $events[] = $fullevent ? $event : $event->id; } } else { if ($next = $event->recurrence->nextRecurrence($date)) { @@ -70,7 +70,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver continue; } $start = new Horde_Date($next); - $start->min -= $event->getAlarm(); + $start->min -= $event->alarm; $diff = Date_Calc::dateDiff($event->start->mday, $event->start->month, $event->start->year, @@ -93,7 +93,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver $event->end = $end; $events[] = $event; } else { - $events[] = $event->getId(); + $events[] = $event->id; } } } @@ -138,8 +138,8 @@ class Kronolith_Driver_Sql extends Kronolith_Driver $cond .= $binds; } } - if (!empty($query->creatorID)) { - $binds = Horde_SQL::buildClause($this->_db, 'event_creator_id', '=', $query->creatorID, true); + if (!empty($query->creator)) { + $binds = Horde_SQL::buildClause($this->_db, 'event_creator_id', '=', $query->creator, true); if (is_array($binds)) { $cond .= $binds[0] . ' AND '; $values = array_merge($values, $binds[1]); @@ -303,7 +303,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver ' event_exceptions, event_creator_id, event_resources' . ' FROM ' . $this->_params['table'] . ' WHERE calendar_id = ?'; - $values = array($this->_calendar); + $values = array($this->calendar); if ($conditions) { $q .= ' AND ' . $conditions; @@ -361,7 +361,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver /* We have all the information we need to create an event object * for this event, so go ahead and cache it. */ - $this->_cache[$this->_calendar][$row['event_id']] = new $this->_eventClass($this, $row); + $this->_cache[$this->calendar][$row['event_id']] = new $this->_eventClass($this, $row); if ($row['event_recurtype'] == Horde_Date_Recurrence::RECUR_NONE) { $events[$row['event_uid']] = $row['event_id']; } else { @@ -390,11 +390,11 @@ class Kronolith_Driver_Sql extends Kronolith_Driver $this->_params['table']); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('Kronolith_Driver_Sql::_countEvents(): user = "%s"; query = "%s"; values = "%s"', - Horde_Auth::getAuth(), $query, $this->_calendar), + Horde_Auth::getAuth(), $query, $this->calendar), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Run the query. */ - return $this->_db->getOne($query, array($this->_calendar)); + return $this->_db->getOne($query, array($this->calendar)); } public function getEvent($eventId = null) @@ -403,8 +403,8 @@ class Kronolith_Driver_Sql extends Kronolith_Driver return new $this->_eventClass($this); } - if (isset($this->_cache[$this->_calendar][$eventId])) { - return $this->_cache[$this->_calendar][$eventId]; + if (isset($this->_cache[$this->calendar][$eventId])) { + return $this->_cache[$this->calendar][$eventId]; } $query = 'SELECT event_id, event_uid, event_description,' . @@ -415,7 +415,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver ' event_alarm, event_alarm_methods, event_modified,' . ' event_exceptions, event_creator_id, event_resources' . ' FROM ' . $this->_params['table'] . ' WHERE event_id = ? AND calendar_id = ?'; - $values = array($eventId, $this->_calendar); + $values = array($eventId, $this->calendar); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('Kronolith_Driver_Sql::getEvent(): user = "%s"; query = "%s"; values = "%s"', @@ -429,8 +429,8 @@ class Kronolith_Driver_Sql extends Kronolith_Driver } if ($event) { - $this->_cache[$this->_calendar][$eventId] = new $this->_eventClass($this, $event); - return $this->_cache[$this->_calendar][$eventId]; + $this->_cache[$this->calendar][$eventId] = new $this->_eventClass($this, $event); + return $this->_cache[$this->calendar][$eventId]; } else { return PEAR::raiseError(_("Event not found")); } @@ -484,8 +484,8 @@ class Kronolith_Driver_Sql extends Kronolith_Driver $eventArray = array(); foreach ($events as $event) { $this->open($event['calendar_id']); - $this->_cache[$this->_calendar][$event['event_id']] = new $this->_eventClass($this, $event); - $eventArray[] = $this->_cache[$this->_calendar][$event['event_id']]; + $this->_cache[$this->calendar][$event['event_id']] = new $this->_eventClass($this, $event); + $eventArray[] = $this->_cache[$this->calendar][$event['event_id']]; } if ($getAll) { @@ -496,7 +496,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver $ownerCalendars = Kronolith::listCalendars(true, Horde_Perms::READ); $event = null; foreach ($eventArray as $ev) { - if (isset($ownerCalendars[$ev->getCalendar()])) { + if (isset($ownerCalendars[$ev->calendar])) { $event = $ev; break; } @@ -506,7 +506,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver if (empty($event)) { $readableCalendars = Kronolith::listCalendars(false, Horde_Perms::READ); foreach ($eventArray as $ev) { - if (isset($readableCalendars[$ev->getCalendar()])) { + if (isset($readableCalendars[$ev->calendar])) { $event = $ev; break; } @@ -528,7 +528,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver */ public function saveEvent($event) { - if ($event->isStored() || $event->exists()) { + if ($event->stored || $event->exists()) { $values = array(); $query = 'UPDATE ' . $this->_params['table'] . ' SET '; @@ -539,7 +539,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver } $query = substr($query, 0, -1); $query .= ' WHERE event_id = ?'; - $values[] = $event->getId(); + $values[] = $event->id; /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('Kronolith_Driver_Sql::saveEvent(): user = "%s"; query = "%s"; values = "%s"', @@ -553,19 +553,19 @@ class Kronolith_Driver_Sql extends Kronolith_Driver } /* Log the modification of this item in the history log. */ - if ($event->getUID()) { + if ($event->uid) { $history = Horde_History::singleton(); - $history->log('kronolith:' . $this->_calendar . ':' . $event->getUID(), array('action' => 'modify'), true); + $history->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'modify'), true); } /* Update tags */ $tagger = Kronolith::getTagger(); - $tagger->replaceTags($event->getUID(), $event->tags, 'event'); + $tagger->replaceTags($event->uid, $event->tags, 'event'); /* Update Geolocation */ if ($gDriver = Kronolith::getGeoDriver()) { try { - $gDriver->setLocation($event->getId(), $event->geoLocation); + $gDriver->setLocation($event->id, $event->geoLocation); } catch (Horde_Exception $e) { Horde::logMessage($e->getMessage(), __FILE__, __LINE__, PEAR_LOG_ERR); return new PEAR_Error($e->getMessage()); @@ -578,20 +578,20 @@ class Kronolith_Driver_Sql extends Kronolith_Driver Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); } - return $event->getId(); + return $event->id; } else { - if ($event->getId()) { - $id = $event->getId(); + if ($event->id) { + $id = $event->id; } else { $id = hash('md5', uniqid(mt_rand(), true)); - $event->setId($id); + $event->id = $id; } - if ($event->getUID()) { - $uid = $event->getUID(); + if ($event->uid) { + $uid = $event->uid; } else { $uid = (string)new Horde_Support_Guid; - $event->setUID($uid); + $event->uid = $uid; } $query = 'INSERT INTO ' . $this->_params['table']; @@ -607,7 +607,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver $cols_name .= ' calendar_id)'; $cols_values .= ' ?)'; - $values[] = $this->_calendar; + $values[] = $this->calendar; $query .= $cols_name . $cols_values; @@ -624,11 +624,11 @@ class Kronolith_Driver_Sql extends Kronolith_Driver /* Log the creation of this item in the history log. */ $history = Horde_History::singleton(); - $history->log('kronolith:' . $this->_calendar . ':' . $uid, array('action' => 'add'), true); + $history->log('kronolith:' . $this->calendar . ':' . $uid, array('action' => 'add'), true); /* Deal with any tags */ $tagger = Kronolith::getTagger(); - $tagger->tag($event->getUID(), $event->tags, 'event'); + $tagger->tag($event->uid, $event->tags, 'event'); /* Notify users about the new event. */ $result = Kronolith::sendNotification($event, 'add'); @@ -655,7 +655,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver } $query = 'UPDATE ' . $this->_params['table'] . ' SET calendar_id = ? WHERE calendar_id = ? AND event_id = ?'; - $values = array($newCalendar, $this->_calendar, $eventId); + $values = array($newCalendar, $this->calendar, $eventId); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('Kronolith_Driver_Sql::move(): %s; values = "%s"', @@ -670,10 +670,10 @@ class Kronolith_Driver_Sql extends Kronolith_Driver } /* Log the moving of this item in the history log. */ - $uid = $event->getUID(); + $uid = $event->uid; if ($uid) { $history = Horde_History::singleton(); - $history->log('kronolith:' . $this->_calendar . ':' . $uid, array('action' => 'delete'), true); + $history->log('kronolith:' . $this->calendar . ':' . $uid, array('action' => 'delete'), true); $history->log('kronolith:' . $newCalendar . ':' . $uid, array('action' => 'add'), true); } @@ -718,7 +718,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver } $query = 'DELETE FROM ' . $this->_params['table'] . ' WHERE event_id = ? AND calendar_id = ?'; - $values = array($eventId, $this->_calendar); + $values = array($eventId, $this->calendar); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('Kronolith_Driver_Sql::deleteEvent(): user = "%s"; query = "%s"; values = "%s"', @@ -732,9 +732,9 @@ class Kronolith_Driver_Sql extends Kronolith_Driver } /* Log the deletion of this item in the history log. */ - if ($event->getUID()) { + if ($event->uid) { $history = Horde_History::singleton(); - $history->log('kronolith:' . $this->_calendar . ':' . $event->getUID(), array('action' => 'delete'), true); + $history->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'delete'), true); } /* Remove the event from any resources that are attached to it */ @@ -754,12 +754,12 @@ class Kronolith_Driver_Sql extends Kronolith_Driver /* Remove any pending alarms. */ if (@include_once 'Horde/Alarm.php') { $alarm = Horde_Alarm::factory(); - $alarm->delete($event->getUID()); + $alarm->delete($event->uid); } /* Remove any tags */ $tagger = Kronolith::getTagger(); - $tagger->replaceTags($event->getUID(), array(), 'event'); + $tagger->replaceTags($event->uid, array(), 'event'); /* Notify about the deleted event. */ if (!$silent) { @@ -925,7 +925,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver return $event; } - $this->deleteEvent($event->getId()); + $this->deleteEvent($event->id); } } diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index 3acd45d55..acaaaa5d6 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -33,32 +33,34 @@ abstract class Kronolith_Event * * @var string */ - public $eventID = null; + protected $_id = null; /** * The UID for this event. * * @var string */ - protected $_uid = null; + public $uid = null; /** * The iCalendar SEQUENCE for this event. * * @var integer */ - protected $_sequence = null; + public $sequence = null; /** * The user id of the creator of the event. * * @var string */ - public $creatorID = null; + protected $_creator = null; /** * The title of this event. * + * For displaying in the interface use getTitle() instead. + * * @var string */ public $title = ''; @@ -203,14 +205,14 @@ abstract class Kronolith_Event * * @var string */ - protected $_calendar; + public $calendar; /** * The type of the calender this event exists on. * * @var string */ - protected $_calendarType; + public $calendarType; /** * The HTML background color to be used for this event. @@ -250,11 +252,11 @@ abstract class Kronolith_Event */ public function __construct($driver, $eventObject = null) { - $this->_calendar = $driver->getCalendar(); + $this->calendar = $driver->calendar; // FIXME: Move color definitions anywhere else. - if (!empty($this->_calendar) && - isset($GLOBALS['all_calendars'][$this->_calendar])) { - $share = $GLOBALS['all_calendars'][$this->_calendar]; + if (!empty($this->calendar) && + isset($GLOBALS['all_calendars'][$this->calendar])) { + $share = $GLOBALS['all_calendars'][$this->calendar]; $backgroundColor = $share->get('color'); if (!empty($backgroundColor)) { $this->_backgroundColor = $backgroundColor; @@ -267,13 +269,68 @@ abstract class Kronolith_Event /* Get tags */ $this->fromDriver($eventObject); $tagger = Kronolith::getTagger(); - $this->tags = $tagger->getTags($this->getUID(), 'event'); + $this->tags = $tagger->getTags($this->uid, 'event'); /* Get geolocation data */ if ($gDriver = Kronolith::getGeoDriver()) { - $this->geoLocation = $gDriver->getLocation($this->getId()); + $this->geoLocation = $gDriver->getLocation($this->id); + } + } + } + + /** + * Setter. + * + * Sets the 'id' and 'creator' properties. + * + * @param string $name Property name. + * @param mixed $value Property value. + */ + public function __set($name, $value) + { + switch ($name) { + case 'id': + if (substr($value, 0, 10) == 'kronolith:') { + $value = substr($value, 10); + } + // Fall through. + case 'creator': + $this->{'_' . $name} = $value; + return; + } + $trace = debug_backtrace(); + trigger_error('Undefined property via __set(): ' . $name + . ' in ' . $trace[0]['file'] + . ' on line ' . $trace[0]['line'], + E_USER_NOTICE); + } + + /** + * Getter. + * + * Returns the 'id' and 'creator' properties. + * + * @param string $name Property name. + * + * @return mixed Property value. + */ + public function __get($name) + { + switch ($name) { + case 'creator': + if (empty($this->_creator)) { + $this->_creator = Horde_Auth::getAuth(); } + // Fall through. + case 'id': + return $this->{'_' . $name}; } + $trace = debug_backtrace(); + trigger_error('Undefined property via __set(): ' . $name + . ' in ' . $trace[0]['file'] + . ' on line ' . $trace[0]['line'], + E_USER_NOTICE); + return null; } /** @@ -284,7 +341,7 @@ abstract class Kronolith_Event */ public function getDriver() { - return Kronolith::getDriver(null, $this->_calendar); + return Kronolith::getDriver(null, $this->calendar); } /** @@ -294,8 +351,8 @@ abstract class Kronolith_Event */ public function getShare() { - if (isset($GLOBALS['all_calendars'][$this->getCalendar()])) { - $share = $GLOBALS['all_calendars'][$this->getCalendar()]; + if (isset($GLOBALS['all_calendars'][$this->calendar])) { + $share = $GLOBALS['all_calendars'][$this->calendar]; } else { $share = PEAR::raiseError('Share not found'); } @@ -317,7 +374,7 @@ abstract class Kronolith_Event } return (!is_a($share = &$this->getShare(), 'PEAR_Error') && - $share->hasPermission($user, $permission, $this->getCreatorId())); + $share->hasPermission($user, $permission, $this->creator)); } /** @@ -327,7 +384,7 @@ abstract class Kronolith_Event */ public function save() { - if (!$this->isInitialized()) { + if (!$this->initialized) { return PEAR::raiseError('Event not yet initialized'); } @@ -343,7 +400,7 @@ abstract class Kronolith_Event * someone is silly enough to add a resource to it's own event.*/ $resource = Kronolith::getDriver('Resource')->getResource($id); $rcal = $resource->get('calendar'); - if ($rcal == $this->getCalendar()) { + if ($rcal == $this->calendar) { continue; } @@ -432,12 +489,12 @@ abstract class Kronolith_Event } $vEvent->setAttribute('DTSTAMP', $_SERVER['REQUEST_TIME']); - $vEvent->setAttribute('UID', $this->_uid); + $vEvent->setAttribute('UID', $this->uid); /* Get the event's history. */ $history = &Horde_History::singleton(); $created = $modified = null; - $log = $history->getHistory('kronolith:' . $this->_calendar . ':' . $this->_uid); + $log = $history->getHistory('kronolith:' . $this->calendar . ':' . $this->uid); if ($log && !is_a($log, 'PEAR_Error')) { foreach ($log->getData() as $entry) { switch ($entry['action']) { @@ -462,14 +519,14 @@ abstract class Kronolith_Event } $vEvent->setAttribute('SUMMARY', $v1 ? $this->getTitle() : Horde_String::convertCharset($this->getTitle(), Horde_Nls::getCharset(), 'utf-8')); - $name = Kronolith::getUserName($this->getCreatorId()); + $name = Kronolith::getUserName($this->creator); if (!$v1) { $name = Horde_String::convertCharset($name, Horde_Nls::getCharset(), 'utf-8'); } $vEvent->setAttribute('ORGANIZER', - 'mailto:' . Kronolith::getUserEmail($this->getCreatorId()), + 'mailto:' . Kronolith::getUserEmail($this->creator), array('CN' => $name)); - if (!$this->isPrivate() || $this->getCreatorId() == Horde_Auth::getAuth()) { + if (!$this->private || $this->creator == Horde_Auth::getAuth()) { if (!empty($this->description)) { $vEvent->setAttribute('DESCRIPTION', $v1 ? $this->description : Horde_String::convertCharset($this->description, Horde_Nls::getCharset(), 'utf-8')); } @@ -493,10 +550,10 @@ abstract class Kronolith_Event $vEvent->setAttribute('URL', $this->url); } } - $vEvent->setAttribute('CLASS', $this->isPrivate() ? 'PRIVATE' : 'PUBLIC'); + $vEvent->setAttribute('CLASS', $this->private ? 'PRIVATE' : 'PUBLIC'); // Status. - switch ($this->getStatus()) { + switch ($this->status) { case Kronolith::STATUS_FREE: // This is not an official iCalendar value, but we need it for // synchronization. @@ -523,7 +580,7 @@ abstract class Kronolith_Event } // Attendees. - foreach ($this->getAttendees() as $email => $status) { + foreach ($this->attendees as $email => $status) { $params = array(); switch ($status['attendance']) { case Kronolith::PART_REQUIRED: @@ -668,19 +725,19 @@ abstract class Kronolith_Event // Unique ID. $uid = $vEvent->getAttribute('UID'); if (!empty($uid) && !is_a($uid, 'PEAR_Error')) { - $this->setUID($uid); + $this->uid = $uid; } // Sequence. $seq = $vEvent->getAttribute('SEQUENCE'); if (is_int($seq)) { - $this->_sequence = $seq; + $this->sequence = $seq; } // Title, tags and description. $title = $vEvent->getAttribute('SUMMARY'); if (!is_array($title) && !is_a($title, 'PEAR_Error')) { - $this->setTitle($title); + $this->title = $title; } // Tags @@ -692,7 +749,7 @@ abstract class Kronolith_Event // Description $desc = $vEvent->getAttribute('DESCRIPTION'); if (!is_array($desc) && !is_a($desc, 'PEAR_Error')) { - $this->setDescription($desc); + $this->description = $desc; } // Remote Url @@ -704,18 +761,14 @@ abstract class Kronolith_Event // Location $location = $vEvent->getAttribute('LOCATION'); if (!is_array($location) && !is_a($location, 'PEAR_Error')) { - $this->setLocation($location); + $this->location = $location; } // Class $class = $vEvent->getAttribute('CLASS'); if (!is_array($class) && !is_a($class, 'PEAR_Error')) { $class = Horde_String::upper($class); - if ($class == 'PRIVATE' || $class == 'CONFIDENTIAL') { - $this->setPrivate(true); - } else { - $this->setPrivate(false); - } + $this->private = $class == 'PRIVATE' || $class == 'CONFIDENTIAL'; } // Status. @@ -726,7 +779,7 @@ abstract class Kronolith_Event $status = 'CANCELLED'; } if (defined('Kronolith::STATUS_' . $status)) { - $this->setStatus(constant('Kronolith::STATUS_' . $status)); + $this->status = constant('Kronolith::STATUS_' . $status); } } @@ -900,19 +953,19 @@ abstract class Kronolith_Event public function fromHash($hash) { // See if it's a new event. - if ($this->getId() === null) { - $this->setCreatorId(Horde_Auth::getAuth()); + if ($this->id === null) { + $this->creator = Horde_Auth::getAuth(); } if (!empty($hash['title'])) { - $this->setTitle($hash['title']); + $this->title = $hash['title']; } else { return PEAR::raiseError(_("Events must have a title.")); } if (!empty($hash['description'])) { - $this->setDescription($hash['description']); + $this->description = $hash['description']; } if (!empty($hash['location'])) { - $this->setLocation($hash['location']); + $this->location = $hash['location']; } if (!empty($hash['start_date'])) { $date = explode('-', $hash['start_date']); @@ -972,7 +1025,7 @@ abstract class Kronolith_Event } } if (!empty($hash['alarm'])) { - $this->setAlarm($hash['alarm']); + $this->alarm = (int)$hash['alarm']; } elseif (!empty($hash['alarm_date']) && !empty($hash['alarm_time'])) { $date = explode('-', $hash['alarm_date']); @@ -987,7 +1040,7 @@ abstract class Kronolith_Event 'month' => $date[1], 'mday' => $date[2], 'year' => $date[0])); - $this->setAlarm(($this->start->timestamp() - $alarm->timestamp()) / 60); + $this->alarm = ($this->start->timestamp() - $alarm->timestamp()) / 60; } } if (!empty($hash['recur_type'])) { @@ -1019,7 +1072,7 @@ abstract class Kronolith_Event */ public function toAlarm($time, $user = null, $prefs = null) { - if (!$this->getAlarm()) { + if (!$this->alarm) { return; } @@ -1039,12 +1092,12 @@ abstract class Kronolith_Event $methods = !empty($this->methods) ? $this->methods : @unserialize($prefs->getValue('event_alarms')); $start = clone $this->start; - $start->min -= $this->getAlarm(); + $start->min -= $this->alarm; if (isset($methods['notify'])) { $methods['notify']['show'] = array( '__app' => $GLOBALS['registry']->getApp(), - 'event' => $this->getId(), - 'calendar' => $this->getCalendar()); + 'event' => $this->id, + 'calendar' => $this->calendar); if (!empty($methods['notify']['sound'])) { if ($methods['notify']['sound'] == 'on') { // Handle boolean sound preferences. @@ -1058,7 +1111,7 @@ abstract class Kronolith_Event } if (isset($methods['popup'])) { $methods['popup']['message'] = $this->getTitle($user); - $description = $this->getDescription(); + $description = $this->description; if (!empty($description)) { $methods['popup']['message'] .= "\n\n" . $description; } @@ -1070,18 +1123,18 @@ abstract class Kronolith_Event $this->location, $this->start->strftime($prefs->getValue('date_format')), $this->start->format($prefs->getValue('twentyFour') ? 'H:i' : 'h:ia'), - $this->getDescription()); + $this->description); } return array( - 'id' => $this->getUID(), + 'id' => $this->uid, 'user' => $user, 'start' => $start->timestamp(), 'end' => $this->end->timestamp(), 'methods' => array_keys($methods), 'params' => $methods, 'title' => $this->getTitle($user), - 'text' => $this->getDescription()); + 'text' => $this->description); } /** @@ -1130,7 +1183,7 @@ abstract class Kronolith_Event { $json = new stdClass; $json->t = $this->getTitle(); - $json->c = $this->getCalendar(); + $json->c = $this->calendar; $json->s = $this->start->toJson(); $json->e = $this->end->toJson(); $json->fi = $this->first; @@ -1162,10 +1215,10 @@ abstract class Kronolith_Event } if ($full) { - $json->id = $this->getId(); - $json->ty = $this->_calendarType; - $json->d = $this->getDescription(); - $json->l = $this->getLocation(); + $json->id = $this->id; + $json->ty = $this->calendarType; + $json->d = $this->description; + $json->l = $this->location; $json->u = $this->url; $json->sd = $this->start->strftime('%x'); $json->st = $this->start->format($time_format); @@ -1193,22 +1246,6 @@ abstract class Kronolith_Event } /** - * TODO - */ - public function isInitialized() - { - return $this->initialized; - } - - /** - * TODO - */ - public function isStored() - { - return $this->stored; - } - - /** * Checks if the current event is already present in the calendar. * * Does the check based on the uid. @@ -1217,15 +1254,15 @@ abstract class Kronolith_Event */ public function exists() { - if (!isset($this->_uid) || !isset($this->_calendar)) { + if (!isset($this->uid) || !isset($this->calendar)) { return false; } - $eventID = $this->getDriver()->exists($this->_uid, $this->_calendar); + $eventID = $this->getDriver()->exists($this->uid, $this->calendar); if (is_a($eventID, 'PEAR_Error') || !$eventID) { return false; } else { - $this->eventID = $eventID; + $this->id = $eventID; return true; } } @@ -1321,8 +1358,8 @@ abstract class Kronolith_Event $formatted = $horde_date->strftime($GLOBALS['prefs']->getValue('date_format')); return $formatted . Horde::applicationUrl('edit.php') - ->add(array('calendar' => $this->getCalendar(), - 'eventID' => $this->eventID, + ->add(array('calendar' => $this->calendar, + 'eventID' => $this->id, 'del_exception' => $date, 'url' => Horde_Util::getFormData('url'))) ->link(array('title' => sprintf(_("Delete exception on %s"), $formatted))) @@ -1341,94 +1378,6 @@ abstract class Kronolith_Event return implode(', ', array_map(array($this, 'exceptionLink'), $this->recurrence->getExceptions())); } - public function getCalendar() - { - return $this->_calendar; - } - - public function setCalendar($calendar) - { - $this->_calendar = $calendar; - } - - public function getCalendarType() - { - return $this->_calendarType; - } - - /** - * Returns the locally unique identifier for this event. - * - * @return string The local identifier for this event. - */ - public function getId() - { - return $this->eventID; - } - - /** - * Sets the locally unique identifier for this event. - * - * @param string $eventId The local identifier for this event. - */ - public function setId($eventId) - { - if (substr($eventId, 0, 10) == 'kronolith:') { - $eventId = substr($eventId, 10); - } - $this->eventID = $eventId; - } - - /** - * Returns the global UID for this event. - * - * @return string The global UID for this event. - */ - public function getUID() - { - return $this->_uid; - } - - /** - * Sets the global UID for this event. - * - * @param string $uid The global UID for this event. - */ - public function setUID($uid) - { - $this->_uid = $uid; - } - - /** - * Returns the iCalendar SEQUENCE for this event. - * - * @return integer The sequence for this event. - */ - public function getSequence() - { - return $this->_sequence; - } - - /** - * Returns the id of the user who created the event. - * - * @return string The creator id - */ - public function getCreatorId() - { - return !empty($this->creatorID) ? $this->creatorID : Horde_Auth::getAuth(); - } - - /** - * Sets the id of the creator of the event. - * - * @param string $creatorID The user id for the user who created the event - */ - public function setCreatorId($creatorID) - { - $this->creatorID = $creatorID; - } - /** * Returns the title of this event. * @@ -1438,7 +1387,7 @@ abstract class Kronolith_Event */ public function getTitle($user = null) { - if (!$this->isInitialized()) { + if (!$this->initialized) { return ''; } @@ -1451,8 +1400,8 @@ abstract class Kronolith_Event $end = $this->end->format($twentyFour ? 'G:i' : 'g:ia'); // We explicitly allow admin access here for the alarms notifications. - if (!Horde_Auth::isAdmin() && $this->isPrivate() && - $this->getCreatorId() != $user) { + if (!Horde_Auth::isAdmin() && $this->private && + $this->creator != $user) { return _("busy"); } elseif (Horde_Auth::isAdmin() || $this->hasPermission(Horde_Perms::READ, $user)) { return strlen($this->title) ? $this->title : _("[Unnamed event]"); @@ -1462,118 +1411,6 @@ abstract class Kronolith_Event } /** - * Sets the title of this event. - * - * @param string The new title for this event. - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * Returns the description of this event. - * - * @return string The description of this event. - */ - public function getDescription() - { - return $this->description; - } - - /** - * Sets the description of this event. - * - * @param string $description The new description for this event. - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * Returns the location this event occurs at. - * - * @return string The location of this event. - */ - public function getLocation() - { - return $this->location; - } - - /** - * Sets the location this event occurs at. - * - * @param string $location The new location for this event. - */ - public function setLocation($location) - { - $this->location = $location; - } - - /** - * Returns whether this event is private. - * - * @return boolean Whether this even is private. - */ - public function isPrivate() - { - return $this->private; - } - - /** - * Sets the private flag of this event. - * - * @param boolean $private Whether this event should be marked private. - */ - public function setPrivate($private) - { - $this->private = !empty($private); - } - - /** - * Returns the event status. - * - * @return integer The status of this event. - */ - public function getStatus() - { - return $this->status; - } - - /** - * Checks whether the events status is the same as the specified value. - * - * @param integer $status The status value to check against. - * - * @return boolean True if the events status is the same as $status. - */ - public function hasStatus($status) - { - return ($status == $this->status); - } - - /** - * Sets the status of this event. - * - * @param integer $status The new event status. - */ - public function setStatus($status) - { - $this->status = $status; - } - - /** - * Returns the entire attendees array. - * - * @return array A copy of the attendees array. - */ - public function getAttendees() - { - return $this->attendees; - } - - /** * Checks to see whether the specified attendee is associated with the * current event. * @@ -1589,17 +1426,6 @@ abstract class Kronolith_Event } /** - * Sets the entire attendee array. - * - * @param array $attendees The new attendees array. This should be of the - * correct format to avoid driver problems. - */ - public function setAttendees($attendees) - { - $this->attendees = array_change_key_case($attendees); - } - - /** * Adds a new attendee to the current event. * * This will overwrite an existing attendee if one exists with the same @@ -1633,19 +1459,6 @@ abstract class Kronolith_Event } /** - * Removes the specified attendee from the current event. - * - * @param string $email The email address of the attendee. - */ - public function removeAttendee($email) - { - $email = Horde_String::lower($email); - if (isset($this->attendees[$email])) { - unset($this->attendees[$email]); - } - } - - /** * Adds a single Kronolith_Resource to this event. * No validation or acceptence/denial is done here...it should be done * when saving the Event. @@ -1664,18 +1477,6 @@ abstract class Kronolith_Event } /** - * Directly set/replace the _resources array. Called from Event::readForm - * to bulk load the resources from $_SESSION - * - * @param $resources - * @return unknown_type - */ - public function setResources($resources) - { - $this->_resources = $resources; - } - - /** * Remove a Kronolith_Resource from this event * * @param Kronolith_Resource $resource The resource to remove @@ -1685,7 +1486,7 @@ abstract class Kronolith_Event public function removeResource($resource) { if (isset($this->_resources[$resource->getId()])) { - unset ($this->_resources[$resource->getId()]); + unset($this->_resources[$resource->getId()]); } } @@ -1699,20 +1500,6 @@ abstract class Kronolith_Event return $this->_resources; } - /** - * Checks to see whether the specified resource is associated with this - * event. - * - * @param string $uid The resource uid. - * - * @return boolean True if the specified attendee is present for this - * event. - */ - public function hasResource($uid) - { - return isset($this->_resources[$uid]); - } - public function isAllDay() { return $this->allday || @@ -1724,16 +1511,6 @@ abstract class Kronolith_Event $this->end->year > $this->start->year)))); } - public function getAlarm() - { - return $this->alarm; - } - - public function setAlarm($alarm) - { - $this->alarm = $alarm; - } - public function readForm() { global $prefs, $cManager; @@ -1741,17 +1518,16 @@ abstract class Kronolith_Event // Event owner. $targetcalendar = Horde_Util::getFormData('targetcalendar'); if (strpos($targetcalendar, ':')) { - list(, $creator) = explode(':', $targetcalendar, 2); - } else { - $creator = isset($this->eventID) ? $this->getCreatorId() : Horde_Auth::getAuth(); + list(, $this->creator) = explode(':', $targetcalendar, 2); + } elseif (!isset($this->id)) { + $this->creator = Horde_Auth::getAuth(); } - $this->setCreatorId($creator); // Basic fields. - $this->setTitle(Horde_Util::getFormData('title', $this->title)); - $this->setDescription(Horde_Util::getFormData('description', $this->description)); - $this->setLocation(Horde_Util::getFormData('location', $this->location)); - $this->setPrivate(Horde_Util::getFormData('private')); + $this->title = Horde_Util::getFormData('title', $this->title); + $this->description = Horde_Util::getFormData('description', $this->description); + $this->location = Horde_Util::getFormData('location', $this->location); + $this->private = (bool)Horde_Util::getFormData('private'); // URL. $url = Horde_Util::getFormData('eventurl', $this->url); @@ -1801,22 +1577,22 @@ abstract class Kronolith_Event $this->url = $url; // Status. - $this->setStatus(Horde_Util::getFormData('status', $this->status)); + $this->status = Horde_Util::getFormData('status', $this->status); // Attendees. if (isset($_SESSION['kronolith']['attendees']) && is_array($_SESSION['kronolith']['attendees'])) { - $this->setAttendees($_SESSION['kronolith']['attendees']); + $this->attendees = $_SESSION['kronolith']['attendees']; } if ($attendees = Horde_Util::getFormData('attendees')) { $attendees = Kronolith::parseAttendees(trim($attendees)); if ($attendees) { - $this->setAttendees($attendees); + $this->attendees = $attendees; } } // Resources if (isset($_SESSION['kronolith']['resources']) && is_array($_SESSION['kronolith']['resources'])) { - $this->setResources($_SESSION['kronolith']['resources']); + $this->_resources = $_SESSION['kronolith']['resources']; } // strptime() is locale dependent, i.e. %p is not always matching @@ -1946,7 +1722,7 @@ abstract class Kronolith_Event // Alarm. if (!is_null($alarm = Horde_Util::getFormData('alarm'))) { if ($alarm) { - $this->setAlarm(Horde_Util::getFormData('alarm_value') * Horde_Util::getFormData('alarm_unit')); + $this->alarm = Horde_Util::getFormData('alarm_value') * Horde_Util::getFormData('alarm_unit'); // Notification. if (Horde_Util::getFormData('alarm_change_method')) { $types = Horde_Util::getFormData('event_alarms'); @@ -1971,7 +1747,7 @@ abstract class Kronolith_Event $this->methods = array(); } } else { - $this->setAlarm(0); + $this->alarm = 0; $this->methods = array(); } } @@ -2329,9 +2105,9 @@ abstract class Kronolith_Event */ public function getViewUrl($params = array(), $full = false) { - $params['eventID'] = $this->eventID; - $params['calendar'] = $this->getCalendar(); - $params['type'] = $this->_calendarType; + $params['eventID'] = $this->id; + $params['calendar'] = $this->calendar; + $params['type'] = $this->calendarType; return Horde::applicationUrl('event.php', $full)->add($params); } @@ -2344,9 +2120,9 @@ abstract class Kronolith_Event public function getEditUrl($params = array()) { $params['view'] = 'EditEvent'; - $params['eventID'] = $this->eventID; - $params['calendar'] = $this->getCalendar(); - $params['type'] = $this->_calendarType; + $params['eventID'] = $this->id; + $params['calendar'] = $this->calendar; + $params['type'] = $this->calendarType; return Horde::applicationUrl('event.php')->add($params); } @@ -2359,9 +2135,9 @@ abstract class Kronolith_Event public function getDeleteUrl($params = array()) { $params['view'] = 'DeleteEvent'; - $params['eventID'] = $this->eventID; - $params['calendar'] = $this->getCalendar(); - $params['type'] = $this->_calendarType; + $params['eventID'] = $this->id; + $params['calendar'] = $this->calendar; + $params['type'] = $this->calendarType; return Horde::applicationUrl('event.php')->add($params); } @@ -2374,9 +2150,9 @@ abstract class Kronolith_Event public function getExportUrl($params = array()) { $params['view'] = 'ExportEvent'; - $params['eventID'] = $this->eventID; - $params['calendar'] = $this->getCalendar(); - $params['type'] = $this->_calendarType; + $params['eventID'] = $this->id; + $params['calendar'] = $this->calendar; + $params['type'] = $this->calendarType; return Horde::applicationUrl('event.php')->add($params); } @@ -2438,7 +2214,7 @@ abstract class Kronolith_Event $status .= Horde::fullSrcImg('recur-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconRecur'))); } - if ($this->isPrivate()) { + if ($this->private) { $title = _("Private event"); $status .= Horde::fullSrcImg('private-' . $icon_color . '.png', array('attr' => array('alt' => $title, 'title' => $title, 'class' => 'iconPrivate'))); } @@ -2453,8 +2229,8 @@ abstract class Kronolith_Event $link .= ' ' . $status; } - if (!$this->isPrivate() || - $this->getCreatorId() == Horde_Auth::getAuth()) { + if (!$this->private || + $this->creator == Horde_Auth::getAuth()) { $link .= $this->getEditUrl( array('datetime' => $datetime->strftime('%Y%m%d%H%M%S'), 'url' => $from_url)) @@ -2500,10 +2276,10 @@ abstract class Kronolith_Event public function getTooltip() { $tooltip = $this->getTimeRange() - . "\n" . sprintf(_("Owner: %s"), ($this->getCreatorId() == Horde_Auth::getAuth() ? - _("Me") : Kronolith::getUserName($this->getCreatorId()))); + . "\n" . sprintf(_("Owner: %s"), ($this->creator == Horde_Auth::getAuth() ? + _("Me") : Kronolith::getUserName($this->creator))); - if (!$this->isPrivate() || $this->getCreatorId() == Horde_Auth::getAuth()) { + if (!$this->private || $this->creator == Horde_Auth::getAuth()) { if ($this->location) { $tooltip .= "\n" . _("Location") . ': ' . $this->location; } diff --git a/kronolith/lib/Event/Holidays.php b/kronolith/lib/Event/Holidays.php index 00ce89a87..c2d175605 100644 --- a/kronolith/lib/Event/Holidays.php +++ b/kronolith/lib/Event/Holidays.php @@ -16,7 +16,7 @@ class Kronolith_Event_Holidays extends Kronolith_Event * * @var string */ - protected $_calendarType = 'holiday'; + public $calendarType = 'holiday'; /** * The status of this event. @@ -42,11 +42,11 @@ class Kronolith_Event_Holidays extends Kronolith_Event { $this->stored = true; $this->initialized = true; - $this->setTitle(Horde_String::convertCharset($dhEvent->getTitle(), 'UTF-8')); + $this->title = Horde_String::convertCharset($dhEvent->getTitle(), 'UTF-8'); $this->start = new Horde_Date($dhEvent->_date->getTime()); $this->end = new Horde_Date($this->start); $this->end->mday++; - $this->setId($dhEvent->getInternalName() . '-' . $this->start->dateString()); + $this->id = $dhEvent->getInternalName() . '-' . $this->start->dateString(); } /** diff --git a/kronolith/lib/Event/Horde.php b/kronolith/lib/Event/Horde.php index 2d49b04e7..6666a72c5 100644 --- a/kronolith/lib/Event/Horde.php +++ b/kronolith/lib/Event/Horde.php @@ -15,7 +15,7 @@ class Kronolith_Event_Horde extends Kronolith_Event * * @var string */ - protected $_calendarType = 'external'; + public $calendarType = 'external'; /** * The API (application) of this event. @@ -63,7 +63,7 @@ class Kronolith_Event_Horde extends Kronolith_Event { $eventStart = new Horde_Date($event['start']); $eventEnd = new Horde_Date($event['end']); - $this->eventID = '_' . $this->_api . $event['id']; + $this->id = '_' . $this->_api . $event['id']; $this->icon = !empty($event['icon']) ? $event['icon'] : null; $this->title = $event['title']; $this->description = isset($event['description']) ? $event['description'] : ''; diff --git a/kronolith/lib/Event/Ical.php b/kronolith/lib/Event/Ical.php index a6dce03f0..a5d5d3e6c 100644 --- a/kronolith/lib/Event/Ical.php +++ b/kronolith/lib/Event/Ical.php @@ -16,7 +16,7 @@ class Kronolith_Event_Ical extends Kronolith_Event * * @var string */ - protected $_calendarType = 'remote'; + public $calendarType = 'remote'; public function fromDriver($vEvent) { diff --git a/kronolith/lib/Event/Kolab.php b/kronolith/lib/Event/Kolab.php index 6e5a35f2a..aecbbb0d7 100644 --- a/kronolith/lib/Event/Kolab.php +++ b/kronolith/lib/Event/Kolab.php @@ -17,7 +17,7 @@ class Kronolith_Event_Kolab extends Kronolith_Event * * @var string */ - protected $_calendarType = 'internal'; + public $calendarType = 'internal'; /** * Const'r @@ -43,8 +43,8 @@ class Kronolith_Event_Kolab extends Kronolith_Event public function fromDriver($event) { - $this->eventID = $event['uid']; - $this->setUID($this->eventID); + $this->id = $event['uid']; + $this->uid = $this->id; if (isset($event['summary'])) { $this->title = $event['summary']; @@ -58,14 +58,14 @@ class Kronolith_Event_Kolab extends Kronolith_Event if (isset($event['sensitivity']) && ($event['sensitivity'] == 'private' || $event['sensitivity'] == 'confidential')) { - $this->setPrivate(true); + $this->private = true; } if (isset($event['organizer']['smtp-address'])) { if (Kronolith::isUserEmail(Horde_Auth::getAuth(), $event['organizer']['smtp-address'])) { - $this->creatorID = Horde_Auth::getAuth(); + $this->creator = Horde_Auth::getAuth(); } else { - $this->creatorID = $event['organizer']['smtp-address']; + $this->creator = $event['organizer']['smtp-address']; } } @@ -160,22 +160,17 @@ class Kronolith_Event_Kolab extends Kronolith_Event public function toDriver() { $event = array(); - $event['uid'] = $this->getUID(); + $event['uid'] = $this->uid; $event['summary'] = $this->title; $event['body'] = $this->description; $event['location'] = $this->location; - - if ($this->isPrivate()) { - $event['sensitivity'] = 'private'; - } else { - $event['sensitivity'] = 'public'; - } + $event['sensitivity'] = $this->private ? 'private' : 'public'; // Only set organizer if this is a new event if ($this->getID() == null) { $organizer = array( - 'display-name' => Kronolith::getUserName($this->getCreatorId()), - 'smtp-address' => Kronolith::getUserEmail($this->getCreatorId()) + 'display-name' => Kronolith::getUserName($this->creator), + 'smtp-address' => Kronolith::getUserEmail($this->creator) ); $event['organizer'] = $organizer; } @@ -214,9 +209,7 @@ class Kronolith_Event_Kolab extends Kronolith_Event // Attendees $event['attendee'] = array(); - $attendees = $this->getAttendees(); - - foreach($attendees as $email => $attendee) { + foreach ($this->attendees as $email => $attendee) { $new_attendee = array(); $new_attendee['display-name'] = $attendee['name']; diff --git a/kronolith/lib/Event/Resource.php b/kronolith/lib/Event/Resource.php index 0f7148d47..dbaf8b66b 100644 --- a/kronolith/lib/Event/Resource.php +++ b/kronolith/lib/Event/Resource.php @@ -19,7 +19,7 @@ class Kronolith_Event_Resource extends Kronolith_Event * * @var string */ - protected $_calendarType = 'resource'; + public $calendarType = 'resource'; /** * @var array @@ -45,9 +45,9 @@ class Kronolith_Event_Resource extends Kronolith_Event $this->durMin = ($this->end->timestamp() - $this->start->timestamp()) / 60; $this->title = $driver->convertFromDriver($SQLEvent['event_title']); - $this->eventID = $SQLEvent['event_id']; + $this->id = $SQLEvent['event_id']; $this->setUID($SQLEvent['event_uid']); - $this->creatorID = $SQLEvent['event_creator_id']; + $this->creator = $SQLEvent['event_creator_id']; if (!empty($SQLEvent['event_recurtype'])) { $this->recurrence = new Horde_Date_Recurrence($this->start); @@ -117,13 +117,13 @@ class Kronolith_Event_Resource extends Kronolith_Event $driver = $this->getDriver(); /* Basic fields. */ - $this->_properties['event_creator_id'] = $driver->convertToDriver($this->getCreatorId()); + $this->_properties['event_creator_id'] = $driver->convertToDriver($this->creator); $this->_properties['event_title'] = $driver->convertToDriver($this->title); - $this->_properties['event_description'] = $driver->convertToDriver($this->getDescription()); - $this->_properties['event_location'] = $driver->convertToDriver($this->getLocation()); - $this->_properties['event_private'] = (int)$this->isPrivate(); - $this->_properties['event_status'] = $this->getStatus(); - $this->_properties['event_attendees'] = serialize($driver->convertToDriver($this->getAttendees())); + $this->_properties['event_description'] = $driver->convertToDriver($this->description); + $this->_properties['event_location'] = $driver->convertToDriver($this->location); + $this->_properties['event_private'] = (int)$this->private; + $this->_properties['event_status'] = $this->status; + $this->_properties['event_attendees'] = serialize($driver->convertToDriver($this->attendees)); $this->_properties['event_resources'] = serialize($driver->convertToDriver($this->getResources())); $this->_properties['event_modified'] = $_SERVER['REQUEST_TIME']; @@ -147,7 +147,7 @@ class Kronolith_Event_Resource extends Kronolith_Event } /* Alarm. */ - $this->_properties['event_alarm'] = (int)$this->getAlarm(); + $this->_properties['event_alarm'] = (int)$this->alarm; /* Alarm Notification Methods. */ $this->_properties['event_alarm_methods'] = serialize($driver->convertToDriver($this->methods)); @@ -195,7 +195,7 @@ class Kronolith_Event_Resource extends Kronolith_Event */ public function getDriver() { - return Kronolith::getDriver('Resource', $this->_calendar); + return Kronolith::getDriver('Resource', $this->calendar); } /** diff --git a/kronolith/lib/Event/Sql.php b/kronolith/lib/Event/Sql.php index cfbd753ed..f7c2d048a 100644 --- a/kronolith/lib/Event/Sql.php +++ b/kronolith/lib/Event/Sql.php @@ -17,7 +17,7 @@ class Kronolith_Event_Sql extends Kronolith_Event * * @var string */ - protected $_calendarType = 'internal'; + public $calendarType = 'internal'; /** * @var array @@ -65,9 +65,9 @@ class Kronolith_Event_Sql extends Kronolith_Event $this->durMin = ($this->end->timestamp() - $this->start->timestamp()) / 60; $this->title = $driver->convertFromDriver($SQLEvent['event_title']); - $this->eventID = $SQLEvent['event_id']; - $this->setUID($SQLEvent['event_uid']); - $this->creatorID = $SQLEvent['event_creator_id']; + $this->id = $SQLEvent['event_id']; + $this->uid = $SQLEvent['event_uid']; + $this->creator = $SQLEvent['event_creator_id']; if (!empty($SQLEvent['event_recurtype'])) { $this->recurrence = new Horde_Date_Recurrence($this->start); @@ -140,14 +140,14 @@ class Kronolith_Event_Sql extends Kronolith_Event $driver = $this->getDriver(); /* Basic fields. */ - $this->_properties['event_creator_id'] = $driver->convertToDriver($this->getCreatorId()); + $this->_properties['event_creator_id'] = $driver->convertToDriver($this->creator); $this->_properties['event_title'] = $driver->convertToDriver($this->title); - $this->_properties['event_description'] = $driver->convertToDriver($this->getDescription()); - $this->_properties['event_location'] = $driver->convertToDriver($this->getLocation()); + $this->_properties['event_description'] = $driver->convertToDriver($this->description); + $this->_properties['event_location'] = $driver->convertToDriver($this->location); $this->_properties['event_url'] = $this->url; - $this->_properties['event_private'] = (int)$this->isPrivate(); - $this->_properties['event_status'] = $this->getStatus(); - $this->_properties['event_attendees'] = serialize($driver->convertToDriver($this->getAttendees())); + $this->_properties['event_private'] = (int)$this->private; + $this->_properties['event_status'] = $this->status; + $this->_properties['event_attendees'] = serialize($driver->convertToDriver($this->attendees)); $this->_properties['event_resources'] = serialize($driver->convertToDriver($this->getResources())); $this->_properties['event_modified'] = $_SERVER['REQUEST_TIME']; @@ -171,7 +171,7 @@ class Kronolith_Event_Sql extends Kronolith_Event } /* Alarm. */ - $this->_properties['event_alarm'] = (int)$this->getAlarm(); + $this->_properties['event_alarm'] = (int)$this->alarm; /* Alarm Notification Methods. */ $this->_properties['event_alarm_methods'] = serialize($driver->convertToDriver($this->methods)); diff --git a/kronolith/lib/FreeBusy.php b/kronolith/lib/FreeBusy.php index d0b223be1..027f937fa 100644 --- a/kronolith/lib/FreeBusy.php +++ b/kronolith/lib/FreeBusy.php @@ -92,10 +92,10 @@ class Kronolith_FreeBusy { /* Add all the busy periods. */ foreach ($busy as $events) { foreach ($events as $event) { - if ($event->hasStatus(Kronolith::STATUS_FREE)) { + if ($event->status == Kronolith::STATUS_FREE) { continue; } - if ($event->hasStatus(Kronolith::STATUS_CANCELLED)) { + if ($event->status == Kronolith::STATUS_CANCELLED) { continue; } diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 2c82b7eda..0b6f5ff12 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -560,7 +560,7 @@ class Kronolith if ($coverDates) { self::addCoverDates($results, $event, $event->start, $event->end, $json); } else { - $results[$event->start->dateString()][$event->getId()] = $json ? $event->toJson() : $event; + $results[$event->start->dateString()][$event->id] = $json ? $event->toJson() : $event; } } @@ -587,7 +587,7 @@ class Kronolith $addEvent = clone $event; $addEvent->start = $next; $addEvent->end = $nextEnd; - $results[$addEvent->start->dateString()][$addEvent->getId()] = $json ? $addEvent->toJson() : $addEvent; + $results[$addEvent->start->dateString()][$addEvent->id] = $json ? $addEvent->toJson() : $addEvent; } } @@ -601,7 +601,7 @@ class Kronolith } } else { if (!$coverDates) { - $results[$event->start->dateString()][$event->getId()] = $json ? $event->toJson() : $event; + $results[$event->start->dateString()][$event->id] = $json ? $event->toJson() : $event; } else { /* Event only occurs once. */ $allDay = $event->isAllDay(); @@ -681,7 +681,7 @@ class Kronolith $addEvent->last = false; } - $results[$loopDate->dateString()][$addEvent->getId()] = $json ? $addEvent->toJson($allDay) : $addEvent; + $results[$loopDate->dateString()][$addEvent->id] = $json ? $addEvent->toJson($allDay) : $addEvent; } $loopDate = new Horde_Date( @@ -723,7 +723,7 @@ class Kronolith if ($loopDate->compareDate($eventEnd) != 0) { $addEvent->last = false; } - $results[$loopDate->dateString()][$addEvent->getId()] = $json ? $addEvent->toJson($allDay) : $addEvent; + $results[$loopDate->dateString()][$addEvent->id] = $json ? $addEvent->toJson($allDay) : $addEvent; } $loopDate->mday++; } @@ -743,7 +743,7 @@ class Kronolith $kronolith_driver = self::getDriver(); $calendars = self::listCalendars(true, Horde_Perms::ALL); - $current_calendar = $kronolith_driver->getCalendar(); + $current_calendar = $kronolith_driver->calendar; $count = 0; foreach (array_keys($calendars) as $calendar) { @@ -791,8 +791,8 @@ class Kronolith $kronolith_driver = Kronolith::getDriver(null, $calendar); $event = $kronolith_driver->getEvent(); $event->initialized = true; - $event->setTitle($title); - $event->setDescription($description); + $event->title = $title; + $event->description = $description; $event->start = $d; $event->end = $d->add(array('hour' => 1)); @@ -1616,7 +1616,7 @@ class Kronolith . $newAttendeeParsedPart->host; // Avoid overwriting existing attendees with the default // values. - $attendees[$email] = array( + $attendees[Horde_String::lower($email)] = array( 'attendance' => Kronolith::PART_REQUIRED, 'response' => Kronolith::RESPONSE_NONE, 'name' => $name); @@ -1639,7 +1639,7 @@ class Kronolith $attendees = array(); /* Attendees */ - if (isset($_SESSION['kronolith']['attendees']) || + if (isset($_SESSION['kronolith']['attendees']) && is_array($_SESSION['kronolith']['attendees'])) { $attendees = array(); @@ -1650,7 +1650,7 @@ class Kronolith } /* Resources */ - if (isset($_SESSION['kronolith']['resources']) || + if (isset($_SESSION['kronolith']['resources']) && is_array($_SESSION['kronolith']['resources'])) { foreach ($_SESSION['kronolith']['resources'] as $resource) { @@ -1680,12 +1680,11 @@ class Kronolith { global $conf; - $attendees = $event->getAttendees(); - if (!$attendees) { + if (!$event->attendees) { return; } - $ident = Horde_Prefs_Identity::singleton('none', $event->getCreatorId()); + $ident = Horde_Prefs_Identity::singleton('none', $event->creator); $myemail = $ident->getValue('from_addr'); if (!$myemail) { @@ -1696,9 +1695,9 @@ class Kronolith $myemail = explode('@', $myemail); $from = Horde_Mime_Address::writeAddress($myemail[0], isset($myemail[1]) ? $myemail[1] : '', $ident->getValue('fullname')); - $share = &$GLOBALS['kronolith_shares']->getShare($event->getCalendar()); + $share = &$GLOBALS['kronolith_shares']->getShare($event->calendar); - foreach ($attendees as $email => $status) { + foreach ($event->attendees as $email => $status) { /* Don't bother sending an invitation/update if the recipient does * not need to participate, or has declined participating, or * doesn't have an email address. */ @@ -1737,27 +1736,27 @@ class Kronolith sprintf(_("on %s at %s"), $event->start->strftime('%x'), $event->start->strftime('%X')) . ")\n\n"; - if ($event->getLocation() != '') { - $message .= sprintf(_("Location: %s"), $event->getLocation()) . "\n\n"; + if (strlen($event->location)) { + $message .= sprintf(_("Location: %s"), $event->location) . "\n\n"; } - if ($event->getAttendees()) { + if ($event->attendees) { $attendee_list = array(); - foreach ($event->getAttendees() as $mail => $attendee) { + foreach ($event->attendees as $mail => $attendee) { $attendee_list[] = empty($attendee['name']) ? $mail : Horde_Mime_Address::trimAddress($attendee['name'] . (strpos($mail, '@') === false ? '' : ' <' . $mail . '>')); } $message .= sprintf(_("Attendees: %s"), implode(', ', $attendee_list)) . "\n\n"; } - if ($event->getDescription() != '') { - $message .= _("The following is a more detailed description of the event:") . "\n\n" . $event->getDescription() . "\n\n"; + if ($event->description != '') { + $message .= _("The following is a more detailed description of the event:") . "\n\n" . $event->description . "\n\n"; } $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 == self::ITIP_REQUEST) { $attend_link = Horde::applicationUrl('attend.php', true, -1) - ->add(array('c' => $event->getCalendar(), - 'e' => $event->getId(), + ->add(array('c' => $event->calendar, + 'e' => $event->id, 'u' => $email)); $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"), $attend_link->add('a', 'accept'), $attend_link->add('a', 'tentative'), $attend_link->add('a', 'decline')); } @@ -1829,7 +1828,7 @@ class Kronolith require_once 'Horde/Group.php'; $groups = &Group::singleton(); - $calendar = $event->getCalendar(); + $calendar = $event->calendar; $recipients = array(); $share = &$GLOBALS['kronolith_shares']->getShare($calendar); if (is_a($share, 'PEAR_Error')) { @@ -1916,7 +1915,7 @@ class Kronolith $share->get('name'), $event->start->strftime($df), $event->start->strftime($tf ? '%R' : '%I:%M%p')) - . "\n\n" . $event->getDescription(); + . "\n\n" . $event->description; $mime_mail = new Horde_Mime_Mail(array('subject' => $subject . ' ' . $event->title, 'to' => implode(',', $df_recipients), @@ -2073,7 +2072,7 @@ class Kronolith */ public static function eventTabs($tabname, $event) { - if (!$event->isInitialized()) { + if (!$event->initialized) { return; } @@ -2090,8 +2089,8 @@ class Kronolith 'onclick' => 'return ShowTab(\'Event\');')); /* We check for read permissions, because we can always save a copy if * we can read the event. */ - if ((!$event->isPrivate() || - $event->getCreatorId() == Horde_Auth::getAuth()) && + if ((!$event->private || + $event->creator == Horde_Auth::getAuth()) && $event->hasPermission(Horde_Perms::READ)) { $tabs->addTab( $event->hasPermission(Horde_Perms::EDIT) ? _("_Edit") : _("Save As New"), diff --git a/kronolith/lib/LoginTasks/Task/PurgeEvents.php b/kronolith/lib/LoginTasks/Task/PurgeEvents.php index e4807942e..ab365ead8 100644 --- a/kronolith/lib/LoginTasks/Task/PurgeEvents.php +++ b/kronolith/lib/LoginTasks/Task/PurgeEvents.php @@ -49,17 +49,17 @@ class Kronolith_LoginTasks_Task_PurgeEvents extends Horde_LoginTasks_Task $query->end = $del_time; $query->status = null; $query->calendars = array_keys($calendars); - $query->creatorID = Horde_Auth::getAuth(); + $query->creator = Horde_Auth::getAuth(); /* Perform the search */ $events = Kronolith::search($query); $count = 0; foreach ($events as $event) { if (!$event->recurs()) { - if ($event->getCalendar() != $kronolith_driver->getCalendar()) { - $kronolith_driver->open($event->getCalendar()); + if ($event->calendar != $kronolith_driver->calendar) { + $kronolith_driver->open($event->calendar); } - $results = $kronolith_driver->deleteEvent($event->getId(), true); + $results = $kronolith_driver->deleteEvent($event->id, true); ++$count; if (is_a($results, 'PEAR_Error')) { Horde::logMessage($results, __FILE__, __LINE__, PEAR_LOG_ERR); diff --git a/kronolith/lib/Resource/Group.php b/kronolith/lib/Resource/Group.php index 10baf5afa..d60793198 100644 --- a/kronolith/lib/Resource/Group.php +++ b/kronolith/lib/Resource/Group.php @@ -110,16 +110,16 @@ class Kronolith_Resource_Group extends Kronolith_Resource_Base /* Check for conflicts, ignoring the conflict if it's for the * same event that is passed. */ if (!is_array($event)) { - $uid = $event->getUID(); + $uid = $event->uid; } else { $uid = 0; } foreach ($busy as $events) { foreach ($events as $e) { - if (!($e->hasStatus(Kronolith::STATUS_CANCELLED) || - $e->hasStatus(Kronolith::STATUS_FREE)) && - $e->getUID() !== $uid) { + if (!($e->status == Kronolith::STATUS_CANCELLED || + $e->status == Kronolith::STATUS_FREE) && + $e->uid !== $uid) { if (!($e->start->compareDateTime($end) >= 0) && !($e->end->compareDateTime($start) <= 0)) { diff --git a/kronolith/lib/Resource/Single.php b/kronolith/lib/Resource/Single.php index 19f307045..a5a618da7 100644 --- a/kronolith/lib/Resource/Single.php +++ b/kronolith/lib/Resource/Single.php @@ -46,15 +46,15 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base /* Check for conflicts, ignoring the conflict if it's for the * same event that is passed. */ if (!is_array($event)) { - $uid = $event->getUID(); + $uid = $event->uid; } else { $uid = 0; } foreach ($busy as $events) { foreach ($events as $e) { - if (!($e->hasStatus(Kronolith::STATUS_CANCELLED) || - $e->hasStatus(Kronolith::STATUS_FREE)) && - $e->getUID() !== $uid) { + if (!($e->status == Kronolith::STATUS_CANCELLED || + $e->status == Kronolith::STATUS_FREE) && + $e->uid !== $uid) { // Comparing to zero allows the events to start at the same // the previous event ends. @@ -84,7 +84,7 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base $driver = $this->getDriver(); /* Make sure it's not already attached. */ - $uid = $event->getUID(); + $uid = $event->uid; $existing = $driver->getByUID($uid, array($this->get('calendar'))); if (!($existing instanceof PEAR_Error)) { /* Already attached, just update */ @@ -94,7 +94,7 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base } else { /* Create a new event */ $e = $driver->getEvent(); - $e->setCalendar($this->get('calendar')); + $e->calendar = $this->get('calendar'); $e->fromiCalendar($event->toiCalendar(new Horde_iCalendar('2.0'))); $e->save(); } @@ -109,7 +109,7 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base public function removeEvent($event) { $driver = Kronolith::getDriver('Resource', $this->get('calendar')); - $re = $driver->getByUID($event->getUID(), array($this->get('calendar'))); + $re = $driver->getByUID($event->uid, array($this->get('calendar'))); // Event will only be in the calendar if it's been accepted. This error // should never happen, but put it here as a safeguard for now. if (!($re instanceof PEAR_Error)) { diff --git a/kronolith/lib/View/Day.php b/kronolith/lib/View/Day.php index 4f112e4f2..02a2f0e80 100644 --- a/kronolith/lib/View/Day.php +++ b/kronolith/lib/View/Day.php @@ -130,7 +130,7 @@ class Kronolith_View_Day extends Kronolith_Day { . 'valign="top" colspan="' . $this->_span[$cid] . '">' . $event->getLink($this, true, $this->link(0, true)); if ($showLocation) { - $row .= '
' . htmlspecialchars($event->getLocation()) . '
'; + $row .= '
' . htmlspecialchars($event->location) . '
'; } $row .= ''; } @@ -245,7 +245,7 @@ class Kronolith_View_Day extends Kronolith_Day { $row .= '
' . htmlspecialchars($event->getTimeRange()) . '
'; } if ($showLocation) { - $row .= '
' . htmlspecialchars($event->getLocation()) . '
'; + $row .= '
' . htmlspecialchars($event->location) . '
'; } $row .= ''; } @@ -307,7 +307,7 @@ class Kronolith_View_Day extends Kronolith_Day { // If we have side_by_side we only want to include the // event in the proper calendar. if ($this->_sidebyside) { - $cid = $event->getCalendar(); + $cid = $event->calendar; } else { $cid = 0; } @@ -362,7 +362,7 @@ class Kronolith_View_Day extends Kronolith_Day { // If we have side_by_side we only want to include the // event in the proper calendar. if ($this->_sidebyside) { - $cid = $event->getCalendar(); + $cid = $event->calendar; } else { $cid = 0; } diff --git a/kronolith/lib/View/EditEvent.php b/kronolith/lib/View/EditEvent.php index 0419ea4b7..73b1482f8 100644 --- a/kronolith/lib/View/EditEvent.php +++ b/kronolith/lib/View/EditEvent.php @@ -41,7 +41,7 @@ class Kronolith_View_EditEvent { } if ($this->event->hasPermission(Horde_Perms::EDIT)) { - $calendar_id = $this->event->getCalendar(); + $calendar_id = $this->event->calendar; } else { $calendar_id = Kronolith::getDefaultCalendar(Horde_Perms::EDIT); } @@ -49,7 +49,7 @@ class Kronolith_View_EditEvent { !is_a($share = &$this->event->getShare(), 'PEAR_Error')) { $calendar_id .= ':' . $share->get('owner'); } - $_SESSION['kronolith']['attendees'] = $this->event->getAttendees(); + $_SESSION['kronolith']['attendees'] = $this->event->attendees; $_SESSION['kronolith']['resources'] = $this->event->getResources(); if ($datetime = Horde_Util::getFormData('datetime')) { $datetime = new Horde_Date($datetime); @@ -62,7 +62,7 @@ class Kronolith_View_EditEvent { $url = Horde_Util::getFormData('url'); $perms = Horde_Perms::EDIT; - if ($this->event->getCreatorId() == Horde_Auth::getAuth()) { + if ($this->event->creator == Horde_Auth::getAuth()) { $perms |= Kronolith::PERMS_DELEGATE; } $calendars = Kronolith::listCalendars(false, $perms); @@ -77,7 +77,7 @@ class Kronolith_View_EditEvent { if ($this->event->hasPermission(Horde_Perms::EDIT)) { $buttons[] = ''; } - if ($this->event->isInitialized()) { + if ($this->event->initialized) { if (!$this->event->recurs() && (!empty($conf['hooks']['permsdenied']) || $GLOBALS['perms']->hasAppPermission('max_events') === true || @@ -98,7 +98,7 @@ class Kronolith_View_EditEvent { // Tags $tagger = Kronolith::getTagger(); - $tags = $tagger->getTags($event->getUID(), 'event'); + $tags = $tagger->getTags($event->uid, 'event'); $tags = implode(',', array_values($tags)); echo '