]> git.mxchange.org Git - friendica.git/blob - mod/nogroup.php
Merge pull request #3906 from zeroadam/Global-Poco-#3878
[friendica.git] / mod / nogroup.php
1 <?php
2 /**
3  * @file mod/nogroup.php
4  */
5 use Friendica\App;
6 use Friendica\Database\DBM;
7
8 require_once 'include/Contact.php';
9 require_once 'include/contact_selectors.php';
10
11 function nogroup_init(App $a)
12 {
13         if (! local_user()) {
14                 return;
15         }
16
17         require_once 'include/group.php';
18         require_once 'include/contact_widgets.php';
19
20         if (! x($a->page, 'aside')) {
21                 $a->page['aside'] = '';
22         }
23
24         $a->page['aside'] .= group_side('contacts', 'group', 'extended', 0, $contact_id);
25 }
26
27 function nogroup_content(App $a)
28 {
29         if (! local_user()) {
30                 notice(t('Permission denied.') . EOL);
31                 return '';
32         }
33
34         require_once 'include/Contact.php';
35         $r = contacts_not_grouped(local_user());
36         if (DBM::is_result($r)) {
37                 $a->set_pager_total($r[0]['total']);
38         }
39         $r = contacts_not_grouped(local_user(), $a->pager['start'], $a->pager['itemspage']);
40         if (DBM::is_result($r)) {
41                 foreach ($r as $rr) {
42                         $contact_details = get_contact_details_by_url($rr['url'], local_user(), $rr);
43
44                         $contacts[] = array(
45                                 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $contact_details['name'], $rr['url']),
46                                 'edit_hover' => t('Edit contact'),
47                                 'photo_menu' => contact_photo_menu($rr),
48                                 'id' => $rr['id'],
49                                 'alt_text' => $alt_text,
50                                 'dir_icon' => $dir_icon,
51                                 'thumb' => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
52                                 'name' => $contact_details['name'],
53                                 'username' => $contact_details['name'],
54                                 'details'       => $contact_details['location'],
55                                 'tags'          => $contact_details['keywords'],
56                                 'about'         => $contact_details['about'],
57                                 'sparkle' => $sparkle,
58                                 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
59                                 'url' => $url,
60                                 'network' => network_to_name($rr['network'], $url),
61                         );
62                 }
63         }
64
65         $tpl = get_markup_template("nogroup-template.tpl");
66         $o .= replace_macros(
67                 $tpl,
68                 array(
69                 '$header' => t('Contacts who are not members of a group'),
70                 '$contacts' => $contacts,
71                 '$paginate' => paginate($a))
72         );
73
74         return $o;
75 }