Class ilMailMemberSearchDataProvider.
More...
◆ __construct()
ilMailMemberSearchDataProvider::__construct |
( |
|
$objParticipants, |
|
|
|
$a_ref_id |
|
) |
| |
◆ buildRoleTitle()
ilMailMemberSearchDataProvider::buildRoleTitle |
( |
string |
$role | ) |
|
|
private |
◆ collectTableData()
ilMailMemberSearchDataProvider::collectTableData |
( |
| ) |
|
|
private |
Definition at line 61 of file class.ilMailMemberSearchDataProvider.php.
References $login, $title, $user, buildRoleTitle(), data, 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()) {
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;
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($roleId);
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($a_obj_id, $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.
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);
◆ $access
ilMailMemberSearchDataProvider::$access |
|
protected |
◆ $data
ilMailMemberSearchDataProvider::$data = [] |
|
protected |
◆ $dataCache
ilMailMemberSearchDataProvider::$dataCache |
|
protected |
◆ $lng
ilMailMemberSearchDataProvider::$lng |
|
protected |
◆ $objParticipants
ilMailMemberSearchDataProvider::$objParticipants = null |
|
protected |
◆ $ref_id
ilMailMemberSearchDataProvider::$ref_id |
|
protected |
◆ $roleSortWeightMap
ilMailMemberSearchDataProvider::$roleSortWeightMap |
|
protected |
◆ $type
ilMailMemberSearchDataProvider::$type = 'crs' |
|
protected |
The documentation for this class was generated from the following file: