[ Index ]
 

Code source de eGroupWare 1.2.106-2

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

title

Body

[fermer]

/addressbook/inc/import/ -> Import_from_Outlook_-_Espanol (source)

   1  <?php
   2  // This file defines a set of functions and an associative array.
   3  // The key of the array corresponds to a header in the source
   4  // import file and the value of the array item will be used in
   5  // the creation of the output file.
   6  //
   7  // An exported Outlook file looks like this:
   8  //
   9  // Title<tab>First Name<tab>Middle Name<tab>Last Name<tab>...
  10  // <tab>Patrick<tab><tab>Walsh<tab>...
  11  //
  12  // Where the first line explains each optional field.  This is what
  13  // will be looked up in the key.
  14  //
  15  // The array need not be in any order and any fields not defined will
  16  // not be transferred.  If the val='+', the value will be appended to
  17  // the previous field and any text after the '+' will be appended 
  18  // before the value.  For example, the following would add a comma and
  19  // a space between LastName and FirstName and store it in FullName:
  20  //
  21  //    array('LastName' => 'FullName','FirstName' => '+, ');
  22  //
  23  // Also start with a '#' symbol and a comma separated list will be
  24  // turned into a number of the same entries.
  25  
  26    /* $Id: Import_from_Outlook_-_Espanol 18716 2005-07-03 14:15:23Z milosch $ */
  27  
  28      /* File submitted by Alejandro Pedraza - alpeb@sourceforge.net */
  29      class import_conv
  30      {
  31          var $currentrecord = array(); //used for buffering to allow uid lines to go first
  32          var $id;
  33          var $type = 'csv';
  34  
  35          var $import = array(
  36              'Tratamiento' => 'n_prefix', 
  37              'Nombre' => 'n_given',
  38              'Segundo Nombre' => 'n_middle',
  39              'Apellidos' => 'n_family',
  40              'Sufijo' => 'n_suffix',
  41              'Organización' => 'org_name',  //objectclass: organization
  42              'Departmento' => 'org_unit', //objectclass: organizationalPerson
  43              'Puesto' => 'title', //objectclass: organizationalPerson
  44              'Calle del trabajo' => 'adr_one_street',
  45              'Calle del trabajo 2' => 'address2',
  46              'Calle del trabajo 3' => 'address3',
  47              'Ciudad de trabajo' => 'adr_one_locality',
  48              'Provincia o estado de trabajo' => 'adr_one_region',
  49              'Código postal del trabajo' => 'adr_one_postalcode',
  50              'País de trabajo' => 'adr_one_countryname',
  51              'Calle del domicilio' => 'adr_two_street',
  52              'Ciudad de residencia' => 'adr_two_locality',
  53              'Provincia o estado de residencia' => 'adr_two_region',
  54              'Código postal de residencia' => 'adr_two_postalcode',
  55              'País de residencia' => 'adr_two_countryname',
  56              'Calle del domicilio 2' => '',
  57              'Calle del domicilio 3' => '',
  58              'Otra calle' => '',
  59              'Otra ciudad' => '',
  60              'Otra provincia o estado' => '',
  61              'Otro código postal' => '',
  62              'Otro país' => '',
  63              "Teléfono del ayudante" => 'tel_msg',
  64              'Fax del trabajo' => 'tel_fax',
  65              'Teléfono del trabajo' => 'tel_work',
  66              'Teléfono del trabajo 2' => 'ophone',
  67              'Devolución de llamada' => '',
  68              'Teléfono del automóvil' => 'tel_car',
  69              'Número de centralita de la organización' => '',
  70              'Fax particular' => '',
  71              'Particular' => 'tel_home',
  72              'Número de teléfono particular 2' => '', //This will make another homePhone entry
  73              'RDSI' => 'tel_isdn',
  74              'Móvil' => 'tel_cell', //newPilotPerson
  75              'Otro fax' => '',
  76              'Otro teléfono' => '',
  77              'Localizador' => 'tel_pager',
  78              'Teléfono principal' => '',
  79              'Radioteléfono' => '',
  80              'Número de teletipo' => '',
  81              'Télex' => '', //organization
  82              'Cuenta' => '',
  83              'Aniversario' => '',
  84              "Nombre del ayudante" => '', //newPilotPerson
  85              'Facturación' => '',
  86              'Cumpleaños' => 'bday',
  87              'Categorías' => '', 
  88              'Hijos' => '',
  89              'Servidor de directorio' => '',
  90              'Dirección de correo electrónico' => 'email',
  91              'Nombre de pantalla de correo electrónico' => '',
  92              'Dirección de correo electrónico 2' => 'email_home',
  93              'Nombre de pantalla de correo electrónico 2' => '',
  94              'Dirección del correo electrónico 3' => '', //add another...
  95              'Nombre de pantalla de correo electrónico 3' => '',
  96              'Género' => '',
  97              'Número de id. oficial' => '',
  98              'Aficiones' => '',
  99              'Iniciales' => '',
 100              'Internet Free Busy' => '',
 101              'Palabras clave' => '',
 102              'Idioma' => '',
 103              'Ubicación' => '',
 104              "Nombre del director" => '',
 105              'Kilometraje' => '',
 106              'Notas' => 'note',
 107              'Ubicación de la oficina' => '',
 108              'Número de id. de la organización' => '',
 109              'Apartado postal' => '',
 110              'Importancia' => '',
 111              'Privado'=>'',
 112              'Profesión' => '',
 113              'Remitido por' => '',
 114              'Confidencialidad' => '',
 115              'Cónyuge' => '',
 116              'Usuario 1' => '',
 117              'Usuario 2' => '',
 118              'Usuario 3' => '',
 119              'Usuario 4' => '',
 120              'Página Web' => 'url'
 121          );
 122  
 123  		function import_start_file($buffer)
 124          {
 125              return $buffer;
 126          }
 127  
 128  		function import_start_record($buffer)
 129          {
 130              $top=array();
 131              ++$this->id;
 132              $this->currentrecord = $top;
 133              return $buffer;
 134          }
 135  
 136  		function import_new_attrib($buffer,$name,$value)
 137          {
 138              $value = trim($value);
 139              $value = str_replace('\n','<BR>',$value);
 140              $value = str_replace('\r','',$value);
 141              $this->currentrecord += array($name => $value);
 142  
 143              return $buffer;
 144          }
 145  
 146  		function import_end_record($buffer)
 147          {
 148              $buffer[$this->id]='';
 149              while ( list($name, $value) = each($this->currentrecord))
 150              {
 151                  $buffer[$this->id][$name] = $value;
 152                  //echo '<br>'.$name.' => '.$value;
 153              }
 154              return $buffer;
 155          }
 156  
 157  		function import_end_file($buffer,$access='private',$cat_id=0)
 158          {
 159              $contacts = CreateObject('phpgwapi.contacts');
 160              //echo '<br>'; 
 161              for ($i=1;$i<=count($buffer);$i++)
 162              {
 163                  while ( list($name,$value) = @each($buffer[$i]) )
 164                  {
 165                      //echo '<br>'.$i.': '.$name.' => '.$value;
 166                      $entry[$i][$name] = $value;
 167                  }
 168                  $entry[$i]['email_type']      = 'INTERNET';
 169                  $entry[$i]['email_home_type'] = 'INTERNET';
 170                  $entry[$i]['adr_one_type']    = 'intl';
 171                  $entry[$i]['adr_two_type']    = 'intl';
 172                  $entry[$i]['fn'] = $entry[$i]['n_given'] . ' ' . $entry[$i]['n_family'];
 173                  //echo '<br>';
 174                  $contacts->add($GLOBALS['egw_info']['user']['account_id'],$entry[$i],$access,$cat_id);
 175              }
 176              $num = $i - 1;
 177              return lang('Successfully imported %1 records into your addressbook.',$num);
 178          }
 179      }
 180  ?>


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