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");
72 $this->lng->loadLanguageModule(
'search');
73 $this->lng->loadLanguageModule(
'crs');
75 $this->
setTitle($this->lng->txt(
'add_members_header'));
81 $this->result_obj->setMaxHits(1000000);
92 $this->search_title = $a_title;
110 $this->searchable_check = $a_status;
158 $toolbar = $ilToolbar;
162 if(!isset($a_options[
'auto_complete_name']))
164 $a_options[
'auto_complete_name'] = $lng->txt(
'obj_user');
166 if(!isset($a_options[
'auto_complete_size']))
168 $a_options[
'auto_complete_size'] = 15;
170 if(!isset($a_options[
'submit_name']))
172 $a_options[
'submit_name'] = $lng->txt(
'btn_add');
174 if(!isset($a_options[
'user_type_default']))
176 $a_options[
'user_type_default'] = null;
179 $ajax_url = $ilCtrl->getLinkTargetByClass(
array(get_class($parent_object),
'ilRepositorySearchGUI'),
180 'doUserAutoComplete',
'',
true,
false);
182 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
183 $ul =
new ilTextInputGUI($a_options[
'auto_complete_name'],
'user_login');
184 $ul->setDataSource($ajax_url);
185 $ul->setSize($a_options[
'auto_complete_size']);
188 $toolbar->addInputItem($ul,
true);
192 $toolbar->addStickyItem($ul,
true);
195 if(count((
array) $a_options[
'user_type']))
197 include_once
'./Services/Form/classes/class.ilSelectInputGUI.php';
199 $si->setOptions($a_options[
'user_type']);
200 $si->setValue($a_options[
'user_type_default']);
203 $toolbar->addInputItem(
$si);
207 $toolbar->addStickyItem(
$si);
211 include_once
'./Services/User/classes/class.ilUserClipboard.php';
213 if($clip->hasContent())
215 include_once
'./Services/UIComponent/SplitButton/classes/class.ilSplitButtonGUI.php';
218 include_once
'./Services/UIComponent/Button/classes/class.ilLinkButton.php';
220 $add_button->setCaption($a_options[
'submit_name'],
false);
221 $add_button->setCommand(
'addUserFromAutoComplete');
223 $action_button->setDefaultButton($add_button);
225 include_once
'./Services/UIComponent/Button/classes/class.ilLinkButton.php';
227 $clip_button->addCSSClass(
'btn btndefault');
228 $GLOBALS[
'DIC']->language()->loadLanguageModule(
'user');
229 $clip_button->setCaption(
$GLOBALS[
'DIC']->
language()->txt(
'clipboard_add_from_btn'),
false);
230 $clip_button->setCommand(
'showClipboard');
234 $toolbar->addButtonInstance($action_button);
238 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
240 $button->setCaption($a_options[
'submit_name'],
false);
241 $button->setCommand(
'addUserFromAutoComplete');
244 $toolbar->addButtonInstance($button);
248 $toolbar->addStickyItem($button);
252 if((
bool)$a_options[
'add_search'] ||
253 is_numeric($a_options[
'add_from_container']))
255 $lng->loadLanguageModule(
"search");
257 $toolbar->addSeparator();
259 if((
bool)$a_options[
'add_search'])
261 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
263 $button->setCaption(
"search_users");
264 $button->setUrl($ilCtrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
''));
265 $toolbar->addButtonInstance($button);
268 if(is_numeric($a_options[
'add_from_container']))
270 $parent_ref_id = (int)$a_options[
'add_from_container'];
271 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id,
"grp");
272 $parent_container_type =
"grp";
273 if(!$parent_container_ref_id)
275 $parent_container_ref_id = $tree->checkForParentType($parent_ref_id,
"crs");
276 $parent_container_type =
"crs";
278 if($parent_container_ref_id)
280 if((
bool)$a_options[
'add_search'])
282 $toolbar->addSpacer();
285 $ilCtrl->setParameterByClass(
'ilRepositorySearchGUI',
"list_obj",
ilObject::_lookupObjId($parent_container_ref_id));
287 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
289 $button->setCaption(
"search_add_members_from_container_".$parent_container_type);
290 $button->setUrl($ilCtrl->getLinkTargetByClass(
array(get_class($parent_object),
'ilRepositorySearchGUI'),
'listUsers'));
291 $toolbar->addButtonInstance($button);
296 $toolbar->setFormAction(
297 $ilCtrl->getFormActionByClass(
299 get_class($parent_object),
300 'ilRepositorySearchGUI')
313 if(
$GLOBALS[
'ilUser']->getId() == ANONYMOUS_USER_ID)
315 include_once
'./Services/JSON/classes/class.ilJsonUtil.php';
321 if(!isset(
$_GET[
'autoCompleteField']))
323 $a_fields =
array(
'login',
'firstname',
'lastname',
'email');
324 $result_field =
'login';
328 $a_fields =
array((
string)
$_GET[
'autoCompleteField']);
329 $result_field = (
string) $_GET[
'autoCompleteField'];
332 include_once
'./Services/User/classes/class.ilUserAutoComplete.php';
336 if(($_REQUEST[
'fetchall']))
341 $auto->setMoreLinkAvailable(
true);
342 $auto->setSearchFields($a_fields);
343 $auto->setResultField($result_field);
344 $auto->enableFieldSearchableCheck(
true);
347 echo $auto->getList($_REQUEST[
'term']);
358 $_SESSION[
'search'][
'string'] = $this->
string = $a_str;
362 return $this->string;
373 $next_class = $this->ctrl->getNextClass($this);
374 $cmd = $this->ctrl->getCmd();
376 $this->ctrl->setReturn($this,
'');
402 $this->ctrl->returnToParent($this);
417 $class = $this->callback[
'class'];
418 $method = $this->callback[
'method'];
422 $class->$method(
$_POST[
'user']);
432 $class = $this->callback[
'class'];
433 $method = $this->callback[
'method'];
435 $users = explode(
',',
$_POST[
'user_login']);
437 foreach($users as $user)
442 $user_ids[] = $user_id;
446 $user_type = isset($_REQUEST[
'user_type']) ? $_REQUEST[
'user_type'] : 0;
448 if(!$class->$method($user_ids,$user_type))
450 $GLOBALS[
'ilCtrl']->returnToParent($this);
456 $GLOBALS[
'ilCtrl']->setParameter($this,
'user_type', (
int) $_REQUEST[
'user_type']);
463 $GLOBALS[
'ilCtrl']->getParentReturn($this)
466 include_once
'./Services/User/classes/class.ilUserClipboardTableGUI.php';
468 $clip->setFormAction(
$GLOBALS[
'ilCtrl']->getFormAction($this));
472 $GLOBALS[
'tpl']->setContent($clip->getHTML());
480 $GLOBALS[
'ilCtrl']->setParameter($this,
'user_type', (
int) $_REQUEST[
'user_type']);
485 $GLOBALS[
'ilCtrl']->redirect($this,
'showClipboard');
487 $class = $this->callback[
'class'];
488 $method = $this->callback[
'method'];
489 $user_type = isset($_REQUEST[
'user_type']) ? $_REQUEST[
'user_type'] : 0;
491 if(!$class->$method($users,$user_type))
493 $GLOBALS[
'ilCtrl']->returnToParent($this);
502 $GLOBALS[
'ilCtrl']->setParameter($this,
'user_type', (
int) $_REQUEST[
'user_type']);
507 $GLOBALS[
'ilCtrl']->redirect($this,
'showClipboard');
510 include_once
'./Services/User/classes/class.ilUserClipboard.php';
512 $clip->delete($users);
516 $this->ctrl->redirect($this,
'showClipboard');
524 include_once
'./Services/User/classes/class.ilUserClipboard.php';
530 $this->ctrl->returnToParent($this);
538 $class = $this->callback[
'class'];
539 $method = $this->callback[
'method'];
542 if(!$class->$method((
array)
$_POST[
'user'],$_POST[
'selectedCommand']))
550 $this->callback =
array(
'class' => $class,
'method' => $method);
551 $this->add_options = $a_add_options ? $a_add_options :
array();
557 $this->tpl->setContent($this->form->getHTML());
565 $selected = (int) $_REQUEST[
'selected_id'];
567 #include_once './Services/Object/classes/class.ilObjectFactory.php'; 568 #$factory = new ilObjectFactory(); 569 #$user = $factory->getInstanceByObjId($selected); 571 #$this->initFormSearch($user); 572 #$this->tpl->setContent($this->form->getHTML()); 574 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rep_search_result.html',
'Services/Search');
583 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
586 $this->form->setFormAction($this->ctrl->getFormAction($this,
'search'));
587 $this->form->setTitle($this->
getTitle());
588 $this->form->addCommandButton(
'performSearch', $this->lng->txt(
'search'));
589 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
593 $kind->
setValue($this->search_type);
594 $this->form->addItem($kind);
597 $users =
new ilRadioOption($this->lng->txt(
'search_for_users'),
'usr');
600 include_once
'Services/Search/classes/class.ilUserSearchOptions.php';
603 switch(
$info[
'type'])
609 $sel->setOptions(
$info[
'values']);
610 $users->addSubItem($sel);
619 $ilCtrl->setParameterByClass(get_class($this),
'autoCompleteField',$info[
'db']);
620 $ul =
new ilTextInputGUI($info[
'lang'],
"rep_query[usr][".$info[
'db'].
"]");
621 $ul->setDataSourceSubmitOnSelection(TRUE);
622 $ul->setDataSourceSubmitUrl(
623 $this->ctrl->getLinkTarget(
625 'showSearchSelected',
631 $ul->setDataSource($ilCtrl->getLinkTarget($this,
632 "doUserAutoComplete",
"",
true));
634 $ul->setMaxLength(120);
641 $ul->setValue($user->getFirstname());
644 $ul->setValue($user->getLastname());
647 $ul->setValue($user->getLogin());
654 $users->addSubItem($ul);
660 $txt->setMaxLength(120);
661 $users->addSubItem(
$txt);
666 $kind->addOption($users);
671 $roles =
new ilRadioOption($this->lng->txt(
'search_for_role_members'),
'role');
672 $role =
new ilTextInputGUI($this->lng->txt(
'search_role_title'),
'rep_query[role][title]');
674 $role->setMaxLength(120);
676 $kind->addOption($roles);
679 $groups =
new ilRadioOption($this->lng->txt(
'search_for_crs_members'),
'crs');
680 $group =
new ilTextInputGUI($this->lng->txt(
'search_crs_title'),
'rep_query[crs][title]');
682 $group->setMaxLength(120);
684 $kind->addOption($groups);
687 $groups =
new ilRadioOption($this->lng->txt(
'search_for_grp_members'),
'grp');
688 $group =
new ilTextInputGUI($this->lng->txt(
'search_grp_title'),
'rep_query[grp][title]');
690 $group->setMaxLength(120);
692 $kind->addOption($groups);
713 $found_query =
false;
730 if(
$_POST[
'cmd'][
'performSearch'])
735 switch($this->search_type)
757 $GLOBALS[
'DIC']->logger()->src()->dump($this->result_obj->getEntries());
759 $this->result_obj->setRequiredPermission(
'read');
760 $this->result_obj->addObserver($this,
'searchResultFilterListener');
764 if($this->search_type ==
'usr')
766 include_once
'./Services/User/classes/class.ilUserFilter.php';
767 $this->search_results = array_intersect(
768 $this->result_obj->getResultIds(),
774 $this->search_results =
array();
775 foreach((
array) $this->result_obj->getResults() as
$res)
777 $this->search_results[] =
$res[
'obj_id'];
781 if(!count($this->search_results))
788 if($this->result_obj->isLimitReached())
790 $message = sprintf($this->lng->txt(
'search_limit_reached'),$this->
settings->getMaxHits());
801 include_once
'Services/Search/classes/class.ilUserSearchOptions.php';
802 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
807 $query_string =
$_SESSION[
'rep_query'][
'usr'][$name];
820 switch($info[
'type'])
828 $udf_search->setFields(
array($name));
829 $result_obj = $udf_search->performSearch();
837 if($info[
'db'] ==
'org_units')
840 $result_obj = $user_search->performSearch();
850 $user_search->setFields(
array($name));
851 $result_obj = $user_search->performSearch();
859 $multi_search->setFields(
array($name));
860 $result_obj = $multi_search->performSearch();
874 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
876 $query_string =
$_SESSION[
'rep_query'][
'grp'][
'title'];
883 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
885 $object_search->setFilter(
array(
'grp'));
897 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
899 $query_string =
$_SESSION[
'rep_query'][
'crs'][
'title'];
906 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
908 $object_search->setFilter(
array(
'crs'));
920 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
922 $query_string =
$_SESSION[
'rep_query'][
'role'][
'title'];
930 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
932 $object_search->setFilter(
array(
'role'));
947 $query_parser->setMinWordLength(1);
950 if(!(
bool)$a_ignore_length)
952 $query_parser->setGlobalMinLength(3);
955 $query_parser->parse();
957 if(!$query_parser->validate())
959 return $query_parser->getMessage();
961 return $query_parser;
967 if(is_array(
$_POST[
'rep_query']))
988 $this->search_type =
$_SESSION[
'rep_search_type'];
989 #echo $this->search_type; 1001 foreach($this->search_results as
$result)
1005 if(!
$_SESSION[
'rep_search'][$this->search_type])
1021 return $_SESSION[
'rep_search'][
'usr'] = $a_usr_ids;
1024 foreach($a_usr_ids as $usr_id)
1026 $_SESSION[
'rep_search'][
'usr'][] = $usr_id;
1033 if($this->stored ==
false)
1035 $this->result_obj->mergeEntries($new_res);
1036 $this->stored =
true;
1041 $this->result_obj->intersectEntries($new_res);
1052 include_once
'./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1054 $toolbar->addButton(
1055 $this->lng->txt(
'search_new'),
1056 $this->ctrl->getLinkTarget($this,
'showSearch')
1058 $this->tpl->setVariable(
'ACTION_BUTTONS',$toolbar->getHTML());
1064 $f_result =
array();
1066 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rep_search_result.html',
'Services/Search');
1069 switch($this->search_type)
1096 $is_in_admin = ($_REQUEST[
'baseClass'] ==
'ilAdministrationGUI');
1100 $_SESSION[
"usr_search_link"] = $this->ctrl->getLinkTarget($this,
'show');
1103 include_once
'./Services/Search/classes/class.ilRepositoryUserResultTableGUI.php';
1106 if(count($this->add_options))
1108 $table->addMultiItemSelectionButton(
1111 'handleMultiCommand',
1112 $this->lng->txt(
'execute')
1117 $table->addMultiCommand(
'addUser', $this->lng->txt(
'btn_add'));
1120 $table->parseUserIds($a_usr_ids);
1122 $this->tpl->setVariable(
'RES_TABLE',$table->getHTML());
1132 include_once
'./Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1135 $table->parseObjectIds($a_obj_ids);
1137 $this->tpl->setVariable(
'RES_TABLE',$table->getHTML());
1147 include_once
'./Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1150 $table->parseObjectIds($a_obj_ids);
1152 $this->tpl->setVariable(
'RES_TABLE',$table->getHTML());
1162 include_once
'./Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1165 $table->parseObjectIds($a_obj_ids);
1167 $this->tpl->setVariable(
'RES_TABLE',$table->getHTML());
1178 if (
$_GET[
"list_obj"] !=
"" && !is_array(
$_POST[
'obj']))
1193 foreach(
$_POST[
'obj'] as $obj_id)
1201 include_once
'./Services/Membership/classes/class.ilParticipants.php';
1211 include_once
'./Services/User/classes/class.ilUserFilter.php';
1216 $members = array_unique((
array) $members);
1219 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rep_search_result.html',
'Services/Search');
1247 if($a_data[
'type'] ==
'usr')
1249 if($a_data[
'obj_id'] == ANONYMOUS_USER_ID)
1264 $this->object_selection = (bool)$a_value;
1274 if (
$_GET[
"list_obj"] !=
"" && !is_array(
$_POST[
'obj']))
1285 $this->ctrl->setParameter($this->callback[
"class"],
"obj", implode(
";",
$_POST[
"obj"]));
1286 $this->ctrl->redirect($this->callback[
"class"], $this->callback[
"method"]);
1296 $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
__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.
Add rich text string
The name of the decorator.
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.
static _getUserSearchInstance($query_parser)
get reference of ilLikeUserSearch
static encode($mixed, $suppress_native=false)
showSearchCourseTable($a_obj_ids)
__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.
initFormSearch(ilObjUser $user=NULL)
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.
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
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)