provide call button on connections list if mobile|tablet and a phone number exists
This commit is contained in:
parent
f3ec818a66
commit
3d811a17fe
@ -230,9 +230,17 @@ class Connections extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
|
|
||||||
|
vcard_query($r);
|
||||||
|
|
||||||
|
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
if($rr['xchan_url']) {
|
if($rr['xchan_url']) {
|
||||||
|
|
||||||
|
if(($rr['vcard']) && is_array($rr['vcard']['tels']) && $rr['vcard']['tels'][0]['nr'])
|
||||||
|
$phone = ((\App::$is_mobile || \App::$is_tablet) ? $rr['vcard']['tels'][0]['nr'] : '');
|
||||||
|
else
|
||||||
|
$phone = '';
|
||||||
|
|
||||||
$status_str = '';
|
$status_str = '';
|
||||||
$status = array(
|
$status = array(
|
||||||
((intval($rr['abook_pending'])) ? t('Pending approval') : ''),
|
((intval($rr['abook_pending'])) ? t('Pending approval') : ''),
|
||||||
@ -267,6 +275,8 @@ class Connections extends \Zotlabs\Web\Controller {
|
|||||||
'network_label' => t('Network'),
|
'network_label' => t('Network'),
|
||||||
'network' => network_to_name($rr['xchan_network']),
|
'network' => network_to_name($rr['xchan_network']),
|
||||||
'public_forum' => ((intval($rr['xchan_pubforum'])) ? true : false),
|
'public_forum' => ((intval($rr['xchan_pubforum'])) ? true : false),
|
||||||
|
'call' => t('Call'),
|
||||||
|
'phone' => $phone,
|
||||||
'status_label' => t('Status'),
|
'status_label' => t('Status'),
|
||||||
'status' => $status_str,
|
'status' => $status_str,
|
||||||
'connected_label' => t('Connected'),
|
'connected_label' => t('Connected'),
|
||||||
|
@ -858,3 +858,33 @@ function vcard_translate_type($type) {
|
|||||||
return [$type, t('Other') . ' (' . $type . ')'];
|
return [$type, t('Other') . ' (' . $type . ')'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function vcard_query(&$r) {
|
||||||
|
|
||||||
|
$arr = [];
|
||||||
|
|
||||||
|
if($r && is_array($r) && count($r)) {
|
||||||
|
$uid = $r[0]['abook_channel'];
|
||||||
|
foreach($r as $rv) {
|
||||||
|
if($rv['abook_xchan'] && (! in_array("'" . dbesc($rv['abook_xchan']) . "'",$arr)))
|
||||||
|
$arr[] = "'" . dbesc($rv['abook_xchan']) . "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($arr) {
|
||||||
|
$a = q("select * from abconfig where chan = %d and xchan in (" . protect_sprintf(implode(',', $arr)) . ") and cat = 'system' and k = 'vcard'",
|
||||||
|
intval($uid)
|
||||||
|
);
|
||||||
|
if($a) {
|
||||||
|
foreach($a as $av) {
|
||||||
|
for($x = 0; $x < count($r); $x ++) {
|
||||||
|
if($r[$x]['abook_xchan'] == $av['xchan']) {
|
||||||
|
$vctmp = \Sabre\VObject\Reader::read($av['v']);
|
||||||
|
$r[$x]['vcard'] = (($vctmp) ? get_vcard_array($vctmp,$r[$x]['abook_id']) : [] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -33,3 +33,7 @@
|
|||||||
.contact-info-label {
|
.contact-info-label {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.connphone {
|
||||||
|
color: green;
|
||||||
|
}
|
@ -14,7 +14,7 @@
|
|||||||
</form>
|
</form>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<h3>{{if $contact.public_forum}}<i class="fa fa-comments-o"></i> {{/if}}<a href="{{$contact.url}}" title="{{$contact.img_hover}}" >{{$contact.name}}</a></h3>
|
<h3>{{if $contact.public_forum}}<i class="fa fa-comments-o"></i> {{/if}}<a href="{{$contact.url}}" title="{{$contact.img_hover}}" >{{$contact.name}}</a>{{if $contact.phone}} <a class="btn btn-default btn-xs" href="tel:{{$contact.phone}}" title="{{$contact.call}}"><i class="fa fa-phone connphone"></i></a>{{/if}}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="section-content-tools-wrapper">
|
<div class="section-content-tools-wrapper">
|
||||||
<div class="contact-photo-wrapper" >
|
<div class="contact-photo-wrapper" >
|
||||||
|
Reference in New Issue
Block a user