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");
81 $this->lng->loadLanguageModule(
'search');
82 $this->lng->loadLanguageModule(
'crs');
84 $this->
setTitle($this->lng->txt(
'add_members_header'));
90 $this->result_obj->setMaxHits(1000000);
114 $this->search_title = $a_title;
132 $this->searchable_check = $a_status;
178 $ilToolbar = $DIC[
'ilToolbar'];
181 $tree = $DIC[
'tree'];
184 $toolbar = $ilToolbar;
188 if (!isset($a_options[
'auto_complete_name'])) {
189 $a_options[
'auto_complete_name'] =
$lng->txt(
'obj_user');
191 if (!isset($a_options[
'auto_complete_size'])) {
192 $a_options[
'auto_complete_size'] = 15;
194 if (!isset($a_options[
'submit_name'])) {
195 $a_options[
'submit_name'] =
$lng->txt(
'btn_add');
197 if (!isset($a_options[
'user_type_default'])) {
198 $a_options[
'user_type_default'] = null;
201 $ajax_url =
$ilCtrl->getLinkTargetByClass(
202 array(get_class($parent_object),
'ilRepositorySearchGUI'),
203 'doUserAutoComplete',
209 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
210 $ul =
new ilTextInputGUI($a_options[
'auto_complete_name'],
'user_login');
211 $ul->setDataSource($ajax_url);
212 $ul->setSize($a_options[
'auto_complete_size']);
214 $toolbar->addInputItem($ul,
true);
216 $toolbar->addStickyItem($ul,
true);
219 if (count((array) $a_options[
'user_type'])) {
220 include_once
'./Services/Form/classes/class.ilSelectInputGUI.php';
222 $si->setOptions($a_options[
'user_type']);
223 $si->setValue($a_options[
'user_type_default']);
225 $toolbar->addInputItem(
$si);
227 $toolbar->addStickyItem(
$si);
231 include_once
'./Services/User/classes/class.ilUserClipboard.php';
233 if ($clip->hasContent()) {
234 include_once
'./Services/UIComponent/SplitButton/classes/class.ilSplitButtonGUI.php';
237 include_once
'./Services/UIComponent/Button/classes/class.ilLinkButton.php';
239 $add_button->setCaption($a_options[
'submit_name'],
false);
240 $add_button->setCommand(
'addUserFromAutoComplete');
242 $action_button->setDefaultButton($add_button);
244 include_once
'./Services/UIComponent/Button/classes/class.ilLinkButton.php';
246 $clip_button->addCSSClass(
'btn btndefault');
247 $GLOBALS[
'DIC']->language()->loadLanguageModule(
'user');
248 $clip_button->setCaption(
$GLOBALS[
'DIC']->
language()->txt(
'clipboard_add_from_btn'),
false);
249 $clip_button->setCommand(
'showClipboard');
253 $toolbar->addButtonInstance($action_button);
255 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
257 $button->setCaption($a_options[
'submit_name'],
false);
258 $button->setCommand(
'addUserFromAutoComplete');
260 $toolbar->addButtonInstance($button);
262 $toolbar->addStickyItem($button);
266 if ((
bool) $a_options[
'add_search'] ||
267 is_numeric($a_options[
'add_from_container'])) {
268 $lng->loadLanguageModule(
"search");
270 $toolbar->addSeparator();
272 if ((
bool) $a_options[
'add_search']) {
273 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
275 $button->setCaption(
"search_users");
276 $button->setUrl(
$ilCtrl->getLinkTargetByClass(
'ilRepositorySearchGUI',
''));
277 $toolbar->addButtonInstance($button);
280 if (is_numeric($a_options[
'add_from_container'])) {
281 $parent_ref_id = (int) $a_options[
'add_from_container'];
282 $parent_container_ref_id =
$tree->checkForParentType($parent_ref_id,
"grp");
283 $parent_container_type =
"grp";
284 if (!$parent_container_ref_id) {
285 $parent_container_ref_id =
$tree->checkForParentType($parent_ref_id,
"crs");
286 $parent_container_type =
"crs";
288 if ($parent_container_ref_id) {
289 if ((
bool) $a_options[
'add_search']) {
290 $toolbar->addSpacer();
295 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
297 $button->setCaption(
"search_add_members_from_container_" . $parent_container_type);
298 $button->setUrl(
$ilCtrl->getLinkTargetByClass(array(get_class($parent_object),
'ilRepositorySearchGUI'),
'listUsers'));
299 $toolbar->addButtonInstance($button);
304 $toolbar->setFormAction(
307 get_class($parent_object),
308 'ilRepositorySearchGUI')
321 if (
$GLOBALS[
'DIC'][
'ilUser']->getId() == ANONYMOUS_USER_ID) {
322 include_once
'./Services/JSON/classes/class.ilJsonUtil.php';
328 if (!isset(
$_GET[
'autoCompleteField'])) {
329 $a_fields = array(
'login',
'firstname',
'lastname',
'email');
330 $result_field =
'login';
332 $a_fields = array((
string)
$_GET[
'autoCompleteField']);
333 $result_field = (string) $_GET[
'autoCompleteField'];
336 include_once
'./Services/User/classes/class.ilUserAutoComplete.php';
340 if (($_REQUEST[
'fetchall'])) {
344 $auto->setMoreLinkAvailable(
true);
345 $auto->setSearchFields($a_fields);
346 $auto->setResultField($result_field);
347 $auto->enableFieldSearchableCheck(
true);
349 if (is_callable($this->user_filter)) {
350 $auto->addUserAccessFilterCallable($this->user_filter);
353 echo $auto->getList($_REQUEST[
'term']);
364 $_SESSION[
'search'][
'string'] = $this->
string = $a_str;
368 return $this->string;
379 $rbacsystem = $DIC[
'rbacsystem'];
381 $next_class = $this->ctrl->getNextClass($this);
382 $cmd = $this->ctrl->getCmd();
384 $this->ctrl->setReturn($this,
'');
386 switch ($next_class) {
407 $this->ctrl->returnToParent($this);
422 $class = $this->callback[
'class'];
423 $method = $this->callback[
'method'];
427 $class->$method((array)
$_POST[
'user']);
437 $class = $this->callback[
'class'];
438 $method = $this->callback[
'method'];
445 $user_ids[] = $user_id;
449 $user_type = isset($_REQUEST[
'user_type']) ? $_REQUEST[
'user_type'] : 0;
451 if (!$class->$method($user_ids, $user_type)) {
452 $GLOBALS[
'DIC'][
'ilCtrl']->returnToParent($this);
458 $GLOBALS[
'DIC'][
'ilCtrl']->setParameter($this,
'user_type', (
int) $_REQUEST[
'user_type']);
462 $GLOBALS[
'DIC'][
'ilTabs']->clearTargets();
463 $GLOBALS[
'DIC'][
'ilTabs']->setBackTarget(
464 $GLOBALS[
'DIC'][
'lng']->txt(
'back'),
465 $GLOBALS[
'DIC'][
'ilCtrl']->getParentReturn($this)
468 include_once
'./Services/User/classes/class.ilUserClipboardTableGUI.php';
470 $clip->setFormAction(
$GLOBALS[
'DIC'][
'ilCtrl']->getFormAction($this));
474 $GLOBALS[
'DIC'][
'tpl']->setContent($clip->getHTML());
482 $GLOBALS[
'DIC'][
'ilCtrl']->setParameter($this,
'user_type', (
int) $_REQUEST[
'user_type']);
486 $GLOBALS[
'DIC'][
'ilCtrl']->redirect($this,
'showClipboard');
488 $class = $this->callback[
'class'];
489 $method = $this->callback[
'method'];
490 $user_type = isset($_REQUEST[
'user_type']) ? $_REQUEST[
'user_type'] : 0;
492 if (!$class->$method(
$users, $user_type)) {
493 $GLOBALS[
'DIC'][
'ilCtrl']->returnToParent($this);
502 $GLOBALS[
'DIC'][
'ilCtrl']->setParameter($this,
'user_type', (
int) $_REQUEST[
'user_type']);
506 $GLOBALS[
'DIC'][
'ilCtrl']->redirect($this,
'showClipboard');
509 include_once
'./Services/User/classes/class.ilUserClipboard.php';
514 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
515 $this->ctrl->redirect($this,
'showClipboard');
523 include_once
'./Services/User/classes/class.ilUserClipboard.php';
528 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
529 $this->ctrl->returnToParent($this);
537 $class = $this->callback[
'class'];
538 $method = $this->callback[
'method'];
541 if (!$class->$method((array)
$_POST[
'user'], $_POST[
'selectedCommand'])) {
546 public function setCallback(&$class, $method, $a_add_options = array())
548 $this->callback = array(
'class' => $class,
'method' => $method);
549 $this->add_options = $a_add_options ? $a_add_options : array();
567 $this->tpl->setContent($this->form->getHTML());
575 $selected = (int) $_REQUEST[
'selected_id'];
577 #include_once './Services/Object/classes/class.ilObjectFactory.php'; 578 #$factory = new ilObjectFactory(); 579 #$user = $factory->getInstanceByObjId($selected); 581 #$this->initFormSearch($user); 582 #$this->tpl->setContent($this->form->getHTML()); 584 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rep_search_result.html',
'Services/Search');
595 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
598 $this->form->setFormAction($this->ctrl->getFormAction($this,
'showSearch'));
599 $this->form->setTitle($this->
getTitle());
600 $this->form->addCommandButton(
'performSearch', $this->lng->txt(
'search'));
601 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
605 $kind->
setValue($this->search_type);
606 $this->form->addItem($kind);
612 include_once
'Services/Search/classes/class.ilUserSearchOptions.php';
614 switch (
$info[
'type']) {
619 $sel->setOptions(
$info[
'values']);
627 if (isset(
$info[
'autoComplete'])
and $info[
'autoComplete']) {
628 $ilCtrl->setParameterByClass(get_class($this),
'autoCompleteField', $info[
'db']);
629 $ul =
new ilTextInputGUI($info[
'lang'],
"rep_query[usr][" . $info[
'db'] .
"]");
630 $ul->setDataSourceSubmitOnSelection(
true);
631 $ul->setDataSourceSubmitUrl(
632 $this->ctrl->getLinkTarget(
634 'showSearchSelected',
640 $ul->setDataSource(
$ilCtrl->getLinkTarget(
642 "doUserAutoComplete",
647 $ul->setMaxLength(120);
650 switch ($info[
'db']) {
652 $ul->setValue(
$user->getFirstname());
655 $ul->setValue(
$user->getLastname());
658 $ul->setValue(
$user->getLogin());
669 $txt->setMaxLength(120);
680 $roles =
new ilRadioOption($this->lng->txt(
'search_for_role_members'),
'role');
681 $role =
new ilTextInputGUI($this->lng->txt(
'search_role_title'),
'rep_query[role][title]');
683 $role->setMaxLength(120);
685 $kind->addOption($roles);
688 $groups =
new ilRadioOption($this->lng->txt(
'search_for_crs_members'),
'crs');
689 $group =
new ilTextInputGUI($this->lng->txt(
'search_crs_title'),
'rep_query[crs][title]');
691 $group->setMaxLength(120);
693 $kind->addOption($groups);
696 $groups =
new ilRadioOption($this->lng->txt(
'search_for_grp_members'),
'grp');
697 $group =
new ilTextInputGUI($this->lng->txt(
'search_grp_title'),
'rep_query[grp][title]');
699 $group->setMaxLength(120);
701 $kind->addOption($groups);
727 $found_query =
false;
728 foreach ((array)
$_POST[
'rep_query'][
$_POST[
'search_for']] as $field => $value) {
741 if (
$_POST[
'cmd'][
'performSearch']) {
745 switch ($this->search_type) {
766 $this->result_obj->setRequiredPermission(
'read');
767 $this->result_obj->addObserver($this,
'searchResultFilterListener');
771 if ($this->search_type ==
'usr') {
773 if (is_callable($this->user_filter,
true, $callable_name)) {
774 $result_ids = call_user_func_array($this->user_filter, [$this->result_obj->getResultIds()]);
776 $result_ids = $this->result_obj->getResultIds();
779 include_once
'./Services/User/classes/class.ilUserFilter.php';
780 $this->search_results = array_intersect(
785 $this->search_results = array();
786 foreach ((array) $this->result_obj->getResults() as
$res) {
787 $this->search_results[] =
$res[
'obj_id'];
791 if (!count($this->search_results)) {
797 if ($this->result_obj->isLimitReached()) {
798 $message = sprintf($this->lng->txt(
'search_limit_reached'), $this->
settings->getMaxHits());
809 include_once
'Services/Search/classes/class.ilUserSearchOptions.php';
810 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
817 if (!$query_string) {
825 switch ($info[
'type']) {
833 $udf_search->setFields(array(
$name));
834 $result_obj = $udf_search->performSearch();
842 if ($info[
'db'] ==
'org_units') {
844 $result_obj = $user_search->performSearch();
855 $user_search->setFields(array(
$name));
856 $result_obj = $user_search->performSearch();
864 $multi_search->setFields(array(
$name));
865 $result_obj = $multi_search->performSearch();
879 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
881 $query_string =
$_SESSION[
'rep_query'][
'grp'][
'title'];
887 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
889 $object_search->setFilter(array(
'grp'));
901 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
903 $query_string =
$_SESSION[
'rep_query'][
'crs'][
'title'];
909 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
911 $object_search->setFilter(array(
'crs'));
923 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
925 $query_string =
$_SESSION[
'rep_query'][
'role'][
'title'];
932 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
934 $object_search->setFilter(array(
'role'));
949 $query_parser->setMinWordLength(1);
952 if (!(
bool) $a_ignore_length) {
953 $query_parser->setGlobalMinLength(3);
956 $query_parser->parse();
958 if (!$query_parser->validate()) {
959 return $query_parser->getMessage();
961 return $query_parser;
967 if (is_array(
$_POST[
'rep_query'])) {
976 if (
$_POST[
'search_for']) {
985 $this->search_type =
$_SESSION[
'rep_search_type'];
986 #echo $this->search_type; 997 foreach ($this->search_results as
$result) {
1000 if (!
$_SESSION[
'rep_search'][$this->search_type]) {
1012 return $_SESSION[
'rep_search'][
'usr'] = $a_usr_ids;
1014 $_SESSION[
'rep_search'][
'usr'] = array();
1015 foreach ($a_usr_ids as $usr_id) {
1016 $_SESSION[
'rep_search'][
'usr'][] = $usr_id;
1018 return $_SESSION[
'rep_search'][
'usr'] ? array_unique(
$_SESSION[
'rep_search'][
'usr']) : array();
1023 if ($this->stored ==
false) {
1024 $this->result_obj->mergeEntries($new_res);
1025 $this->stored =
true;
1028 $this->result_obj->intersectEntries($new_res);
1039 include_once
'./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1041 $toolbar->addButton(
1042 $this->lng->txt(
'search_new'),
1043 $this->ctrl->getLinkTarget($this,
'showSearch')
1045 $this->tpl->setVariable(
'ACTION_BUTTONS', $toolbar->getHTML());
1051 $f_result = array();
1053 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rep_search_result.html',
'Services/Search');
1056 switch ($this->search_type) {
1082 $is_in_admin = ($_REQUEST[
'baseClass'] ==
'ilAdministrationGUI');
1085 $_SESSION[
"usr_search_link"] = $this->ctrl->getLinkTarget($this,
'show');
1088 include_once
'./Services/Search/classes/class.ilRepositoryUserResultTableGUI.php';
1091 if (count($this->add_options)) {
1092 $table->addMultiItemSelectionButton(
1095 'handleMultiCommand',
1096 $this->lng->txt(
'execute')
1099 $table->addMultiCommand(
'addUser', $this->lng->txt(
'btn_add'));
1102 $table->parseUserIds($a_usr_ids);
1104 $this->tpl->setVariable(
'RES_TABLE',
$table->getHTML());
1114 include_once
'./Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1117 $table->parseObjectIds($a_obj_ids);
1119 $this->tpl->setVariable(
'RES_TABLE',
$table->getHTML());
1129 include_once
'./Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1132 $table->parseObjectIds($a_obj_ids);
1134 $this->tpl->setVariable(
'RES_TABLE',
$table->getHTML());
1144 include_once
'./Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1147 $table->parseObjectIds($a_obj_ids);
1149 $this->tpl->setVariable(
'RES_TABLE',
$table->getHTML());
1160 if (
$_GET[
"list_obj"] !=
"" && !is_array(
$_POST[
'obj'])) {
1173 foreach (
$_POST[
'obj'] as $obj_id) {
1179 include_once
'./Services/Membership/classes/class.ilParticipants.php';
1182 if (is_callable($this->user_filter)) {
1183 $part = call_user_func_array(
1193 $members = array_merge((array) $members, $part);
1200 $rbacreview = $DIC[
'rbacreview'];
1203 if (is_callable($this->user_filter)) {
1204 $assigned = call_user_func_array(
1207 $rbacreview->assignedUsers($obj_id)
1211 $assigned = $rbacreview->assignedUsers($obj_id);
1218 $members = array_unique((array) $members);
1221 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.rep_search_result.html',
'Services/Search');
1249 if ($a_data[
'type'] ==
'usr') {
1250 if ($a_data[
'obj_id'] == ANONYMOUS_USER_ID) {
1264 $this->object_selection = (bool) $a_value;
1274 if (
$_GET[
"list_obj"] !=
"" && !is_array(
$_POST[
'obj'])) {
1283 $this->ctrl->setParameter($this->callback[
"class"],
"obj", implode(
";",
$_POST[
"obj"]));
1284 $this->ctrl->redirect($this->callback[
"class"], $this->callback[
"method"]);
1294 $this->user_limitations = (bool) $a_limitations;
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)
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.
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
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static _getSearchableFieldsInfo($a_admin=false)
setPrivacyMode($privacy_mode)