ILIAS  release_8 Revision v8.24
ilRepositorySearchGUI Class Reference
+ Inheritance diagram for ilRepositorySearchGUI:
+ Collaboration diagram for ilRepositorySearchGUI:

Public Member Functions

 __construct ()
 
 addUserAccessFilterCallable (callable $user_filter)
 Closure for filtering users e.g $rep_search_gui->addUserAccessFilterCallable(function($user_ids) use($ref_id,$rbac_perm,$pos_perm)) { // filter users return $filtered_users }. More...
 
 setTitle (string $a_title)
 
 getTitle ()
 
 enableSearchableCheck (bool $a_status)
 
 isSearchableCheckEnabled ()
 
 setPrivacyMode (int $privacy_mode)
 
 getPrivacyMode ()
 
 getSearchType ()
 
 getRoleCallback ()
 
 setString (string $a_str)
 
 getString ()
 
 executeCommand ()
 
 __clearSession ()
 
 cancel ()
 
 start ()
 
 addRole ()
 
 addUser ()
 
 setCallback (object $class, string $method, array $a_add_options=[], string $default_option='')
 
 setRoleCallback (object $class, string $method, array $a_add_options=[], string $default_option='')
 
 setPermissionQueryCallback (object $class, string $method)
 
 showSearch ()
 
 showSearchSelected ()
 
 initFormSearch (ilObjUser $user=null)
 
 show ()
 
 appendSearch ()
 
 performSearch ()
 
 __performUserSearch ()
 
 __performGroupSearch ()
 
 __performRoleSearch ()
 
 __parseQueryString (string $a_string, bool $a_combination_or=true, bool $a_ignore_length=false)
 
 __loadQueries ()
 
 __setSearchType ()
 
 __updateResults ()
 
 __appendToStoredResults (array $a_usr_ids)
 
 __storeEntries (ilSearchResult $new_res)
 
 showSearchResults ()
 
 searchResultFilterListener (int $a_ref_id, array $a_data)
 Listener called from ilSearchResult Id is obj_id for role, usr Id is ref_id for crs grp. More...
 
 allowObjectSelection (bool $a_value=false)
 
 setUserLimitations (bool $a_limitations)
 allow user limitations like inactive and access limitations More...
 
 getUserLimitations ()
 allow user limitations like inactive and access limitations More...
 

Static Public Member Functions

static fillAutoCompleteToolbar (object $parent_object, ilToolbarGUI $toolbar=null, array $a_options=[], bool $a_sticky=false)
 array( auto_complete_name = $lng->txt('user'), auto_complete_size = 15, user_type = array(ilCourseParticipants::CRS_MEMBER,ilCourseParticpants::CRS_TUTOR), submit_name = $lng->txt('add') ) More...
 

Protected Member Functions

 initUserTypeFromQuery ()
 
 initUserTypeFromPost ()
 
 doUserAutoComplete ()
 
 addUserFromAutoComplete ()
 
 showClipboard ()
 
 addFromClipboard ()
 
 removeFromClipboard ()
 
 emptyClipboard ()
 
 handleMultiCommand ()
 
 __performCourseSearch ()
 
 addNewSearchButton ()
 
 showSearchUserTable (array $a_usr_ids, string $a_parent_cmd)
 
 showSearchRoleTable (array $a_obj_ids)
 
 showSearchGroupTable (array $a_obj_ids)
 
 showSearchCourseTable (array $a_obj_ids)
 
 listUsers (array $selected_entries=[])
 
 storedUserList ()
 
 selectObject ()
 Return selection of course/group/roles to calling script. More...
 

Protected Attributes

array $add_options = []
 
string $default_option = ''
 
bool $object_selection = false
 
bool $searchable_check = true
 
string $search_title = ''
 
bool $user_limitations = true
 
bool $stored = false
 
array $callback = []
 
array $role_callback = []
 
ilSearchResult $result_obj
 
ilSearchSettings $settings
 
ilPropertyFormGUI $form = null
 
 $user_filter = null
 
ilTree $tree
 
Renderer $ui_renderer
 
Factory $ui_factory
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilObjUser $user = null
 
ilRbacReview $rbacreview
 
ilTabsGUI $tabs
 
ilLanguage $lng
 

Private Attributes

array $search_results = []
 
string $search_type = 'usr'
 
string $string = ''
 
int $privacy_mode = ilUserAutoComplete::PRIVACY_MODE_IGNORE_USER_SETTING
 
GlobalHttpState $http
 
RefineryFactory $refinery
 

Detailed Description

Definition at line 37 of file class.ilRepositorySearchGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilRepositorySearchGUI::__construct ( )

Definition at line 79 of file class.ilRepositorySearchGUI.php.

80 {
81 global $DIC;
82
83
84
85 $this->ctrl = $DIC->ctrl();
86 $this->tpl = $DIC->ui()->mainTemplate();
87 $this->tree = $DIC->repositoryTree();
88 $this->ui_renderer = $DIC->ui()->renderer();
89 $this->ui_factory = $DIC->ui()->factory();
90 $this->lng = $DIC->language();
91 $this->rbacreview = $DIC->rbac()->review();
92 $this->refinery = $DIC->refinery();
93 $this->http = $DIC->http();
94 $this->user = $DIC->user();
95 $this->tabs = $DIC->tabs();
96
97 $this->lng->loadLanguageModule('search');
98 $this->lng->loadLanguageModule('crs');
99
100 $this->setTitle($this->lng->txt('add_members_header'));
101
102 $this->__setSearchType();
103 $this->__loadQueries();
104
105 $this->result_obj = new ilSearchResult();
106 $this->result_obj->setMaxHits(1000000);
107 $this->settings = new ilSearchSettings();
108 }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.

References $DIC, __loadQueries(), __setSearchType(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\settings(), setTitle(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ __appendToStoredResults()

ilRepositorySearchGUI::__appendToStoredResults ( array  $a_usr_ids)
Returns
int[]

Definition at line 1121 of file class.ilRepositorySearchGUI.php.

1121 : array
1122 {
1123 if (!ilSession::get('search_append')) {
1124 $rep_search = ilSession::get('rep_search') ?? [];
1125 $rep_search['usr'] = $a_usr_ids;
1126 ilSession::set('rep_search', $rep_search);
1127 return $a_usr_ids;
1128 }
1129 $rep_search = ilSession::get('rep_search') ?? [];
1130 foreach ($a_usr_ids as $usr_id) {
1131 $rep_search['usr'][] = $usr_id;
1132 }
1133 $rep_search['usr'] = array_unique($rep_search['usr'] ?? []);
1134 ilSession::set('rep_search', $rep_search);
1135 return $rep_search['usr'];
1136 }
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.

References ilSession\get(), and ilSession\set().

+ Here is the call graph for this function:

◆ __clearSession()

ilRepositorySearchGUI::__clearSession ( )

Definition at line 422 of file class.ilRepositorySearchGUI.php.

422 : void
423 {
424 ilSession::clear('rep_search');
425 ilSession::clear('append_results');
426 ilSession::clear('rep_query');
427 ilSession::clear('rep_search_type');
428 }
static clear(string $a_var)

References ilSession\clear().

+ Here is the call graph for this function:

◆ __loadQueries()

ilRepositorySearchGUI::__loadQueries ( )

Definition at line 1073 of file class.ilRepositorySearchGUI.php.

1073 : void
1074 {
1075 if ($this->http->wrapper()->post()->has('rep_query')) {
1077 'rep_query',
1078 $this->http->request()->getParsedBody()['rep_query']
1079 );
1080 }
1081 }

References ILIAS\FileDelivery\http(), and ilSession\set().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __parseQueryString()

ilRepositorySearchGUI::__parseQueryString ( string  $a_string,
bool  $a_combination_or = true,
bool  $a_ignore_length = false 
)
Returns
ilQueryParser|string

Definition at line 1053 of file class.ilRepositorySearchGUI.php.

1054 {
1055 $query_parser = new ilQueryParser(ilUtil::stripSlashes($a_string));
1056 $query_parser->setCombination($a_combination_or ? ilQueryParser::QP_COMBINATION_OR : ilQueryParser::QP_COMBINATION_AND);
1057 $query_parser->setMinWordLength(1);
1058
1059 // #17502
1060 if (!$a_ignore_length) {
1061 $query_parser->setGlobalMinLength(3); // #14768
1062 }
1063
1064 $query_parser->parse();
1065
1066 if (!$query_parser->validate()) {
1067 return $query_parser->getMessage();
1068 }
1069 return $query_parser;
1070 }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

References ilQueryParser\QP_COMBINATION_AND, ilQueryParser\QP_COMBINATION_OR, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ __performCourseSearch()

ilRepositorySearchGUI::__performCourseSearch ( )
protected

Definition at line 1017 of file class.ilRepositorySearchGUI.php.

1017 : bool
1018 {
1019 $rep_query = ilSession::get('rep_query');
1020 $query_string = $rep_query['crs']['title'] ?? '';
1021 if (!is_object($query_parser = $this->__parseQueryString($query_string))) {
1022 $this->tpl->setOnScreenMessage('info', $query_parser, true);
1023 return false;
1024 }
1025
1026 $object_search = new ilLikeObjectSearch($query_parser);
1027 $object_search->setFilter(array('crs'));
1028 $this->__storeEntries($object_search->performSearch());
1029
1030 return true;
1031 }
__storeEntries(ilSearchResult $new_res)
__parseQueryString(string $a_string, bool $a_combination_or=true, bool $a_ignore_length=false)

References ilSession\get().

+ Here is the call graph for this function:

◆ __performGroupSearch()

ilRepositorySearchGUI::__performGroupSearch ( )

Definition at line 1001 of file class.ilRepositorySearchGUI.php.

1001 : bool
1002 {
1003 $rep_query = ilSession::get('rep_query');
1004 $query_string = $rep_query['grp']['title'] ?? '';
1005 if (!is_object($query_parser = $this->__parseQueryString($query_string))) {
1006 $this->tpl->setOnScreenMessage('info', $query_parser, true);
1007 return false;
1008 }
1009
1010 $object_search = new ilLikeObjectSearch($query_parser);
1011 $object_search->setFilter(array('grp'));
1012 $this->__storeEntries($object_search->performSearch());
1013
1014 return true;
1015 }

References ilSession\get().

+ Here is the call graph for this function:

◆ __performRoleSearch()

ilRepositorySearchGUI::__performRoleSearch ( )

Definition at line 1033 of file class.ilRepositorySearchGUI.php.

1033 : bool
1034 {
1035 $rep_query = ilSession::get('rep_query');
1036 $query_string = $rep_query['role']['title'] ?? '';
1037 if (!is_object($query_parser = $this->__parseQueryString($query_string))) {
1038 $this->tpl->setOnScreenMessage('info', $query_parser, true);
1039 return false;
1040 }
1041
1042 // Perform like search
1043 $object_search = new ilLikeObjectSearch($query_parser);
1044 $object_search->setFilter(array('role'));
1045 $this->__storeEntries($object_search->performSearch());
1046
1047 return true;
1048 }

References ilSession\get().

+ Here is the call graph for this function:

◆ __performUserSearch()

ilRepositorySearchGUI::__performUserSearch ( )

Definition at line 939 of file class.ilRepositorySearchGUI.php.

939 : bool
940 {
942 $name = $info['db'];
943
944 $rep_query = ilSession::get('rep_query');
945 $query_string = $rep_query['usr'][$name] ?? '';
946 // continue if no query string is given
947 if (!$query_string) {
948 continue;
949 }
950
951 if (!is_object($query_parser = $this->__parseQueryString($query_string, true, ($info['type'] == ilUserSearchOptions::FIELD_TYPE_SELECT)))) {
952 $this->tpl->setOnScreenMessage('info', $query_parser);
953 return false;
954 }
955 switch ($info['type']) {
957 $query_parser = $this->__parseQueryString($query_string);
958
959 // no break
962 $udf_search->setFields(array($name));
963 $result_obj = $udf_search->performSearch();
964
965 // Store entries
967 break;
968
970
971 if ($info['db'] == 'org_units') {
973 $result_obj = $user_search->performSearch();
975 break;
976 }
977 $query_parser = $this->__parseQueryString($query_string, true, true);
978
979 // no break
981 $user_search = ilObjectSearchFactory::_getUserSearchInstance($query_parser);
982 $user_search->setFields(array($name));
983 $result_obj = $user_search->performSearch();
984
985 // store entries
987 break;
988
990 $multi_search = ilObjectSearchFactory::getUserMultiFieldSearchInstance($query_parser);
991 $multi_search->setFields(array($name));
992 $result_obj = $multi_search->performSearch();
994 break;
995
996 }
997 }
998 return true;
999 }
static _getUserDefinedFieldSearchInstance(ilQueryParser $query_parser)
static getUserOrgUnitAssignmentInstance(ilQueryParser $query_parser)
static _getUserSearchInstance(ilQueryParser $query_parser)
static getUserMultiFieldSearchInstance(ilQueryParser $query_parser)
static _getSearchableFieldsInfo(bool $a_admin=false)
if($format !==null) $name
Definition: metadata.php:247

References $name, ilUserSearchOptions\_getSearchableFieldsInfo(), ilObjectSearchFactory\_getUserDefinedFieldSearchInstance(), ilObjectSearchFactory\_getUserSearchInstance(), ilUserSearchOptions\FIELD_TYPE_MULTI, ilUserSearchOptions\FIELD_TYPE_SELECT, ilUserSearchOptions\FIELD_TYPE_TEXT, ilUserSearchOptions\FIELD_TYPE_UDF_SELECT, ilUserSearchOptions\FIELD_TYPE_UDF_TEXT, ilSession\get(), ilObjectSearchFactory\getUserMultiFieldSearchInstance(), and ilObjectSearchFactory\getUserOrgUnitAssignmentInstance().

+ Here is the call graph for this function:

◆ __setSearchType()

ilRepositorySearchGUI::__setSearchType ( )

Definition at line 1084 of file class.ilRepositorySearchGUI.php.

1084 : bool
1085 {
1086 // Update search type. Default to user search
1087 if ($this->http->wrapper()->post()->has('search_for')) {
1089 'rep_search_type',
1090 $this->http->request()->getParsedBody()['search_for']
1091 );
1092 } elseif (!ilSession::get('rep_search_type')) {
1093 ilSession::set('rep_search_type', 'usr');
1094 }
1095 $this->search_type = (string) ilSession::get('rep_search_type');
1096 return true;
1097 }

References ilSession\get(), ILIAS\FileDelivery\http(), and ilSession\set().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __storeEntries()

ilRepositorySearchGUI::__storeEntries ( ilSearchResult  $new_res)

Definition at line 1138 of file class.ilRepositorySearchGUI.php.

1138 : bool
1139 {
1140 if ($this->stored == false) {
1141 $this->result_obj->mergeEntries($new_res);
1142 $this->stored = true;
1143 return true;
1144 } else {
1145 $this->result_obj->intersectEntries($new_res);
1146 return true;
1147 }
1148 }

◆ __updateResults()

ilRepositorySearchGUI::__updateResults ( )

Definition at line 1100 of file class.ilRepositorySearchGUI.php.

1100 : bool
1101 {
1102 if (!ilSession::get('search_append')) {
1103 ilSession::set('rep_search', []);
1104 }
1105 $rep_search = ilSession::get('rep_search') ?? [];
1106 foreach ($this->search_results as $result) {
1107 $rep_search[$this->search_type][] = $result;
1108 }
1109 if (!$rep_search[$this->search_type]) {
1110 $rep_search[$this->search_type] = [];
1111 } else {
1112 $rep_search[$this->search_type] = array_unique($rep_search[$this->search_type]);
1113 }
1114 ilSession::set('rep_search', $rep_search);
1115 return true;
1116 }

References ilSession\get(), and ilSession\set().

+ Here is the call graph for this function:

◆ addFromClipboard()

ilRepositorySearchGUI::addFromClipboard ( )
protected

Definition at line 547 of file class.ilRepositorySearchGUI.php.

547 : void
548 {
549 $user_type = $this->initUserTypeFromPost();
550 if ($user_type === '') {
551 $user_type = $this->initUserTypeFromQuery();
552 }
553 $this->ctrl->setParameter($this, 'user_type', $user_type);
554
555 $users = [];
556 if ($this->http->wrapper()->post()->has('uids')) {
557 $users = $this->http->wrapper()->post()->retrieve(
558 'uids',
559 $this->refinery->kindlyTo()->dictOf(
560 $this->refinery->kindlyTo()->int()
561 )
562 );
563 }
564 if (!count($users)) {
565 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
566 $this->ctrl->redirect($this, 'showClipboard');
567 }
568 $class = $this->callback['class'];
569 $method = $this->callback['method'];
570 if (!$class->$method($users, $user_type)) {
571 $this->ctrl->returnToParent($this);
572 }
573 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ addNewSearchButton()

ilRepositorySearchGUI::addNewSearchButton ( )
protected

Definition at line 1150 of file class.ilRepositorySearchGUI.php.

1150 : void
1151 {
1152 $toolbar = new ilToolbarGUI();
1153 $toolbar->addButton(
1154 $this->lng->txt('search_new'),
1155 $this->ctrl->getLinkTarget($this, 'showSearch')
1156 );
1157 $this->tpl->setVariable('ACTION_BUTTONS', $toolbar->getHTML());
1158 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ addRole()

ilRepositorySearchGUI::addRole ( )

Definition at line 445 of file class.ilRepositorySearchGUI.php.

445 : void
446 {
447 $class = $this->role_callback['class'];
448 $method = $this->role_callback['method'];
449
450 // call callback if that function does give a return value => show error message
451 // listener redirects if everything is ok.
452 $obj_ids = [];
453 if ($this->http->wrapper()->post()->has('obj')) {
454 $obj_ids = $this->http->wrapper()->post()->retrieve(
455 'obj',
456 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
457 );
458 }
459 $role_ids = array();
460 foreach ($obj_ids as $id) {
461 $obj_type = ilObject::_lookupType($id);
462 if ($obj_type == "crs" || $obj_type == "grp") {
464 $ref_id = end($refs);
466 $role_ids[] = $mem_role;
467 } else {
468 $role_ids[] = $id;
469 }
470 }
471 $class->$method($role_ids);
472
473 $this->showSearchResults();
474 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static getDefaultMemberRole(int $a_ref_id)
$ref_id
Definition: ltiauth.php:67

References $id, $ref_id, ilObject\_getAllReferences(), ilObject\_lookupType(), ilParticipants\getDefaultMemberRole(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ addUser()

ilRepositorySearchGUI::addUser ( )

Reimplemented in ilStudyProgrammeRepositorySearchGUI.

Definition at line 476 of file class.ilRepositorySearchGUI.php.

476 : void
477 {
478 $class = $this->callback['class'];
479 $method = $this->callback['method'];
480
481 $users = [];
482 if ($this->http->wrapper()->post()->has('user')) {
483 $users = $this->http->wrapper()->post()->retrieve(
484 'user',
485 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
486 );
487 }
488
489 // call callback if that function does give a return value => show error message
490 // listener redirects if everything is ok.
491 $class->$method($users);
492
493 $this->showSearchResults();
494 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ addUserAccessFilterCallable()

ilRepositorySearchGUI::addUserAccessFilterCallable ( callable  $user_filter)

Closure for filtering users e.g $rep_search_gui->addUserAccessFilterCallable(function($user_ids) use($ref_id,$rbac_perm,$pos_perm)) { // filter users return $filtered_users }.

Definition at line 140 of file class.ilRepositorySearchGUI.php.

140 : void
141 {
142 $this->user_filter = $user_filter;
143 }

References $user_filter.

◆ addUserFromAutoComplete()

ilRepositorySearchGUI::addUserFromAutoComplete ( )
protected

Definition at line 497 of file class.ilRepositorySearchGUI.php.

497 : void
498 {
499 $class = $this->callback['class'];
500 $method = $this->callback['method'];
501
502 $post_users = '';
503 if ($this->http->wrapper()->post()->has('user_login')) {
504 $post_users = $this->http->wrapper()->post()->retrieve(
505 'user_login',
506 $this->refinery->kindlyTo()->string()
507 );
508 }
509
510 $users = explode(',', $post_users);
511 $user_ids = array();
512 foreach ($users as $user) {
513 $user_id = ilObjUser::_lookupId($user);
514 if ($user_id) {
515 $user_ids[] = $user_id;
516 }
517 }
518
519 $user_type = $this->initUserTypeFromPost();
520 if (!$class->$method($user_ids, $user_type)) {
521 $this->ctrl->returnToParent($this);
522 }
523 }
static _lookupId($a_user_str)

References ilObjUser\_lookupId(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ allowObjectSelection()

ilRepositorySearchGUI::allowObjectSelection ( bool  $a_value = false)

Definition at line 1372 of file class.ilRepositorySearchGUI.php.

1372 : void
1373 {
1374 $this->object_selection = $a_value;
1375 }

◆ appendSearch()

ilRepositorySearchGUI::appendSearch ( )

Definition at line 830 of file class.ilRepositorySearchGUI.php.

830 : void
831 {
832 ilSession::set('search_append', true);
833 $this->performSearch();
834 }

References ilSession\set().

+ Here is the call graph for this function:

◆ cancel()

ilRepositorySearchGUI::cancel ( )

Definition at line 430 of file class.ilRepositorySearchGUI.php.

430 : void
431 {
432 $this->ctrl->returnToParent($this);
433 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ doUserAutoComplete()

ilRepositorySearchGUI::doUserAutoComplete ( )
protected

Definition at line 337 of file class.ilRepositorySearchGUI.php.

337 : ?string
338 {
339 // hide anonymout request
340 if ($this->user->getId() == ANONYMOUS_USER_ID) {
341 echo json_encode(new stdClass(), JSON_THROW_ON_ERROR);
342 exit;
343 }
344 if (!$this->http->wrapper()->query()->has('autoCompleteField')) {
345 $a_fields = [
346 'login',
347 'firstname',
348 'lastname',
349 'email'
350 ];
351 $result_field = 'login';
352 } else {
353 $auto_complete_field = $this->http->wrapper()->query()->retrieve(
354 'autoCompleteField',
355 $this->refinery->kindlyTo()->string()
356 );
357 $a_fields = [$auto_complete_field];
358 $result_field = $auto_complete_field;
359 }
360 $auto = new ilUserAutoComplete();
361 $auto->setPrivacyMode($this->getPrivacyMode());
362
363 if ($this->http->wrapper()->query()->has('fetchall')) {
364 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
365 }
366
367 $auto->setMoreLinkAvailable(true);
368 $auto->setSearchFields($a_fields);
369 $auto->setResultField($result_field);
370 $auto->enableFieldSearchableCheck(true);
371 $auto->setUserLimitations($this->getUserLimitations());
372 if (is_callable($this->user_filter)) { // #0024249
373 $auto->addUserAccessFilterCallable(Closure::fromCallable($this->user_filter));
374 }
375
376 $query = '';
377 if ($this->http->wrapper()->post()->has('term')) {
378 $query = $this->http->wrapper()->post()->retrieve(
379 'term',
380 $this->refinery->kindlyTo()->string()
381 );
382 }
383 if ($query === "") {
384 if ($this->http->wrapper()->query()->has('term')) {
385 $query = $this->http->wrapper()->query()->retrieve(
386 'term',
387 $this->refinery->kindlyTo()->string()
388 );
389 }
390 }
391 echo $auto->getList($query);
392 exit;
393 }
getUserLimitations()
allow user limitations like inactive and access limitations
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27
exit
Definition: login.php:28
$query

References $query, ANONYMOUS_USER_ID, exit, ILIAS\FileDelivery\http(), ilUserAutoComplete\MAX_ENTRIES, ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ emptyClipboard()

ilRepositorySearchGUI::emptyClipboard ( )
protected

Definition at line 603 of file class.ilRepositorySearchGUI.php.

603 : void
604 {
605 $clip = ilUserClipboard::getInstance($this->user->getId());
606 $clip->clear();
607 $clip->save();
608
609 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
610 $this->ctrl->returnToParent($this);
611 }
static getInstance(int $a_usr_id)

References ILIAS\Repository\ctrl(), ilUserClipboard\getInstance(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ enableSearchableCheck()

ilRepositorySearchGUI::enableSearchableCheck ( bool  $a_status)

Definition at line 155 of file class.ilRepositorySearchGUI.php.

155 : void
156 {
157 $this->searchable_check = $a_status;
158 }

◆ executeCommand()

ilRepositorySearchGUI::executeCommand ( )

Definition at line 407 of file class.ilRepositorySearchGUI.php.

407 : bool
408 {
409 $next_class = $this->ctrl->getNextClass($this);
410 $cmd = $this->ctrl->getCmd();
411 switch ($next_class) {
412 default:
413 if (!$cmd) {
414 $cmd = "showSearch";
415 }
416 $this->$cmd();
417 break;
418 }
419 return true;
420 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ fillAutoCompleteToolbar()

static ilRepositorySearchGUI::fillAutoCompleteToolbar ( object  $parent_object,
ilToolbarGUI  $toolbar = null,
array  $a_options = [],
bool  $a_sticky = false 
)
static

array( auto_complete_name = $lng->txt('user'), auto_complete_size = 15, user_type = array(ilCourseParticipants::CRS_MEMBER,ilCourseParticpants::CRS_TUTOR), submit_name = $lng->txt('add') )

Definition at line 194 of file class.ilRepositorySearchGUI.php.

199 : ilToolbarGUI {
200 global $DIC;
201
202 $ilToolbar = $DIC->toolbar();
203 $lng = $DIC->language();
204 $ilCtrl = $DIC->ctrl();
205 $tree = $DIC->repositoryTree();
206 $user = $DIC->user();
207
208 if (!$toolbar instanceof ilToolbarGUI) {
209 $toolbar = $ilToolbar;
210 }
211
212 // Fill default options
213 if (!isset($a_options['auto_complete_name'])) {
214 $a_options['auto_complete_name'] = $lng->txt('obj_user');
215 }
216 if (!isset($a_options['auto_complete_size'])) {
217 $a_options['auto_complete_size'] = 15;
218 }
219 if (!isset($a_options['submit_name'])) {
220 $a_options['submit_name'] = $lng->txt('btn_add');
221 }
222 if (!isset($a_options['user_type_default'])) {
223 $a_options['user_type_default'] = null;
224 }
225
226 if (!isset($a_options['add_search'])) {
227 $a_options['add_search'] = false;
228 }
229 if (!isset($a_options['add_from_container'])) {
230 $a_options['add_from_container'] = null;
231 }
232
233 $ajax_url = $ilCtrl->getLinkTargetByClass(
234 array(get_class($parent_object),'ilRepositorySearchGUI'),
235 'doUserAutoComplete',
236 '',
237 true,
238 false
239 );
240
241 $ul = new ilTextInputGUI($a_options['auto_complete_name'], 'user_login');
242 $ul->setDataSource($ajax_url);
243 $ul->setSize($a_options['auto_complete_size']);
244 if (!$a_sticky) {
245 $toolbar->addInputItem($ul, true);
246 } else {
247 $toolbar->addStickyItem($ul, true);
248 }
249
250 if (isset($a_options['user_type']) && count((array) $a_options['user_type'])) {
251 $si = new ilSelectInputGUI("", "user_type");
252 $si->setOptions($a_options['user_type']);
253 $si->setValue($a_options['user_type_default']);
254 if (!$a_sticky) {
255 $toolbar->addInputItem($si);
256 } else {
257 $toolbar->addStickyItem($si);
258 }
259 }
260
262 if ($clip->hasContent()) {
263 $action_button = ilSplitButtonGUI::getInstance();
264
265 $add_button = ilSubmitButton::getInstance();
266 $add_button->setCaption($a_options['submit_name'], false);
267 $add_button->setCommand('addUserFromAutoComplete');
268
269 $action_button->setDefaultButton($add_button);
270
271 $clip_button = ilSubmitButton::getInstance();
272 $clip_button->addCSSClass('btn btndefault');
273 $lng->loadLanguageModule('user');
274 $clip_button->setCaption($lng->txt('clipboard_add_from_btn'), false);
275 $clip_button->setCommand('showClipboard');
276
277 $action_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($clip_button));
278
279 $toolbar->addButtonInstance($action_button);
280 } else {
281 $button = ilSubmitButton::getInstance();
282 $button->setCaption($a_options['submit_name'], false);
283 $button->setCommand('addUserFromAutoComplete');
284 if (!$a_sticky) {
285 $toolbar->addButtonInstance($button);
286 } else {
287 $toolbar->addStickyItem($button);
288 }
289 }
290
291 if ($a_options['add_search'] ||
292 is_numeric($a_options['add_from_container'])) {
293 $lng->loadLanguageModule("search");
294
295 $toolbar->addSeparator();
296
297 if ($a_options['add_search']) {
298 $button = ilLinkButton::getInstance();
299 $button->setCaption("search_users");
300 $button->setUrl($ilCtrl->getLinkTargetByClass('ilRepositorySearchGUI', ''));
301 $toolbar->addButtonInstance($button);
302 }
303
304 if (is_numeric($a_options['add_from_container'])) {
305 $parent_ref_id = (int) $a_options['add_from_container'];
306 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "grp");
307 $parent_container_type = "grp";
308 if (!$parent_container_ref_id) {
309 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "crs");
310 $parent_container_type = "crs";
311 }
312 if ($parent_container_ref_id) {
313 if ($a_options['add_search']) {
314 $toolbar->addSpacer();
315 }
316
317 $ilCtrl->setParameterByClass('ilRepositorySearchGUI', "list_obj", ilObject::_lookupObjId($parent_container_ref_id));
318
319 $button = ilLinkButton::getInstance();
320 $button->setCaption("search_add_members_from_container_" . $parent_container_type);
321 $button->setUrl($ilCtrl->getLinkTargetByClass(array(get_class($parent_object),'ilRepositorySearchGUI'), 'listUsers'));
322 $toolbar->addButtonInstance($button);
323 }
324 }
325 }
326
327 $toolbar->setFormAction(
328 $ilCtrl->getFormActionByClass(
329 array(
330 get_class($parent_object),
331 'ilRepositorySearchGUI')
332 )
333 );
334 return $toolbar;
335 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupObjId(int $ref_id)
This class represents a selection list property in a property form.
This class represents a text property in a property form.
setFormAction(string $a_val, bool $a_multipart=false, string $a_target="")
Set form action (if form action is set, toolbar is wrapped into form tags)
addButtonInstance(ilButtonBase $a_button)
Add button instance.
addInputItem(ilToolbarItem $a_item, bool $a_output_label=false)
addStickyItem( $a_item, bool $a_output_label=false)
Add a sticky item.
addSpacer(string $a_width=null)
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...

Referenced by ilOrgUnitStaffGUI\addOtherRolesToolbar(), ilOrgUnitStaffGUI\addStaffToolbar(), ilTestParticipantsGUI\addUserSearchControls(), ilObjBlogGUI\contributors(), ilOrgUnitUserAssignmentGUI\index(), ilSurveyParticipantsGUI\listAppraiseesObject(), ilExerciseManagementGUI\membersObject(), ilBookingParticipantGUI\render(), ilLearningSequenceMembershipGUI\showParticipantsToolbar(), ilMembershipGUI\showParticipantsToolbar(), ilSkillProfileGUI\showUsers(), ilExSubmissionTeamGUI\submissionScreenTeamObject(), ilObjRoleGUI\userassignmentObject(), and ilIndividualAssessmentMembersGUI\view().

+ Here is the caller graph for this function:

◆ getPrivacyMode()

ilRepositorySearchGUI::getPrivacyMode ( )

Definition at line 170 of file class.ilRepositorySearchGUI.php.

170 : int
171 {
172 return $this->privacy_mode;
173 }

References $privacy_mode.

◆ getRoleCallback()

ilRepositorySearchGUI::getRoleCallback ( )

Definition at line 180 of file class.ilRepositorySearchGUI.php.

180 : array
181 {
183 }

References $role_callback.

◆ getSearchType()

ilRepositorySearchGUI::getSearchType ( )

Definition at line 175 of file class.ilRepositorySearchGUI.php.

175 : string
176 {
177 return $this->search_type;
178 }

References $search_type.

◆ getString()

ilRepositorySearchGUI::getString ( )

Definition at line 402 of file class.ilRepositorySearchGUI.php.

402 : string
403 {
404 return $this->string;
405 }

◆ getTitle()

ilRepositorySearchGUI::getTitle ( )

Definition at line 150 of file class.ilRepositorySearchGUI.php.

150 : string
151 {
152 return $this->search_title;
153 }

References $search_title.

◆ getUserLimitations()

ilRepositorySearchGUI::getUserLimitations ( )

allow user limitations like inactive and access limitations

Definition at line 1422 of file class.ilRepositorySearchGUI.php.

1422 : bool
1423 {
1425 }

◆ handleMultiCommand()

ilRepositorySearchGUI::handleMultiCommand ( )
protected

Definition at line 614 of file class.ilRepositorySearchGUI.php.

614 : void
615 {
616 $class = $this->callback['class'];
617 $method = $this->callback['method'];
618
619 $post_user = (array) ($this->http->request()->getParsedBody()['user'] ?? []);
620 $post_selected_command = '';
621 if (
622 $this->http->wrapper()->post()->has('table_top_cmd') &&
623 $this->http->wrapper()->post()->has('selectedCommand_2')
624 ) {
625 $post_selected_command = $this->http->wrapper()->post()->retrieve(
626 'selectedCommand_2',
627 $this->refinery->kindlyTo()->string()
628 );
629 } elseif ($this->http->wrapper()->post()->has('selectedCommand')) {
630 $post_selected_command = $this->http->wrapper()->post()->retrieve(
631 'selectedCommand',
632 $this->refinery->kindlyTo()->string()
633 );
634 }
635 // Redirects if everything is ok
636 if (!$class->$method($post_user, $post_selected_command)) {
637 $this->showSearchResults();
638 }
639 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ initFormSearch()

ilRepositorySearchGUI::initFormSearch ( ilObjUser  $user = null)

Definition at line 699 of file class.ilRepositorySearchGUI.php.

699 : void
700 {
701 $this->form = new ilPropertyFormGUI();
702 $this->form->setFormAction($this->ctrl->getFormAction($this, 'showSearch'));
703 $this->form->setTitle($this->getTitle());
704 $this->form->addCommandButton('performSearch', $this->lng->txt('search'));
705 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
706
707
708 $kind = new ilRadioGroupInputGUI($this->lng->txt('search_type'), 'search_for');
709 $kind->setValue($this->search_type);
710 $this->form->addItem($kind);
711
712 // Users
713 $users = new ilRadioOption($this->lng->txt('search_for_users'), 'usr');
714
715 // UDF
717 switch ($info['type'] ?? ilUserSearchOptions::FIELD_TYPE_UDF_UNDEFINED) {
720
721 $sel = new ilSelectInputGUI($info['lang'], "rep_query[usr][" . $info['db'] . "]");
722 $sel->setOptions($info['values']);
723 $users->addSubItem($sel);
724 break;
725
729
730 if (isset($info['autoComplete']) and $info['autoComplete']) {
731 $this->ctrl->setParameterByClass(get_class($this), 'autoCompleteField', $info['db']);
732 $ul = new ilTextInputGUI($info['lang'], "rep_query[usr][" . $info['db'] . "]");
733 $ul->setDataSourceSubmitOnSelection(true);
734 $ul->setDataSourceSubmitUrl(
735 $this->ctrl->getLinkTarget(
736 $this,
737 'showSearchSelected',
738 '',
739 false,
740 false
741 )
742 );
743 $ul->setDataSource($this->ctrl->getLinkTarget(
744 $this,
745 "doUserAutoComplete",
746 "",
747 true
748 ));
749 $ul->setSize(30);
750 $ul->setMaxLength(120);
751
752 if ($user instanceof ilObjUser) {
753 switch ($info['db']) {
754 case 'firstname':
755 $ul->setValue($user->getFirstname());
756 break;
757 case 'lastname':
758 $ul->setValue($user->getLastname());
759 break;
760 case 'login':
761 $ul->setValue($user->getLogin());
762 break;
763 }
764 }
765
766
767
768 $users->addSubItem($ul);
769 } else {
770 $txt = new ilTextInputGUI($info['lang'], "rep_query[usr][" . $info['db'] . "]");
771 $txt->setSize(30);
772 $txt->setMaxLength(120);
773 $users->addSubItem($txt);
774 }
775 break;
776 }
777 }
778 $kind->addOption($users);
779
780
781
782 // Role
783 $roles = new ilRadioOption($this->lng->txt('search_for_role_members'), 'role');
784 $role = new ilTextInputGUI($this->lng->txt('search_role_title'), 'rep_query[role][title]');
785 $role->setSize(30);
786 $role->setMaxLength(120);
787 $roles->addSubItem($role);
788 $kind->addOption($roles);
789
790 // Course
791 $groups = new ilRadioOption($this->lng->txt('search_for_crs_members'), 'crs');
792 $group = new ilTextInputGUI($this->lng->txt('search_crs_title'), 'rep_query[crs][title]');
793 $group->setSize(30);
794 $group->setMaxLength(120);
795 $groups->addSubItem($group);
796 $kind->addOption($groups);
797
798 // Group
799 $groups = new ilRadioOption($this->lng->txt('search_for_grp_members'), 'grp');
800 $group = new ilTextInputGUI($this->lng->txt('search_grp_title'), 'rep_query[grp][title]');
801 $group->setSize(30);
802 $group->setMaxLength(120);
803 $groups->addSubItem($group);
804 $kind->addOption($groups);
805
806 // Orgus
807 if (ilUserSearchOptions::_isEnabled("org_units")) {
808 $orgus = new ilRadioOption($this->lng->txt('search_for_orgu_members'), 'orgu');
810 $this->lng->txt('select_orgu'),
811 'rep_query_orgu',
812 true,
813 $this->form
814 );
815 $orgu->getExplorerGUI()->setSelectableTypes(["orgu"]);
816 $orgu->getExplorerGUI()->setTypeWhiteList(["root", "orgu"]);
817 $orgu->getExplorerGUI()->setRootId(ilObjOrgUnit::getRootOrgRefId());
818 $orgu->getExplorerGUI()->setAjax(false);
819 $orgus->addSubItem($orgu);
820 $kind->addOption($orgus);
821 }
822 }
static getRootOrgRefId()
User class.
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$txt
Definition: error.php:13
form( $class_path, string $cmd)

References $txt, ilUserSearchOptions\_getSearchableFieldsInfo(), ilUserSearchOptions\_isEnabled(), ILIAS\Repository\ctrl(), ilUserSearchOptions\FIELD_TYPE_MULTI, ilUserSearchOptions\FIELD_TYPE_SELECT, ilUserSearchOptions\FIELD_TYPE_TEXT, ilUserSearchOptions\FIELD_TYPE_UDF_SELECT, ilUserSearchOptions\FIELD_TYPE_UDF_TEXT, ilUserSearchOptions\FIELD_TYPE_UDF_UNDEFINED, ILIAS\Repository\form(), ilObjUser\getFirstname(), ilObjUser\getLastname(), ilObjUser\getLogin(), ilObjOrgUnit\getRootOrgRefId(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initUserTypeFromPost()

ilRepositorySearchGUI::initUserTypeFromPost ( )
protected

Definition at line 121 of file class.ilRepositorySearchGUI.php.

121 : string
122 {
123 if ($this->http->wrapper()->post()->has('user_type')) {
124 return $this->http->wrapper()->post()->retrieve(
125 'user_type',
126 $this->refinery->kindlyTo()->string()
127 );
128 }
129 return '';
130 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ initUserTypeFromQuery()

ilRepositorySearchGUI::initUserTypeFromQuery ( )
protected

Definition at line 110 of file class.ilRepositorySearchGUI.php.

110 : string
111 {
112 if ($this->http->wrapper()->query()->has('user_type')) {
113 return $this->http->wrapper()->query()->retrieve(
114 'user_type',
115 $this->refinery->kindlyTo()->string()
116 );
117 }
118 return '';
119 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ isSearchableCheckEnabled()

ilRepositorySearchGUI::isSearchableCheckEnabled ( )

Definition at line 160 of file class.ilRepositorySearchGUI.php.

160 : bool
161 {
163 }

References $searchable_check.

◆ listUsers()

ilRepositorySearchGUI::listUsers ( array  $selected_entries = [])
protected

Definition at line 1249 of file class.ilRepositorySearchGUI.php.

1249 : bool
1250 {
1251 // get parameter is used e.g. in exercises to provide
1252 // "add members of course" link
1253 if (
1254 $this->http->wrapper()->post()->has('obj') &&
1255 !count($selected_entries)
1256 ) {
1257 $selected_entries = $this->http->wrapper()->post()->retrieve(
1258 'obj',
1259 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
1260 );
1261 }
1262 if (
1263 $this->http->wrapper()->query()->has('list_obj') &&
1264 !count($selected_entries)
1265 ) {
1266 $selected_entries[] = $this->http->wrapper()->query()->retrieve(
1267 'list_obj',
1268 $this->refinery->kindlyTo()->int()
1269 );
1270 }
1271 if (!count($selected_entries)) {
1272 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1273 $this->showSearchResults();
1274 return false;
1275 }
1276 $rep_search = ilSession::get('rep_search') ?? [];
1277 $rep_search['objs'] = $selected_entries;
1278 ilSession::set('rep_search', $rep_search);
1279
1280 // Get all members
1281 $members = array();
1282 foreach ($selected_entries as $obj_id) {
1283 $type = ilObject::_lookupType($obj_id);
1284 switch ($type) {
1285 case 'crs':
1286 case 'grp':
1288 $part = [];
1289 if (is_callable($this->user_filter)) {
1290 $part = call_user_func_array(
1291 $this->user_filter,
1292 [
1293 ilParticipants::getInstanceByObjId($obj_id)->getParticipants()
1294 ]
1295 );
1296 } else {
1297 $part = ilParticipants::getInstanceByObjId($obj_id)->getParticipants();
1298 }
1299
1300 $members = array_merge((array) $members, $part);
1301 }
1302 break;
1303
1304 case 'role':
1305 $assigned = [];
1306 if (is_callable($this->user_filter)) {
1307 $assigned = call_user_func_array(
1308 $this->user_filter,
1309 [
1310 $this->rbacreview->assignedUsers($obj_id)
1311 ]
1312 );
1313 } else {
1314 $assigned = $this->rbacreview->assignedUsers($obj_id);
1315 }
1316
1317 $members = array_merge($members, ilUserFilter::getInstance()->filter($assigned));
1318 break;
1319 case 'orgu':
1320 if ($ref_ids = ilObject::_getAllReferences($obj_id)) {
1322 ->getUserIdsOfOrgUnit(array_shift($ref_ids));
1323 if (is_callable($this->user_filter)) {
1324 $assigned = call_user_func_array(
1325 $this->user_filter,
1326 [$assigned]
1327 );
1328 }
1329
1330 $members = array_merge(
1331 $members,
1332 $assigned
1333 );
1334 }
1335 break;
1336 }
1337 }
1338 $members = array_unique($members);
1339 $this->__appendToStoredResults($members);
1340
1341 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
1342
1343 $this->addNewSearchButton();
1344 $rep_search = ilSession::get('rep_search');
1345 $this->showSearchUserTable($rep_search['usr'] ?? [], 'storedUserList');
1346 return true;
1347 }
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type.
static hasParticipantListAccess(int $a_obj_id, int $a_usr_id=null)
Check if (current) user has access to the participant list.
showSearchUserTable(array $a_usr_ids, string $a_parent_cmd)
$type

References $type, ilObject\_getAllReferences(), ilObject\_lookupType(), ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), ilSession\get(), ilOrgUnitUserAssignmentQueries\getInstance(), ilUserFilter\getInstance(), ilParticipants\getInstanceByObjId(), ilParticipants\hasParticipantListAccess(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilSession\set().

+ Here is the call graph for this function:

◆ performSearch()

ilRepositorySearchGUI::performSearch ( )

Definition at line 836 of file class.ilRepositorySearchGUI.php.

836 : bool
837 {
838 // only autocomplete input field, no search form if user privay should be respected
839 // see bug 25481
841 return false;
842 }
843 $found_query = false;
844
845 $post_rep_query = (array) ($this->http->request()->getParsedBody()['rep_query'] ?? []);
846 $post_search_for = (string) ($this->http->request()->getParsedBody()['search_for'] ?? '');
847 if (isset($post_rep_query[$post_search_for])) {
848 foreach ((array) $post_rep_query[$post_search_for] as $field => $value) {
849 if (trim(ilUtil::stripSlashes($value))) {
850 $found_query = true;
851 break;
852 }
853 }
854 }
855 if ($this->http->wrapper()->post()->has('rep_query_orgu')) {
856 $found_query = true;
857 }
858 if (!$found_query) {
859 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_search_string'));
860 $this->start();
861 return false;
862 }
863
864 $post_cmd = (array) ($this->http->request()->getParsedBody()['cmd'] ?? []);
865 // unset search_append if called directly
866 if (isset($post_cmd['performSearch'])) {
867 ilSession::clear('search_append');
868 }
869
870 switch ($this->search_type) {
871 case 'usr':
872 $this->__performUserSearch();
873 break;
874
875 case 'grp':
876 $this->__performGroupSearch();
877 break;
878
879 case 'crs':
880 $this->__performCourseSearch();
881 break;
882
883 case 'role':
884 $this->__performRoleSearch();
885 break;
886 case 'orgu':
887 $post_rep_query_orgu = (array) ($this->http->request()->getParsedBody()['rep_query_orgu'] ?? []);
888 $selected_objects = array_map(
889 function ($ref_id) {
890 return ilObject::_lookupObjId((int) $ref_id);
891 },
892 $post_rep_query_orgu
893 );
894 return $this->listUsers($selected_objects);
895 default:
896 echo 'not defined';
897 }
898
899 $this->result_obj->setRequiredPermission('read');
900 $this->result_obj->addObserver($this, 'searchResultFilterListener');
901 $this->result_obj->filter(ROOT_FOLDER_ID, true);
902
903 // User access filter
904 if ($this->search_type == 'usr') {
905 $callable_name = '';
906 if (is_callable($this->user_filter, true, $callable_name)) {
907 $result_ids = call_user_func_array($this->user_filter, [$this->result_obj->getResultIds()]);
908 } else {
909 $result_ids = $this->result_obj->getResultIds();
910 }
911
912 $this->search_results = array_intersect(
913 $result_ids,
914 ilUserFilter::getInstance()->filter($result_ids)
915 );
916 } else {
917 $this->search_results = array();
918 foreach ($this->result_obj->getResults() as $res) {
919 $this->search_results[] = $res['obj_id'];
920 }
921 }
922
923 if (!count($this->search_results)) {
924 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('search_no_match'));
925 $this->showSearch();
926 return true;
927 }
928 $this->__updateResults();
929 if ($this->result_obj->isLimitReached()) {
930 $message = sprintf($this->lng->txt('search_limit_reached'), $this->settings->getMaxHits());
931 $this->tpl->setOnScreenMessage('info', $message);
932 return true;
933 }
934 // show results
935 $this->show();
936 return true;
937 }
listUsers(array $selected_entries=[])
const ROOT_FOLDER_ID
Definition: constants.php:32
$res
Definition: ltiservices.php:69
$message
Definition: xapiexit.php:32

References $message, $ref_id, $res, ilObject\_lookupObjId(), ilSession\clear(), ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), ilUserFilter\getInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ilUserAutoComplete\PRIVACY_MODE_RESPECT_USER_SETTING, ROOT_FOLDER_ID, show(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ removeFromClipboard()

ilRepositorySearchGUI::removeFromClipboard ( )
protected

Definition at line 576 of file class.ilRepositorySearchGUI.php.

576 : void
577 {
578 $users = [];
579 if ($this->http->wrapper()->post()->has('uids')) {
580 $users = $this->http->wrapper()->post()->retrieve(
581 'uids',
582 $this->refinery->kindlyTo()->listOf(
583 $this->refinery->kindlyTo()->int()
584 )
585 );
586 }
587
588 $this->ctrl->setParameter($this, 'user_type', $this->initUserTypeFromQuery());
589 if (!count($users)) {
590 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
591 $this->ctrl->redirect($this, 'showClipboard');
592 }
593
594 $clip = ilUserClipboard::getInstance($this->user->getId());
595 $clip->delete($users);
596 $clip->save();
597
598 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
599 $this->ctrl->redirect($this, 'showClipboard');
600 }

References ILIAS\Repository\ctrl(), ilUserClipboard\getInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ searchResultFilterListener()

ilRepositorySearchGUI::searchResultFilterListener ( int  $a_ref_id,
array  $a_data 
)

Listener called from ilSearchResult Id is obj_id for role, usr Id is ref_id for crs grp.

Definition at line 1362 of file class.ilRepositorySearchGUI.php.

1362 : bool
1363 {
1364 if ($a_data['type'] == 'usr') {
1365 if ($a_data['obj_id'] == ANONYMOUS_USER_ID) {
1366 return false;
1367 }
1368 }
1369 return true;
1370 }

References ANONYMOUS_USER_ID.

◆ selectObject()

ilRepositorySearchGUI::selectObject ( )
protected

Return selection of course/group/roles to calling script.

Definition at line 1380 of file class.ilRepositorySearchGUI.php.

1380 : bool
1381 {
1382 // get parameter is used e.g. in exercises to provide
1383 // "add members of course"
1384 $selected_entries = [];
1385 if ($this->http->wrapper()->post()->has('obj')) {
1386 $selected_entries = $this->http->wrapper()->post()->retrieve(
1387 'obj',
1388 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
1389 );
1390 }
1391 if (
1392 $this->http->wrapper()->query()->has('list_obj') &&
1393 !count($selected_entries)
1394 ) {
1395 $selected_entries[] = $this->http->wrapper()->query()->retrieve(
1396 'list_obj',
1397 $this->refinery->kindlyTo()->int()
1398 );
1399 }
1400
1401 if (!count($selected_entries)) {
1402 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1403 $this->showSearchResults();
1404 return false;
1405 }
1406 $this->ctrl->setParameter($this->callback["class"], "obj", implode(";", $selected_entries));
1407 $this->ctrl->redirect($this->callback["class"], $this->callback["method"]);
1408 return true;
1409 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ setCallback()

ilRepositorySearchGUI::setCallback ( object  $class,
string  $method,
array  $a_add_options = [],
string  $default_option = '' 
)
Parameters
string[]$a_add_options

Definition at line 644 of file class.ilRepositorySearchGUI.php.

649 : void {
650 $this->callback = array('class' => $class,'method' => $method);
651 $this->add_options = $a_add_options;
652 $this->default_option = $default_option;
653 }

◆ setPermissionQueryCallback()

ilRepositorySearchGUI::setPermissionQueryCallback ( object  $class,
string  $method 
)

Definition at line 670 of file class.ilRepositorySearchGUI.php.

670 : void
671 {
672 }

◆ setPrivacyMode()

ilRepositorySearchGUI::setPrivacyMode ( int  $privacy_mode)

Definition at line 165 of file class.ilRepositorySearchGUI.php.

165 : void
166 {
167 $this->privacy_mode = $privacy_mode;
168 }

References $privacy_mode.

◆ setRoleCallback()

ilRepositorySearchGUI::setRoleCallback ( object  $class,
string  $method,
array  $a_add_options = [],
string  $default_option = '' 
)
Parameters
string[]$a_add_options

Definition at line 658 of file class.ilRepositorySearchGUI.php.

663 : void {
664 $this->role_callback = array('class' => $class,'method' => $method);
665 $this->add_options = $a_add_options;
666 $this->default_option = $default_option;
667 }

◆ setString()

ilRepositorySearchGUI::setString ( string  $a_str)

Definition at line 396 of file class.ilRepositorySearchGUI.php.

396 : void
397 {
398 $search = ilSession::get('search');
399 $search['string'] = $this->string = $a_str;
400 ilSession::set('search', $search);
401 }

References ilSession\get(), and ilSession\set().

+ Here is the call graph for this function:

◆ setTitle()

ilRepositorySearchGUI::setTitle ( string  $a_title)

Definition at line 145 of file class.ilRepositorySearchGUI.php.

145 : void
146 {
147 $this->search_title = $a_title;
148 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setUserLimitations()

ilRepositorySearchGUI::setUserLimitations ( bool  $a_limitations)

allow user limitations like inactive and access limitations

Definition at line 1414 of file class.ilRepositorySearchGUI.php.

1414 : void
1415 {
1416 $this->user_limitations = $a_limitations;
1417 }

◆ show()

ilRepositorySearchGUI::show ( )

Definition at line 825 of file class.ilRepositorySearchGUI.php.

825 : void
826 {
827 $this->showSearchResults();
828 }

◆ showClipboard()

ilRepositorySearchGUI::showClipboard ( )
protected

Definition at line 525 of file class.ilRepositorySearchGUI.php.

525 : void
526 {
527 $user_type = $this->initUserTypeFromQuery();
528 if ($user_type === '') {
529 $user_type = $this->initUserTypeFromPost();
530 }
531 $this->ctrl->setParameter($this, 'user_type', $user_type);
532 $this->tabs->clearTargets();
533 $this->tabs->setBackTarget(
534 $this->lng->txt('back'),
535 $this->ctrl->getParentReturn($this)
536 );
537
538 $clip = new ilUserClipboardTableGUI($this, 'showClipboard', $this->user->getId());
539 $clip->setFormAction($this->ctrl->getFormAction($this));
540 $clip->init();
541 $clip->parse();
542
543 $this->tpl->setContent($clip->getHTML());
544 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ showSearch()

ilRepositorySearchGUI::showSearch ( )

Definition at line 674 of file class.ilRepositorySearchGUI.php.

674 : void
675 {
676 // only autocomplete input field, no search form if user privay should be respected
677 // see bug 25481
679 return;
680 }
681 $this->initFormSearch();
682 $this->tpl->setContent($this->form->getHTML());
683 }
initFormSearch(ilObjUser $user=null)

References ILIAS\Repository\form(), and ilUserAutoComplete\PRIVACY_MODE_RESPECT_USER_SETTING.

+ Here is the call graph for this function:

◆ showSearchCourseTable()

ilRepositorySearchGUI::showSearchCourseTable ( array  $a_obj_ids)
protected

Definition at line 1241 of file class.ilRepositorySearchGUI.php.

1241 : void
1242 {
1243 $table = new ilRepositoryObjectResultTableGUI($this, 'showSearchResults', $this->object_selection);
1244 $table->parseObjectIds($a_obj_ids);
1245
1246 $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1247 }
TableGUI class object (course,group and role) search results Used in member search.

◆ showSearchGroupTable()

ilRepositorySearchGUI::showSearchGroupTable ( array  $a_obj_ids)
protected

Definition at line 1233 of file class.ilRepositorySearchGUI.php.

1233 : void
1234 {
1235 $table = new ilRepositoryObjectResultTableGUI($this, 'showSearchResults', $this->object_selection);
1236 $table->parseObjectIds($a_obj_ids);
1237
1238 $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1239 }

◆ showSearchResults()

ilRepositorySearchGUI::showSearchResults ( )

Definition at line 1160 of file class.ilRepositorySearchGUI.php.

1160 : void
1161 {
1162 $counter = 0;
1163 $f_result = array();
1164
1165 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
1166 $this->addNewSearchButton();
1167
1168 $rep_search = ilSession::get('rep_search');
1169
1170 switch ($this->search_type) {
1171 case "usr":
1172 $this->showSearchUserTable($rep_search['usr'] ?? [], 'showSearchResults');
1173 break;
1174
1175 case 'grp':
1176 $this->showSearchGroupTable($rep_search['grp'] ?? []);
1177 break;
1178
1179 case 'crs':
1180 $this->showSearchCourseTable($rep_search['crs'] ?? []);
1181 break;
1182
1183 case 'role':
1184 $this->showSearchRoleTable($rep_search['role'] ?? []);
1185 break;
1186 }
1187 }

References ilSession\get().

+ Here is the call graph for this function:

◆ showSearchRoleTable()

ilRepositorySearchGUI::showSearchRoleTable ( array  $a_obj_ids)
protected

Definition at line 1225 of file class.ilRepositorySearchGUI.php.

1225 : void
1226 {
1227 $table = new ilRepositoryObjectResultTableGUI($this, 'showSearchResults', $this->object_selection);
1228 $table->parseObjectIds($a_obj_ids);
1229
1230 $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1231 }

◆ showSearchSelected()

ilRepositorySearchGUI::showSearchSelected ( )

Definition at line 685 of file class.ilRepositorySearchGUI.php.

685 : void
686 {
687 $selected = [];
688 if ($this->http->wrapper()->query()->has('selected_id')) {
689 $selected = $this->http->wrapper()->query()->retrieve(
690 'selected_id',
691 $this->refinery->kindlyTo()->int()
692 );
693 }
694 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
695 $this->addNewSearchButton();
696 $this->showSearchUserTable([$selected], 'showSearchResults');
697 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ showSearchUserTable()

ilRepositorySearchGUI::showSearchUserTable ( array  $a_usr_ids,
string  $a_parent_cmd 
)
protected

Definition at line 1189 of file class.ilRepositorySearchGUI.php.

1189 : void
1190 {
1191 $base_class = '';
1192 if ($this->http->wrapper()->query()->has('baseClass')) {
1193 $base_class = $this->http->wrapper()->query()->retrieve(
1194 'baseClass',
1195 $this->refinery->kindlyTo()->string()
1196 );
1197 }
1198
1199 // String value of 'baseClass' is in lower case
1200 $is_in_admin = ($base_class === strtolower(ilAdministrationGUI::class));
1201
1202 if ($is_in_admin) {
1203 // remember link target to admin search gui (this)
1204 ilSession::set('usr_search_link', $this->ctrl->getLinkTarget($this, 'show'));
1205 }
1206
1207 $table = new ilRepositoryUserResultTableGUI($this, $a_parent_cmd, $is_in_admin);
1208 if (count($this->add_options)) {
1209 $table->addMultiItemSelectionButton(
1210 'selectedCommand',
1211 $this->add_options,
1212 'handleMultiCommand',
1213 $this->lng->txt('execute'),
1214 $this->default_option
1215 );
1216 } else {
1217 $table->addMultiCommand('addUser', $this->lng->txt('btn_add'));
1218 }
1219 $table->setUserLimitations($this->getUserLimitations());
1220 $table->parseUserIds($a_usr_ids);
1221
1222 $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1223 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilSession\set().

+ Here is the call graph for this function:

◆ start()

ilRepositorySearchGUI::start ( )

Definition at line 435 of file class.ilRepositorySearchGUI.php.

435 : bool
436 {
437 // delete all session info
438 $this->__clearSession();
439 $this->showSearch();
440
441 return true;
442 }

◆ storedUserList()

ilRepositorySearchGUI::storedUserList ( )
protected

Definition at line 1349 of file class.ilRepositorySearchGUI.php.

1349 : bool
1350 {
1351 $rep_search = ilSession::get('rep_search');
1352 $objects = $rep_search['objs'] ?? [];
1353 $this->listUsers($objects);
1354 return true;
1355 }

References ilSession\get().

+ Here is the call graph for this function:

Field Documentation

◆ $add_options

array ilRepositorySearchGUI::$add_options = []
protected

Definition at line 41 of file class.ilRepositorySearchGUI.php.

◆ $callback

array ilRepositorySearchGUI::$callback = []
protected

Definition at line 53 of file class.ilRepositorySearchGUI.php.

◆ $ctrl

ilCtrl ilRepositorySearchGUI::$ctrl
protected

Definition at line 70 of file class.ilRepositorySearchGUI.php.

◆ $default_option

string ilRepositorySearchGUI::$default_option = ''
protected

Definition at line 42 of file class.ilRepositorySearchGUI.php.

◆ $form

ilPropertyFormGUI ilRepositorySearchGUI::$form = null
protected

Definition at line 58 of file class.ilRepositorySearchGUI.php.

◆ $http

GlobalHttpState ilRepositorySearchGUI::$http
private

Definition at line 76 of file class.ilRepositorySearchGUI.php.

◆ $lng

ilLanguage ilRepositorySearchGUI::$lng
protected

Definition at line 75 of file class.ilRepositorySearchGUI.php.

◆ $object_selection

bool ilRepositorySearchGUI::$object_selection = false
protected

Definition at line 43 of file class.ilRepositorySearchGUI.php.

◆ $privacy_mode

int ilRepositorySearchGUI::$privacy_mode = ilUserAutoComplete::PRIVACY_MODE_IGNORE_USER_SETTING
private

Definition at line 65 of file class.ilRepositorySearchGUI.php.

Referenced by getPrivacyMode(), and setPrivacyMode().

◆ $rbacreview

ilRbacReview ilRepositorySearchGUI::$rbacreview
protected

Definition at line 73 of file class.ilRepositorySearchGUI.php.

◆ $refinery

RefineryFactory ilRepositorySearchGUI::$refinery
private

◆ $result_obj

ilSearchResult ilRepositorySearchGUI::$result_obj
protected

Definition at line 56 of file class.ilRepositorySearchGUI.php.

◆ $role_callback

array ilRepositorySearchGUI::$role_callback = []
protected

Definition at line 54 of file class.ilRepositorySearchGUI.php.

Referenced by getRoleCallback().

◆ $search_results

array ilRepositorySearchGUI::$search_results = []
private

Definition at line 39 of file class.ilRepositorySearchGUI.php.

◆ $search_title

string ilRepositorySearchGUI::$search_title = ''
protected

Definition at line 46 of file class.ilRepositorySearchGUI.php.

Referenced by getTitle().

◆ $search_type

string ilRepositorySearchGUI::$search_type = 'usr'
private

Definition at line 48 of file class.ilRepositorySearchGUI.php.

Referenced by getSearchType().

◆ $searchable_check

bool ilRepositorySearchGUI::$searchable_check = true
protected

Definition at line 45 of file class.ilRepositorySearchGUI.php.

Referenced by isSearchableCheckEnabled().

◆ $settings

ilSearchSettings ilRepositorySearchGUI::$settings
protected

Definition at line 57 of file class.ilRepositorySearchGUI.php.

◆ $stored

bool ilRepositorySearchGUI::$stored = false
protected

Definition at line 52 of file class.ilRepositorySearchGUI.php.

◆ $string

string ilRepositorySearchGUI::$string = ''
private

Definition at line 49 of file class.ilRepositorySearchGUI.php.

◆ $tabs

ilTabsGUI ilRepositorySearchGUI::$tabs
protected

Definition at line 74 of file class.ilRepositorySearchGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilRepositorySearchGUI::$tpl
protected

Definition at line 71 of file class.ilRepositorySearchGUI.php.

◆ $tree

ilTree ilRepositorySearchGUI::$tree
protected

Definition at line 67 of file class.ilRepositorySearchGUI.php.

◆ $ui_factory

Factory ilRepositorySearchGUI::$ui_factory
protected

Definition at line 69 of file class.ilRepositorySearchGUI.php.

◆ $ui_renderer

Renderer ilRepositorySearchGUI::$ui_renderer
protected

Definition at line 68 of file class.ilRepositorySearchGUI.php.

◆ $user

ilObjUser ilRepositorySearchGUI::$user = null
protected

Definition at line 72 of file class.ilRepositorySearchGUI.php.

◆ $user_filter

ilRepositorySearchGUI::$user_filter = null
protected

Definition at line 63 of file class.ilRepositorySearchGUI.php.

Referenced by addUserAccessFilterCallable().

◆ $user_limitations

bool ilRepositorySearchGUI::$user_limitations = true
protected

Definition at line 50 of file class.ilRepositorySearchGUI.php.


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