ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilUserUtil Class Reference

Class ilUserUtil. More...

+ Collaboration diagram for ilUserUtil:

Static Public Member Functions

static getNamePresentation ( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
 Default behaviour is: More...
 
static hasPublicProfile (int $a_user_id)
 
static getProfileLink (int $a_usr_id)
 Get link to personal profile Return empty string in case of not public profile. More...
 

Detailed Description

Class ilUserUtil.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilUserUtil.php.

Member Function Documentation

◆ getNamePresentation()

static ilUserUtil::getNamePresentation (   $a_user_id,
bool  $a_user_image = false,
bool  $a_profile_link = false,
string  $a_profile_back_link = '',
bool  $a_force_first_lastname = false,
bool  $a_omit_login = false,
bool  $a_sortable = true,
bool  $a_return_data_array = false,
  $a_ctrl_path = 'ilpublicuserprofilegui' 
)
static

Default behaviour is:

  • lastname, firstname if public profile enabled
  • [loginname] (always) modifications by jposselt at databay . de : if $a_user_id is an array of user ids the method returns an array of 'id' => 'NamePresentation' pairs.
    Parameters
    int|int[]$a_user_id
    string | array$a_ctrl_path
    Returns
    array|false|mixed
    Exceptions
    ilWACException

Definition at line 40 of file class.ilUserUtil.php.

References Vendor\Package\$d, $data, $DIC, $id, $ilDB, $lng, ilObjUser\_getPersonalPicturePath(), and ILIAS\Repository\int().

Referenced by ilSurveyAppraiseesTableGUI\__construct(), ilExcDeliveredFilesTableGUI\__construct(), ILIAS\Survey\Mode\AbstractUIModifier\addApprSelectionToToolbar(), ILIAS\Mail\Placeholder\MailSignatureUserFullnamePlaceholder\addPlaceholder(), ILIAS\Portfolio\Notification\SharedNotification\appendObjectInformation(), ILIAS\Test\Logging\AdditionalInformationGenerator\buildListOfUsers(), ilExSubmissionTeamGUI\buildSubmissionPropertiesAndActions(), ilMDCopyrightUsageTableGUI\collectData(), ilSystemNotification\compose(), ilGroupAddToGroupActionGUI\confirmAddUser(), ilSurveyParticipantsGUI\confirmAdminAppraiseesCloseObject(), ilGroupAddToGroupActionGUI\confirmCreateGroupAndAddUser(), ilBadgeManagementGUI\confirmDeassignBadge(), ilExerciseManagementGUI\confirmDeassignMembersObject(), ilSurveyParticipantsGUI\confirmDeleteAppraiseesObject(), ilMailingListsGUI\confirmDeleteMembers(), ilSurveyParticipantsGUI\confirmDeleteRatersObject(), ilConsultationHoursGUI\confirmRejectBooking(), ilCourseParticipantsGroupsGUI\confirmRemove(), ilExSubmissionTeamGUI\confirmRemoveTeamMemberObject(), ilExerciseManagementGUI\createTeamsFromGroupsObject(), ilContSkillAdminGUI\deassignCompetencesConfirm(), ILIAS\Survey\Execution\LaunchGUI\determineMainLink(), ilObjDataCollection\doUpdate(), ilSharedResourceGUI\executeCommand(), ilUserForTagTableGUI\fillRow(), ilHistoryTableGUI\fillRow(), ilPageHistoryTableGUI\fillRow(), ilWikiRecentChangesTableGUI\fillRow(), ilExAssignmentListTextTableGUI\fillRow(), ilWikiPagesTableGUI\fillRow(), ilWorkspaceShareTableGUI\fillRow(), ilBookingReservationsTableGUI\fillRow(), ILIAS\BackgroundTasks\Task\Job\Manager\UI\JobTable\formatResultInfo(), ILIAS\BackgroundTasks\Task\Job\Manager\UI\JobTable\formatStatusInfo(), ilExSubmissionTeamGUI\getAdoptForm(), ILIAS\Skill\Profile\SkillProfileManager\getAssignments(), ILIAS\Bibliographic\Field\Table\ProfileUserAssignmentTable\getAssignmentTitle(), ILIAS\OnScreenChat\Repository\Subscriber\getDataByUserIds(), ilPublicUserProfileGUI\getEmbeddable(), ilContributorTableGUI\getItems(), ilExAssignmentTeamTableGUI\getItems(), ilMessageGUI\getItemTitle(), ilNoteGUI\getItemTitle(), ilPageLinker\getLinkXML(), ilLMPageObjectGUI\getLinkXML(), ilLMPresentationLinker\getLinkXML(), ILIAS\Awareness\WidgetManager\getListData(), ILIAS\Test\Logging\TestAdministrationInteraction\getLogEntryAsDataTableRow(), ILIAS\Test\Logging\TestParticipantInteraction\getLogEntryAsDataTableRow(), ILIAS\Test\Logging\TestQuestionAdministrationInteraction\getLogEntryAsDataTableRow(), ILIAS\Test\Logging\TestScoringInteraction\getLogEntryAsDataTableRow(), ILIAS\Test\Logging\TestAdministrationInteraction\getLogEntryAsExportRow(), ILIAS\Test\Logging\TestQuestionAdministrationInteraction\getLogEntryAsExportRow(), ILIAS\Test\Logging\TestParticipantInteraction\getLogEntryAsExportRow(), ILIAS\Test\Logging\TestScoringInteraction\getLogEntryAsExportRow(), ilLearningModuleNotification\getMailBody(), ILIAS\Repository\Profile\ProfileGUI\getNamePresentation(), ilExSubmissionTeamGUI\getOverviewContent(), ilWikiPagesTableGUI\getPages(), ilExPeerReviewGUI\getPeerReviewReceiverPanel(), ilAbstractUsersGalleryCollectionProvider\getPopulatedGroup(), ilExPeerReviewGUI\getReceivedFeedbackPanel(), ilDclBaseRecordModel\getStandardFieldHTML(), ILIAS\Notifications\Provider\AwarenessToastProvider\getToasts(), ilAppointmentPresentationGUI\getUserName(), ilMailUserHelper\getUsernameMapForIds(), ilInternalLinkGUI\getUserSearchResult(), ilBlogPosting\handleNews(), ilWorkspaceAccessTableGUI\importData(), ilLearningProgressBaseGUI\initEditUserForm(), ilSurveyParticipantsGUI\initExternalRaterForm(), ilBuddySystemRelationsTableGUI\initFilter(), ilCalendarCategoryGUI\initFormCategory(), ilExerciseManagementGUI\initGroupForm(), ilExPeerReviewGUI\initPeerReviewItemForm(), ILIAS\Contact\MailingLists\MailingListsMembersTable\initRecords(), ilBookingPreferencesGUI\listBookingResults(), ilChatroomViewGUI\lostConnection(), ilSurveyExecutionGUI\outSurveyPage(), ilExAssignmentListTextTableGUI\parse(), ilConsultationHourBookingTableGUI\parse(), ilMailingListsGUI\performDeleteMembers(), ilWikiPageGUI\preview(), ilContSkillAdminGUI\publishAssignments(), ilNewsTimelineItemGUI\render(), ilLikeGUI\renderModal(), ilObjBlogGUI\renderNavigationByAuthors(), ilPublicUserProfileGUI\renderTitle(), ilMembershipCronNotifications\run(), ILIAS\Wiki\Notification\NotificationGUI\send(), ilLMMailNotification\send(), ilBuddySystemNotification\send(), ilObjSurvey\send360ReminderToUser(), ilWikiUtil\sendNotification(), ilObjSurvey\sendNotificationMail(), ILIAS\Notes\NotificationsManager\sendNotifications(), ilObjSurvey\sendRaterNotification(), ilMStShowUserGUI\setTitleAndIcon(), ilChatroomBanGUI\show(), ilPageObjectGUI\showEditLockInfo(), ilPageObjectGUI\showPage(), ilExAssignmentPeerReviewOverviewTableGUI\translateUserIds(), and ilPageObject\update().

50  {
51  global $DIC;
52  $lng = $DIC['lng'];
53  $ilCtrl = $DIC['ilCtrl'];
54  $ilDB = $DIC['ilDB'];
55 
56  if (!is_array($a_ctrl_path)) {
57  $a_ctrl_path = [$a_ctrl_path];
58  }
59 
60  if (!($return_as_array = is_array($a_user_id))) {
61  $a_user_id = [$a_user_id];
62  }
63 
64  $sql = 'SELECT
65  a.usr_id,
66  firstname,
67  lastname,
68  title,
69  login,
70  b.value public_profile,
71  c.value public_title
72  FROM
73  usr_data a
74  LEFT JOIN
75  usr_pref b ON
76  (a.usr_id = b.usr_id AND
77  b.keyword = %s)
78  LEFT JOIN
79  usr_pref c ON
80  (a.usr_id = c.usr_id AND
81  c.keyword = %s)
82  WHERE ' . $ilDB->in('a.usr_id', $a_user_id, false, 'integer');
83 
84  $userrow = $ilDB->queryF($sql, ['text', 'text'], ['public_profile', 'public_title']);
85 
86  $names = [];
87 
88  $data = [];
89  while ($row = $ilDB->fetchObject($userrow)) {
90  $pres = '';
91  $d = [
92  'id' => (int) $row->usr_id,
93  'title' => '',
94  'lastname' => '',
95  'firstname' => '',
96  'img' => '',
97  'link' => ''
98  ];
99  $has_public_profile = in_array($row->public_profile, ['y', 'g']);
100  if ($a_force_first_lastname || $has_public_profile) {
101  $title = '';
102  if ($row->public_title == 'y' && $row->title) {
103  $title = $row->title . ' ';
104  }
105  $d['title'] = $title;
106  if ($a_sortable) {
107  $pres = $row->lastname;
108  if (strlen($row->firstname)) {
109  $pres .= (', ' . $row->firstname . ' ');
110  }
111  } else {
112  $pres = $title;
113  if (strlen($row->firstname)) {
114  $pres .= $row->firstname . ' ';
115  }
116  $pres .= ($row->lastname . ' ');
117  }
118  $d['firstname'] = $row->firstname;
119  $d['lastname'] = $row->lastname;
120  }
121  $d['login'] = $row->login;
122  $d['public_profile'] = $has_public_profile;
123 
124 
125  if (!$a_omit_login) {
126  $pres .= '[' . $row->login . ']';
127  }
128 
129  if ($a_profile_link && $has_public_profile) {
130  $ilCtrl->setParameterByClass(end($a_ctrl_path), 'user_id', $row->usr_id);
131  if ($a_profile_back_link != '') {
132  $ilCtrl->setParameterByClass(
133  end($a_ctrl_path),
134  'back_url',
135  rawurlencode($a_profile_back_link)
136  );
137  }
138  $link = $ilCtrl->getLinkTargetByClass($a_ctrl_path, 'getHTML');
139  $pres = '<a href="' . $link . '">' . $pres . '</a>';
140  $d['link'] = $link;
141  }
142 
143  if ($a_user_image) {
144  $img = ilObjUser::_getPersonalPicturePath($row->usr_id, 'xxsmall');
145  $pres = '<img class="ilUserXXSmall" src="' . $img . '" alt="' . $lng->txt('icon') .
146  ' ' . $lng->txt('user_picture') . '" /> ' . $pres;
147  $d['img'] = $img;
148  }
149 
150  $names[$row->usr_id] = $pres;
151  $data[$row->usr_id] = $d;
152  }
153 
154  foreach ($a_user_id as $id) {
155  if (!isset($names[$id])) {
156  $names[$id] = $lng->txt('deleted_user');
157  }
158  if ($names[$id] === '') {
159  $names[$id] = $lng->txt('usr_name_undisclosed');
160  }
161  }
162 
163  if ($a_return_data_array) {
164  if ($return_as_array) {
165  return $data;
166  } else {
167  return current($data);
168  }
169  }
170  return $return_as_array ? $names : $names[$a_user_id[0]];
171  }
global $DIC
Definition: shib_login.php:22
static _getPersonalPicturePath(int $a_usr_id, string $a_size='small', bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProfileLink()

static ilUserUtil::getProfileLink ( int  $a_usr_id)
static

Get link to personal profile Return empty string in case of not public profile.

Definition at line 193 of file class.ilUserUtil.php.

References $DIC, ilObjUser\_lookupPref(), and ilUserStartingPointRepository\getValidAndAccessibleStartingPointAsUrl().

Referenced by ilMDCopyrightUsageTableGUI\collectData(), ilRepositoryUserResultTableGUI\fillRow(), and ILIAS\Calendar\ConsultationHours\BookingDataProvider\read().

193  : string
194  {
195  global $DIC;
196  $ctrl = $DIC['ilCtrl'];
197 
198  $public_profile = ilObjUser::_lookupPref($a_usr_id, 'public_profile');
199  if ($public_profile != 'y' and $public_profile != 'g') {
200  return '';
201  }
202 
203  $ctrl->setParameterByClass('ilpublicuserprofilegui', 'user', $a_usr_id);
204  return $ctrl->getLinkTargetByClass('ilpublicuserprofilegui', 'getHTML');
205  }
static _lookupPref(int $a_usr_id, string $a_keyword)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPublicProfile()

static ilUserUtil::hasPublicProfile ( int  $a_user_id)
static

Definition at line 173 of file class.ilUserUtil.php.

References $DIC, and $ilDB.

Referenced by ilPageLinker\getLinkXML(), ilLMPageObjectGUI\getLinkXML(), and ilLMPresentationLinker\getLinkXML().

173  : bool
174  {
175  global $DIC;
176  $ilDB = $DIC['ilDB'];
177 
178  $set = $ilDB->query(
179  'SELECT value FROM usr_pref ' .
180  ' WHERE usr_id = ' . $ilDB->quote($a_user_id, 'integer') .
181  ' and keyword = ' . $ilDB->quote('public_profile', 'text')
182  );
183  $rec = $ilDB->fetchAssoc($set);
184 
185  return in_array($rec['value'] ?? '', ['y', 'g']);
186  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: