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


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

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

date: 2004/05/01 10:15:38;  author: mleonhardt;  state: Exp;  lines: +35 -6

Log Message:
- extended ui functionality
  - edit and show device description
  - show lastsync timestamps
=====================================================================
Index: sync/inc/class.so_sync.inc.php
diff -u sync/inc/class.so_sync.inc.php:1.28 sync/inc/class.so_sync.inc.php:1.29
--- sync/inc/class.so_sync.inc.php:1.28 Thu Apr 29 19:38:07 2004
+++ sync/inc/class.so_sync.inc.php      Sat May  1 10:15:38 2004
@@ -95,20 +95,32 @@
     * reads from table phpgw_syncdevices
     *
     * @param  $deviceid unique ID in internal devices database (table 
phpgw_syncdevices)
-    * @return array deviceinfoarray 'uri'=>unique identifier (e.g. EMSI) of 
the device, 'username'=>phpgw username of the deviceowner, 
+    * @param  $talkative boolean optional parameter which requests more 
deviceinformation fields 
+    * @return array deviceinfoarray 'uri'=>unique identifier (e.g. EMSI) of 
the device, 
+    *         'username'=>phpgw username of the deviceowner, also returns 
'description' if $talkative is true 
     *         integer -1 in case of error or not found
     */
     
-    function GetDeviceInfo($deviceid)
+    function GetDeviceInfo($deviceid, $talkative = false)
     {
-      $GLOBALS['phpgw']->db->query("SELECT uri, username FROM 
phpgw_syncdevices WHERE deviceid='" .$deviceid. "'",__LINE__,__FILE__);
+      if ($talkative)
+        $talkativefields = ', description';
+      else
+        $talkativefields = '';
+      $GLOBALS['phpgw']->db->query("SELECT uri, username $talkativefields FROM 
phpgw_syncdevices WHERE deviceid='" .$deviceid. "'",__LINE__,__FILE__);
       $GLOBALS['phpgw']->db->next_record();
       
       $uri = $GLOBALS['phpgw']->db->f('uri');
       if (isset($uri))
       {  
         $username = $GLOBALS['phpgw']->db->f('username');
-        return array('uri'=>$uri, 'username'=>$username);
+        if ($talkative)
+        {
+          return array('uri'=>$uri, 'username'=>$username, 
+                       'description'=>$GLOBALS['phpgw']->db->f('description'));
+        }
+        else
+          return array('uri'=>$uri, 'username'=>$username);
       } 
       else 
         return -1;
@@ -129,7 +141,9 @@
       $result = $GLOBALS['phpgw']->db->query("SELECT deviceid, accountid, uri, 
description, username FROM phpgw_syncdevices WHERE 
accountid='".$accountid."'",__LINE__,__FILE__);
       while ($GLOBALS['phpgw']->db->next_record())
       {
-        $devicelist[$GLOBALS['phpgw']->db->f('deviceid')] = array(
+        $deviceid = $GLOBALS['phpgw']->db->f('deviceid');
+        $devicelist[$deviceid] = array(
+          $deviceid,
           $GLOBALS['phpgw']->db->f('accountid'),
           $GLOBALS['phpgw']->db->f('uri'),
           $GLOBALS['phpgw']->db->f('description'),
@@ -598,6 +612,21 @@
     function DeleteMapping($mappingid)
     {
       $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_syncmapping WHERE 
mappingid='$mappingid'",__LINE__,__FILE__);
+      return !($GLOBALS['phpgw']->db->Error);
+    }
+
+   /**
+    * set the device description of the device with $deviceid (has to exist in 
the db yet)
+    *
+    * @param integer $deviceid unique device ID for internal devices database
+    * @param string $newdescription new description of the device
+    * @return boolean true if successfull, false in case of error  
+    */
+
+    function setDeviceDescription($deviceid, $newdescription)
+    {
+      $GLOBALS['phpgw']->db->query("UPDATE phpgw_syncdevices SET 
description='$newdescription' " .
+                             " WHERE deviceid='$deviceid'",__LINE__,__FILE__);
       return !($GLOBALS['phpgw']->db->Error);
     }
        }




reply via email to

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