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(); $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) {
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'); $tpl = get_markup_template('common_friends.tpl');
foreach($r as $rr) { $o = replace_macros($tpl, [
$o .= replace_macros($tpl,array( '$title' => t('View Common Connections'),
'$url' => $rr['xchan_url'], '$items' => $items
'$name' => $rr['xchan_name'], ]);
'$photo' => $rr['xchan_photo_m'],
'$tags' => ''
));
}
$o .= cleardiv();
}
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}}]" /> </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> </a>
<div>
{{$item.name}}
</div> </div>
<div class="profile-match-break"></div>
<div class="profile-match-name">
<a href="{{$url}}" title="{{$name}}[{{$tags}}]">{{$name}}</a>
</div> </div>
{{if $note}} {{/foreach}}
<div class="profile-match-note">{{$note}}</div> </div>
{{/if}}
<div class="profile-match-end"></div>
</div> </div>