From 28dc08534bbf5b53f747bd0419d5259b5be60208 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 10 Jul 2009 10:50:10 +0200 Subject: [PATCH] Added QR Code export A contact can now be exported to a vcard encoded in a 2D barcode that can be scanned with a mobile phone. The feature was tested with QuickMark on the iPhone. --- inc/lang/en.php | 1 + inc/template.php | 16 ++++++++++++++++ pix/qrcode.png | Bin 0 -> 462 bytes styles/design.css | 5 +++++ templates/entry_show.tpl | 1 - templates/toolbar.tpl | 5 +++++ 6 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 pix/qrcode.png diff --git a/inc/lang/en.php b/inc/lang/en.php index ef06d76..edc9467 100644 --- a/inc/lang/en.php +++ b/inc/lang/en.php @@ -59,6 +59,7 @@ $lang['help'] = 'Help'; $lang['select'] = 'Select'; $lang['orgs'] = 'Companies'; $lang['upload'] = 'Upload'; +$lang['qrcode'] = 'QR Code'; $lang['publicbook'] = 'Public Addressbook'; $lang['privatebook'] = 'Private Addressbook'; diff --git a/inc/template.php b/inc/template.php index 81c0b93..6042c7b 100644 --- a/inc/template.php +++ b/inc/template.php @@ -76,6 +76,8 @@ function tpl_entry($in){ // join marker field to markers if(is_array($out['marker'])) $out['markers'] = join(', ',$out['marker']); + $out['qrcode'] = tpl_qrcode($out); + /* print '
';
 print_r($out);
@@ -85,6 +87,20 @@ print '
'; $smarty->assign('entry',$out); } +function tpl_qrcode($in){ + $data = "BEGIN:VCARD\n"; + $data .= "N:{$in['name']};{$in['givenname']}\n"; + if($in['mobile']) $data .= "TEL;CELL:{$in['mobile']}\n"; + if($in['phone']) $data .= "TEL;WORK:{$in['phone']}\n"; + if($in['homephone']) $data .= "TEL;HOME:{$in['homephone']}\n"; + if($in['mail'][0]) $data .= "EMAIL:{$in['mail'][0]}\n"; + $data .= "END:VCARD"; + $data = rawurlencode($data); + + return 'http://chart.apis.google.com/chart?cht=qr&chld=L|5&chs=500x500&chl='.$data.'&.png'; +} + + /** * assigns the last LDAP error to the template */ diff --git a/pix/qrcode.png b/pix/qrcode.png new file mode 100644 index 0000000000000000000000000000000000000000..26b6c4e0495a9bce6ac72b1d0a358c7c8e5818a9 GIT binary patch literal 462 zcmV;<0WtoGP)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXS- z2q*;yT+prn00B-(L_t(I%f*wiY63wJhQHI3BQ_S=3L@8}u+qXVtyt$?AWvbNXGs;V zyh2DTh=>-~Tsjd11*=pS^)kCD;$8OiQdwkRm|1rBpZ}kowY1jUVkK_0n*r?IZZ`rR z0hCf`tx-zlTtu$o*( z;=_sf^F(||cztpak+N-8^?e`D^YDEi0MGLPNRou-hdY#VGFbp3f}JkR3zxZwFquqp z%m#zO4}gf|7!;X^(C_!N>M3gxp;W}cl#w2s&1TH!a~6vQ%jNP{g2~_##02PeyO_n& zXU_mut5voU$1%s_F*gg2<4~*B{s!1=HthF%>h(IUR*P!2dew_4ide7LG@DI2oeoMV ztS}5C5xEx;dcB@ColbSp^rb!=4y_;v^jXfk_3yv&8 - {include file="footer.tpl"} diff --git a/templates/toolbar.tpl b/templates/toolbar.tpl index 014348d..743d268 100644 --- a/templates/toolbar.tpl +++ b/templates/toolbar.tpl @@ -45,6 +45,11 @@ {$lang.vcfexport} + +
  • + {$lang.qrcode} +
  • + {if $smarty.request.mode == 'map' && $conf.gmapkey}
  • -- 2.39.5