[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] [18611] IPC interface for Todo.
From: |
Johan Gunnarsson |
Subject: |
[Phpgroupware-cvs] [18611] IPC interface for Todo. |
Date: |
Mon, 09 Jun 2008 10:59:55 +0000 |
Revision: 18611
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18611
Author: johang
Date: 2008-06-09 10:59:54 +0000 (Mon, 09 Jun 2008)
Log Message:
-----------
IPC interface for Todo. Uses old iCal code for now.
Added Paths:
-----------
trunk/todo/inc/class.ipc_todo.inc.php
Added: trunk/todo/inc/class.ipc_todo.inc.php
===================================================================
--- trunk/todo/inc/class.ipc_todo.inc.php (rev 0)
+++ trunk/todo/inc/class.ipc_todo.inc.php 2008-06-09 10:59:54 UTC (rev
18611)
@@ -0,0 +1,158 @@
+<?php
+ /**
+ * Todo IPC
+ *
+ * @author Johan Gunnarsson <address@hidden>
+ * @copyright Copyright (c) 2007 Free Software Foundation, Inc.
+ * @license GNU General Public License 3 or later
+ * @package todo
+ * @version $ $
+ */
+
+ /**
+ * IPC of the todo application.
+ */
+ class ipc_todo extends ipc_
+ {
+ /**
+ * @access private
+ */
+ var $botodo;
+
+ /**
+ * {i,v}Calendar convertion.
+ *
+ * @access private
+ */
+ var $bo_ical;
+
+ /**
+ * Constructor.
+ *
+ * @access public
+ */
+ function ipc_todo()
+ {
+ $this->botodo = CreateObject('todo.botodo');
+
+ $this->bo_ical = CreateObject('calendar.boicalendar');
+ }
+
+ /**
+ * Add data in a certain mime type format to the application.
+ *
+ * @access public
+ * @param $data Data for adding to the application, the
datatype depends
+ * on the mime type.
+ * @param $type Specifies the mime type of the passed data.
+ * @return int ID of the added data.
+ */
+ function addData($data, $type)
+ {
+ switch($type)
+ {
+ case 'text/x-vcalendar':
+ case 'text/calendar':
+ $x = $this->bo_ical->parse($data,
$type);
+ break;
+ default:
+ return FALSE;
+ }
+
+ var_dump($x);
+
+ // return $this->botodo->save($item);
+ }
+
+ /**
+ * Convert data from a mime type to another.
+ *
+ * @access public
+ * @param $data Data for converting, the datatype depends on
the
+ * input mime type.
+ * @param $typeIn Specifies the input mime type of the passed
data.
+ * @param $typeOut Specifies the output mime type of the passed
data.
+ * @return string Converted data from application, the datatype
+ * depends on the passed output mime type.
+ */
+ function convertData($data, $typeIn, $typeOut)
+ {
+ }
+
+ /**
+ * Get data from the application in a certain mime type format.
+ *
+ * @param $id ID of data to get from the application.
+ * @param $type Specifies the mime type of the returned data.
+ * @return mixed Data from application, the datatype depends on
the
+ * passed mime type, false if no data exists for
the
+ * passed id.
+ */
+ function getData($id, $type)
+ {
+ }
+
+ /**
+ * Return a list with the available id's in the application. The
+ * optional lastmod parameter allows a limitations of the data
id list.
+ * The list contains all the id's of the modified data since
the passed
+ * lastmod timestamp.
+ *
+ * @param $time Last modification time. Default is -1 which
return
+ * all data IDs.
+ * @return array List of data IDs.
+ */
+ function getIdList($time=-1)
+ {
+ $all_notes = $this->bonotes->sonotes->read(array());
+ $note_count = count($all_notes);
+ $all_note_ids = array();
+
+ for($i = 0; $i < $note_count; $i++)
+ {
+ if($all_notes[$i]['date'] > $time)
+ {
+ $all_note_ids[] =
intval($all_notes[$i]['note_id']);
+ }
+ }
+
+ return $all_note_ids;
+ }
+
+ /**
+ * Remove data of the passed ID.
+ *
+ * @param $id ID of data to remove from the application.
+ * @return boolean True if the data is removed, otherwise false.
+ */
+ function removeData($id)
+ {
+ return $this->bonotes->delete($id);
+ }
+
+ /**
+ * Replace the existing data of the passed id with the passed
data in
+ * a certain mime type format.
+ *
+ * @param $id ID of data to replace.
+ * @param $data The new data, the datatype depends on the
passed
+ * mime type.
+ * @param $type Specifies the mime type of the passed data.
+ * @return boolean True if the data is replaced, otherwise
false.
+ */
+ function replaceData($id, $data, $type)
+ {
+ }
+
+ /**
+ * Checks if data for the passed id exists.
+ *
+ * @param $id ID to check
+ * @return boolean True if the data with id exist, otherwise
false
+ */
+ function existData($id)
+ {
+ return !is_null($this->bonotes->read_single($id));
+ }
+ }
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] [18611] IPC interface for Todo.,
Johan Gunnarsson <=