some basic work on mod common

This commit is contained in:
Mario Vavti 2017-10-03 11:37:45 +02:00
parent 66511d8f07
commit fa93114804
2 changed files with 28 additions and 27 deletions

View File

@ -25,7 +25,7 @@ class Common extends \Zotlabs\Web\Controller {
} }
function get() { function get() {
$o = ''; $o = '';
@ -34,39 +34,38 @@ class Common extends \Zotlabs\Web\Controller {
$observer_hash = get_observer_hash(); $observer_hash = get_observer_hash();
if(! perm_is_allowed(\App::$profile['profile_uid'],$observer_hash,'view_contacts')) { if(! perm_is_allowed(\App::$profile['profile_uid'],$observer_hash,'view_contacts')) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return; return;
} }
$o .= '<h2>' . t('Common connections') . '</h2>';
$t = count_common_friends(\App::$profile['profile_uid'],$observer_hash); $t = count_common_friends(\App::$profile['profile_uid'],$observer_hash);
if(! $t) { if(! $t) {
notice( t('No connections in common.') . EOL); notice( t('No connections in common.') . EOL);
return $o; return;
} }
$r = common_friends(\App::$profile['profile_uid'],$observer_hash); $r = common_friends(\App::$profile['profile_uid'],$observer_hash);
if($r) { if($r) {
$tpl = get_markup_template('common_friends.tpl');
foreach($r as $rr) { foreach($r as $rr) {
$o .= replace_macros($tpl,array( $items[] = [
'$url' => $rr['xchan_url'], 'url' => $rr['xchan_url'],
'$name' => $rr['xchan_name'], 'name' => $rr['xchan_name'],
'$photo' => $rr['xchan_photo_m'], 'photo' => $rr['xchan_photo_m'],
'$tags' => '' 'tags' => ''
)); ];
} }
$o .= cleardiv();
} }
$tpl = get_markup_template('common_friends.tpl');
$o = replace_macros($tpl, [
'$title' => t('View Common Connections'),
'$items' => $items
]);
return $o; return $o;
} }

View File

@ -1,15 +1,17 @@
<div class="generic-content-wrapper"> <div class="generic-content-wrapper">
<div class="profile-match-photo"> <div class="section-title-wrapper">
<a href="{{$url}}"> <h2>{{$title}}</h2>
<img src="{{$photo}}" alt="{{$name}}" width="80" height="80" title="{{$name}} [{{$url}}]" />
</a>
</div> </div>
<div class="profile-match-break"></div> <div class="section-content-wrapper clearfix">
<div class="profile-match-name"> {{foreach $items as $item}}
<a href="{{$url}}" title="{{$name}}[{{$tags}}]">{{$name}}</a> <div class="float-left mr-4">
<a href="{{$item.url}}">
<img class="contact-block-img" src="{{$item.photo}}" alt="{{$item.name}}" title="{{$item.name}} [{{$item.url}}]" />
</a>
<div>
{{$item.name}}
</div>
</div>
{{/foreach}}
</div> </div>
{{if $note}}
<div class="profile-match-note">{{$note}}</div>
{{/if}}
<div class="profile-match-end"></div>
</div> </div>