[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/addressbook/inc/export/ -> Outlook_CSV_-_Italian (source)

   1  <?php
   2  // file for outlook italian version
   3  // based on Outlook_CSV_-_English - modified fields names and birthday treatment
   4  // by Simone Capra - capra@erweb.it - http://www.erweb.it
   5  
   6  
   7  // This file defines a set of functions and an associative array.
   8  // The key of the array corresponds to a header in the source
   9  // export file and the value of the array item will be used in
  10  // the creation of the output file.
  11  //
  12  // An exported Outlook file looks like this:
  13  //
  14  // Title<tab>First Name<tab>Middle Name<tab>Last Name<tab>...
  15  // <tab>Patrick<tab><tab>Walsh<tab>...
  16  //
  17  // Where the first line explains each optional field.  This is what
  18  // will be looked up in the key.
  19  //
  20  // The array need not be in any order and any fields not defined will
  21  // not be transferred.  If the val='+', the value will be appended to
  22  // the previous field and any text after the '+' will be appended
  23  // before the value.  For example, the following would add a comma and
  24  // a space between LastName and FirstName and store it in FullName:
  25  //
  26  //    array("LastName" => "FullName","FirstName" => "+, ");
  27  //
  28  // Also start with a '#' symbol and a comma separated list will be
  29  // turned into a number of the same entries.
  30  
  31  
  32  
  33  
  34      class export_conv
  35      {
  36          var $currentrecord = array(); //used for buffering to allow uid lines to go first
  37          var $id;
  38          var $type = 'csv';
  39  
  40  
  41          var $export = array(
  42              'title'               => 'Posizione',
  43              'n_prefix'            => 'Titolo',
  44              'n_given'             => 'Nome',
  45              'n_middle'            => 'Secondo nome',
  46              'n_family'            => 'Cognome',
  47              'n_suffix'            => 'Titolo straniero',
  48              'org_name'            => 'Società',
  49              'org_unit'            => 'Reparto',
  50              'adr_one_street'      => 'Via (uff.)',
  51              'address2'            => 'Via (uff.) 2',
  52              'address3'            => 'Via (uff.) 3',
  53              'adr_one_locality'    => 'Città (uff.)',
  54              'adr_one_region'      => 'Provincia (uff.)',
  55              'adr_one_postalcode'  => 'CAP (uff.)',
  56              'adr_one_countryname' => 'Paese (uff.)',
  57              'adr_two_street'      => 'Via (ab.)',
  58              'adr_two_locality'    => 'Città (ab.)',
  59              'adr_two_region'      => 'Provincia (ab.)',
  60              'adr_two_postalcode'  => 'CAP (ab.)',
  61              'adr_two_countryname' => 'Paese (ab.)',
  62              'tel_fax'             => 'Fax (uff.)',
  63              'tel_work'            => 'Ufficio',
  64              'tel_msg'             => 'Telefono assistente',
  65              'tel_car'             => 'Telefono auto',
  66              'tel_isdn'            => 'ISDN',
  67              'tel_home'            => 'Abitazione',
  68              'tel_cell'            => 'Cellulare',
  69              'tel_pager'           => 'Pager',
  70              'ophone'              => 'Business Phone 2',
  71              'bday'                => 'Compleanno',
  72              'email'               => 'Indirizzo posta elettronica',
  73              'email_home'          => 'Indirizzo posta elettronica 2',
  74              'url'                 => 'Pagina Web',
  75              'note'                => 'Notes'
  76          );
  77  
  78          // This will store the contacts object
  79          var $contacts = '';
  80  
  81          function export_start_file($buffer,$ncat_id='')
  82          {
  83              $this->id=-1;
  84              if ($ncat_id)
  85              {
  86                  $filter = 'tid=n,cat_id='.$ncat_id;
  87              }
  88              else
  89              {
  90                  $filter = 'tid=n';
  91              }
  92              $this->contacts = CreateObject('phpgwapi.contacts');
  93  
  94              $tmp = $this->contacts->read('','',array('id'=>'id'),'',$filter);
  95              for ($i=0;$i<count($tmp);$i++)
  96              {
  97                  $this->ids[$i] = $tmp[$i]['id'];
  98              }
  99              // $ids is now an array of all id's for this user, e.g. $ids[0] = 21, etc...
 100              // $buffer is still empty
 101              return $buffer;
 102          }
 103  
 104          // Read each entry
 105          function export_start_record($buffer)
 106          {
 107              $this->id++;
 108              $top = $this->contacts->read_single_entry($this->ids[$this->id],$this->qfields);
 109              $this->currentrecord = $top[0];
 110              return $buffer;
 111          }
 112  
 113          // Read each attribute, populate buffer
 114          // name/value are the fields from the export array above
 115          function export_new_attrib($buffer,$name,$value)
 116          {
 117              if ($this->export[$name])
 118              {
 119                  if($name=='bday'){
 120                      list($m,$d,$y) = explode("/",$value );
 121                      $value = $d.'/'.$m.'/'.$y;
 122                  }
 123  
 124                  $buffer[$this->id][$this->export[$name]] = $value;
 125                  //echo '<br>'.$this->id.' - '.$this->export[$name].': '.$buffer[$this->id][$this->export[$name]];
 126              }
 127              return $buffer;
 128          }
 129  
 130          // Tack on some extra values
 131          function export_end_record($buffer)
 132          {
 133              return $buffer;
 134          }
 135  
 136          function export_end_file($buffer)
 137          {
 138              // Build the header for the file (field list)
 139              reset($this->export);
 140              while (list($name,$value)=each($this->export))
 141              {
 142                  $entries .= $value . ',';
 143              }
 144              $entries = substr($entries,0,-1);
 145              $entries .= "\r\n";
 146  
 147              // Now add all the data
 148              reset($this->ids);
 149              for ($i=0;$i<count($this->ids);$i++)
 150              {
 151                  reset($this->export);
 152                  while (list($name,$value)=each($this->export))
 153                  {
 154                      $entries .= $buffer[$i][$value] . ',';
 155                  }
 156                  $entries = substr($entries,0,-1);
 157                  $entries .= "\r\n";
 158              }
 159              $buffer = $entries;
 160              return $buffer;
 161          }
 162      }
 163  ?>


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