35 include_once
'Services/Search/classes/class.ilSearchResult.php';
36 include_once
'Services/Search/classes/class.ilSearchSettings.php';
37 include_once
'./Services/User/classes/class.ilUserAccountSettings.php';
38 include_once
'Services/Search/classes/class.ilQueryParser.php';
39 include_once(
"./Services/User/classes/class.ilUserAutoComplete.php");
77 $this->lng->loadLanguageModule(
'search');
78 $this->lng->loadLanguageModule(
'crs');
80 $this->
setTitle($this->lng->txt(
'add_members_header'));
86 $this->result_obj->setMaxHits(1000000);
110 $this->search_title = $a_title;
128 $this->searchable_check = $a_status;
175 $toolbar = $ilToolbar;
179 if (!isset($a_options[
'auto_complete_name'])) {
180 $a_options[
'auto_complete_name'] = $lng->txt(
'obj_user');
182 if (!isset($a_options[
'auto_complete_size'])) {
183 $a_options[
'auto_complete_size'] = 15;
185 if (!isset($a_options[
'submit_name'])) {
186 $a_options[
'submit_name'] = $lng->txt(
'btn_add');
188 if (!isset($a_options[
'user_type_default'])) {
189 $a_options[
'user_type_default'] = null;
192 $ajax_url = $ilCtrl->getLinkTargetByClass(
193 array(get_class($parent_object),
'ilRepositorySearchGUI'),
194 'doUserAutoComplete',
200 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
201 $ul =
new ilTextInputGUI($a_options[
'auto_complete_name'],
'user_login');
202 $ul->setDataSource($ajax_url);
203 $ul->setSize($a_options[
'auto_complete_size']);
205 $toolbar->addInputItem($ul,
true);
207 $toolbar->addStickyItem($ul,
true);
210 if (count((
array) $a_options[
'user_type'])) {
211 include_once
'./Services/Form/classes/class.ilSelectInputGUI.php';
213 $si->setOptions($a_options[
'user_type']);
214 $si->setValue($a_options[
'user_type_default']);
216 $toolbar->addInputItem(
$si);
218 $toolbar->addStickyItem(
$si);
222 include_once
'./Services/User/classes/class.ilUserClipboard.php';
224 if ($clip->hasContent()) {
225 include_once
'./Services/UIComponent/SplitButton/classes/class.ilSplitButtonGUI.php';
228 include_once
'./Services/UIComponent/Button/classes/class.ilLinkButton.php';
230 $add_button->setCaption($a_options[
'submit_name'],
false);
231 $add_button->setCommand(
'addUserFromAutoComplete');
233 $action_button->setDefaultButton($add_button);
235 include_once
'./Services/UIComponent/Button/classes/class.ilLinkButton.php';
237 $clip_button->addCSSClass(
'btn btndefault');
238 $GLOBALS[
'DIC']->language()->loadLanguageModule(
'user');
239 $clip_button->setCaption(
$GLOBALS[
'DIC']->language()->txt(
'clipboard_add_from_btn'),
false);
240 $clip_button->setCommand(
'showClipboard');
244 $toolbar->addButtonInstance($action_button);
246 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
248 $button->setCaption($a_options[
'submit_name'],
false);
249 $button->setCommand(
'addUserFromAutoComplete');
251 $toolbar->addButtonInstance($button);
253 $toolbar->addStickyItem($button);
257 if ((
bool) $a_options[
'add_search'] ||
258 is_numeric($a_options[
'add_from_container'])) {
259 $lng->loadLanguageModule(
"search");
261 $toolbar->addSeparator();
263 if ((
bool) $a_options[
'add_search']) {
264 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
266 $button->setCaption(
"search_users");
267 $button->setUrl($ilCtrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
''));
268 $toolbar->addButtonInstance($button);
271 if (is_numeric($a_options[
'add_from_container'])) {
272 $parent_ref_id = (int) $a_options[
'add_from_container'];
273 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id,
"grp");
274 $parent_container_type =
"grp";
275 if (!$parent_container_ref_id) {
276 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id,
"crs");
277 $parent_container_type =
"crs";
279 if ($parent_container_ref_id) {
280 if ((
bool) $a_options[
'add_search']) {
281 $toolbar->addSpacer();
284 $ilCtrl->setParameterByClass(
'ilRepositorySearchGUI',
"list_obj",
ilObject::_lookupObjId($parent_container_ref_id));
286 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
288 $button->setCaption(
"search_add_members_from_container_" . $parent_container_type);
289 $button->setUrl($ilCtrl->getLinkTargetByClass(
array(get_class($parent_object),
'ilRepositorySearchGUI'),
'listUsers'));
290 $toolbar->addButtonInstance($button);
295 $toolbar->setFormAction(
296 $ilCtrl->getFormActionByClass(
298 get_class($parent_object),
299 'ilRepositorySearchGUI')
312 if (
$GLOBALS[
'ilUser']->getId() == ANONYMOUS_USER_ID) {
313 include_once
'./Services/JSON/classes/class.ilJsonUtil.php';
319 if (!isset(
$_GET[
'autoCompleteField'])) {
320 $a_fields =
array(
'login',
'firstname',
'lastname',
'email');
321 $result_field =
'login';
323 $a_fields =
array((
string)
$_GET[
'autoCompleteField']);
324 $result_field = (
string) $_GET[
'autoCompleteField'];
327 include_once
'./Services/User/classes/class.ilUserAutoComplete.php';
331 if (($_REQUEST[
'fetchall'])) {
335 $auto->setMoreLinkAvailable(
true);
336 $auto->setSearchFields($a_fields);
337 $auto->setResultField($result_field);
338 $auto->enableFieldSearchableCheck(
true);
341 echo $auto->getList($_REQUEST[
'term']);
352 $_SESSION[
'search'][
'string'] = $this->
string = $a_str;
356 return $this->string;
367 $next_class = $this->ctrl->getNextClass($this);
368 $cmd = $this->ctrl->getCmd();
370 $this->ctrl->setReturn($this,
'');
372 switch ($next_class) {
393 $this->ctrl->returnToParent($this);
408 $class = $this->callback[
'class'];
409 $method = $this->callback[
'method'];
423 $class = $this->callback[
'class'];
424 $method = $this->callback[
'method'];
428 foreach (
$users as $user) {
431 $user_ids[] = $user_id;
435 $user_type = isset($_REQUEST[
'user_type']) ? $_REQUEST[
'user_type'] : 0;
437 if (!$class->$method($user_ids, $user_type)) {
438 $GLOBALS[
'ilCtrl']->returnToParent($this);
444 $GLOBALS[
'ilCtrl']->setParameter($this,
'user_type', (
int) $_REQUEST[
'user_type']);
451 $GLOBALS[
'ilCtrl']->getParentReturn($this)
454 include_once
'./Services/User/classes/class.ilUserClipboardTableGUI.php';
456 $clip->setFormAction(
$GLOBALS[
'ilCtrl']->getFormAction($this));
460 $GLOBALS[
'tpl']->setContent($clip->getHTML());
468 $GLOBALS[
'ilCtrl']->setParameter($this,
'user_type', (
int) $_REQUEST[
'user_type']);
472 $GLOBALS[
'ilCtrl']->redirect($this,
'showClipboard');
474 $class = $this->callback[
'class'];
475 $method = $this->callback[
'method'];
476 $user_type = isset($_REQUEST[
'user_type']) ? $_REQUEST[
'user_type'] : 0;
478 if (!$class->$method(
$users, $user_type)) {
479 $GLOBALS[
'ilCtrl']->returnToParent($this);
488 $GLOBALS[
'ilCtrl']->setParameter($this,
'user_type', (
int) $_REQUEST[
'user_type']);
492 $GLOBALS[
'ilCtrl']->redirect($this,
'showClipboard');
495 include_once
'./Services/User/classes/class.ilUserClipboard.php';
501 $this->ctrl->redirect($this,
'showClipboard');
509 include_once
'./Services/User/classes/class.ilUserClipboard.php';
515 $this->ctrl->returnToParent($this);
523 $class = $this->callback[
'class'];
524 $method = $this->callback[
'method'];
527 if (!$class->$method((
array)
$_POST[
'user'], $_POST[
'selectedCommand'])) {
534 $this->callback =
array(
'class' => $class,
'method' => $method);
535 $this->add_options = $a_add_options ? $a_add_options :
array();
553 $this->tpl->setContent($this->form->getHTML());
561 $selected = (int) $_REQUEST[
'selected_id'];
563 #include_once './Services/Object/classes/class.ilObjectFactory.php'; 564 #$factory = new ilObjectFactory(); 565 #$user = $factory->getInstanceByObjId($selected); 567 #$this->initFormSearch($user); 568 #$this->tpl->setContent($this->form->getHTML()); 570 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rep_search_result.html',
'Services/Search');
579 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
582 $this->form->setFormAction($this->ctrl->getFormAction($this,
'search'));
583 $this->form->setTitle($this->
getTitle());
584 $this->form->addCommandButton(
'performSearch', $this->lng->txt(
'search'));
585 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
589 $kind->
setValue($this->search_type);
590 $this->form->addItem($kind);
596 include_once
'Services/Search/classes/class.ilUserSearchOptions.php';
598 switch (
$info[
'type']) {
603 $sel->setOptions(
$info[
'values']);
611 if (isset(
$info[
'autoComplete']) and
$info[
'autoComplete']) {
612 $ilCtrl->setParameterByClass(get_class($this),
'autoCompleteField', $info[
'db']);
613 $ul =
new ilTextInputGUI($info[
'lang'],
"rep_query[usr][" . $info[
'db'] .
"]");
614 $ul->setDataSourceSubmitOnSelection(
true);
615 $ul->setDataSourceSubmitUrl(
616 $this->ctrl->getLinkTarget(
618 'showSearchSelected',
624 $ul->setDataSource($ilCtrl->getLinkTarget(
626 "doUserAutoComplete",
631 $ul->setMaxLength(120);
634 switch ($info[
'db']) {
636 $ul->setValue($user->getFirstname());
639 $ul->setValue($user->getLastname());
642 $ul->setValue($user->getLogin());
653 $txt->setMaxLength(120);
664 $roles =
new ilRadioOption($this->lng->txt(
'search_for_role_members'),
'role');
665 $role =
new ilTextInputGUI($this->lng->txt(
'search_role_title'),
'rep_query[role][title]');
667 $role->setMaxLength(120);
669 $kind->addOption($roles);
672 $groups =
new ilRadioOption($this->lng->txt(
'search_for_crs_members'),
'crs');
673 $group =
new ilTextInputGUI($this->lng->txt(
'search_crs_title'),
'rep_query[crs][title]');
675 $group->setMaxLength(120);
677 $kind->addOption($groups);
680 $groups =
new ilRadioOption($this->lng->txt(
'search_for_grp_members'),
'grp');
681 $group =
new ilTextInputGUI($this->lng->txt(
'search_grp_title'),
'rep_query[grp][title]');
683 $group->setMaxLength(120);
685 $kind->addOption($groups);
711 $found_query =
false;
712 foreach ((
array)
$_POST[
'rep_query'][
$_POST[
'search_for']] as $field => $value) {
725 if (
$_POST[
'cmd'][
'performSearch']) {
729 switch ($this->search_type) {
750 $this->result_obj->setRequiredPermission(
'read');
751 $this->result_obj->addObserver($this,
'searchResultFilterListener');
755 if ($this->search_type ==
'usr') {
757 if (is_callable($this->user_filter,
true, $callable_name)) {
758 $result_ids = call_user_func_array($this->user_filter, [$this->result_obj->getResultIds()]);
760 $result_ids = $this->result_obj->getResultIds();
763 include_once
'./Services/User/classes/class.ilUserFilter.php';
764 $this->search_results = array_intersect(
769 $this->search_results =
array();
770 foreach ((
array) $this->result_obj->getResults() as
$res) {
771 $this->search_results[] =
$res[
'obj_id'];
775 if (!count($this->search_results)) {
781 if ($this->result_obj->isLimitReached()) {
782 $message = sprintf($this->lng->txt(
'search_limit_reached'), $this->
settings->getMaxHits());
793 include_once
'Services/Search/classes/class.ilUserSearchOptions.php';
794 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
801 if (!$query_string) {
809 switch ($info[
'type']) {
818 $result_obj = $udf_search->performSearch();
826 if ($info[
'db'] ==
'org_units') {
828 $result_obj = $user_search->performSearch();
840 $result_obj = $user_search->performSearch();
849 $result_obj = $multi_search->performSearch();
863 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
865 $query_string =
$_SESSION[
'rep_query'][
'grp'][
'title'];
871 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
873 $object_search->setFilter(
array(
'grp'));
885 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
887 $query_string =
$_SESSION[
'rep_query'][
'crs'][
'title'];
893 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
895 $object_search->setFilter(
array(
'crs'));
907 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
909 $query_string =
$_SESSION[
'rep_query'][
'role'][
'title'];
916 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
918 $object_search->setFilter(
array(
'role'));
933 $query_parser->setMinWordLength(1);
936 if (!(
bool) $a_ignore_length) {
937 $query_parser->setGlobalMinLength(3);
940 $query_parser->parse();
942 if (!$query_parser->validate()) {
943 return $query_parser->getMessage();
945 return $query_parser;
951 if (is_array(
$_POST[
'rep_query'])) {
960 if (
$_POST[
'search_for']) {
969 $this->search_type =
$_SESSION[
'rep_search_type'];
970 #echo $this->search_type; 981 foreach ($this->search_results as
$result) {
984 if (!
$_SESSION[
'rep_search'][$this->search_type]) {
996 return $_SESSION[
'rep_search'][
'usr'] = $a_usr_ids;
999 foreach ($a_usr_ids as $usr_id) {
1000 $_SESSION[
'rep_search'][
'usr'][] = $usr_id;
1007 if ($this->stored ==
false) {
1008 $this->result_obj->mergeEntries($new_res);
1009 $this->stored =
true;
1012 $this->result_obj->intersectEntries($new_res);
1023 include_once
'./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1025 $toolbar->addButton(
1026 $this->lng->txt(
'search_new'),
1027 $this->ctrl->getLinkTarget($this,
'showSearch')
1029 $this->tpl->setVariable(
'ACTION_BUTTONS', $toolbar->getHTML());
1035 $f_result =
array();
1037 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rep_search_result.html',
'Services/Search');
1040 switch ($this->search_type) {
1066 $is_in_admin = ($_REQUEST[
'baseClass'] ==
'ilAdministrationGUI');
1069 $_SESSION[
"usr_search_link"] = $this->ctrl->getLinkTarget($this,
'show');
1072 include_once
'./Services/Search/classes/class.ilRepositoryUserResultTableGUI.php';
1075 if (count($this->add_options)) {
1076 $table->addMultiItemSelectionButton(
1079 'handleMultiCommand',
1080 $this->lng->txt(
'execute')
1083 $table->addMultiCommand(
'addUser', $this->lng->txt(
'btn_add'));
1086 $table->parseUserIds($a_usr_ids);
1088 $this->tpl->setVariable(
'RES_TABLE',
$table->getHTML());
1098 include_once
'./Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1101 $table->parseObjectIds($a_obj_ids);
1103 $this->tpl->setVariable(
'RES_TABLE',
$table->getHTML());
1113 include_once
'./Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1116 $table->parseObjectIds($a_obj_ids);
1118 $this->tpl->setVariable(
'RES_TABLE',
$table->getHTML());
1128 include_once
'./Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1131 $table->parseObjectIds($a_obj_ids);
1133 $this->tpl->setVariable(
'RES_TABLE',
$table->getHTML());
1144 if (
$_GET[
"list_obj"] !=
"" && !is_array(
$_POST[
'obj'])) {
1157 foreach (
$_POST[
'obj'] as $obj_id) {
1163 include_once
'./Services/Membership/classes/class.ilParticipants.php';
1166 if (is_callable($this->user_filter)) {
1167 $part = call_user_func_array(
1177 $members = array_merge((
array) $members, $part);
1185 if (is_callable($this->user_filter)) {
1186 $assigned = call_user_func_array(
1189 $rbacreview->assignedUsers($obj_id)
1193 $assigned = $rbacreview->assignedUsers($obj_id);
1200 $members = array_unique((
array) $members);
1203 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rep_search_result.html',
'Services/Search');
1231 if ($a_data[
'type'] ==
'usr') {
1232 if ($a_data[
'obj_id'] == ANONYMOUS_USER_ID) {
1246 $this->object_selection = (bool) $a_value;
1256 if (
$_GET[
"list_obj"] !=
"" && !is_array(
$_POST[
'obj'])) {
1265 $this->ctrl->setParameter($this->callback[
"class"],
"obj", implode(
";",
$_POST[
"obj"]));
1266 $this->ctrl->redirect($this->callback[
"class"], $this->callback[
"method"]);
1276 $this->user_limitations = (bool) $a_limitations;
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setCallback(&$class, $method, $a_add_options=array())
setTitle($a_title)
Set form title.
selectObject()
Return selection of course/group/roles to calling script.
This class represents an option in a radio group.
showSearchGroupTable($a_obj_ids)
TableGUI class user search results.
enableSearchableCheck($a_status)
En/disable the validation of the searchable flag.
addUserFromAutoComplete()
Add user from auto complete input.
static getInstance($a_usr_id)
Get singelton instance.
isSearchableCheckEnabled()
executeCommand()
Control public.
showSearchSelected()
submit from autocomplete
const PRIVACY_MODE_RESPECT_USER_SETTING
__performGroupSearch()
Search groups.
addNewSearchButton()
Add new search button.
__appendToStoredResults($a_usr_ids)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
showSearchRoleTable($a_obj_ids)
Show usr table.
static _lookupId($a_user_str)
Lookup id by login.
const FIELD_TYPE_UDF_TEXT
__construct()
Constructor public.
static getInstance()
Singelton get instance.
static getUserMultiFieldSearchInstance($query_parser)
setUserLimitations($a_limitations)
allow user limitations like inactive and access limitations
__performRoleSearch()
Search roles.
static hasParticipantListAccess($a_obj_id, $a_usr_id=null)
Check if (current) user has access to the participant list.
searchResultFilterListener($a_ref_id, $a_data)
Listener called from ilSearchResult Id is obj_id for role, usr Id is ref_id for crs grp...
Auto completion class for user lists.
addFromClipboard()
add users from clipboard
__performCourseSearch()
Search courses.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Show administrate clipboard content.
initFormSearch(ilObjUser $user=null)
catch(Exception $e) $message
static _getUserSearchInstance($query_parser)
get reference of ilLikeUserSearch
setPermissionQueryCallback($class, $method)
Set callback method for user permission access queries.
static encode($mixed, $suppress_native=false)
showSearchCourseTable($a_obj_ids)
foreach($_POST as $key=> $value) $res
__storeEntries(&$new_res)
doUserAutoComplete()
Do auto completion.
addSubItem($a_item)
Add Subitem.
getUserLimitations()
allow user limitations like inactive and access limitations
static _lookupObjId($a_id)
This class represents a text property in a property form.
getTitle()
Get search form title.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const FIELD_TYPE_UDF_SELECT
Class ilUserSearchOptions.
listUsers()
List users of course/group/roles.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
allowObjectSelection($a_value=false)
Toggle object selection status.
removeFromClipboard()
Remove from clipboard.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
storedUserList()
Called from table sort.
TableGUI class object (course,group and role) search results Used in member search.
addUserAccessFilterCallable(callable $user_filter)
Closure for filtering users e.g $rep_search_gui->addUserAccessFilterCallable(function($user_ids) use(...
setString($a_str)
Set/get search string public.
handleMultiCommand()
Handle multi command.
& __parseQueryString($a_string, $a_combination_or=true, $a_ignore_length=false)
parse query string, using query parser instance
static getLogger($a_component_id)
Get component logger.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with
if(empty($password)) $table
const PRIVACY_MODE_IGNORE_USER_SETTING
showSearchUserTable($a_usr_ids, $a_parent_cmd)
Show usr table.
emptyClipboard()
Remove from clipboard.
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
static getUserOrgUnitAssignmentInstance($query_parser)
get orgunit search instance
performSearch()
Perform a search.
static _getUserDefinedFieldSearchInstance($query_parser)
get reference of ilLikeUserDefinedFieldSearch
static _getSearchableFieldsInfo($a_admin=false)
setPrivacyMode($privacy_mode)