[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: addressbook/inc/import Import_from_Outlook_-_Esp
From: |
Miles Lott <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: addressbook/inc/import Import_from_Outlook_-_Espa駉l,NONE,1.1 |
Date: |
Sun, 18 Aug 2002 19:23:30 -0400 |
Update of /cvsroot/phpgroupware/addressbook/inc/import
In directory subversions:/tmp/cvs-serv7381
Added Files:
Import_from_Outlook_-_Espa帽ol
Log Message:
New file from address@hidden
--- NEW FILE ---
<?php
// This file defines a set of functions and an associative array.
// The key of the array corresponds to a header in the source
// import file and the value of the array item will be used in
// the creation of the output file.
//
// An exported Outlook file looks like this:
//
// Title<tab>First Name<tab>Middle Name<tab>Last Name<tab>...
// <tab>Patrick<tab><tab>Walsh<tab>...
//
// Where the first line explains each optional field. This is what
// will be looked up in the key.
//
// The array need not be in any order and any fields not defined will
// not be transferred. If the val='+', the value will be appended to
// the previous field and any text after the '+' will be appended
// before the value. For example, the following would add a comma and
// a space between LastName and FirstName and store it in FullName:
//
// array('LastName' => 'FullName','FirstName' => '+, ');
//
// Also start with a '#' symbol and a comma separated list will be
// turned into a number of the same entries.
class import_conv
{
var $currentrecord = array(); //used for buffering to allow uid
lines to go first
var $id;
var $type = 'csv';
/* Thanks to alexbsa for the Outlook fields */
var $import = array(
'Tratamiento' => 'n_prefix',
'Puesto' => 'title',
'Nombre' => 'n_given',
'Apellidos' => 'n_family',
'Sufijo' => 'n_suffix',
'Organizaci贸n' => 'org_name',
'Departamento' => 'org_unit',
'Calle del Trabajo' => 'adr_one_street',
'Calle del trabajo 2' => 'address2',
'Calle del trabajo 3' => 'address3',
'Apartado postal' => '+ A.P. ',
'Ciudad de trabajo' => 'adr_one_locality',
'Provincia o estado de trabajo' => 'adr_one_region',
'C贸digo postal del trabajo' => 'adr_one_postalcode',
'Pa铆s de trabajo' => 'adr_one_countryname',
'Calle del domicilio' => 'adr_two_street',
'Calle del domicilio 2' => '',
'Calle del domicilio 3' => '',
'Ciudad de residencia' => 'adr_two_locality',
'Provincia o estado de residencia' => 'adr_two_region',
'C贸digo postal de residencia' => 'adr_two_postalcode',
'Pa铆s de residencia' => 'adr_two_countryname',
'Otra calle' => '',
'Otra calle 2' => '',
'Otra calle 3' => '',
'Otra ciudad' => '',
'Otra provincia o estado' => '',
'Otro c贸digo postal' => '',
'Otro pa铆s' => '',
"Tel茅fono del ayudante" => 'tel_msg',
'Fax del trabajo' => 'tel_fax',
'Tel茅fono del trabajo' => 'tel_work',
'Tel茅fono del trabajo 2' => 'ophone',
'Devoluci贸n de llamada' => '',
'Tel茅fono del autom贸vil' => 'tel_car',
'N煤mero de centralita de la organizaci贸n' => '',
'Fax particular' => '',
'Particular' => 'tel_home',
'N煤mero de tel茅fono particular 2' => '',
'RDSI' => 'tel_isdn',
'M贸vil' => 'tel_cell',
'Otro fax' => '',
'Otro tel茅fono' => '',
'Localizador' => 'tel_pager',
'Tel茅fono principal' => '',
'Radiotel茅fono' => '',
'N煤mero de teletipo' => '',
'T茅lex' => '',
'Aficiones' => '',
'Aniversario' => '',
'Cumplea帽os' => 'bday',
'Direcci贸n de correo electr贸nico' => 'email',
'Direcci贸n de correo electr贸nico 2' => 'email_home',
'Notas' => 'note',
'P谩gina Web' => 'url'
);
function import_start_file($buffer)
{
return $buffer;
}
function import_start_record($buffer)
{
$top=array();
++$this->id;
$this->currentrecord = $top;
return $buffer;
}
function import_new_attrib($buffer,$name,$value)
{
$value = trim($value);
$value = str_replace('\n','<BR>',$value);
$value = str_replace('\r','',$value);
$this->currentrecord += array($name => $value);
return $buffer;
}
function import_end_record($buffer)
{
$buffer[$this->id]='';
while ( list($name, $value) =
each($this->currentrecord))
{
$buffer[$this->id][$name] = $value;
//echo '<br>'.$name.' => '.$value;
}
return $buffer;
}
function import_end_file($buffer,$access='private',$cat_id=0)
{
$contacts = CreateObject('phpgwapi.contacts');
//echo '<br>';
for ($i=1;$i<=count($buffer);$i++)
{
while ( list($name,$value) = @each($buffer[$i])
)
{
//echo '<br>'.$i.': '.$name.' =>
'.$value;
$entry[$i][$name] = $value;
}
$entry[$i]['email_type'] = 'INTERNET';
$entry[$i]['email_home_type'] = 'INTERNET';
$entry[$i]['adr_one_type'] = 'intl';
$entry[$i]['adr_two_type'] = 'intl';
//echo '<br>';
$contacts->add($GLOBALS['phpgw_info']['user']['account_id'],$entry[$i],$access,$cat_id);
}
$num = $i - 1;
return lang('Successfully imported x records into your
addressbook.',$num);
}
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: addressbook/inc/import Import_from_Outlook_-_Espa駉l,NONE,1.1,
Miles Lott <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: projects/inc class.boprojects.inc.php,1.47,1.48 class.uiprojects.inc.php,1.56,1.57
- Next by Date:
[Phpgroupware-cvs] CVS: addressbook/inc hook_home.inc.php,1.13,1.14
- Previous by thread:
[Phpgroupware-cvs] CVS: projects/inc class.boprojects.inc.php,1.47,1.48 class.uiprojects.inc.php,1.56,1.57
- Next by thread:
[Phpgroupware-cvs] CVS: addressbook/inc hook_home.inc.php,1.13,1.14
- Index(es):