ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ContSkillMemberRetrieval.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use ILIAS\Repository\RetrievalBase;
27
29{
30 use RetrievalBase;
31
32 public function __construct(
33 protected ContainerSkillManager $cont_skill_manager,
34 protected \ilContainer $container
35 ) {
36 }
37
38 public function getData(
39 array $fields,
40 ?Range $range = null,
41 ?Order $order = null,
42 array $filter = [],
43 array $parameters = []
44 ): \Generator {
45 $participants = \ilCourseParticipants::getInstanceByObjId($this->container->getId());
46 $members = $participants->getMembers();
47
48 $member_data = [];
49 foreach ($members as $member_id) {
50 $name = \ilObjUser::_lookupName($member_id);
51 $login = \ilObjUser::_lookupLogin($member_id);
52
53 $member_data[] = [
54 "id" => $member_id,
55 "name" => $name["lastname"] . ", " . $name["firstname"],
56 "login" => $login,
57 "published" => $this->cont_skill_manager->getPublished($member_id),
58 "skills" => $this->cont_skill_manager->getMemberSkillLevelsForContainerOrdered($member_id)
59 ];
60 }
61
62 // Apply ordering and range
63 $member_data = $this->applyOrder($member_data, $order);
64 $member_data = $this->applyRange($member_data, $range);
65
66 foreach ($member_data as $member) {
67 yield $member;
68 }
69 }
70
71 public function count(
72 array $filter,
73 array $parameters
74 ): int {
75 $participants = \ilCourseParticipants::getInstanceByObjId($this->container->getId());
76 return count($participants->getMembers());
77 }
78
79 public function isFieldNumeric(string $field): bool
80 {
81 return in_array($field, ["id"]);
82 }
83}
__construct(protected ContainerSkillManager $cont_skill_manager, protected \ilContainer $container)
getData(array $fields, ?Range $range=null, ?Order $order=null, array $filter=[], array $parameters=[])
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:29
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:29
Class ilContainer.
static _lookupName(int $a_user_id)
static _lookupLogin(int $a_user_id)
getMembers()
Get all members ids (admins and tutors are not members) Use get participants to fetch all.
$container
@noRector
Definition: wac.php:37