public static function vcard($mailvars)
 {
     if (!is_array($mailvars)) {
         return false;
     }
     $default = array('firstname' => '', 'middlename' => '', 'lastname' => '', 'nickname' => '', 'title' => '', 'work_title' => '', 'email' => '', 'pobox' => '', 'extendedaddress' => '', 'street' => '', 'zipcode' => '', 'city' => '', 'state' => '', 'country' => '', 'work_pobox' => '', 'work_office' => '', 'work_street' => '', 'work_zipcode' => '', 'work_city' => '', 'work_state' => '', 'work_country' => '', 'birthday' => '', 'work_email' => '', 'work_telephone' => '', 'website' => '', 'telephone' => '', 'work_role' => '', 'note' => '', 'work_organization' => '');
     $vars = array_merge($default, $mailvars);
     $vcard = new Contact_Vcard_Build();
     // General informations
     $vcard->setFormattedName($vars['nom'] . ' ' . $vars['lastname']);
     $vcard->setName($vars['lastname'], $vars['firstname'], $vars['middlename'], $vars['title'], '');
     $vcard->setBirthday($vars['birthday']);
     $vcard->addNickname($vars['nickname']);
     $vcard->setNote($vars['note']);
     // Home informations
     $vcard->addEmail($vars['email']);
     $vcard->addParam('TYPE', 'HOME');
     $vcard->addTelephone($vars['telephone']);
     $vcard->addParam('TYPE', 'HOME');
     $vcard->addAddress($vars['pobox'], $vars['street'], $vars['extendedaddress'], $vars['city'], $vars['state'], $vars['zipcode'], $vars['country']);
     $vcard->addParam('TYPE', 'HOME');
     $vcard->setURL($vars['website']);
     $vcard->addParam('TYPE', 'HOME');
     // Business informations
     $vcard->addEmail($vars['work_email']);
     $vcard->addParam('TYPE', 'WORK');
     $vcard->addTelephone($vars['work_telephone']);
     $vcard->addParam('TYPE', 'WORK');
     $vcard->addAddress($vars['work_pobox'], $vars['work_office'], $vars['work_street'], $vars['work_city'], $vars['work_state'], $vars['work_zipcode'], $vars['work_country']);
     $vcard->addParam('TYPE', 'WORK');
     $vcard->addOrganization($vars['work_organization']);
     $vcard->setRole($vars['work_role']);
     $vcard->setTitle($vars['work_title']);
     return $vcard->fetch();
 }
Exemple #2
0
 // include PEAR vCard class
 require_once $AppUI->getLibraryClass('PEAR/Contact_Vcard_Build');
 // instantiate a builder object
 // (defaults to version 3.0)
 $vcard = new Contact_Vcard_Build();
 // set a formatted name
 $vcard->setFormattedName($contact->contact_first_name . ' ' . $contact->contact_last_name);
 // set the structured name parts
 $vcard->setName($contact->contact_last_name, $contact->contact_first_name, $contact->contact_type, $contact->contact_title, '');
 // set the source of the vCard
 $vcard->setSource($w2Pconfig['company_name'] . ' ' . $w2Pconfig['page_title'] . ': ' . $w2Pconfig['site_domain']);
 // set the birthday of the contact
 $vcard->setBirthday($contact->contact_birthday);
 // set a note of the contact
 $contact->contact_notes = mb_str_replace("\r", ' ', $contact->contact_notes);
 $vcard->setNote($contact->contact_notes);
 // add an organization
 $vcard->addOrganization($contact->company_name);
 // add dp company id
 $vcard->setUniqueID($contact->contact_company);
 // add a phone number
 $vcard->addTelephone($contact->contact_phone);
 $vcard->addParam('TYPE', 'PF');
 // add a phone number
 $vcard->addTelephone($contact->contact_phone2);
 // add a mobile phone number
 $vcard->addTelephone($contact->contact_mobile);
 $vcard->addParam('TYPE', 'car');
 // add a work email.  note that we add the value
 // first and the param after -- Contact_Vcard_Build
 // is smart enough to add the param in the correct
 /**
  * Gibt vCard Daten zurück. Statisch weil es auch von der Trl_Component
  * aufgerufen wird.
  */
 protected function _getVcardContent($dataRow, $imageData)
 {
     $defaults = $this->_getDefaultValues();
     require_once Kwf_Config::getValue('externLibraryPath.pearContactVcardBuild') . '/Contact/Vcard/Build.php';
     $vcard = new Contact_Vcard_Build('2.1');
     $vcard->setName(utf8_decode($dataRow->lastname), utf8_decode($dataRow->firstname), '', utf8_decode($dataRow->title), '');
     $vcard->addParam('CHARSET', 'ISO-8859-1');
     $vcard->setFormattedName(utf8_decode($dataRow->firstname) . ' ' . utf8_decode($dataRow->lastname));
     $vcard->addParam('CHARSET', 'ISO-8859-1');
     if (isset($defaults['ORG'])) {
         $vcard->addOrganization(utf8_decode($defaults['ORG']));
         $vcard->addParam('CHARSET', 'ISO-8859-1');
     }
     if (!empty($dataRow->working_position)) {
         $vcard->setRole(utf8_decode($dataRow->working_position));
         $vcard->addParam('CHARSET', 'ISO-8859-1');
     }
     if (!empty($dataRow->phone)) {
         $vcard->addTelephone(utf8_decode($dataRow->phone));
         $vcard->addParam('TYPE', 'WORK');
         $vcard->addParam('TYPE', 'PREF');
         $vcard->addParam('CHARSET', 'ISO-8859-1');
     }
     if (!empty($dataRow->mobile)) {
         $vcard->addTelephone(utf8_decode($dataRow->mobile), 'mobile');
         $vcard->addParam('TYPE', 'WORK');
         $vcard->addParam('CHARSET', 'ISO-8859-1');
     }
     $fax = null;
     if (!empty($dataRow->fax)) {
         $fax = $dataRow->fax;
     } else {
         if (isset($defaults['TEL;WORK;FAX'])) {
             $fax = $defaults['TEL;WORK;FAX'];
         }
     }
     if ($fax) {
         $vcard->addTelephone(utf8_decode($fax), 'fax');
         $vcard->addParam('TYPE', 'WORK');
         $vcard->addParam('CHARSET', 'ISO-8859-1');
     }
     if (!empty($dataRow->email)) {
         $vcard->addEmail(utf8_decode($dataRow->email));
         $vcard->addParam('TYPE', 'WORK');
         $vcard->addParam('CHARSET', 'ISO-8859-1');
     }
     if (isset($defaults['URL;WORK'])) {
         $vcard->setURL(utf8_decode($defaults['URL;WORK']));
         $vcard->addParam('TYPE', 'WORK');
         $vcard->addParam('CHARSET', 'ISO-8859-1');
     }
     if (isset($defaults['NOTE'])) {
         $vcard->setNote(utf8_decode($defaults['NOTE']));
         $vcard->addParam('CHARSET', 'ISO-8859-1');
     }
     if (isset($defaults['ADR;WORK']) || !empty($dataRow->street) || !empty($dataRow->city) || !empty($dataRow->zip) || !empty($dataRow->country)) {
         /**
          * muss ein array mit folgenden werten liefern:
          * 0 => ''
          * 1 => ''
          * 2 => street
          * 3 => city
          * 4 => province
          * 5 => zip
          * 6 => country
          */
         $values = array();
         if (!empty($defaults['ADR;WORK'])) {
             $values = explode(';', utf8_decode($defaults['ADR;WORK']));
         }
         for ($i = 0; $i <= 6; $i++) {
             if (!isset($values[$i])) {
                 $values[$i] = '';
             }
         }
         if (!empty($dataRow->street)) {
             $values[2] = utf8_decode($dataRow->street);
         }
         if (!empty($dataRow->city)) {
             $values[3] = utf8_decode($dataRow->city);
         }
         if (!empty($dataRow->country)) {
             $values[4] = utf8_decode($dataRow->country);
         }
         if (!empty($dataRow->zip)) {
             $values[5] = utf8_decode($dataRow->zip);
         }
         if (!empty($dataRow->country)) {
             $values[6] = utf8_decode($dataRow->country);
         }
         $vcard->addAddress($values[0], $values[1], $values[2], $values[3], $values[4], $values[5], $values[6]);
         $vcard->addParam('TYPE', 'WORK');
         $vcard->addParam('CHARSET', 'ISO-8859-1');
     }
     if ($imageData && $imageData->hasContent()) {
         $data = call_user_func_array(array($imageData->componentClass, 'getMediaOutput'), array($imageData->componentId, 'default', $imageData->componentClass));
         $type = explode('/', $data['mimeType']);
         $type[1] = strtoupper($type[1]);
         if ($type[1] == 'PJPEG') {
             $type[1] = 'JPEG';
         }
         if ($type[1] == 'JPEG') {
             $vcard->setPhoto(base64_encode($data['contents']));
             $vcard->addParam('TYPE', $type[1]);
             $vcard->addParam('ENCODING', 'BASE64');
         }
     }
     $vcard->setRevision(date('Y-m-d') . 'T' . date('H:i:s') . 'Z');
     return $vcard->fetch();
 }
 // include PEAR vCard class
 require_once $AppUI->getLibraryClass('PEAR/Contact_Vcard_Build');
 // instantiate a builder object
 // (defaults to version 3.0)
 $vcard = new Contact_Vcard_Build();
 // set a formatted name
 $vcard->setFormattedName($contacts[0]['contact_first_name'] . ' ' . $contacts[0]['contact_last_name']);
 // set the structured name parts
 $vcard->setName($contacts[0]['contact_last_name'], $contacts[0]['contact_first_name'], $contacts[0]['contact_type'], $contacts[0]['contact_title'], '');
 // set the source of the vCard
 $vcard->setSource($dPconfig['company_name'] . ' ' . $dPconfig['page_title'] . ': ' . $dPconfig['site_domain']);
 // set the birthday of the contact
 $vcard->setBirthday($contacts[0]['contact_birthday']);
 // set a note of the contact
 $contacts[0]['contact_notes'] = str_replace("\r", " ", $contacts[0]['contact_notes']);
 $vcard->setNote($contacts[0]['contact_notes']);
 // add an organization
 $vcard->addOrganization($contacts[0]['contact_company']);
 // add a phone number
 $vcard->addTelephone($contacts[0]['contact_phone']);
 $vcard->addParam('TYPE', 'PF');
 // add a phone number
 $vcard->addTelephone($contacts[0]['contact_phone2']);
 // add a mobile phone number
 $vcard->addTelephone($contacts[0]['contact_mobile']);
 $vcard->addParam('TYPE', 'car');
 // add a work email.  note that we add the value
 // first and the param after -- Contact_Vcard_Build
 // is smart enough to add the param in the correct
 // place.
 $vcard->addEmail($contacts[0]['contact_email']);
 // add a work email.  note that we add the value
 // first and the param after -- Contact_Vcard_Build
 // is smart enough to add the param in the correct place.
 if ($data["cp_email"]) {
     $vcard->addEmail($data["cp_email"]);
     $vcard->addParam('TYPE', 'WORK');
     $vcard->addParam('TYPE', 'PREF');
 }
 // add a work address
 $vcard->addAddress('', '', $data["cp_street"], $data["cp_city"], '', $data["cp_zipcode"], $data["cp_country"]);
 $vcard->addParam('TYPE', 'WORK');
 if ($data["cp_birthday"]) {
     $vcard->setBirthday($data["cp_birthday"]);
 }
 if ($data["cp_notes"]) {
     $vcard->setNote($data["cp_notes"]);
 }
 if ($data["cp_phone1"]) {
     $vcard->addTelephone($data["cp_phone1"]);
     $vcard->addParam('TYPE', 'WORK');
     $vcard->addParam('TYPE', 'PREF');
 }
 if ($data["cp_fax"]) {
     $vcard->addTelephone($data["cp_fax"]);
     $vcard->addParam('TYPE', 'FAX');
 }
 if ($data["cp_position"]) {
     $vcard->setTitle($data["cp_position"]);
 }
 if ($data["cp_cv_id"] && $data["tabelle"] == "C") {
     $fa = getFirmenStamm($data["cp_cv_id"]);