forked from extern/egroupware
Move import array to vcard class, change postition of objects creation
This commit is contained in:
parent
f65e2edda5
commit
f1d60a66b9
@ -29,25 +29,18 @@
|
|||||||
var $id;
|
var $id;
|
||||||
var $type = 'vcard';
|
var $type = 'vcard';
|
||||||
|
|
||||||
var $import = array(
|
// These will hold the class objects
|
||||||
"n" => "n",
|
var $contacts = '';
|
||||||
"sound" => "sound",
|
var $vcard = '';
|
||||||
"bday" => "bday",
|
|
||||||
"note" => "note",
|
// This will be populated via the vcard->import var
|
||||||
"tz" => "tz",
|
var $import = array();
|
||||||
"geo" => "geo",
|
|
||||||
"url" => "url",
|
|
||||||
"pubkey" => "pubkey",
|
|
||||||
"org" => "org",
|
|
||||||
"title" => "title",
|
|
||||||
"adr" => "adr",
|
|
||||||
"label" => "label",
|
|
||||||
"tel" => "tel",
|
|
||||||
"email" => "email"
|
|
||||||
);
|
|
||||||
|
|
||||||
function import_start_file($buffer,$j="",$k="") {
|
function import_start_file($buffer,$j="",$k="") {
|
||||||
$this->id = 0;
|
$this->id = 0;
|
||||||
|
$this->contacts = CreateObject("phpgwapi.contacts");
|
||||||
|
$this->vcard = CreateObject("phpgwapi.vcard");
|
||||||
|
$this->import = $this->vcard->import;
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,16 +73,13 @@
|
|||||||
function import_end_file($buffer) {
|
function import_end_file($buffer) {
|
||||||
global $phpgw,$phpgw_info;
|
global $phpgw,$phpgw_info;
|
||||||
|
|
||||||
$contacts = CreateObject("phpgwapi.contacts");
|
|
||||||
$vcard = CreateObject("phpgwapi.vcard");
|
|
||||||
|
|
||||||
for ($i=1;$i<=count($buffer);$i++) {
|
for ($i=1;$i<=count($buffer);$i++) {
|
||||||
// Send the entire array to the vcard class in function.
|
// Send the entire array to the vcard class in function.
|
||||||
// It will parse the vcard fields and clean the array of extra
|
// It will parse the vcard fields and clean the array of extra
|
||||||
// bogus values that get stuffed in.
|
// bogus values that get stuffed in.
|
||||||
$entry = $vcard->in($buffer[$i]);
|
$entry = $this->vcard->in($buffer[$i]);
|
||||||
// Now actually add the new entry
|
// Now actually add the new entry
|
||||||
$contacts->add($phpgw_info["user"]["account_id"],$entry);
|
$this->contacts->add($phpgw_info["user"]["account_id"],$entry);
|
||||||
}
|
}
|
||||||
$num = $i - 1;
|
$num = $i - 1;
|
||||||
return "Successfully imported $num records into your addressbook.";
|
return "Successfully imported $num records into your addressbook.";
|
||||||
|
Loading…
Reference in New Issue
Block a user