ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilUsersGalleryParticipants.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
25 {
27  protected array $users = [];
28 
29  public function __construct(protected ilParticipants $participants)
30  {
31  }
32 
37  protected function getUsers(array $usr_ids): array
38  {
39  $users = [];
40 
41  foreach ($usr_ids as $usr_id) {
42  if (isset($this->users[$usr_id])) {
43  continue;
44  }
45 
46  if (!($user = ilObjectFactory::getInstanceByObjId($usr_id, false)) || !($user instanceof ilObjUser)) {
47  continue;
48  }
49 
50  if (!$user->getActive()) {
51  continue;
52  }
53 
54  $users[$user->getId()] = $user;
55  $this->users[$user->getId()] = true;
56  }
57 
58  return $users;
59  }
60 
61  public function getGroupedCollections(): array
62  {
64  global $DIC;
65 
66  $groups = [];
67 
68  foreach ([
69  [$this->participants->getContacts(), true, $DIC->language()->txt('crs_mem_contact')],
70  [$this->participants->getAdmins() , false, ''],
71  [$this->participants->getTutors() , false, ''],
72  [$this->participants->getMembers() , false, '']
73  ] as $users) {
74  $group = $this->getPopulatedGroup($this->getUsers($users[0]));
75  $group->setHighlighted($users[1]);
76  $group->setLabel($users[2]);
77  $groups[] = $group;
78  }
79 
80  return $groups;
81  }
82 }
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Base class for course and group participants.
__construct(protected ilParticipants $participants)