ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilUsersGalleryUsers.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/classes/class.ilAbstractGalleryUsers.php';
4 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
9 {
13  protected function getSortedRelations()
14  {
15  $requested_for_me = ilBuddyList::getInstanceByGlobalUser()->getRequestRelationsForOwner()->toArray();
16  $linked = ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations()->toArray();
17  $requested_by_me = ilBuddyList::getInstanceByGlobalUser()->getRequestRelationsByOwner()->toArray();
18  $me_ignored = ilBuddyList::getInstanceByGlobalUser()->getIgnoredRelationsByOwner()->toArray();
19  $ignored = ilBuddyList::getInstanceByGlobalUser()->getIgnoredRelationsForOwner()->toArray();
20 
21  return array($requested_for_me, $linked, $requested_by_me + $me_ignored, $ignored);
22  }
23 
28  public function getGalleryUsers($ignore_myself = false)
29  {
33  global $ilUser;
34  $relations = $this->getSortedRelations();
35  $ordered_data = array();
36  foreach($relations as $sorted_relation)
37  {
38  $user_data = array();
39  foreach($sorted_relation as $key => $users)
40  {
44  if(!($user = ilObjectFactory::getInstanceByObjId($key, false)))
45  {
46  continue;
47  }
48  if(!$user->getActive())
49  {
50  continue;
51  }
52 
53  if($ignore_myself && $user->getId() == $ilUser->getId())
54  {
55  continue;
56  }
57 
58  $user_data[$user->getId()] = array(
59  'id' => $user->getId(),
60  'user' => $user
61  );
62  }
63  $user_data = $this->collectUserDetails($user_data);
64  $ordered_data = array_merge($ordered_data, ilUtil::sortArray($user_data, 'sort', 'asc'));
65  }
66  return $ordered_data;
67  }
68 
72  public function getUserCssClass()
73  {
74  return 'ilBuddySystemRemoveWhenUnlinked';
75  }
76 }
static getInstanceByGlobalUser()
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
$ilUser
Definition: imgupload.php:18
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
Class ilAbstractGalleryUsers.
Class ilUsersGalleryUsers.