phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgroupware/ipc_test_suite/sources/app/class.ipc_to


From: nomail
Subject: [Phpgroupware-cvs] phpgroupware/ipc_test_suite/sources/app/class.ipc_todo.inc.php, 1.1.2.2
Date: Fri, 14 May 2004 20:39:44 +0200

Update of /phpgroupware/ipc_test_suite/sources/app
Modified Files:
        Branch: Version-0_9_16-branch
          class.ipc_todo.inc.php

date: 2004/05/14 18:39:44;  author: mkaemmerer;  state: Exp;  lines: +78 -11

Log Message:
- new version from DS
=====================================================================
Index: phpgroupware/ipc_test_suite/sources/app/class.ipc_todo.inc.php
diff -u phpgroupware/ipc_test_suite/sources/app/class.ipc_todo.inc.php:1.1.2.1 
phpgroupware/ipc_test_suite/sources/app/class.ipc_todo.inc.php:1.1.2.2
--- phpgroupware/ipc_test_suite/sources/app/class.ipc_todo.inc.php:1.1.2.1      
Mon Apr  5 19:42:00 2004
+++ phpgroupware/ipc_test_suite/sources/app/class.ipc_todo.inc.php      Fri May 
14 18:39:44 2004
@@ -55,7 +55,22 @@
                                        'todo_owner'        => 'owner'          
// -in  +out
                                ),
                                'text/plain' => array('title'),
-                               'text/xml' => array(
+                               'x-phpgroupware/search-index-data-item' => 
array(
+                                       // extern           <> intern           
   
+                                       'todo_id'           => 'id',            
// -in  +out
+                                       'todo_id_parent'    => 'parent',        
// +in  +out
+                                       'todo_id_main'      => 'main',          
// +in  +out
+                                       'todo_level'        => 'level',         
// +in  +out
+                                       'todo_title'        => 'title',         
// +in  +out
+                                       'todo_description'  => 'descr',         
// +in  +out
+                                       'todo_status'       => 'status',        
// +in  +out
+                                       'todo_priority'     => 'pri',           
// +in  +out
+                                       'todo_category'     => 'cat',           
// +in  +out
+                                       'todo_start_date'   => 'sdate',         
// +in  +out
+                                       'todo_end_date'     => 'edate',         
// +in  +out
+                                       'todo_create_date'  => 'entry_date',    
// -in  +out
+                                       'todo_access'       => 'access',        
// +in  +out
+                                       'todo_owner'        => 'owner'          
// -in  +out
                                )
                        );
                }
@@ -126,15 +141,18 @@
                * 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 integer $lastmod last modification time, default is -1 
and means return all data id's
+               * @param string $restriction restrict the result for a special 
use of the id list. The possible restrictions are 'syncable' or 'searchable'. 
When using 'syncable' only person ids will be returned in the result. 
'searchable' returns all ids for both persons and orgs without check the owner. 
Otherwise no restriction will be used and the result contains all ids for both 
persons and orgs from the owner.
                * @return array list of data id's
                */
-               function getIdList($lastmod=-1)
+               function getIdList($lastmod=-1, $restriction='')
                {
                        $idList = array();
-       
-                       $todos = $this->bo->_list(null, null, null, null, null, 
null, null, null, null, $lastmod);;
+
+                       $todos = $this->bo->sotodo->read_todos(null, null, 
null, null, null, null, null, null, null, $lastmod);
                        if($todos == false)
+                       {
                                return $idList;
+                       }
        
                        foreach($todos as $todo)
                        {
@@ -214,12 +232,23 @@
                                        $keyIntern = $this->map[$type][0];
                                        $dataExtern = $dataIntern[$keyIntern];
                                break;
-                               case 'text/xml':
-                                       return false;
+                               case 'x-phpgroupware/search-index-data-item':
+                                       $dataExtern = array();
+                                       foreach($this->map[$type] as $keyExtern 
=> $keyIntern)
+                                       {
+                                               if 
(isset($dataIntern[$keyIntern]) == true)
+                                               {
+                                                 $dataExtern[$keyExtern] = 
$dataIntern[$keyIntern];
+                                               }
+                                               else
+                                               {
+                                                       $dataExtern[$keyExtern] 
= null;
+                                               }
+                                       }
+                                       $dataExtern = 
$this->_export_index_data_item($dataExtern);
                                break;
                                default:
                                        return false;
-                               break;
                        }
        
                        return $dataExtern;
@@ -265,15 +294,53 @@
                                        $keyIntern = $this->map[$type][0];
                                        $dataIntern[$keyIntern] = $dataExtern;
                                break;
-                               case 'text/xml':
-                                       return false;
-                               break;
                                default:
                                        return false;
-                               break;
                        }
        
                        return $dataIntern;
+               }
+
+
+               function &_export_index_data_item($fields)
+               {
+                       $index_xml_item = CreateObject('search.index_xml_item', 
'todo', $fields['todo_id']);
+
+                       $index_xml_item->setDisplayName($fields['todo_title']);
+
+                       $index_xml_item->setPriority($fields['todo_priority']);
+
+                       $catId   = '';
+                       $catName = '';
+                       $index_xml_item->setCategory($catId, $catName);
+
+                       $ownerId = $fields['todo_owner'];
+                       $groupId = '';
+                       $visibilty = $fields['todo_access'];
+                       $index_xml_item->setAccess($ownerId, $groupId, 
$visibilty);
+
+                       $created    = $fields['todo_create_date'];
+                       $modified   = '';
+                       $lastAccess = '';
+                       $index_xml_item->setTimestamp($created, $modified, 
$lastAccess);
+
+                       // create csv file string
+                       $csv = implode(',', array_keys($fields));
+                       $csv .= "\r\n";
+
+                       $values = array_values($fields);
+                       for($i=0; $i<count($values); ++$i)
+                       {
+                               if($i>0)
+                                       $csv .= ",";
+                               $csv .= str_replace(",", "\,", 
addslashes($values[$i]));
+                       }
+                       $csv .= "\r\n";
+
+                       $index_xml_item->setContent($csv, 'text/csv', '1.0');
+                       $index_xml_item->setContentTransferEncoding('base64');
+
+                       return $index_xml_item;
                }
 
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]