[ 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_-_Hungary (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_-_Hungary 18716 2005-07-03 14:15:23Z milosch $ */
  27  
  28      class import_conv
  29      {
  30          var $currentrecord = array(); //used for buffering to allow uid lines to go first
  31          var $id;
  32          var $type = 'csv';
  33  
  34          var $import = array(
  35              'Cím' => 'n_prefix',
  36              'Utónév' => 'n_given',
  37              'Középső' => 'n_middle',
  38              'Vezetéknév' => 'n_family',
  39              'Utótag' => 'n_suffix',
  40              'Cég' => 'org_name',  //objectclass: organization
  41              'Osztály' => 'org_unit', //objectclass: organizationalPerson
  42              'Beosztás' => 'title', //objectclass: organizationalPerson
  43              'Mukahely címe' => 'adr_one_street',
  44              '2. vállalati utcacím' => 'address2',
  45              '3. vállalati utcacím' => 'address3',
  46              'Város (hivatal)' => 'adr_one_locality',
  47              'Megye (hivatal)' => 'adr_one_region',
  48              'Munkahely irányítószám' => 'adr_one_postalcode',
  49              'Ország (hivatal)' => 'adr_one_countryname',
  50              'Lakcím' => 'adr_two_street',
  51              'Város (lakás)' => 'adr_two_locality',
  52              'Megye (lakás)' => 'adr_two_region',
  53              'Irányítószám (lakás)' => 'adr_two_postalcode',
  54              'Ország (lakás)' => 'adr_two_countryname',
  55              '2. otthoni utcacím' => '',
  56              '3. otthoni utcacím' => '',
  57              'Más utcacím' => '',
  58              'Más város' => '',
  59              'Más állam' => '',
  60              'Más irányítószám' => '',
  61              'Más ország' => '',
  62              "Titkár telefonszáma" => 'tel_msg',
  63              'Hivatali fax' => 'tel_fax',
  64              'Hivatali telefon' => 'tel_work',
  65              'Másik hivatali telefon' => 'ophone',
  66              'Visszahívás' => '',
  67              'Autótelefon' => 'tel_car',
  68              'Cég fővonala' => '',
  69              'Otthoni fax' => '',
  70              'Otthoni telefon' => 'tel_home',
  71              'Másik otthoni telefon' => '', //This will make another homePhone entry
  72              'ISDN' => 'tel_isdn',
  73              'Mobiltelefon' => 'tel_cell', //newPilotPerson
  74              'Egyéb fax' => '',
  75              'Egyéb telefon' => '',
  76              'Személyhívó' => 'tel_pager',
  77              'Elsődleges telefon' => '',
  78              'Rádiótelefon' => '',
  79              'TTY/TDD telefon' => '',
  80              'Telex' => '', //organization
  81              'Címkiszolgáló' => '',
  82              'Évforduló' => '',
  83              "Titkár neve" => '', //newPilotPerson
  84              'Számlaadatok' => '',
  85              'Születésnap' => 'bday',
  86              'Kategóriák' => '',
  87              'Gyerekek' => '',
  88              'Címkiszolgáló' => '',
  89              'Elektronikus levélcím' => 'email',
  90              'Elektronikus levélhez megjelenítendő név' => '',
  91              '2. elektronikus levélcím' => 'email_home',
  92              '2. elektronikus levélhez megjelenítendő név' => '',
  93              '3. elektronikus levélcím' => '', //add another...
  94              '3. elektronikus levélhez megjelenítendő név' => '',
  95              'Nem' => '',
  96              'Kormányzati azonosító' => '',
  97              'Hobbi' => '',
  98              'Monogram' => '',
  99              'Elfoglaltság közzététele az Interneten' => '',
 100              'Kulcsszavak' => '',
 101              'Nyelv' => '',
 102              'Hely' => '',
 103              "Felettes neve" => '',
 104              'Távolság' => '',
 105              'Feljegyzések' => 'note',
 106              'Iroda helye' => '',
 107              'Szervezeti azonosító' => '',
 108              'Egyéb cím, postafiók' => '',
 109              'Prioritás' => '',
 110              'Magánjellegű' => '',
 111              'Referencia' => '',
 112              'Sensitivity' => '',
 113              'Házastárs' => '',
 114              'Felhasználói 1' => '',
 115              'Felhasználói 2' => '',
 116              'Felhasználói 3' => '',
 117              'Felhasználói 4' => '',
 118              'Weblap' => 'url'
 119          );
 120  
 121  		function import_start_file($buffer)
 122          {
 123              return $buffer;
 124          }
 125  
 126  		function import_start_record($buffer)
 127          {
 128              $top = array();
 129              ++$this->id;
 130              $this->currentrecord = $top;
 131              return $buffer;
 132          }
 133  
 134  		function import_new_attrib($buffer,$name,$value)
 135          {
 136              $value = trim($value);
 137              $value = str_replace('\n','<BR>',$value);
 138              $value = str_replace('\r','',$value);
 139              $this->currentrecord += array($name => $value);
 140  
 141              return $buffer;
 142          }
 143  
 144  		function import_end_record($buffer)
 145          {
 146              $buffer[$this->id] = '';
 147              while(list($name, $value) = each($this->currentrecord))
 148              {
 149                  $buffer[$this->id][$name] = $value;
 150                  //echo '<br>'.$name.' => '.$value;
 151              }
 152              return $buffer;
 153          }
 154  
 155  		function import_end_file($buffer,$access='private',$cat_id=0)
 156          {
 157              $contacts = CreateObject('phpgwapi.contacts');
 158              //echo '<br>';
 159              for($i=1;$i<=count($buffer);$i++)
 160              {
 161                  while(list($name,$value) = @each($buffer[$i]))
 162                  {
 163                      //echo '<br>'.$i.': '.$name.' => '.$value;
 164                      $entry[$i][$name] = $value;
 165                  }
 166                  $entry[$i]['email_type']      = 'INTERNET';
 167                  $entry[$i]['email_home_type'] = 'INTERNET';
 168                  $entry[$i]['adr_one_type']    = 'intl';
 169                  $entry[$i]['adr_two_type']    = 'intl';
 170                  $entry[$i]['fn'] = $entry[$i]['n_family'] . ' ' . $entry[$i]['n_given'];
 171                  //echo '<br>';
 172                  $contacts->add($GLOBALS['egw_info']['user']['account_id'],$entry[$i],$access,$cat_id);
 173              }
 174              $num = $i - 1;
 175              return lang('Successfully imported %1 records into your addressbook.',$num);
 176          }
 177      }
 178  ?>


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