19declare(strict_types=1);
59 public function __construct($a_parent_obj, $a_parent_cmd, $a_admin_mode =
false, $a_type = self::TYPE_STANDARD)
63 $this->
profile = $DIC[
'user']->getProfile();
64 $this->
user = $DIC[
'user']->getLoggedInUser();
65 $this->review =
$DIC->rbac()->review();
66 $this->
ui = $DIC->ui();
67 $this->
http = $DIC->http();
70 $this->admin_mode = (bool) $a_admin_mode;
71 $this->type = $a_type;
73 $this->
setId(
"rep_search_" . $this->
user->getId());
83 if ($this->
getType() == self::TYPE_STANDARD) {
84 $this->
setRowTemplate(
"tpl.rep_search_usr_result_row.html",
"components/ILIAS/Search");
86 $this->
enable(
'select_all');
91 $this->
setRowTemplate(
"tpl.global_search_usr_result_row.html",
"components/ILIAS/Search");
99 if ($this->
getType() == self::TYPE_STANDARD) {
102 $this->
addColumn($all_cols[$col][
'txt'], $sort_field);
106 $this->
getType() != self::TYPE_STANDARD &&
120 $this->lucene_result =
$res;
130 $this->user_limitations = $a_limitations;
143 if (!self::$all_selectable_cols) {
146 if ($this->admin_mode) {
148 $columns[
'access_until'] = array(
'txt' => $this->
lng->txt(
'access_until'));
149 $columns[
'last_login'] = array(
'txt' => $this->
lng->txt(
'last_login'));
152 self::$all_selectable_cols = $columns;
159 if (!count($a_commands)) {
167 protected function fillRow(array $a_set): void
169 $this->tpl->setVariable(
"VAL_ID", $a_set[
"usr_id"]);
172 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
175 $this->tpl->setVariable(
'IMG_LINKED_TO_PROFILE', $link);
176 $this->tpl->setVariable(
177 'USR_IMG_SRC_LINKED',
181 $this->tpl->setVariable(
192 $a_set[
'gender'] = $a_set[
'gender'] ? $this->
lng->txt(
'gender_' . $a_set[
'gender']) :
'';
193 $this->tpl->setCurrentBlock(
'custom_fields');
194 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
195 $this->tpl->parseCurrentBlock();
200 $this->tpl->setCurrentBlock(
'custom_fields');
201 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
202 $this->tpl->parseCurrentBlock();
206 $this->tpl->setCurrentBlock(
'custom_fields');
207 $this->tpl->setVariable(
'CUST_CLASS',
' ' . $a_set[
'access_class']);
208 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
209 $this->tpl->parseCurrentBlock();
214 $this->tpl->setCurrentBlock(
'custom_fields');
215 $this->tpl->setVariable(
'VAL_CUST', $a_set[$field]);
216 $this->tpl->parseCurrentBlock();
219 case 'interests_general':
220 case 'interests_help_offered':
221 case 'interests_help_looking':
222 $this->tpl->setCurrentBlock(
'custom_fields');
223 $this->tpl->setVariable(
'VAL_CUST', implode(
', ', (array) $a_set[$field]));
224 $this->tpl->parseCurrentBlock();
228 $this->tpl->setCurrentBlock(
'custom_fields');
229 $this->tpl->setVariable(
231 ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits((
int) $a_set[
'usr_id'])
233 $this->tpl->parseCurrentBlock();
238 if ($this->admin_mode) {
239 $this->
ctrl->setParameterByClass(
"ilobjusergui",
"ref_id",
"7");
240 $this->
ctrl->setParameterByClass(
"ilobjusergui",
"obj_id", $a_set[
"usr_id"]);
241 $this->
ctrl->setParameterByClass(
"ilobjusergui",
"search",
"1");
242 $link = $this->
ctrl->getLinkTargetByClass(array(
"iladministrationgui",
"ilobjusergui"),
"view");
243 $a_set[$field] =
"<a href=\"" . $link .
"\">" . $a_set[$field] .
"</a>";
244 } elseif ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
245 $a_set[$field] =
"<a href=\"" . $link .
"\">" . $a_set[$field] .
"</a>";
251 $this->tpl->setCurrentBlock(
'custom_fields');
252 $this->tpl->setVariable(
'VAL_CUST', (
string) ($a_set[$field] ?:
''));
253 $this->tpl->parseCurrentBlock();
258 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
262 $this->tpl->setVariable(
'CONTACT_ACTIONS',
'');
276 $parse_access =
false;
277 if (isset($additional_fields[
'access_until'])) {
278 $parse_access =
true;
279 unset($additional_fields[
'access_until']);
282 $udf_ids = $usr_data_fields = $odf_ids = array();
283 foreach ($additional_fields as $field) {
284 if ($field ==
'org_units') {
287 if (substr($field, 0, 3) ==
'udf') {
288 $udf_ids[] = substr($field, 4);
291 $usr_data_fields[] = $field;
295 $u_query->setOrderField(
'login');
296 $u_query->setOrderDirection(
'ASC');
297 $u_query->setLimit(999999);
300 $u_query->setActionFilter(
"active");
304 $u_query->setAccessFilter(
true);
307 $u_query->setAdditionalFields($usr_data_fields);
308 $u_query->setUserFilter($a_user_ids);
310 $usr_data = $u_query->query();
313 if ($this->admin_mode && $parse_access) {
315 $current_time = time();
316 foreach ($usr_data[
'set'] as $k =>
$user) {
317 if (
$user[
'active']) {
318 if (
$user[
"time_limit_unlimited"]) {
319 $txt_access = $this->
lng->txt(
"access_unlimited");
320 $usr_data[
"set"][$k][
"access_class"] =
"smallgreen";
321 } elseif (
$user[
"time_limit_until"] < $current_time) {
322 $txt_access = $this->
lng->txt(
"access_expired");
323 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
326 $usr_data[
"set"][$k][
"access_class"] =
"small";
329 $txt_access = $this->
lng->txt(
"inactive");
330 $usr_data[
"set"][$k][
"access_class"] =
"smallred";
332 $usr_data[
"set"][$k][
"access_until"] = $txt_access;
340 foreach ($usr_data[
'set'] as $set) {
342 if ((
int) ($set[
'usr_id'] ?? 0) === 0) {
345 $data = $this->
profile->getDataFor((
int) $set[
'usr_id']);
346 foreach ($udf_ids as $udf_field) {
347 $users[
$counter][
'udf_' . $udf_field] =
$data->getAdditionalFieldByIdentifier($udf_field);
352 $users = $usr_data[
'set'];
355 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
357 foreach ($users as
$counter => $ud) {
362 if ($this->
getType() === self::TYPE_GLOBAL_SEARCH) {
371 $html = parent::getHTML();
372 if ($this->
getType() == self::TYPE_GLOBAL_SEARCH) {
382 if ($sort ===
'relevance') {
383 usort($set,
function (
$a,
$b) {
384 return $b[
'relevance'] <=>
$a[
'relevance'];
389 if (str_ends_with($sort,
'_asc')) {
390 $col = substr($sort, 0, -4);
391 usort($set,
function (
$a,
$b) use ($col) {
392 return [
$a[$col],
$b[
'relevance'] ??
''] <=> [
$b[$col],
$a[
'relevance'] ??
''];
394 } elseif (str_ends_with($sort,
'_desc')) {
395 $col = substr($sort, 0, -5);
396 usort($set,
function (
$a,
$b) use ($col) {
397 return [
$b[$col],
$b[
'relevance'] ??
''] <=> [
$a[$col],
$a[
'relevance'] ??
''];
406 $sorts = [
'relevance' => $this->
lng->txt(
'search_sort_relevance')];
409 $sorts[$col .
'_asc'] = sprintf(
410 $this->
lng->txt(
'search_sort_generic_asc'),
411 $all_cols[$col][
'txt']
413 $sorts[$col .
'_desc'] = sprintf(
414 $this->
lng->txt(
'search_sort_generic_desc'),
415 $all_cols[$col][
'txt']
425 return $lucene_enabled ?
'relevance' :
'login_asc';
Provides fluid interface to RBAC services.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
Search result implementing iterator interface.
static _getPersonalPicturePath(int $a_usr_id, string $a_size='small', bool $a_force_pic=false)
class ilRbacReview Contains Review functions of core Rbac.
TableGUI class user search results.
ilLuceneSearchResult $lucene_result
setLuceneResult(ilLuceneSearchResult $res)
fillRow(array $a_set)
Standard Version of Fill Row.
static array $all_selectable_cols
parseUserIds(array $a_user_ids)
__construct($a_parent_obj, $a_parent_cmd, $a_admin_mode=false, $a_type=self::TYPE_STANDARD)
initMultiCommands(array $a_commands)
applySortation(array $set)
setUserLimitations(bool $a_limitations)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setEnableTitle(bool $a_enabletitle)
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setExternalSorting(bool $a_val)
addMultiItemSelectionButton(string $a_sel_var, array $a_options, string $a_cmd, string $a_text, string $a_default_selection='')
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
enable(string $a_module_name)
static getSelectableColumnInfo(bool $a_admin=false)
Get info of searchable fields for selectable columns in table gui.
static getProfileLink(int $a_usr_id)
Get link to personal profile Return empty string in case of not public profile.
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
buildSortationViewControl()
trait ilSearchResultTableHelper