[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
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_-_Deutsch 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 /* Thanks to knecke for the Outlook fields */ 35 var $import = array( 36 'Anrede' => 'n_prefix', 37 'Vorname' => 'n_given', 38 'Weitere Vornamen' => 'n_middle', 39 'Nachname' => 'n_family', 40 'Suffix' => 'n_suffix', 41 'Firma' => 'org_name', 42 'Abteilung' => 'org_unit', 43 'Position' => 'title', 44 'Straße geschäftlich' => 'adr_one_street', 45 'Straße geschäftlich 2' => 'address2', 46 'Straße geschäftlich 3' => 'address3', 47 'Ort geschäftlich' => 'adr_one_locality', 48 'Region geschäftlich' => 'adr_one_region', 49 'Postleitzahl geschäftlich' => 'adr_one_postalcode', 50 'Land geschäftlich' => 'adr_one_countryname', 51 'Straße privat' => 'adr_two_street', 52 'Straße privat 2' => '', 53 'Straße privat 3' => '', 54 'Ort privat' => 'adr_two_locality', 55 'Region privat' => 'adr_two_region', 56 'Postleitzahl privat' => 'adr_two_postalcode', 57 'Land privat' => 'adr_two_countryname', 58 'Weitere Straße' => '', 59 'Weitere Straße 2' => '', 60 'Weitere Straße 3' => '', 61 'Weiterer Ort' => '', 62 'Weitere Region' => '', 63 'Weitere Postleitzahl' => '', 64 'Weiteres Land' => '', 65 'Telefon Assistent' => 'tel_msg', 66 'Fax geschäftlich' => 'tel_fax', 67 'Telefon geschäftlich' => 'tel_work', 68 'Telefon geschäftlich 2' => 'ophone', 69 'Rückmeldung' => '', 70 'Autotelefon' => 'tel_car', 71 'Telefon Firma' => '', 72 'Fax privat' => '', 73 'Telefon privat' => 'tel_home', 74 'Telefon privat 2' => '', 75 'ISDN' => 'tel_isdn', 76 'Mobiltelefon' => 'tel_cell', 77 'Weiteres Fax' => '', 78 'Weiteres Telefon' => '', 79 'Pager' => 'tel_pager', 80 'Haupttelefon' => '', 81 'Mobiltelefon 2' => '', 82 'Telefon für Hörbehinderte' => '', 83 'Telex' => '', 84 'Abrechnungsinformation' => '', 85 'Benutzer 1' => '', 86 'Benutzer 2' => '', 87 'Benutzer 3' => '', 88 'Benutzer 4' => '', 89 'Beruf' => '', 90 'Büro' => '', 91 'E-Mail-Adresse' => 'email', 92 'E-Mail: Angezeigter Name' => '', 93 'E-Mail 2: Adresse' => 'email_home', 94 'E-Mail 2: Angezeigter Name' => '', 95 'E-Mail 3: Adresse' => '', 96 'E-Mail 3: Angezeigter Name' => '', 97 'Empfohlen von' => '', 98 'Geburtstag' => 'bday', 99 'Geschlecht' => '', 100 'Hobby' => '', 101 'Initialen' => '', 102 'Internet-Frei/Gebucht' => '', 103 'Jahrestag' => '', 104 'Kategorien' => '', 105 'Kinder' => '', 106 'Konto' => '', 107 'Name Assistent' => '', 108 'Name des/der Vorgesetzten' => '', 109 'Notizen' => 'note', 110 'Organisations-Nr.' => '', 111 'Ort' => '', 112 'Partner' => '', 113 'Postfach' => '', 114 'Priorität' => '', 115 'Privat' => '', 116 'Regierungs-Nr.' => '', 117 'Reisekilometer' => '', 118 'Sprache' => '', 119 'Stichwörter' => '', 120 'Vertraulichkeit' => '', 121 'Verzeichnisserver' => '', 122 'Webseite' => 'url' 123 ); 124 125 function import_start_file($buffer) 126 { 127 return $buffer; 128 } 129 130 function import_start_record($buffer) 131 { 132 $top = array(); 133 ++$this->id; 134 $this->currentrecord = $top; 135 return $buffer; 136 } 137 138 function import_new_attrib($buffer,$name,$value) 139 { 140 $value = trim($value); 141 $value = str_replace('\n','<BR>',$value); 142 $value = str_replace('\r','',$value); 143 $this->currentrecord += array($name => $value); 144 145 return $buffer; 146 } 147 148 function import_end_record($buffer) 149 { 150 $buffer[$this->id] = ''; 151 while(list($name, $value) = each($this->currentrecord)) 152 { 153 $buffer[$this->id][$name] = $value; 154 //echo '<br>'.$name.' => '.$value; 155 } 156 return $buffer; 157 } 158 159 function import_end_file($buffer,$access='private',$cat_id=0) 160 { 161 $contacts = CreateObject('phpgwapi.contacts'); 162 //echo '<br>'; 163 for($i=1;$i<=count($buffer);$i++) 164 { 165 while(list($name,$value) = @each($buffer[$i])) 166 { 167 //echo '<br>'.$i.': '.$name.' => '.$value; 168 $entry[$i][$name] = $value; 169 } 170 $entry[$i]['email_type'] = 'INTERNET'; 171 $entry[$i]['email_home_type'] = 'INTERNET'; 172 $entry[$i]['adr_one_type'] = 'intl'; 173 $entry[$i]['adr_two_type'] = 'intl'; 174 $entry[$i]['fn'] = $entry[$i]['n_given'] . ' ' . $entry[$i]['n_family']; 175 //echo '<br>'; 176 $contacts->add($GLOBALS['egw_info']['user']['account_id'],$entry[$i],$access,$cat_id); 177 } 178 $num = $i - 1; 179 return lang('Successfully imported %1 records into your addressbook.',$num); 180 } 181 } 182 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |