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.47


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.so_sync.inc.php, 1.47
Date: Thu, 1 Jul 2004 10:46:44 +0200

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

date: 2004/07/01 08:46:44;  author: mleonhardt;  state: Exp;  lines: +73 -2

Log Message:
- handful new functions for conflict-view in UI
=====================================================================
Index: sync/inc/class.so_sync.inc.php
diff -u sync/inc/class.so_sync.inc.php:1.46 sync/inc/class.so_sync.inc.php:1.47
--- sync/inc/class.so_sync.inc.php:1.46 Sun Jun 20 21:02:07 2004
+++ sync/inc/class.so_sync.inc.php      Thu Jul  1 08:46:44 2004
@@ -239,6 +239,46 @@
     }
     
     /******************************************************************/
+    /** functions for phpgw_syncconflicts *****************************/
+    /******************************************************************/
+   
+   /**
+    * Get all conflicts of a given phpGW user
+    *
+    * @param integer $deviceid unique device ID for internal devices database  
   
+    * @param string  $source Source name from device (e.g. 'contacts')
+    * @param array &$conflictlist output var which holds the conflictlist
+    * @return boolean true if the user has conflicts
+    */
+    
+    function GetConflictList($deviceid, $source, &$conflictlist)
+    {
+      $conflictlist = array();
+
+      $GLOBALS['phpgw']->db->query(
+        'SELECT conflictid, conflicts.channelid, luid, ldata, timestamp ' . 
+        'FROM phpgw_syncsources as ss, phpgw_syncchannels as sc, ' .
+        'phpgw_syncconflicts as conflicts ' .
+        "WHERE ss.uri='$source' and " .
+        "sc.deviceid='$deviceid' and " .
+        'sc.sourceid = ss.sourceid and ' .
+        'sc.channelid = conflicts.channelid',
+        __LINE__,__FILE__);
+      while ($GLOBALS['phpgw']->db->next_record())
+      {
+        $conflictid = $GLOBALS['phpgw']->db->f('conflictid');
+        $conflictlist[$conflictid] = array(
+          $conflictid,
+          $GLOBALS['phpgw']->db->f('channelid'),
+          $GLOBALS['phpgw']->db->f('luid'),
+          $GLOBALS['phpgw']->db->f('ldata'),
+          $GLOBALS['phpgw']->db->f('timestamp'));
+      }
+      
+      return $conflictlist;
+    }
+
+    /******************************************************************/
     /** functions for phpgw_syncsources *******************************/
     /******************************************************************/
    
@@ -487,7 +527,12 @@
     */
     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->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');
@@ -913,5 +958,31 @@
      }    
    }
    
+   /**
+    * check if conflicts are pending for a given source
+    *
+    * @param integer $deviceid is the deviceid of the device which whant to 
+    *        do the sync
+    * @param string $source Source-URI of the source to sync
+    * @return boolean true if conflicts are there 
+    */
+    
+    function hasconflicts($deviceid, $source) {
+      // cache channelid for our $deviceid and $source
+      $channelid = $this->GetChannelIDfromSourceAndDeviceID($deviceid, 
$source);
+      
+      $GLOBALS['phpgw']->db->query("SELECT conflictid FROM phpgw_syncconflicts 
WHERE channelid='" .
+                          $channelid . "'",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->next_record();
+      
+      $conflictid = $GLOBALS['phpgw']->db->f('conflictid');
+      $result = isset($conflictid);  
+
+      if ($this->debug)
+        error_log("hasconflicts: $deviceid, $source returns $result");
+
+      return $result; 
+    }
+    
        }
 ?>




reply via email to

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