[ 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_-_French 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 ledruide for the Outlook fields */ 35 var $import = array( 36 'Fonction' => 'title', 37 'Prénom' => 'n_given', 38 'Deuxième prénom' => 'n_middle', 39 'Nom' => 'n_family', 40 'Suffixe' => 'n_suffix', 41 'Société' => 'org_name', 42 'Service' => 'org_unit', 43 'Rue (bureau)' => 'adr_one_street', 44 'Rue (bureau) 2' => 'address2', 45 'Rue (bureau) 3' => 'address3', 46 'Ville (bureau)' => 'adr_one_locality', 47 'État/Prov (bureau)' => 'adr_one_region', 48 'Code postal (bureau)' => 'adr_one_postalcode', 49 'Pays (bureau)' => 'adr_one_countryname', 50 'Rue (domicile)' => 'adr_two_street', 51 'Rue (domicile) 3' => '', 52 'Rue (domicile) 3' => '', 53 'Ville (domicile)' => 'adr_two_locality', 54 'État/Prov (domicile)' => 'adr_two_region', 55 'Code postal (domicile)' => 'adr_two_postalcode', 56 'Pays (domicile)' => 'adr_two_countryname', 57 'Rue (autre)' => '', 58 'Rue (autre) 2' => '', 59 'Rue (autre) 3' => '', 60 'Ville (autre)' => '', 61 'État/Prov (autre)' => '', 62 'Code postal (autre)' => '', 63 'Pays (autre)' => '', 64 "Téléphone de l'assistant(e)" => 'tel_msg', 65 'Télécopie (bureau)' => 'tel_fax', 66 'Téléphone (bureau)' => 'tel_work', 67 'Téléphone 2 (bureau)' => 'ophone', 68 'Rappel' => '', 69 'Téléphone (voiture)' => 'tel_car', 70 'Téléphone société' => '', 71 'Télécopie (domicile)' => '', 72 'Téléphone (domicile)' => 'tel_home', 73 'Téléphone 2 (domicile)' => '', 74 'RNIS' => 'tel_isdn', 75 'Tél. mobile' => 'tel_cell', 76 'Télécopie (autre)' => '', 77 'Téléphone (autre)' => '', 78 'Récepteur de radiomessagerie' => 'tel_pager', 79 'Téléphone principal' => '', 80 'Radio téléphone' => '', 81 'Téléphone TDD/TTY' => '', 82 'Télex' => '', 83 'Compte' => '', 84 'Anniversaire de mariage ou fête' => '', 85 "Nom de l'assistant(e)" => '', 86 'Informations facturation' => '', 87 'Anniversaire' => 'bday', 88 'Catégories' => '', 89 'Enfants' => '', 90 'Adresse e-mail' => 'email', 91 "Nom complet de l'adresse e-mail" => '', 92 'Adresse e-mail 2' => 'email_home', 93 "Nom complet de l'adresse e-mail 2" => '', 94 'Adresse e-mail 3' => '', 95 "Nom complet de l'adresse e-mail 3" => '', 96 'Sexe' => '', 97 'Code gouvernement' => '', 98 'Passe-temps' => '', 99 'Initiales' => '', 100 'Mots clés' => '', 101 'Langue' => '', 102 'Lieu' => '', 103 'Kilométrage' => '', 104 'Notes' => 'note', 105 'Bureau' => '', 106 "Numéro d'identification de l'organisation" => '', 107 'B.P.' => '', 108 'Privé' => '', 109 'Profession' => '', 110 'Recommandé par' => '', 111 'Conjoint(e)' => '', 112 'Utilisateur 1' => '', 113 'Utilisateur 2' => '', 114 'Utilisateur 3' => '', 115 'Utilisateur 4' => '', 116 'Page Web' => 'url' 117 ); 118 119 function import_start_file($buffer) 120 { 121 return $buffer; 122 } 123 124 function import_start_record($buffer) 125 { 126 $top = array(); 127 ++$this->id; 128 $this->currentrecord = $top; 129 return $buffer; 130 } 131 132 function import_new_attrib($buffer,$name,$value) 133 { 134 $value = trim($value); 135 $value = str_replace('\n','<BR>',$value); 136 $value = str_replace('\r','',$value); 137 $this->currentrecord += array($name => $value); 138 139 return $buffer; 140 } 141 142 function import_end_record($buffer) 143 { 144 $buffer[$this->id] = ''; 145 while(list($name, $value) = each($this->currentrecord)) 146 { 147 $buffer[$this->id][$name] = $value; 148 //echo '<br>'.$name.' => '.$value; 149 } 150 return $buffer; 151 } 152 153 function import_end_file($buffer,$access='private',$cat_id=0) 154 { 155 $contacts = CreateObject('phpgwapi.contacts'); 156 //echo '<br>'; 157 for($i=1;$i<=count($buffer);$i++) 158 { 159 while(list($name,$value) = @each($buffer[$i])) 160 { 161 //echo '<br>'.$i.': '.$name.' => '.$value; 162 $entry[$i][$name] = $value; 163 } 164 $entry[$i]['email_type'] = 'INTERNET'; 165 $entry[$i]['email_home_type'] = 'INTERNET'; 166 $entry[$i]['adr_one_type'] = 'intl'; 167 $entry[$i]['adr_two_type'] = 'intl'; 168 $entry[$i]['fn'] = $entry[$i]['n_given'] . ' ' . $entry[$i]['n_family']; 169 //echo '<br>'; 170 $contacts->add($GLOBALS['egw_info']['user']['account_id'],$entry[$i],$access,$cat_id); 171 } 172 $num = $i - 1; 173 return lang('Successfully imported %1 records into your addressbook.',$num); 174 } 175 } 176 ?>
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 |