plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Wed May 23 18:57:59 CEST 2012


 plugins/libkolab/lib/kolab_format_task.php |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

New commits:
commit bd1ab069e4716fb31dc476686ce2966fe80e4344
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed May 23 18:57:46 2012 +0200

    Started implementing task format wrapper

diff --git a/plugins/libkolab/lib/kolab_format_task.php b/plugins/libkolab/lib/kolab_format_task.php
index a8b497f..cf89b53 100644
--- a/plugins/libkolab/lib/kolab_format_task.php
+++ b/plugins/libkolab/lib/kolab_format_task.php
@@ -29,6 +29,12 @@ class kolab_format_task extends kolab_format
     protected $read_func = 'kolabformat::readTodo';
     protected $write_func = 'kolabformat::writeTodo';
 
+    private $status_map = array(
+        'NEEDS-ACTION' => kolabformat::StatusNeedsAction,
+        'IN-PROCESS'   => kolabformat::StatusInProcess,
+        'COMPLETED'    => kolabformat::StatusCompleted,
+        'CANCELLED'    => kolabformat::StatusCancelled,
+    );
 
     function __construct($xmldata = null)
     {
@@ -93,13 +99,28 @@ class kolab_format_task extends kolab_format
         $this->init();
 
         // read object properties
+        $status_map = array_flip($this->status_map);
         $object = array(
-            'uid'       => $this->obj->uid(),
-            'changed'   => $this->obj->lastModified(),
+            'uid'         => $this->obj->uid(),
+            'changed'     => $this->obj->lastModified(),
+            'summary'     => $this->obj->summary(),
+            'description' => $this->obj->description(),
+            'location'    => $this->obj->location(),
+            'status'      => $this->status_map[$this->obj->status()],
+            'complete'    => intval($this->obj->percentComplete()),
+            'priority'    => $this->obj->priority(),
         );
 
+        // if due date is set
+        if ($dtstart = $this->obj->start()) {
+            $object['start'] = self::php_datetime($dtstart);
+        }
+        // if due date is set
+        if ($due = $this->obj->due()) {
+            $object['due'] = self::php_datetime($due);
+        }
 
-        // TODO: read object properties
+        // TODO: map more properties
 
         $this->data = $object;
         return $this->data;





More information about the commits mailing list