Remove getTags()/setTags().
authorJan Schneider <jan@horde.org>
Mon, 1 Nov 2010 18:41:29 +0000 (19:41 +0100)
committerJan Schneider <jan@horde.org>
Tue, 2 Nov 2010 15:14:20 +0000 (16:14 +0100)
kronolith/data.php
kronolith/lib/Driver/Sql.php
kronolith/lib/Event.php
kronolith/lib/Event/Kolab.php
kronolith/lib/Resource/Single.php
kronolith/lib/View/EditEvent.php

index b53fe6e..2bdb25e 100644 (file)
@@ -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;
                 }
             }
index 76c154a..cce5823 100644 (file)
@@ -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);
index e9cbb9d..46bca8a 100644 (file)
@@ -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.
index 1785381..93e9e75 100644 (file)
@@ -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');
     }
 
     /**
index daf7f06..8fe8263 100644 (file)
@@ -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;
index ca6b705..7613834 100644 (file)
@@ -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