[ 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.bofields.inc.php (source)

   1  <?php
   2    /**************************************************************************\
   3    * eGroupWare - Addressbook                                                 *
   4    * http://www.egroupware.org                                                *
   5    * Written by Joseph Engo <jengo@phpgroupware.org> and                      *
   6    * Miles Lott <milosch@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.bofields.inc.php 20295 2006-02-15 12:31:25Z  $ */
  15  
  16      class bofields
  17      {
  18          var $so;
  19  
  20  		function bofields()
  21          {
  22              /* Config class here is the so object */
  23              $this->so = CreateObject('phpgwapi.config','addressbook');
  24          }
  25  
  26  		function _read($start=0,$limit=5,$query='')
  27          {
  28              $i = 0;
  29              $fields = array();
  30  
  31              $this->so->read_repository();
  32              $config_name = isset($this->so->config_data['customfields']) ? 'customfields' : 'custom_fields';
  33              while(list($name,$descr) = @each($this->so->config_data[$config_name]))
  34              {
  35                  if(is_array($descr))
  36                  {
  37                      $descr = $descr['label'];
  38                  }
  39                  /*
  40                  if($start < $i)
  41                  {
  42                      continue;
  43                  }
  44                  */
  45  
  46                  $test = @strtolower($name);
  47                  //if($query && !strstr($test,strtolower($query)))
  48                  if($query && ($query != $test))
  49                  {
  50                  }
  51                  else
  52                  {
  53                      $fields[$i]['name'] = $name;
  54                      $fields[$i]['title'] = $descr;
  55                      $fields[$i]['id'] = $i;
  56  
  57                      /*
  58                      if($i >= $limit)
  59                      {
  60                          break;
  61                      }
  62                      */
  63                      $i++;
  64                  }
  65              }
  66              switch($sort)
  67              {
  68                  case 'DESC';
  69                      krsort($fields);
  70                      break;
  71                  case 'ASC':
  72                  default:
  73                      ksort($fields);
  74              }
  75              @reset($fields);
  76  
  77              return $fields;
  78          }
  79  
  80  		function _save($old='',$new='')
  81          {
  82              $this->so->read_repository();
  83  
  84              if(!is_array($this->so->config_data['custom_fields']))
  85              {
  86                  $this->so->config_data['custom_fields'] = array();
  87              }
  88  
  89              if($old)
  90              {
  91                  unset($this->so->config_data['custom_fields'][$old]);
  92              }
  93              if($new)
  94              {
  95                  $tmp = strtolower(str_replace(' ','_',$new));
  96                  $this->so->config_data['custom_fields'][$tmp] = $new;
  97              }
  98  
  99              $this->so->save_repository();
 100          }
 101      }
 102  ?>


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