streams/include/contact_widgets.php

137 lines
3.5 KiB
PHP
Raw Normal View History

2013-02-26 01:09:40 +00:00
<?php /** @file */
function follow_widget() {
return replace_macros(get_markup_template('follow.tpl'),array(
'$connect' => t('Add New Connection'),
'$desc' => t('Enter the channel address'),
'$hint' => t('Example: bob@example.com, http://example.com/barbara'),
'$follow' => t('Connect')
));
}
function findpeople_widget() {
2012-04-11 03:50:31 +00:00
require_once('include/Contact.php');
$a = get_app();
if(get_config('system','invitation_only')) {
$x = get_pconfig(local_user(),'system','invites_remaining');
if($x || is_site_admin()) {
$a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
. sprintf( tt('%d invitation available','%d invitations available',$x), $x)
. '</div>' . $inv;
}
}
return replace_macros(get_markup_template('peoplefind.tpl'),array(
2012-11-03 09:34:12 +00:00
'$findpeople' => t('Find Channels'),
'$desc' => t('Enter name or interest'),
'$label' => t('Connect/Follow'),
'$hint' => t('Examples: Robert Morgenstein, Fishing'),
'$findthem' => t('Find'),
2012-11-03 09:34:12 +00:00
'$suggest' => t('Channel Suggestions'),
'$similar' => t('Similar Interests'),
2012-04-11 03:50:31 +00:00
'$random' => t('Random Profile'),
'$inv' => t('Invite Friends')
));
}
2011-11-02 04:27:11 +00:00
function fileas_widget($baseurl,$selected = '') {
$a = get_app();
2012-07-10 05:08:25 +00:00
if(! local_user())
return '';
$terms = array();
2012-07-10 05:08:25 +00:00
$r = q("select distinct(term) from term where uid = %d and type = %d order by term asc",
intval(local_user()),
intval(TERM_FILE)
);
2012-11-03 13:32:27 +00:00
if(! $r)
return;
foreach($r as $rr)
2012-07-10 05:08:25 +00:00
$terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
return replace_macros(get_markup_template('fileas_widget.tpl'),array(
2012-03-30 09:42:36 +00:00
'$title' => t('Saved Folders'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('Everything'),
'$terms' => $terms,
'$base' => $baseurl,
));
}
2012-01-06 04:40:48 +00:00
function categories_widget($baseurl,$selected = '') {
$a = get_app();
2012-11-04 04:52:58 +00:00
if(! feature_enabled($a->profile['profile_uid'],'categories'))
2012-11-03 23:51:29 +00:00
return '';
$terms = array();
$r = q("select distinct(term.term)
from term join item on term.oid = item.id
where item.uid = %d
and term.uid = item.uid
and term.type = %d
and item.author_xchan = '%s'
order by term.term asc",
2012-07-10 05:08:25 +00:00
intval($a->profile['profile_uid']),
intval(TERM_CATEGORY),
$a->profile['channel_hash']
2012-07-10 05:08:25 +00:00
);
if($r && count($r)) {
2012-07-10 05:08:25 +00:00
foreach($r as $rr)
$terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
return replace_macros(get_markup_template('categories_widget.tpl'),array(
'$title' => t('Categories'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('Everything'),
'$terms' => $terms,
'$base' => $baseurl,
));
}
return '';
}
2012-05-02 02:16:18 +00:00
function common_friends_visitor_widget($profile_uid) {
$a = get_app();
if(local_user() == $profile_uid)
return;
$observer_hash = get_observer_hash();
2012-09-10 04:17:06 +00:00
if((! $observer_hash) || (! perm_is_allowed($profile_uid,$observer_hash,'view_contacts')))
return;
2012-05-02 02:16:18 +00:00
require_once('include/socgraph.php');
$t = count_common_friends($profile_uid,$observer_hash);
2012-05-02 02:16:18 +00:00
if(! $t)
return;
$r = common_friends($profile_uid,$observer_hash,0,5,true);
2012-05-02 02:16:18 +00:00
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
'$desc' => sprintf( tt("%d connection in common", "%d connections in common", $t), $t),
2012-05-04 08:46:36 +00:00
'$base' => $a->get_baseurl(),
'$uid' => $profile_uid,
'$cid' => $observer,
'$linkmore' => (($t > 5) ? 'true' : ''),
2012-05-04 08:46:36 +00:00
'$more' => t('show more'),
2012-05-02 02:20:41 +00:00
'$items' => $r
2012-05-02 02:16:18 +00:00
));
};