ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilUsersGalleryParticipants.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
25 {
28  protected array $users = [];
29 
30  public function __construct(ilParticipants $participants)
31  {
32  $this->participants = $participants;
33  }
34 
39  protected function getUsers(array $usr_ids): array
40  {
41  $users = [];
42 
43  foreach ($usr_ids as $usr_id) {
44  if (isset($this->users[$usr_id])) {
45  continue;
46  }
47 
48  if (!($user = ilObjectFactory::getInstanceByObjId($usr_id, false)) || !($user instanceof ilObjUser)) {
49  continue;
50  }
51 
52  if (!$user->getActive()) {
53  continue;
54  }
55 
56  $users[$user->getId()] = $user;
57  $this->users[$user->getId()] = true;
58  }
59 
60  return $users;
61  }
62 
63  public function getGroupedCollections(): array
64  {
66  global $DIC;
67 
68  $groups = [];
69 
70  foreach ([
71  [$this->participants->getContacts(), true, $DIC->language()->txt('crs_mem_contact')],
72  [$this->participants->getAdmins() , false, ''],
73  [$this->participants->getTutors() , false, ''],
74  [$this->participants->getMembers() , false, '']
75  ] as $users) {
76  $group = $this->getPopulatedGroup($this->getUsers($users[0]));
77  $group->setHighlighted($users[1]);
78  $group->setLabel($users[2]);
79  $groups[] = $group;
80  }
81 
82  return $groups;
83  }
84 }
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilParticipants $participants)
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.