Class ilMailMemberSearchDataProvider.
More...
◆ __construct()
ilMailMemberSearchDataProvider::__construct |
( |
protected ilParticipants |
$objParticipants, |
|
|
protected int |
$ref_id |
|
) |
| |
◆ buildRoleTitle()
ilMailMemberSearchDataProvider::buildRoleTitle |
( |
string |
$role | ) |
|
|
private |
◆ collectTableData()
ilMailMemberSearchDataProvider::collectTableData |
( |
| ) |
|
|
private |
Definition at line 56 of file class.ilMailMemberSearchDataProvider.php.
References $user_id, ILIAS\Repository\access(), buildRoleTitle(), ilObjectFactory\getInstanceByObjId(), and sortRoles().
Referenced by __construct().
58 $participants = $this->objParticipants->getParticipants();
59 if ($this->type ===
'crs' || $this->type ===
'grp') {
60 $participants = $this->
access->filterUserIdsByRbacOrPositionOfCurrentUser(
68 $preloadedRoleIds = [];
69 foreach ($participants as
$user_id) {
75 if (!$user->getActive()) {
79 $login = $user->getLogin();
82 if (in_array($user->getPref(
'public_profile'), [
'g',
'y'])) {
83 $publicName = $user->getLastname() .
', ' . $user->getFirstname();
87 $this->data[
$user_id][
'login'] = $login;
88 $this->data[
$user_id][
'name'] = $publicName;
90 $assignedRoles = $this->objParticipants->getAssignedRoles($user_id);
91 $rolesToPreload = array_diff($assignedRoles, $preloadedRoleIds);
92 $this->dataCache->preloadObjectCache($rolesToPreload);
95 foreach ($assignedRoles as $roleId) {
96 $preloadedRoleIds[$roleId] = $roleId;
97 $title = $this->dataCache->lookupTitle((
int) $roleId);
98 $roleTitles[] = $title;
101 $roleTitles = $this->
sortRoles($roleTitles);
104 fn(
string $roleTitle):
string => $this->
buildRoleTitle($roleTitle),
108 $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 116 of file class.ilMailMemberSearchDataProvider.php.
References Vendor\Package\$a, and Vendor\Package\$b.
Referenced by collectTableData().
118 usort($roleTitles,
function (
string $a,
string $b):
int {
119 $leftPrefixTitle = substr($a, 0, 8);
120 $rightPrefixTitle = substr($b, 0, 8);
122 $leftRating = $this->roleSortWeightMap[$leftPrefixTitle] ?? 0;
123 $rightRating = $this->roleSortWeightMap[$rightPrefixTitle] ?? 0;
125 if ($leftRating > 0 || $rightRating > 0) {
126 if ($leftRating !== $rightRating) {
127 return $rightRating - $leftRating > 0 ? 1 : -1;
133 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 |
◆ $roleSortWeightMap
array ilMailMemberSearchDataProvider::$roleSortWeightMap |
|
protected |
◆ $type
string ilMailMemberSearchDataProvider::$type = 'crs' |
|
protected |
The documentation for this class was generated from the following file: