Members: 16,996
Threads: 38,845
Posts: 159,389
Online: 16

Newest Member: Kl_broka@rediffmail.com


Odoo.tv - Outdoor Television


Sedo - Domains kaufen und verkaufen das Projekt mambers.com steht zum Verkauf Besucherstatistiken von mambers.com etracker® Web-Controlling statt Logfile-Analyse
Old 27.06.2004, 01:26   #1 (permalink)
Expert Mamber
 
pflegeonline's Avatar
 
Join Date: Apr 2004
Location: Schladming/Graz
Posts: 414
pflegeonline is on a distinguished road
Default AkoStaff vCard-possibility

Hi @ all.
I've found a possibility for generating vCard (*.vcf) with AkoStaff
First I've put a few more Fields to the mos_akostaff:

  • $MiddleName
  • $LastName
  • $EducationTitle
  • $Addon
  • $Company
  • $Organisation
  • $Department
  • $tel2
  • $HomeStreet
  • $HomeZip
  • $HomeCity
  • $HomeRegion
  • $HomeCountry


Now to the Sourcecode. The File (e.g. vcard.php) has to be put in teh root-dir because when you use SEF-urls it's not possible to reach the file. In the code itself nothing has to be changed. Following url is needed to call the file vcard.php out of akostaff.

www.mysite.com/vcard.php?staffid=$row1->id

It's important to do this with the ?staffid=$row1->id because the vcard.php fetches the staffid to filter the right data out of the DB.

The Code:
PHP Code:
<?
/***************************************************************************

PHP vCard class v2.0
(c) Kai Blankenhorn modified for MOS akostaff by Stefan Gabardi
[url]www.bitfolge.de/en[/url]
[email]kaib@bitfolge.de[/email]


This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

***************************************************************************/


function encode($string) {
    return 
escape(quoted_printable_encode($string));
}

function 
escape($string) {
    return 
str_replace(";","\;",$string);
}

// taken from PHP documentation comments
function quoted_printable_encode($input$line_max 76) {
    
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
    
$lines preg_split("/(?:\r\n|\r|\n)/"$input);
    
$eol "\r\n";
    
$linebreak "=0D=0A";
    
$escape "=";
    
$output "";

    for (
$j=0;$j<count($lines);$j++) {
        
$line $lines[$j];
        
$linlen strlen($line);
        
$newline "";
        for(
$i 0$i $linlen$i++) {
            
$c substr($line$i1);
            
$dec ord($c);
            if ( (
$dec == 32) && ($i == ($linlen 1)) ) { // convert space at eol only
                
$c "=20"
            } elseif ( (
$dec == 61) || ($dec 32 ) || ($dec 126) ) { // always encode "\t", which is *not* required
                
$h2 floor($dec/16); $h1 floor($dec%16); 
                
$c $escape.$hex["$h2"].$hex["$h1"]; 
            }
            if ( (
strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
                
$output .= $newline.$escape.$eol// soft line break; " =\r\n" is okay
                
$newline "    ";
            }
            
$newline .= $c;
        } 
// end of for
        
$output .= $newline;
        if (
$j<count($lines)-1$output .= $linebreak;
    }
    return 
trim($output);
}

class 
vCard {
    var 
$properties;
    var 
$filename;
    
    function 
setPhoneNumber($number$type="") {
    
// type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE"
        
$key "TEL";
        if (
$type!=""$key .= ";".$type;
        
$key.= ";ENCODING=QUOTED-PRINTABLE";
        
$this->properties[$key] = quoted_printable_encode($number);
    }
    
    
// UNTESTED !!!
    
function setPhoto($type$photo) { // $type = "GIF" | "JPEG"
        
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
    }
    
    function 
setFormattedName($name) {
        
$this->properties["FN"] = quoted_printable_encode($name);
    }
    
    function 
setName($family=""$first=""$additional=""$prefix=""$suffix="") {
        
$this->properties["N"] = "$family;$first;$additional;$prefix;$suffix";
        
$this->filename "$first%20$family.vcf";
        if (
$this->properties["FN"]==""$this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
    }
    
    function 
setBirthday($date) { // $date format is YYYY-MM-DD
        
$this->properties["BDAY"] = $date;
    }
    
    function 
setAddress($postoffice=""$extended=""$street=""$city=""$region=""$zip=""$country=""$type="HOME;POSTAL") {
    
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
        
$key "ADR";
        if (
$type!=""$key.= ";$type";
        
$key.= ";ENCODING=QUOTED-PRINTABLE";
        
$this->properties[$key] = encode($name).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
        
        if (
$this->properties["LABEL;$type;ENCODING=QUOTED-PRINTABLE"] == "") {
            
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
        
}
    }
    
    function 
setLabel($postoffice=""$extended=""$street=""$city=""$region=""$zip=""$country=""$type="HOME;POSTAL") {
        
$label "";
        if (
$postoffice!=""$label.= "$postoffice\r\n";
        if (
$extended!=""$label.= "$extended\r\n";
        if (
$street!=""$label.= "$street\r\n";
        if (
$zip!=""$label.= "$zip ";
        if (
$city!=""$label.= "$city\r\n";
        if (
$region!=""$label.= "$region\r\n";
        if (
$country!=""$country.= "$country\r\n";
        
        
$this->properties["LABEL;$type;ENCODING=QUOTED-PRINTABLE"] = quoted_printable_encode($label);
    }
    
    function 
setEmail($address) {
        
$this->properties["EMAIL;INTERNET"] = $address;
    }
    
    function 
setNote($note) {
        
$this->properties["NOTE;ENCODING=QUOTED-PRINTABLE"] = quoted_printable_encode($note);
    }
    
    function 
setURL($url$type="") {
    
// $type may be WORK | HOME
        
$key "URL";
        if (
$type!=""$key.= ";$type";
        
$this->properties[$key] = $url;
    }
    
    function 
getVCard() {
        
$text "BEGIN:VCARD\r\n";
        
$text.= "VERSION:2.1\r\n";
        foreach(
$this->properties as $key => $value) {
            
$text.= "$key:$value\r\n";
        }
        
$text.= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
        
$text.= "MAILER:PHP vCard class by Kai Blankenhorn\r\n";
        
$text.= "END:VCARD\r\n";
        return 
$text;
    }
    
    function 
getFileName() {
        return 
$this->filename;
    }
}


//  USAGE EXAMPLE
include_once ('configuration.php');

$host $mosConfig_host;  
$username $mosConfig_user
$password $mosConfig_password
$data $mosConfig_db;
$db mysql_connect ($host$username$password);

parse_str($url["query"]);
$res mysql_db_query("$data""SELECT * FROM mos_akostaff WHERE id= '".$_GET['staffid']."'");
$num mysql_num_rows($res);
for (
$i=0$i<$num$i++)
{
  
$name mysql_result($res$i"name");
  
$MiddleName mysql_result($res$i"MiddleName");
  
$LastName mysql_result($res$i"LastName");
  
$EducationTitle mysql_result($res$i"EducationTitle");
  
$Addon mysql_result($res$i"Addon");
  
$Nick mysql_result($res$i"nick");
  
$Company mysql_result($res$i"Company");
  
$Organisation mysql_result($res$i"Organisation");
  
$Department mysql_result($res$i"Department");
  
$position mysql_result($res$i"position");
  
$bio mysql_result($res$i"biography");
  
$tel mysql_result($res$i"tel");
  
$tel1 mysql_result($res$i"tel2");
  
$fax mysql_result($res$i"fax");
  
$HomeStreet mysql_result($res$i"HomeStreet");
  
$HomeZip mysql_result($res$i"HomeZip");
  
$HomeCity mysql_result($res$i"HomeCity");
  
$HomeRegion mysql_result($res$i"HomeRegion");
  
$HomeCountry mysql_result($res$i"HomeCountry");
  
$website mysql_result($res$i"website");
  
$age mysql_result($res$i"age");
  
$email mysql_result($res$i"email");

$v = new vCard();

$v->setPhoneNumber("$tel""PREF;HOME;VOICE");
$v->setName("$LastName""$name""$MiddleName""$Addon");
$v->setBirthday("$age");
$v->setAddress("""""$HomeStreet""$HomeCity""$HomeRegion""$HomeZip""$HomeCountry");
$v->setEmail("$email");
$v->setNote("$bio");
$v->setURL("http://$website""WORK");
}
$output $v->getVCard();
$filename $v->getFileName();

Header("Content-Disposition: attachment; filename=$filename");
Header("Content-Length: ".strlen($output));
Header("Connection: close");
Header("Content-Type: text/x-vCard; name=$filename");

echo 
$output;
?>
Next month I'll release a complete hack of akostaff, because i didn't have the time now to put the additional fields in the backend for filling the additional fields in the db (Now I'm making that over phpMyadmin).
You can see an example at the following site:
http://pflegeonline.pflegenetzwerk.o...view&staffid=1 ansehen.

greetz
stefan
__________________
pflegeonline is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 27.06.2004, 02:30   #2 (permalink)
Professional Mamber
 
Join Date: Mar 2004
Posts: 802
jomaco1 is on a distinguished road
Default Re: AkoStaff vCard-possibility

Very cool!
__________________
Mark

Arthur...congrats on the rebuild! Hope it stays clean.

Click HERE to view signature. (If nothing happens at first...keep clicking)
jomaco1 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 27.06.2004, 02:35   #3 (permalink)
Expert Mamber
 
pflegeonline's Avatar
 
Join Date: Apr 2004
Location: Schladming/Graz
Posts: 414
pflegeonline is on a distinguished road
Default Re: AkoStaff vCard-possibility

Thx!
Took me a lot of time to do that, I've SEF-Urls enabled, and first I wantet to put the vcard.php in the com_akostaff - dir! And it didn't work - oh what a wonder!

greetz
stefan
__________________
pflegeonline is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 27.06.2004, 15:07   #4 (permalink)
Professional Mamber
 
eyezberg's Avatar
 
Join Date: Apr 2004
Location: Gap / France
Posts: 860
eyezberg is an unknown quantity at this point
Default Re: AkoStaff vCard-possibility

Klasse!
If only I had a use for AkoStaff..
__________________
joe / ex Mambo ex Doc Team
Eyezberg.com
eyezberg is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 27.06.2004, 15:10   #5 (permalink)
Expert Mamber
 
pflegeonline's Avatar
 
Join Date: Apr 2004
Location: Schladming/Graz
Posts: 414
pflegeonline is on a distinguished road
Default Re: AkoStaff vCard-possibility

Perhabs there will be someday!
Never stop hoping!

greetz
Stefan
__________________
pflegeonline is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AkoStaff problem with WYSIWYG editors gintas Component Development 3 14.02.2005 14:22
Akostaff vcf-support? pflegeonline Komponenten 12 21.07.2004 15:55
AkoStaff 2mal installieren Boomi Mambo 4.5 Allgemein 2 21.06.2004 20:14
problem with AkoStaff gama Mambo 4.5 'How Do I' Questions 1 06.06.2004 21:46
AkoStaff in mehreren Menus?? Sansibar Komponenten 0 27.05.2004 01:10


All times are GMT +2. The time now is 09:44.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
A vBSkinworks Design
© Copyright 2004-2008 by Arthur Konze Webdesign.