[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/addressbook/inc/ -> class.soaddressbook.inc.php (source)

   1  <?php
   2    /**************************************************************************\
   3    * eGroupWare - Addressbook                                                 *
   4    * http://www.egroupware.org                                                *
   5    * Written by Joseph Engo <jengo@phpgroupware.org                           *
   6    *  and Miles Lott <milos@groupwhere.org>                                   *
   7    * --------------------------------------------                             *
   8    *  This program is free software; you can redistribute it and/or modify it *
   9    *  under the terms of the GNU General Public License as published by the   *
  10    *  Free Software Foundation; either version 2 of the License, or (at your  *
  11    *  option) any later version.                                              *
  12    \**************************************************************************/
  13  
  14    /* $Id: class.soaddressbook.inc.php 20295 2006-02-15 12:31:25Z  $ */
  15  
  16      class soaddressbook
  17      {
  18          var $contacts;
  19          var $rights;
  20          var $grants;
  21          var $owner;
  22  
  23  		function soaddressbook()
  24          {
  25              if(!is_object($GLOBALS['egw']->contacts))
  26              {
  27                  $GLOBALS['egw']->contacts = CreateObject('phpgwapi.contacts');
  28              }
  29              $this->contacts = &$GLOBALS['egw']->contacts;
  30              $this->grants = &$this->contacts->grants;
  31  
  32              /* _debug_array($GLOBALS['egw_info']); */
  33              /* _debug_array($grants); */
  34          }
  35  
  36  		function read_entries($data)
  37          {
  38  //            echo 'OK!';
  39  //            _debug_array($data);exit;
  40              return $this->contacts->read(
  41                  $data['start'],
  42                  $data['limit'],
  43                  $data['fields'],
  44                  $data['query'],
  45                  $data['filter'],
  46                  $data['sort'],
  47                  $data['order'],
  48                  -1,
  49                  $data['cquery']
  50              );
  51          }
  52  
  53  		function read_entry($id,$fields)
  54          {
  55              return $this->contacts->read_single_entry($id,$fields);
  56          }
  57  
  58  		function read_last_entry($fields)
  59          {
  60              return $this->contacts->read_last_entry($fields);
  61          }
  62  
  63  		function add_entry($fields)
  64          {
  65              $owner  = $fields['owner'];
  66              $access = $fields['access'];
  67              $cat_id = $fields['cat_id'];
  68              $tid    = $fields['tid'];
  69              unset($fields['owner']);
  70              unset($fields['access']);
  71              unset($fields['cat_id']);
  72              unset($fields['ab_id']);
  73              unset($fields['tid']);
  74  
  75              return $this->contacts->add($owner,$fields,$access,$cat_id,$tid);
  76          }
  77  
  78  		function get_lastid()
  79          {
  80              $entry = $this->contacts->read_last_entry();
  81              return $entry[0]['id'];
  82          }
  83  
  84  		function update_entry($fields)
  85          {
  86              $ab_id  = isset($fields['ab_id']) ? $fields['ab_id'] : $fields['id'];
  87              $owner  = $fields['owner'];
  88              unset($fields['owner']);
  89              unset($fields['ab_id']);
  90              unset($fields['id']);
  91  
  92              return $this->contacts->update($ab_id,$owner,$fields);
  93          }
  94  
  95  		function delete_entry($id)
  96          {
  97              return $this->contacts->delete($id);
  98          }
  99      }
 100  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7