vcard export from profile

This commit is contained in:
zotlabs 2017-01-15 21:23:43 -08:00
parent 0ef2cd8719
commit e5662dc893
3 changed files with 21 additions and 1 deletions

View File

@ -60,7 +60,9 @@ class Profile extends \Zotlabs\Web\Controller {
} }
$groups = array(); $groups = array();
$tab = 'profile'; $tab = 'profile';
$o = ''; $o = '';
@ -69,6 +71,15 @@ class Profile extends \Zotlabs\Web\Controller {
return; return;
} }
if(argc() > 2 && argv(2) === 'vcard') {
header('Content-type: text/vcard');
header('content-disposition: attachment; filename="' . t('vcard') . '-' . $profile['channel_address'] . '.vcf"' );
echo \App::$profile['profile_vcard'];
killme();
}
$is_owner = ((local_channel()) && (local_channel() == \App::$profile['profile_uid']) ? true : false); $is_owner = ((local_channel()) && (local_channel() == \App::$profile['profile_uid']) ? true : false);

View File

@ -1278,10 +1278,14 @@ function advanced_profile(&$a) {
// logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA); // logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA);
$exportlink = ((App::$profile['profile_vcard']) ? zid(z_root() . '/profile/' . App::$profile['channel_address'] . '/vcard') : '');
return replace_macros($tpl, array( return replace_macros($tpl, array(
'$title' => t('Profile'), '$title' => t('Profile'),
'$canlike' => (($profile['canlike'])? true : false), '$canlike' => (($profile['canlike'])? true : false),
'$likethis' => t('Like this thing'), '$likethis' => t('Like this thing'),
'$export' => t('Export'),
'$exportlink' => $exportlink,
'$profile' => $profile, '$profile' => $profile,
'$fields' => $clean_fields, '$fields' => $clean_fields,
'$editmenu' => profile_edit_menu(App::$profile['profile_uid']), '$editmenu' => profile_edit_menu(App::$profile['profile_uid']),

View File

@ -34,6 +34,11 @@
<a class="btn btn-primary btn-xs" href="{{$editmenu.edit.0}}" ><i class="fa fa-pencil"></i>&nbsp;{{$editmenu.edit.3}}</a> <a class="btn btn-primary btn-xs" href="{{$editmenu.edit.0}}" ><i class="fa fa-pencil"></i>&nbsp;{{$editmenu.edit.3}}</a>
</div> </div>
{{/if}} {{/if}}
{{if $exportlink}}
<div class="btn-group">
<a class="btn btn-default btn-xs" href="{{$exportlink}}" ><i class="fa fa-vcard"></i>&nbsp;{{$export}}</a>
</div>
{{/if}}
</div> </div>
<h2>{{$title}}</h2> <h2>{{$title}}</h2>
<div class="clear"></div> <div class="clear"></div>