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