ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilUsersGalleryContacts.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once 'Services/User/Gallery/classes/class.ilAbstractUsersGalleryCollectionProvider.php';
4 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
5 
10 {
14  protected function getRelationSequence()
15  {
16  $requested_for_me = ilBuddyList::getInstanceByGlobalUser()->getRequestRelationsForOwner()->toArray();
17  $linked = ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()->toArray();
18  $requested_by_me = ilBuddyList::getInstanceByGlobalUser()->getRequestRelationsByOwner()->toArray();
19  $me_ignored = ilBuddyList::getInstanceByGlobalUser()->getIgnoredRelationsByOwner()->toArray();
20  $ignored = ilBuddyList::getInstanceByGlobalUser()->getIgnoredRelationsForOwner()->toArray();
21 
22  return [$requested_for_me, $linked, $requested_by_me + $me_ignored, $ignored];
23  }
24 
28  public function getGroupedCollections($ignore_myself = false)
29  {
30  global $DIC;
31 
32  $relations = $this->getRelationSequence();
33  $groups = [];
34 
35  foreach ($relations as $sorted_relation) {
36  $user_data = [];
37 
38  foreach ($sorted_relation as $usr_id => $users) {
40  if (!($user = ilObjectFactory::getInstanceByObjId($usr_id, false))) {
41  continue;
42  }
43 
44  if (!$user->getActive()) {
45  continue;
46  }
47 
48  if ($ignore_myself && $user->getId() == $DIC->user()->getId()) {
49  continue;
50  }
51 
52  $user_data[$user->getId()] = $user;
53  }
54 
55  $groups[] = $this->getPopulatedGroup($user_data);
56  }
57 
58  return $groups;
59  }
60 
64  public function hasRemovableUsers()
65  {
66  return true;
67  }
68 }
static getInstanceByGlobalUser()
global $DIC
Definition: saml.php:7
$user
Definition: migrateto20.php:57
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$users
Definition: authpage.php:44
Class ilUsersGalleryUsers.