turn common friends into a widget
This commit is contained in:
parent
bced63e823
commit
72a19a14af
@ -123,7 +123,7 @@ class Channel extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
//$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']);
|
//$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']);
|
||||||
|
|
||||||
$o .= common_friends_visitor_widget(\App::$profile['profile_uid']);
|
// $o .= common_friends_visitor_widget(\App::$profile['profile_uid']);
|
||||||
|
|
||||||
if($channel && $is_owner) {
|
if($channel && $is_owner) {
|
||||||
$channel_acl = array(
|
$channel_acl = array(
|
||||||
|
19
Zotlabs/Widget/Common_friends.php
Normal file
19
Zotlabs/Widget/Common_friends.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Zotlabs\Widget;
|
||||||
|
|
||||||
|
require_once('include/contact_widgets.php');
|
||||||
|
|
||||||
|
class Common_friends {
|
||||||
|
|
||||||
|
function widget($arr) {
|
||||||
|
|
||||||
|
if((! \App::$profile['profile_uid'])
|
||||||
|
|| (! perm_is_allowed(\App::$profile['profile_uid'],get_observer_hash(),'view_contacts'))) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return common_friends_visitor_widget(\App::$profile['profile_uid']);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -143,7 +143,7 @@ function cardcategories_widget($baseurl,$selected = '') {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function common_friends_visitor_widget($profile_uid) {
|
function common_friends_visitor_widget($profile_uid,$cnt = 10) {
|
||||||
|
|
||||||
if(local_channel() == $profile_uid)
|
if(local_channel() == $profile_uid)
|
||||||
return;
|
return;
|
||||||
@ -156,17 +156,18 @@ function common_friends_visitor_widget($profile_uid) {
|
|||||||
require_once('include/socgraph.php');
|
require_once('include/socgraph.php');
|
||||||
|
|
||||||
$t = count_common_friends($profile_uid,$observer_hash);
|
$t = count_common_friends($profile_uid,$observer_hash);
|
||||||
|
|
||||||
if(! $t)
|
if(! $t)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$r = common_friends($profile_uid,$observer_hash,0,5,true);
|
$r = common_friends($profile_uid,$observer_hash,0,$cnt,true);
|
||||||
|
|
||||||
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
|
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
|
||||||
'$desc' => sprintf( tt("%d connection in common", "%d connections in common", $t), $t),
|
'$desc' => sprintf( t('Common connections: %d'), $t),
|
||||||
'$base' => z_root(),
|
'$base' => z_root(),
|
||||||
'$uid' => $profile_uid,
|
'$uid' => $profile_uid,
|
||||||
'$cid' => $observer,
|
'$cid' => $observer,
|
||||||
'$linkmore' => (($t > 5) ? 'true' : ''),
|
'$linkmore' => (($t > $cnt) ? 'true' : ''),
|
||||||
'$more' => t('show more'),
|
'$more' => t('show more'),
|
||||||
'$items' => $r
|
'$items' => $r
|
||||||
));
|
));
|
||||||
|
@ -7,4 +7,7 @@
|
|||||||
[widget=categories][/widget]
|
[widget=categories][/widget]
|
||||||
[widget=tagcloud_wall][var=limit]24[/var][/widget]
|
[widget=tagcloud_wall][var=limit]24[/var][/widget]
|
||||||
[/region]
|
[/region]
|
||||||
|
[region=content]
|
||||||
|
[widget=common_friends][/widget]
|
||||||
|
[/region]
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="profile-match-wrapper">
|
<div class="generic-content-wrapper">
|
||||||
<div class="profile-match-photo">
|
<div class="profile-match-photo">
|
||||||
<a href="{{$url}}">
|
<a href="{{$url}}">
|
||||||
<img src="{{$photo}}" alt="{{$name}}" width="80" height="80" title="{{$name}} [{{$url}}]" />
|
<img src="{{$photo}}" alt="{{$name}}" width="80" height="80" title="{{$name}} [{{$url}}]" />
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<div id="remote-friends-in-common" class="bigwidget">
|
<div class="widget">
|
||||||
<div id="rfic-desc">{{$desc}} {{if $linkmore}}<a href="{{$base}}/common/{{$uid}}">{{$more}}</a>{{/if}}</div>
|
<div class="panel">
|
||||||
|
<div class="section-subtitle-wrapper" role="tab" id="common-friends-visitor">
|
||||||
|
<h3><a data-toggle="collapse" href="#common-friends-collapse">{{$desc}}</a></h3>
|
||||||
|
</div>
|
||||||
|
<div id="common-friends-collapse" class="collapse" role="tabpanel" aria-labelledby="common-friends-visitor">
|
||||||
{{if $items}}
|
{{if $items}}
|
||||||
{{foreach $items as $item}}
|
{{foreach $items as $item}}
|
||||||
<div class="profile-match-wrapper">
|
<div class="profile-match-wrapper">
|
||||||
@ -17,5 +21,8 @@
|
|||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div id="rfic-end" class="clear"></div>
|
<div id="rfic-end" class="clear"></div>
|
||||||
|
{{if $linkmore}}<button class="btn btn-default"><a href="{{$base}}/common/{{$uid}}">{{$more}}</a></button>{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user