1<?php
2/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Awareness/classes/class.ilAwarenessUserProvider.php';
5
6/**
7 * @author  Michael Jansen <mjansen@databay.de>
8 * @version $Id$
9 * @ingroup ServicesAwareness
10 */
11class ilAwarenessUserProviderContactRequests extends ilAwarenessUserProvider
12{
13    /**
14     * @var ilObjUser
15     */
16    protected $user;
17
18    /**
19     * ilAwarenessUserProviderApprovedContacts constructor.
20     */
21    public function __construct()
22    {
23        global $DIC;
24
25        parent::__construct();
26
27        $this->user = $DIC['ilUser'];
28    }
29
30    /**
31     * Get provider id
32     * @return string provider id
33     */
34    public function getProviderId()
35    {
36        return 'contact_approved';
37    }
38
39    /**
40     * Provider title (used in awareness overlay and in administration settings)
41     * @return string provider title
42     */
43    public function getTitle()
44    {
45        $this->lng->loadLanguageModule('contact');
46        return $this->lng->txt('contact_awrn_req_contacts');
47    }
48
49    /**
50     * Provider info (used in administration settings)
51     * @return string provider info text
52     */
53    public function getInfo()
54    {
55        $this->lng->loadLanguageModule('contact');
56        return $this->lng->txt('contact_awrn_req_contacts_info');
57    }
58
59    /**
60     * Get initial set of users
61     * @return array array of user IDs
62     */
63    public function getInitialUserSet()
64    {
65        if ($this->user->isAnonymous()) {
66            return array();
67        }
68
69        require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
70        if (!ilBuddySystem::getInstance()->isEnabled()) {
71            return array();
72        }
73
74        require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
75        $buddylist = ilBuddyList::getInstanceByGlobalUser();
76        return $buddylist->getRequestRelationsForOwner()->getKeys();
77    }
78
79    /**
80     * Is highlighted
81     *
82     * @return bool return true, if user group should be highlighted (using extra highlighted number)
83     */
84    public function isHighlighted()
85    {
86        return true;
87    }
88}
89