phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] sync/inc/class.so_sync.inc.php, 1.30


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.so_sync.inc.php, 1.30
Date: Sun, 23 May 2004 09:16:22 -0000

Update of /sync/inc
Modified Files:
        Branch: 
          class.so_sync.inc.php

date: 2004/05/01 13:59:30;  author: mkaemmerer;  state: Exp;  lines: +68 -1

Log Message:
- added new functions for UI and conflict handling
=====================================================================
Index: sync/inc/class.so_sync.inc.php
diff -u sync/inc/class.so_sync.inc.php:1.29 sync/inc/class.so_sync.inc.php:1.30
--- sync/inc/class.so_sync.inc.php:1.29 Sat May  1 10:15:38 2004
+++ sync/inc/class.so_sync.inc.php      Sat May  1 13:59:30 2004
@@ -415,6 +415,73 @@
         return array('0', '0', '0'); // return 0 for slowsync      
     }
     
+   /**
+    * Get conflict setting for each channel from DeviceID and Source
+    *
+    * results are:
+    * 1: server record wins
+    * 2: client record wins
+    * 3: duplicate
+    * 4: do nothing
+    * -1: error
+    * 
+    * @param integer $deviceid unique device ID for internal devices database  
   
+    * @param string  $source Source name from device (e.g. 'contacts')
+    * @return integer channelid or -1 in case of non existing channel or error 
+    */
+    function GetConflictHandleSetting($deviceid, $source)
+    {
+      $GLOBALS['phpgw']->db->query("SELECT conflict FROM phpgw_syncsources, 
phpgw_syncchannels WHERE phpgw_syncsources.uri='$source' and 
phpgw_syncchannels.deviceid='$deviceid' and phpgw_syncchannels.sourceid = 
phpgw_syncsources.sourceid",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->next_record();
+      
+      $id = $GLOBALS['phpgw']->db->f('conflict');
+      if (isset($id))  
+        return $id; 
+      else 
+        return -1;
+    }
+    
+   /**
+    * Set conflict setting for each channel 
+    *
+    * @param integer $deviceid unique device ID for internal devices database
+    * @param string $source Source name from device (e.g. 'contacts')
+    * @param integer $conflict new conflict value (see 
GetConflictHandleSetting)
+    * @return integer channelid of the modified source or -1 in case of error  
+    */
+       
+    function SetConflictHandleSetting($deviceid, $source, $conflict)
+    {
+      $GLOBALS['phpgw']->db->query("SELECT channelid FROM phpgw_syncsources, 
phpgw_syncchannels WHERE phpgw_syncsources.uri='".$source."' and 
phpgw_syncchannels.deviceid='".$deviceid."' and phpgw_syncchannels.sourceid = 
phpgw_syncsources.sourceid",__LINE__,__FILE__);
+      
+      if ($GLOBALS['phpgw']->db->next_record())
+      {
+        $channelid = $GLOBALS['phpgw']->db->f('channelid');
+        $GLOBALS['phpgw']->db->query("UPDATE phpgw_syncchannels SET 
conflict='$conflict' WHERE channelid='$channelid'",__LINE__,__FILE__);
+        return $channelid; 
+      } else
+        return -1;
+    }
+
+   /**
+    * Get all source names for one deviceid 
+    *
+    * @param integer $deviceid unique device ID for internal devices database
+    * @return array of string (source URIs, e.g. 'notes', './contact')
+    * 
+    */
+
+    function getSupportedSources($deviceid)
+    {
+      $GLOBALS['phpgw']->db->query("SELECT sourceid, uri FROM 
phpgw_syncsources, phpgw_syncchannels where deviceid='$DeviceID' and and 
phpgw_syncchannels.deviceid='".$deviceid."' and phpgw_syncchannels.sourceid = 
phpgw_syncsources.sourceid",__LINE__,__FILE__);
+
+      $result = array();
+      while ($GLOBALS['phpgw']->db->next_record())
+        array_push($result, $GLOBALS['phpgw']->db->f('uri'));
+      
+      return $result;
+    }
+
     /******************************************************************/
     /** functions for phpgw_syncmapping *******************************/
     /******************************************************************/




reply via email to

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