]> git.mxchange.org Git - friendica.git/blob - include/contact_widgets.php
Merge pull request #63 from tomtom84/master
[friendica.git] / include / contact_widgets.php
1 <?php
2
3 function follow_widget() {
4
5         return replace_macros(get_markup_template('follow.tpl'),array(
6                 '$connect' => t('Add New Contact'),
7                 '$desc' => t('Enter address or web location'),
8                 '$hint' => t('Example: bob@example.com, http://example.com/barbara'),
9                 '$follow' => t('Connect')
10         ));
11
12 }
13
14 function findpeople_widget() {
15
16         $a = get_app();
17
18         $inv = (($a->config['register_policy'] != REGISTER_CLOSED) ? t('Invite Friends') : '');
19
20         if(get_config('system','invitation_only')) {
21                 $x = get_pconfig(local_user(),'system','invites_remaining');
22                 if($x || is_site_admin()) {
23                         $a->page['aside'] .= '<div class="side-link" id="side-invite-remain">' 
24                         . sprintf( tt('%d invitation available','%d invitations available',$x), $x) 
25                         . '</div>' . $inv;
26                 }
27         }
28  
29         return replace_macros(get_markup_template('peoplefind.tpl'),array(
30                 '$findpeople' => t('Find People'),
31                 '$desc' => t('Enter name or interest'),
32                 '$label' => t('Connect/Follow'),
33                 '$hint' => t('Examples: Robert Morgenstein, Fishing'),
34                 '$findthem' => t('Find'),
35                 '$suggest' => t('Friend Suggestions'),
36                 '$similar' => t('Similar Interests'),
37                 '$inv' => $inv
38         ));
39
40 }
41
42
43 function networks_widget($baseurl,$selected = '') {
44
45         $a = get_app();
46
47         if(! local_user())
48                 return '';
49
50         
51         $r = q("select distinct(network) from contact where uid = %d",
52                 intval(local_user())
53         );
54
55         $nets = array();
56         if(count($r)) {
57                 require_once('include/contact_selectors.php');
58                 foreach($r as $rr) {
59                                 if($rr['network'])
60                                         $nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
61                 }
62         }
63
64         if(count($nets) < 2)
65                 return '';
66
67         return replace_macros(get_markup_template('nets.tpl'),array(
68                 '$title' => t('Networks'),
69                 '$desc' => '',
70                 '$sel_all' => (($selected == '') ? 'selected' : ''),
71                 '$all' => t('All Networks'),
72                 '$nets' => $nets,
73                 '$base' => $baseurl,
74
75         ));
76 }
77
78