50 $this->dataCache = $DIC[
'ilObjDataCache'];
51 $this->access = $DIC->access();
53 $this->type = $this->objParticipants->getType();
54 $this->lng = $DIC[
'lng'];
56 $this->ref_id = $a_ref_id;
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);
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);
buildRoleTitle(string $role)
sortRoles(array $roleTitles)
__construct($objParticipants, $a_ref_id)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _getTranslation($a_role_title)
Class ilMailMemberSearchDataProvider.