ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilUsersGalleryParticipants.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
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}
User class.
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.
Class ilUsersGalleryParticipants.
__construct(protected ilParticipants $participants)
global $DIC
Definition: shib_login.php:26