From 41d6133760f4544f8f19784a26cf35806eade715 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 1 Nov 2010 19:41:29 +0100 Subject: [PATCH] Remove getTags()/setTags(). --- kronolith/data.php | 3 +-- kronolith/lib/Driver/Sql.php | 2 +- kronolith/lib/Event.php | 40 +++++++-------------------------------- kronolith/lib/Event/Kolab.php | 1 - kronolith/lib/Resource/Single.php | 2 +- kronolith/lib/View/EditEvent.php | 6 +----- 6 files changed, 11 insertions(+), 43 deletions(-) diff --git a/kronolith/data.php b/kronolith/data.php index b53fe6e36..2bdb25e0a 100644 --- a/kronolith/data.php +++ b/kronolith/data.php @@ -153,8 +153,7 @@ case 'export': $row['recur_interval'] = null; $row['recur_data'] = null; } - $tags = $event->getTags(); - $row['tags'] = $tags ? implode(', ', $tags) : ''; + $row['tags'] = implode(', ', $event->tags); $data[] = $row; } } diff --git a/kronolith/lib/Driver/Sql.php b/kronolith/lib/Driver/Sql.php index 76c154ae0..cce5823aa 100644 --- a/kronolith/lib/Driver/Sql.php +++ b/kronolith/lib/Driver/Sql.php @@ -279,7 +279,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver foreach ($events as $id) { $event = $this->getEvent($id); if (isset($tags) && !empty($tags[$event->uid])) { - $event->setTags($tags[$event->uid]); + $event->tags = $tags[$event->uid]; } Kronolith::addEvents($results, $event, $startDate, $endDate, $showRecurrence, $json, $coverDates); diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index e9cbb9df4..46bca8a42 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -325,6 +325,7 @@ abstract class Kronolith_Event case 'span': case 'rowspan': case 'geoLocation': + case 'tags': $this->{'_' . $name} = $value; return; } @@ -359,7 +360,10 @@ abstract class Kronolith_Event case 'rowspan': return $this->{'_' . $name}; case 'tags': - return $this->getTags(); + if (!isset($this->_tags)) { + $this->_tags = Kronolith::getTagger()->getTags($this->uid, 'event'); + } + return $this->_tags; case 'geoLocation': return $this->getGeolocation(); } @@ -571,10 +575,7 @@ abstract class Kronolith_Event } // Tags - $tags = $this->tags; - if (is_array($tags)) { - $tags = implode(', ', $tags); - } + $tags = implode(', ', $this->tags); if (!empty($tags)) { $vEvent->setAttribute('CATEGORIES', $tags); } @@ -1210,10 +1211,7 @@ abstract class Kronolith_Event } /* Categories (Tags) */ - $tags = $message->getCategories(); - foreach ($tags as $tag) { - $this->tags[] = $tag; - } + $this->_tags = $message->getCategories(); /* Flag that we are initialized */ $this->initialized = true; @@ -2774,30 +2772,6 @@ abstract class Kronolith_Event } /** - * Setter for tags - * - * @param array $tags An array of tag_names - */ - public function setTags($tags) - { - $this->_tags = $tags; - } - - /** - * Getter for tags - * - * @return mixed An array of tag_names, or false if tags were never set. - */ - public function getTags() - { - if (!isset($this->_tags)) { - $this->_tags = Kronolith::getTagger()->getTags($this->uid, 'event'); - } - - return $this->_tags; - } - - /** * Setter for geo data * * @param array $data An array of lat/lng data. diff --git a/kronolith/lib/Event/Kolab.php b/kronolith/lib/Event/Kolab.php index 178538136..93e9e7599 100644 --- a/kronolith/lib/Event/Kolab.php +++ b/kronolith/lib/Event/Kolab.php @@ -39,7 +39,6 @@ class Kronolith_Event_Kolab extends Kronolith_Event $this->alarm = $alarm; parent::__construct($driver, $eventObject); - $this->_tags = Kronolith::getTagger()->getTags($this->uid, 'event'); } /** diff --git a/kronolith/lib/Resource/Single.php b/kronolith/lib/Resource/Single.php index daf7f06a2..8fe826304 100644 --- a/kronolith/lib/Resource/Single.php +++ b/kronolith/lib/Resource/Single.php @@ -156,7 +156,7 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base $to->status = $from->status; $to->description = $from->description; $to->url = $from->url; - $to->setTags($from->tags); + $to->tags = $from->tags; $to->setGeoLocation($from->geoLocation); $to->first = $from ->first; $to->last = $from->last; diff --git a/kronolith/lib/View/EditEvent.php b/kronolith/lib/View/EditEvent.php index ca6b705d9..7613834cc 100644 --- a/kronolith/lib/View/EditEvent.php +++ b/kronolith/lib/View/EditEvent.php @@ -104,11 +104,7 @@ class Kronolith_View_EditEvent { } $event = &$this->event; - - // Tags - $tagger = Kronolith::getTagger(); - $tags = $tagger->getTags($event->uid, 'event'); - $tags = implode(',', array_values($tags)); + $tags = implode(',', array_values($event->tags)); Horde_Core_Ui_JsCalendar::init(array( 'full_weekdays' => true -- 2.11.0