Class ilMailMemberSearchDataProvider.
More...
◆ __construct()
ilMailMemberSearchDataProvider::__construct |
( |
ilParticipants |
$objParticipants, |
|
|
int |
$a_ref_id |
|
) |
| |
◆ buildRoleTitle()
ilMailMemberSearchDataProvider::buildRoleTitle |
( |
string |
$role | ) |
|
|
private |
◆ collectTableData()
ilMailMemberSearchDataProvider::collectTableData |
( |
| ) |
|
|
private |
Definition at line 61 of file class.ilMailMemberSearchDataProvider.php.
References ILIAS\Repository\access(), buildRoleTitle(), ilObjectFactory\getInstanceByObjId(), and sortRoles().
Referenced by __construct().
63 $participants = $this->objParticipants->getParticipants();
64 if ($this->type ===
'crs' || $this->type ===
'grp') {
65 $participants = $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
73 $preloadedRoleIds = [];
74 foreach ($participants as $user_id) {
80 if (!$user->getActive()) {
84 $login = $user->getLogin();
87 if (in_array($user->getPref(
'public_profile'), [
'g',
'y'])) {
88 $publicName = $user->getLastname() .
', ' . $user->getFirstname();
91 $this->data[$user_id][
'user_id'] = $user_id;
92 $this->data[$user_id][
'login'] = $login;
93 $this->data[$user_id][
'name'] = $publicName;
95 $assignedRoles = $this->objParticipants->getAssignedRoles($user_id);
96 $rolesToPreload = array_diff($assignedRoles, $preloadedRoleIds);
97 $this->dataCache->preloadObjectCache($rolesToPreload);
100 foreach ($assignedRoles as $roleId) {
101 $preloadedRoleIds[$roleId] = $roleId;
102 $title = $this->dataCache->lookupTitle((
int) $roleId);
103 $roleTitles[] = $title;
106 $roleTitles = $this->
sortRoles($roleTitles);
108 $roleTitles = array_map(
function (
string $roleTitle):
string {
112 $this->data[$user_id][
'role'] = implode(
', ', $roleTitles);
buildRoleTitle(string $role)
sortRoles(array $roleTitles)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
◆ getData()
ilMailMemberSearchDataProvider::getData |
( |
| ) |
|
◆ sortRoles()
ilMailMemberSearchDataProvider::sortRoles |
( |
array |
$roleTitles | ) |
|
|
private |
- Parameters
-
- Returns
- string[]
Definition at line 120 of file class.ilMailMemberSearchDataProvider.php.
References Vendor\Package\$a, and Vendor\Package\$b.
Referenced by collectTableData().
122 usort($roleTitles,
function (
string $a,
string $b):
int {
123 $leftPrefixTitle = substr($a, 0, 8);
124 $rightPrefixTitle = substr($b, 0, 8);
126 $leftRating = $this->roleSortWeightMap[$leftPrefixTitle] ?? 0;
127 $rightRating = $this->roleSortWeightMap[$rightPrefixTitle] ?? 0;
129 if ($leftRating > 0 || $rightRating > 0) {
130 if ($leftRating !== $rightRating) {
131 return $rightRating - $leftRating > 0 ? 1 : -1;
137 return strcmp($a, $b);
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
◆ $access
◆ $data
array ilMailMemberSearchDataProvider::$data = [] |
|
protected |
◆ $dataCache
◆ $lng
array ilLanguage ilMailMemberSearchDataProvider::$lng |
|
protected |
◆ $objParticipants
◆ $ref_id
int ilMailMemberSearchDataProvider::$ref_id |
|
protected |
◆ $roleSortWeightMap
array ilMailMemberSearchDataProvider::$roleSortWeightMap |
|
protected |
◆ $type
string ilMailMemberSearchDataProvider::$type = 'crs' |
|
protected |
The documentation for this class was generated from the following file: