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

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

View File

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