ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilRepositorySearchGUI Class Reference
+ Inheritance diagram for ilRepositorySearchGUI:
+ Collaboration diagram for ilRepositorySearchGUI:

Public Member Functions

 __construct ()
 Constructor public. More...
 
 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 ($a_title)
 Set form title. More...
 
 getTitle ()
 Get search form title. More...
 
 enableSearchableCheck ($a_status)
 En/disable the validation of the searchable flag. More...
 
 isSearchableCheckEnabled ()
 
 setPrivacyMode ($privacy_mode)
 
 getPrivacyMode ()
 
 setString ($a_str)
 Set/get search string public. More...
 
 getString ()
 
 executeCommand ()
 Control public. More...
 
 __clearSession ()
 
 cancel ()
 
 start ()
 
 addRole ()
 
 addUser ()
 
 setCallback (&$class, $method, $a_add_options=array(), $default_option='')
 
 setRoleCallback (&$class, $method, $a_add_options=array(), $default_option='')
 
 setPermissionQueryCallback ($class, $method)
 Set callback method for user permission access queries. More...
 
 showSearch ()
 
 showSearchSelected ()
 submit from autocomplete More...
 
 initFormSearch (ilObjUser $user=null)
 
 show ()
 
 appendSearch ()
 
 performSearch ()
 Perform a search. More...
 
 __performUserSearch ()
 
 __performGroupSearch ()
 Search groups. More...
 
 __performRoleSearch ()
 Search roles. More...
 
__parseQueryString ($a_string, $a_combination_or=true, $a_ignore_length=false)
 parse query string, using query parser instance More...
 
 __loadQueries ()
 
 __setSearchType ()
 
 __updateResults ()
 
 __appendToStoredResults ($a_usr_ids)
 
 __storeEntries (&$new_res)
 
 showSearchResults ()
 
 searchResultFilterListener ($a_ref_id, $a_data)
 Listener called from ilSearchResult Id is obj_id for role, usr Id is ref_id for crs grp. More...
 
 allowObjectSelection ($a_value=false)
 Toggle object selection status. More...
 
 setUserLimitations ($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 ($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
 fill toolbar with More...
 

Data Fields

 $search_type = 'usr'
 

Protected Member Functions

 doUserAutoComplete ()
 Do auto completion. More...
 
 addUserFromAutoComplete ()
 Add user from auto complete input. More...
 
 showClipboard ()
 
 addFromClipboard ()
 add users from clipboard More...
 
 removeFromClipboard ()
 Remove from clipboard. More...
 
 emptyClipboard ()
 Remove from clipboard. More...
 
 handleMultiCommand ()
 Handle multi command. More...
 
 __performCourseSearch ()
 Search courses. More...
 
 addNewSearchButton ()
 Add new search button. More...
 
 showSearchUserTable ($a_usr_ids, $a_parent_cmd)
 Show usr table. More...
 
 showSearchRoleTable ($a_obj_ids)
 Show usr table. More...
 
 showSearchGroupTable ($a_obj_ids)
 
 showSearchCourseTable ($a_obj_ids)
 
 listUsers ()
 List users of course/group/roles. More...
 
 storedUserList ()
 Called from table sort. More...
 
 selectObject ()
 Return selection of course/group/roles to calling script. More...
 

Protected Attributes

 $add_options = array()
 
 $default_option = ''
 
 $object_selection = false
 
 $searchable_check = true
 
 $search_title = ''
 
 $user_limitations = true
 
 $user_filter = null
 
 $tree
 
 $ui_renderer
 
 $ui_factory
 

Private Attributes

 $search_results = array()
 
 $privacy_mode = ilUserAutoComplete::PRIVACY_MODE_IGNORE_USER_SETTING
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilRepositorySearchGUI::__construct ( )

Constructor public.

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

References $DIC, $lng, $tpl, $tree, $ui_factory, $ui_renderer, __loadQueries(), __setSearchType(), settings(), and setTitle().

86  {
87  global $DIC;
88 
89  $ilCtrl = $DIC['ilCtrl'];
90  $tpl = $DIC['tpl'];
91  $lng = $DIC['lng'];
92  $tree = $DIC['tree'];
93  $ui_renderer = $DIC["ui.renderer"];
94  $ui_factory = $DIC["ui.factory"];
95 
96  $this->ctrl = $ilCtrl;
97  $this->tpl = $tpl;
98  $this->tree = $tree;
99  $this->ui_renderer = $ui_renderer;
100  $this->ui_factory = $ui_factory;
101 
102  $this->lng = $lng;
103  $this->lng->loadLanguageModule('search');
104  $this->lng->loadLanguageModule('crs');
105 
106  $this->setTitle($this->lng->txt('add_members_header'));
107 
108  $this->__setSearchType();
109  $this->__loadQueries();
110 
111  $this->result_obj = new ilSearchResult();
112  $this->result_obj->setMaxHits(1000000);
113  $this->settings = new ilSearchSettings();
114  }
setTitle($a_title)
Set form title.
settings()
Definition: settings.php:2
$lng
global $DIC
Definition: goto.php:24
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

Member Function Documentation

◆ __appendToStoredResults()

ilRepositorySearchGUI::__appendToStoredResults (   $a_usr_ids)

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

References $_SESSION.

Referenced by listUsers().

1087  {
1088  if (!$_SESSION['search_append']) {
1089  return $_SESSION['rep_search']['usr'] = $a_usr_ids;
1090  }
1091  $_SESSION['rep_search']['usr'] = array();
1092  foreach ($a_usr_ids as $usr_id) {
1093  $_SESSION['rep_search']['usr'][] = $usr_id;
1094  }
1095  return $_SESSION['rep_search']['usr'] ? array_unique($_SESSION['rep_search']['usr']) : array();
1096  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ __clearSession()

ilRepositorySearchGUI::__clearSession ( )

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

References $_SESSION.

Referenced by start().

420  {
421  unset($_SESSION['rep_search']);
422  unset($_SESSION['append_results']);
423  unset($_SESSION['rep_query']);
424  unset($_SESSION['rep_search_type']);
425  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ __loadQueries()

ilRepositorySearchGUI::__loadQueries ( )

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

References $_POST, and $_SESSION.

Referenced by __construct().

1043  {
1044  if (is_array($_POST['rep_query'])) {
1045  $_SESSION['rep_query'] = $_POST['rep_query'];
1046  }
1047  }
$_SESSION["AccountId"]
$_POST["username"]
+ Here is the caller graph for this function:

◆ __parseQueryString()

& ilRepositorySearchGUI::__parseQueryString (   $a_string,
  $a_combination_or = true,
  $a_ignore_length = false 
)

parse query string, using query parser instance

Returns
object of query parser or error message if an error occured public

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

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

Referenced by __performCourseSearch(), __performGroupSearch(), __performRoleSearch(), and __performUserSearch().

1023  {
1024  $query_parser = new ilQueryParser(ilUtil::stripSlashes($a_string));
1025  $query_parser->setCombination($a_combination_or ? QP_COMBINATION_OR : QP_COMBINATION_AND);
1026  $query_parser->setMinWordLength(1);
1027 
1028  // #17502
1029  if (!(bool) $a_ignore_length) {
1030  $query_parser->setGlobalMinLength(3); // #14768
1031  }
1032 
1033  $query_parser->parse();
1034 
1035  if (!$query_parser->validate()) {
1036  return $query_parser->getMessage();
1037  }
1038  return $query_parser;
1039  }
const QP_COMBINATION_OR
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const QP_COMBINATION_AND
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __performCourseSearch()

ilRepositorySearchGUI::__performCourseSearch ( )
protected

Search courses.

Returns

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

References $_SESSION, __parseQueryString(), __storeEntries(), and ilUtil\sendInfo().

Referenced by performSearch().

977  {
978  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
979 
980  $query_string = $_SESSION['rep_query']['crs']['title'];
981  if (!is_object($query_parser = $this->__parseQueryString($query_string))) {
982  ilUtil::sendInfo($query_parser, true);
983  return false;
984  }
985 
986  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
987  $object_search = new ilLikeObjectSearch($query_parser);
988  $object_search->setFilter(array('crs'));
989  $this->__storeEntries($object_search->performSearch());
990 
991  return true;
992  }
$_SESSION["AccountId"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
& __parseQueryString($a_string, $a_combination_or=true, $a_ignore_length=false)
parse query string, using query parser instance
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __performGroupSearch()

ilRepositorySearchGUI::__performGroupSearch ( )

Search groups.

Returns

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

References $_SESSION, __parseQueryString(), __storeEntries(), and ilUtil\sendInfo().

Referenced by performSearch().

955  {
956  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
957 
958  $query_string = $_SESSION['rep_query']['grp']['title'];
959  if (!is_object($query_parser = $this->__parseQueryString($query_string))) {
960  ilUtil::sendInfo($query_parser, true);
961  return false;
962  }
963 
964  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
965  $object_search = new ilLikeObjectSearch($query_parser);
966  $object_search->setFilter(array('grp'));
967  $this->__storeEntries($object_search->performSearch());
968 
969  return true;
970  }
$_SESSION["AccountId"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
& __parseQueryString($a_string, $a_combination_or=true, $a_ignore_length=false)
parse query string, using query parser instance
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __performRoleSearch()

ilRepositorySearchGUI::__performRoleSearch ( )

Search roles.

Returns

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

References $_SESSION, __parseQueryString(), __storeEntries(), and ilUtil\sendInfo().

Referenced by performSearch().

999  {
1000  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
1001 
1002  $query_string = $_SESSION['rep_query']['role']['title'];
1003  if (!is_object($query_parser = $this->__parseQueryString($query_string))) {
1004  ilUtil::sendInfo($query_parser, true);
1005  return false;
1006  }
1007 
1008  // Perform like search
1009  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
1010  $object_search = new ilLikeObjectSearch($query_parser);
1011  $object_search->setFilter(array('role'));
1012  $this->__storeEntries($object_search->performSearch());
1013 
1014  return true;
1015  }
$_SESSION["AccountId"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
& __parseQueryString($a_string, $a_combination_or=true, $a_ignore_length=false)
parse query string, using query parser instance
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __performUserSearch()

ilRepositorySearchGUI::__performUserSearch ( )

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

References $_SESSION, $name, __parseQueryString(), __storeEntries(), ilUserSearchOptions\_getSearchableFieldsInfo(), ilObjectSearchFactory\_getUserDefinedFieldSearchInstance(), ilObjectSearchFactory\_getUserSearchInstance(), FIELD_TYPE_MULTI, FIELD_TYPE_SELECT, FIELD_TYPE_TEXT, FIELD_TYPE_UDF_SELECT, FIELD_TYPE_UDF_TEXT, ilObjectSearchFactory\getUserMultiFieldSearchInstance(), ilObjectSearchFactory\getUserOrgUnitAssignmentInstance(), isSearchableCheckEnabled(), and ilUtil\sendInfo().

Referenced by performSearch().

885  {
886  include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
887  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
888 
890  $name = $info['db'];
891  $query_string = $_SESSION['rep_query']['usr'][$name];
892 
893  // continue if no query string is given
894  if (!$query_string) {
895  continue;
896  }
897 
898  if (!is_object($query_parser = $this->__parseQueryString($query_string, true, ($info['type'] == FIELD_TYPE_SELECT)))) {
899  ilUtil::sendInfo($query_parser);
900  return false;
901  }
902  switch ($info['type']) {
904  // Do a phrase query for select fields
905  $query_parser = $this->__parseQueryString($query_string);
906 
907  // no break
908  case FIELD_TYPE_UDF_TEXT:
910  $udf_search->setFields(array($name));
911  $result_obj = $udf_search->performSearch();
912 
913  // Store entries
914  $this->__storeEntries($result_obj);
915  break;
916 
917  case FIELD_TYPE_SELECT:
918 
919  if ($info['db'] == 'org_units') {
920  $user_search = ilObjectSearchFactory::getUserOrgUnitAssignmentInstance($query_parser);
921  $result_obj = $user_search->performSearch();
922  $this->__storeEntries($result_obj);
923  break;
924  }
925 
926  // Do a phrase query for select fields
927  $query_parser = $this->__parseQueryString($query_string, true, true);
928 
929  // no break
930  case FIELD_TYPE_TEXT:
931  $user_search = &ilObjectSearchFactory::_getUserSearchInstance($query_parser);
932  $user_search->setFields(array($name));
933  $result_obj = $user_search->performSearch();
934 
935  // store entries
936  $this->__storeEntries($result_obj);
937  break;
938 
939  case FIELD_TYPE_MULTI:
940  $multi_search = ilObjectSearchFactory::getUserMultiFieldSearchInstance($query_parser);
941  $multi_search->setFields(array($name));
942  $result_obj = $multi_search->performSearch();
943  $this->__storeEntries($result_obj);
944  break;
945 
946  }
947  }
948  }
$_SESSION["AccountId"]
const FIELD_TYPE_MULTI
const FIELD_TYPE_UDF_TEXT
const FIELD_TYPE_SELECT
static getUserMultiFieldSearchInstance($query_parser)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if($format !==null) $name
Definition: metadata.php:230
static _getUserSearchInstance($query_parser)
get reference of ilLikeUserSearch
const FIELD_TYPE_UDF_SELECT
Class ilUserSearchOptions.
& __parseQueryString($a_string, $a_combination_or=true, $a_ignore_length=false)
parse query string, using query parser instance
const FIELD_TYPE_TEXT
static getUserOrgUnitAssignmentInstance($query_parser)
get orgunit search instance
static _getUserDefinedFieldSearchInstance($query_parser)
get reference of ilLikeUserDefinedFieldSearch
static _getSearchableFieldsInfo($a_admin=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setSearchType()

ilRepositorySearchGUI::__setSearchType ( )

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

References $_POST, and $_SESSION.

Referenced by __construct().

1051  {
1052  // Update search type. Default to user search
1053  if ($_POST['search_for']) {
1054  #echo 1;
1055  $_SESSION['rep_search_type'] = $_POST['search_for'];
1056  }
1057  if (!$_POST['search_for'] and !$_SESSION['rep_search_type']) {
1058  #echo 2;
1059  $_SESSION['rep_search_type'] = 'usr';
1060  }
1061 
1062  $this->search_type = $_SESSION['rep_search_type'];
1063  #echo $this->search_type;
1064 
1065  return true;
1066  }
$_SESSION["AccountId"]
$_POST["username"]
+ Here is the caller graph for this function:

◆ __storeEntries()

ilRepositorySearchGUI::__storeEntries ( $new_res)

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

Referenced by __performCourseSearch(), __performGroupSearch(), __performRoleSearch(), and __performUserSearch().

1099  {
1100  if ($this->stored == false) {
1101  $this->result_obj->mergeEntries($new_res);
1102  $this->stored = true;
1103  return true;
1104  } else {
1105  $this->result_obj->intersectEntries($new_res);
1106  return true;
1107  }
1108  }
+ Here is the caller graph for this function:

◆ __updateResults()

ilRepositorySearchGUI::__updateResults ( )

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

References $_SESSION, $result, and $search_type.

Referenced by performSearch().

1070  {
1071  if (!$_SESSION['search_append']) {
1072  $_SESSION['rep_search'] = array();
1073  }
1074  foreach ($this->search_results as $result) {
1075  $_SESSION['rep_search'][$this->search_type][] = $result;
1076  }
1077  if (!$_SESSION['rep_search'][$this->search_type]) {
1078  $_SESSION['rep_search'][$this->search_type] = array();
1079  } else {
1080  // remove duplicate entries
1081  $_SESSION['rep_search'][$this->search_type] = array_unique($_SESSION['rep_search'][$this->search_type]);
1082  }
1083  return true;
1084  }
$_SESSION["AccountId"]
$result
+ Here is the caller graph for this function:

◆ addFromClipboard()

ilRepositorySearchGUI::addFromClipboard ( )
protected

add users from clipboard

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

References $_POST, $GLOBALS, and ilUtil\sendFailure().

528  {
529  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'user_type', (int) $_REQUEST['user_type']);
530  $users = (array) $_POST['uids'];
531  if (!count($users)) {
532  ilUtil::sendFailure($this->lng->txt('select_one'), true);
533  $GLOBALS['DIC']['ilCtrl']->redirect($this, 'showClipboard');
534  }
535  $class = $this->callback['class'];
536  $method = $this->callback['method'];
537  $user_type = isset($_REQUEST['user_type']) ? $_REQUEST['user_type'] : 0;
538 
539  if (!$class->$method($users, $user_type)) {
540  $GLOBALS['DIC']['ilCtrl']->returnToParent($this);
541  }
542  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ addNewSearchButton()

ilRepositorySearchGUI::addNewSearchButton ( )
protected

Add new search button.

Returns

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

Referenced by listUsers(), showSearchResults(), and showSearchSelected().

1115  {
1116  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1117  $toolbar = new ilToolbarGUI();
1118  $toolbar->addButton(
1119  $this->lng->txt('search_new'),
1120  $this->ctrl->getLinkTarget($this, 'showSearch')
1121  );
1122  $this->tpl->setVariable('ACTION_BUTTONS', $toolbar->getHTML());
1123  }
+ Here is the caller graph for this function:

◆ addRole()

ilRepositorySearchGUI::addRole ( )

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

References $_POST, ilObject\_getAllReferences(), ilObject\_lookupType(), ilParticipants\getDefaultMemberRole(), and showSearchResults().

443  {
444  $class = $this->role_callback['class'];
445  $method = $this->role_callback['method'];
446 
447  // call callback if that function does give a return value => show error message
448  // listener redirects if everything is ok.
449  $obj_ids = (array) $_POST['obj'];
450  $role_ids = array();
451  foreach ($obj_ids as $id) {
452  $obj_type = ilObject::_lookupType($id);
453  if ($obj_type == "crs" || $obj_type == "grp") {
454  $refs = ilObject::_getAllReferences($id);
455  $ref_id = end($refs);
457  $role_ids[] = $mem_role;
458  } else {
459  $role_ids[] = $id;
460  }
461  }
462  $class->$method((array) $role_ids);
463 
464  $this->showSearchResults();
465  }
static getDefaultMemberRole($a_ref_id)
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
$_POST["username"]
+ Here is the call graph for this function:

◆ addUser()

ilRepositorySearchGUI::addUser ( )

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

References $_POST, and showSearchResults().

468  {
469  $class = $this->callback['class'];
470  $method = $this->callback['method'];
471 
472  // call callback if that function does give a return value => show error message
473  // listener redirects if everything is ok.
474  $class->$method((array) $_POST['user']);
475 
476  $this->showSearchResults();
477  }
$_POST["username"]
+ 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 }.

Parameters
callable$user_filter

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

References $user_filter.

126  {
127  $this->user_filter = $user_filter;
128  }

◆ addUserFromAutoComplete()

ilRepositorySearchGUI::addUserFromAutoComplete ( )
protected

Add user from auto complete input.

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

References $_POST, $GLOBALS, and ilObjUser\_lookupId().

483  {
484  $class = $this->callback['class'];
485  $method = $this->callback['method'];
486 
487  $users = explode(',', $_POST['user_login']);
488  $user_ids = array();
489  foreach ($users as $user) {
490  $user_id = ilObjUser::_lookupId($user);
491  if ($user_id) {
492  $user_ids[] = $user_id;
493  }
494  }
495 
496  $user_type = isset($_REQUEST['user_type']) ? $_REQUEST['user_type'] : 0;
497 
498  if (!$class->$method($user_ids, $user_type)) {
499  $GLOBALS['DIC']['ilCtrl']->returnToParent($this);
500  }
501  }
static _lookupId($a_user_str)
Lookup id by login.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_POST["username"]
+ Here is the call graph for this function:

◆ allowObjectSelection()

ilRepositorySearchGUI::allowObjectSelection (   $a_value = false)

Toggle object selection status.

Parameters
bool$a_value

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

1358  {
1359  $this->object_selection = (bool) $a_value;
1360  }

◆ appendSearch()

ilRepositorySearchGUI::appendSearch ( )

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

References $_SESSION, and performSearch().

778  {
779  $_SESSION['search_append'] = true;
780  $this->performSearch();
781  }
$_SESSION["AccountId"]
+ Here is the call graph for this function:

◆ cancel()

ilRepositorySearchGUI::cancel ( )

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

428  {
429  $this->ctrl->returnToParent($this);
430  }

◆ doUserAutoComplete()

ilRepositorySearchGUI::doUserAutoComplete ( )
protected

Do auto completion.

Returns
void

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

References $_GET, $GLOBALS, ANONYMOUS_USER_ID, ilJsonUtil\encode(), exit, getPrivacyMode(), getUserLimitations(), and ilUserAutoComplete\MAX_ENTRIES.

341  {
342  // hide anonymout request
343  if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) {
344  include_once './Services/JSON/classes/class.ilJsonUtil.php';
345  return ilJsonUtil::encode(new stdClass());
346  exit;
347  }
348 
349 
350  if (!isset($_GET['autoCompleteField'])) {
351  $a_fields = array('login','firstname','lastname','email');
352  $result_field = 'login';
353  } else {
354  $a_fields = array((string) $_GET['autoCompleteField']);
355  $result_field = (string) $_GET['autoCompleteField'];
356  }
357 
358  include_once './Services/User/classes/class.ilUserAutoComplete.php';
359  $auto = new ilUserAutoComplete();
360  $auto->setPrivacyMode($this->getPrivacyMode());
361 
362  if (($_REQUEST['fetchall'])) {
363  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
364  }
365 
366  $auto->setMoreLinkAvailable(true);
367  $auto->setSearchFields($a_fields);
368  $auto->setResultField($result_field);
369  $auto->enableFieldSearchableCheck(true);
370  $auto->setUserLimitations($this->getUserLimitations());
371  if (is_callable($this->user_filter)) { // #0024249
372  $auto->addUserAccessFilterCallable($this->user_filter);
373  }
374 
375  echo $auto->getList($_REQUEST['term']);
376  exit();
377  }
exit
Definition: login.php:29
const ANONYMOUS_USER_ID
Definition: constants.php:25
$_GET["client_id"]
Auto completion class for user lists.
static encode($mixed, $suppress_native=false)
getUserLimitations()
allow user limitations like inactive and access limitations
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

◆ emptyClipboard()

ilRepositorySearchGUI::emptyClipboard ( )
protected

Remove from clipboard.

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

References $GLOBALS, and ilUserClipboard\getInstance().

569  {
570  include_once './Services/User/classes/class.ilUserClipboard.php';
571  $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
572  $clip->clear();
573  $clip->save();
574 
575  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
576  $this->ctrl->returnToParent($this);
577  }
static getInstance($a_usr_id)
Get singelton instance.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

◆ enableSearchableCheck()

ilRepositorySearchGUI::enableSearchableCheck (   $a_status)

En/disable the validation of the searchable flag.

Parameters
bool$a_status

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

153  {
154  $this->searchable_check = $a_status;
155  }

◆ executeCommand()

ilRepositorySearchGUI::executeCommand ( )

Control public.

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

References $DIC.

398  {
399  global $DIC;
400 
401  $rbacsystem = $DIC['rbacsystem'];
402 
403  $next_class = $this->ctrl->getNextClass($this);
404  $cmd = $this->ctrl->getCmd();
405 
406  $this->ctrl->setReturn($this, '');
407 
408  switch ($next_class) {
409  default:
410  if (!$cmd) {
411  $cmd = "showSearch";
412  }
413  $this->$cmd();
414  break;
415  }
416  return true;
417  }
global $DIC
Definition: goto.php:24

◆ fillAutoCompleteToolbar()

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

fill toolbar with

Parameters
ilToolbarGUI$toolbar
arrayoptions: all are optional e.g. 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') )
Returns
ilToolbarGUI

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

References $DIC, $GLOBALS, $lng, $si, $tree, ilObject\_lookupObjId(), ilSubmitButton\getInstance(), ilLinkButton\getInstance(), ilUserClipboard\getInstance(), ilSplitButtonGUI\getInstance(), and language().

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

197  {
198  global $DIC;
199 
200  $ilToolbar = $DIC['ilToolbar'];
201  $lng = $DIC['lng'];
202  $ilCtrl = $DIC['ilCtrl'];
203  $tree = $DIC['tree'];
204 
205  if (!$toolbar instanceof ilToolbarGUI) {
206  $toolbar = $ilToolbar;
207  }
208 
209  // Fill default options
210  if (!isset($a_options['auto_complete_name'])) {
211  $a_options['auto_complete_name'] = $lng->txt('obj_user');
212  }
213  if (!isset($a_options['auto_complete_size'])) {
214  $a_options['auto_complete_size'] = 15;
215  }
216  if (!isset($a_options['submit_name'])) {
217  $a_options['submit_name'] = $lng->txt('btn_add');
218  }
219  if (!isset($a_options['user_type_default'])) {
220  $a_options['user_type_default'] = null;
221  }
222 
223  $ajax_url = $ilCtrl->getLinkTargetByClass(
224  array(get_class($parent_object),'ilRepositorySearchGUI'),
225  'doUserAutoComplete',
226  '',
227  true,
228  false
229  );
230 
231  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
232  $ul = new ilTextInputGUI($a_options['auto_complete_name'], 'user_login');
233  $ul->setDataSource($ajax_url);
234  $ul->setSize($a_options['auto_complete_size']);
235  if (!$a_sticky) {
236  $toolbar->addInputItem($ul, true);
237  } else {
238  $toolbar->addStickyItem($ul, true);
239  }
240 
241  if (count((array) $a_options['user_type'])) {
242  include_once './Services/Form/classes/class.ilSelectInputGUI.php';
243  $si = new ilSelectInputGUI("", "user_type");
244  $si->setOptions($a_options['user_type']);
245  $si->setValue($a_options['user_type_default']);
246  if (!$a_sticky) {
247  $toolbar->addInputItem($si);
248  } else {
249  $toolbar->addStickyItem($si);
250  }
251  }
252 
253  include_once './Services/User/classes/class.ilUserClipboard.php';
254  $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
255  if ($clip->hasContent()) {
256  include_once './Services/UIComponent/SplitButton/classes/class.ilSplitButtonGUI.php';
257  $action_button = ilSplitButtonGUI::getInstance();
258 
259  include_once './Services/UIComponent/Button/classes/class.ilLinkButton.php';
260  $add_button = ilSubmitButton::getInstance();
261  $add_button->setCaption($a_options['submit_name'], false);
262  $add_button->setCommand('addUserFromAutoComplete');
263 
264  $action_button->setDefaultButton($add_button);
265 
266  include_once './Services/UIComponent/Button/classes/class.ilLinkButton.php';
267  $clip_button = ilSubmitButton::getInstance();
268  $clip_button->addCSSClass('btn btndefault');
269  $GLOBALS['DIC']->language()->loadLanguageModule('user');
270  $clip_button->setCaption($GLOBALS['DIC']->language()->txt('clipboard_add_from_btn'), false);
271  $clip_button->setCommand('showClipboard');
272 
273  $action_button->addMenuItem(new ilButtonToSplitButtonMenuItemAdapter($clip_button));
274 
275  $toolbar->addButtonInstance($action_button);
276  } else {
277  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
278  $button = ilSubmitButton::getInstance();
279  $button->setCaption($a_options['submit_name'], false);
280  $button->setCommand('addUserFromAutoComplete');
281  if (!$a_sticky) {
282  $toolbar->addButtonInstance($button);
283  } else {
284  $toolbar->addStickyItem($button);
285  }
286  }
287 
288  if ((bool) $a_options['add_search'] ||
289  is_numeric($a_options['add_from_container'])) {
290  $lng->loadLanguageModule("search");
291 
292  $toolbar->addSeparator();
293 
294  if ((bool) $a_options['add_search']) {
295  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
296  $button = ilLinkButton::getInstance();
297  $button->setCaption("search_users");
298  $button->setUrl($ilCtrl->getLinkTargetByClass('ilRepositorySearchGUI', ''));
299  $toolbar->addButtonInstance($button);
300  }
301 
302  if (is_numeric($a_options['add_from_container'])) {
303  $parent_ref_id = (int) $a_options['add_from_container'];
304  $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "grp");
305  $parent_container_type = "grp";
306  if (!$parent_container_ref_id) {
307  $parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "crs");
308  $parent_container_type = "crs";
309  }
310  if ($parent_container_ref_id) {
311  if ((bool) $a_options['add_search']) {
312  $toolbar->addSpacer();
313  }
314 
315  $ilCtrl->setParameterByClass('ilRepositorySearchGUI', "list_obj", ilObject::_lookupObjId($parent_container_ref_id));
316 
317  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
318  $button = ilLinkButton::getInstance();
319  $button->setCaption("search_add_members_from_container_" . $parent_container_type);
320  $button->setUrl($ilCtrl->getLinkTargetByClass(array(get_class($parent_object),'ilRepositorySearchGUI'), 'listUsers'));
321  $toolbar->addButtonInstance($button);
322  }
323  }
324  }
325 
326  $toolbar->setFormAction(
327  $ilCtrl->getFormActionByClass(
328  array(
329  get_class($parent_object),
330  'ilRepositorySearchGUI')
331  )
332  );
333  return $toolbar;
334  }
static getInstance($a_usr_id)
Get singelton instance.
addStickyItem($a_item, $a_output_label=false)
Add a sticky item.
addSpacer($a_width=null)
Add spacer.
addButtonInstance(ilButtonBase $a_button)
Add button instance.
addInputItem(ilToolbarItem $a_item, $a_output_label=false)
Add input item.
setFormAction($a_val, $a_multipart=false, $a_target="")
Set form action (if form action is set, toolbar is wrapped into form tags)
$lng
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
addSeparator()
Add separator.
language()
Definition: language.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPrivacyMode()

ilRepositorySearchGUI::getPrivacyMode ( )
Returns
int

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

References $privacy_mode.

Referenced by doUserAutoComplete(), performSearch(), and showSearch().

+ Here is the caller graph for this function:

◆ getString()

ilRepositorySearchGUI::getString ( )

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

389  {
390  return $this->string;
391  }

◆ getTitle()

ilRepositorySearchGUI::getTitle ( )

Get search form title.

Returns
string

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

References $search_title.

Referenced by initFormSearch().

+ Here is the caller graph for this function:

◆ getUserLimitations()

ilRepositorySearchGUI::getUserLimitations ( )

allow user limitations like inactive and access limitations

Returns
bool

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

References $user_limitations.

Referenced by doUserAutoComplete(), and showSearchUserTable().

1397  {
1398  return $this->user_limitations;
1399  }
+ Here is the caller graph for this function:

◆ handleMultiCommand()

ilRepositorySearchGUI::handleMultiCommand ( )
protected

Handle multi command.

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

References $_POST, and showSearchResults().

583  {
584  $class = $this->callback['class'];
585  $method = $this->callback['method'];
586 
587  // Redirects if everything is ok
588  if (!$class->$method((array) $_POST['user'], $_POST['selectedCommand'])) {
589  $this->showSearchResults();
590  }
591  }
$_POST["username"]
+ Here is the call graph for this function:

◆ initFormSearch()

ilRepositorySearchGUI::initFormSearch ( ilObjUser  $user = null)

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

References $DIC, $txt, ilUserSearchOptions\_getSearchableFieldsInfo(), ilUserSearchOptions\_isEnabled(), ilRadioOption\addSubItem(), FIELD_TYPE_MULTI, FIELD_TYPE_SELECT, FIELD_TYPE_TEXT, FIELD_TYPE_UDF_SELECT, FIELD_TYPE_UDF_TEXT, ilObjOrgUnit\getRootOrgRefId(), getTitle(), isSearchableCheckEnabled(), and ilRadioGroupInputGUI\setValue().

Referenced by showSearch().

645  {
646  global $DIC;
647 
648  $ilCtrl = $DIC['ilCtrl'];
649 
650  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
651 
652  $this->form = new ilPropertyFormGUI();
653  $this->form->setFormAction($this->ctrl->getFormAction($this, 'showSearch'));
654  $this->form->setTitle($this->getTitle());
655  $this->form->addCommandButton('performSearch', $this->lng->txt('search'));
656  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
657 
658 
659  $kind = new ilRadioGroupInputGUI($this->lng->txt('search_type'), 'search_for');
660  $kind->setValue($this->search_type);
661  $this->form->addItem($kind);
662 
663  // Users
664  $users = new ilRadioOption($this->lng->txt('search_for_users'), 'usr');
665 
666  // UDF
667  include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
669  switch ($info['type']) {
671  case FIELD_TYPE_SELECT:
672 
673  $sel = new ilSelectInputGUI($info['lang'], "rep_query[usr][" . $info['db'] . "]");
674  $sel->setOptions($info['values']);
675  $users->addSubItem($sel);
676  break;
677 
678  case FIELD_TYPE_MULTI:
679  case FIELD_TYPE_UDF_TEXT:
680  case FIELD_TYPE_TEXT:
681 
682  if (isset($info['autoComplete']) and $info['autoComplete']) {
683  $ilCtrl->setParameterByClass(get_class($this), 'autoCompleteField', $info['db']);
684  $ul = new ilTextInputGUI($info['lang'], "rep_query[usr][" . $info['db'] . "]");
685  $ul->setDataSourceSubmitOnSelection(true);
686  $ul->setDataSourceSubmitUrl(
687  $this->ctrl->getLinkTarget(
688  $this,
689  'showSearchSelected',
690  '',
691  false,
692  false
693  )
694  );
695  $ul->setDataSource($ilCtrl->getLinkTarget(
696  $this,
697  "doUserAutoComplete",
698  "",
699  true
700  ));
701  $ul->setSize(30);
702  $ul->setMaxLength(120);
703 
704  if ($user instanceof ilObjUser) {
705  switch ($info['db']) {
706  case 'firstname':
707  $ul->setValue($user->getFirstname());
708  break;
709  case 'lastname':
710  $ul->setValue($user->getLastname());
711  break;
712  case 'login':
713  $ul->setValue($user->getLogin());
714  break;
715  }
716  }
717 
718 
719 
720  $users->addSubItem($ul);
721  } else {
722  $txt = new ilTextInputGUI($info['lang'], "rep_query[usr][" . $info['db'] . "]");
723  $txt->setSize(30);
724  $txt->setMaxLength(120);
725  $users->addSubItem($txt);
726  }
727  break;
728  }
729  }
730  $kind->addOption($users);
731 
732 
733 
734  // Role
735  $roles = new ilRadioOption($this->lng->txt('search_for_role_members'), 'role');
736  $role = new ilTextInputGUI($this->lng->txt('search_role_title'), 'rep_query[role][title]');
737  $role->setSize(30);
738  $role->setMaxLength(120);
739  $roles->addSubItem($role);
740  $kind->addOption($roles);
741 
742  // Course
743  $groups = new ilRadioOption($this->lng->txt('search_for_crs_members'), 'crs');
744  $group = new ilTextInputGUI($this->lng->txt('search_crs_title'), 'rep_query[crs][title]');
745  $group->setSize(30);
746  $group->setMaxLength(120);
747  $groups->addSubItem($group);
748  $kind->addOption($groups);
749 
750  // Group
751  $groups = new ilRadioOption($this->lng->txt('search_for_grp_members'), 'grp');
752  $group = new ilTextInputGUI($this->lng->txt('search_grp_title'), 'rep_query[grp][title]');
753  $group->setSize(30);
754  $group->setMaxLength(120);
755  $groups->addSubItem($group);
756  $kind->addOption($groups);
757 
758  // Orgus
759  if (ilUserSearchOptions::_isEnabled("org_units")) {
760  $orgus = new ilRadioOption($this->lng->txt('search_for_orgu_members'), 'orgu');
761  $orgu = new ilRepositorySelector2InputGUI($this->lng->txt('select_orgu'), 'rep_query_orgu', true, get_class($this));
762  $orgu->getExplorerGUI()->setSelectableTypes(["orgu"]);
763  $orgu->getExplorerGUI()->setTypeWhiteList(["root", "orgu"]);
764  $orgu->getExplorerGUI()->setRootId(ilObjOrgUnit::getRootOrgRefId());
765  $orgu->getExplorerGUI()->setAjax(false);
766  $orgus->addSubItem($orgu);
767  $kind->addOption($orgus);
768  }
769  }
This class represents an option in a radio group.
getLogin()
get login / username public
This class represents a property form user interface.
getFirstname()
get firstname public
const FIELD_TYPE_MULTI
const FIELD_TYPE_UDF_TEXT
const FIELD_TYPE_SELECT
This class represents a property in a property form.
getLastname()
get lastname public
addSubItem($a_item)
Add Subitem.
global $DIC
Definition: goto.php:24
getTitle()
Get search form title.
const FIELD_TYPE_UDF_SELECT
Class ilUserSearchOptions.
$txt
Definition: error.php:13
static getRootOrgRefId()
const FIELD_TYPE_TEXT
static _getSearchableFieldsInfo($a_admin=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSearchableCheckEnabled()

ilRepositorySearchGUI::isSearchableCheckEnabled ( )
Returns
bool

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

References $searchable_check.

Referenced by __performUserSearch(), and initFormSearch().

+ Here is the caller graph for this function:

◆ listUsers()

ilRepositorySearchGUI::listUsers ( )
protected

List users of course/group/roles.

Returns

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

References $_GET, $_POST, $_SESSION, $DIC, $type, __appendToStoredResults(), ilObject\_getAllReferences(), ilObject\_lookupType(), addNewSearchButton(), filter(), ilOrgUnitUserAssignmentQueries\getInstance(), ilUserFilter\getInstance(), ilParticipants\getInstanceByObjId(), ilParticipants\hasParticipantListAccess(), ilUtil\sendFailure(), showSearchResults(), and showSearchUserTable().

Referenced by performSearch(), and storedUserList().

1235  {
1236  // get parameter is used e.g. in exercises to provide
1237  // "add members of course" link
1238  if ($_GET["list_obj"] != "" && !is_array($_POST['obj'])) {
1239  $_POST['obj'][0] = $_GET["list_obj"];
1240  }
1241  if (!is_array($_POST['obj']) or !$_POST['obj']) {
1242  ilUtil::sendFailure($this->lng->txt('select_one'));
1243  $this->showSearchResults();
1244  return false;
1245  }
1246 
1247  $_SESSION['rep_search']['objs'] = $_POST['obj'];
1248 
1249  // Get all members
1250  $members = array();
1251  foreach ($_POST['obj'] as $obj_id) {
1252  $type = ilObject::_lookupType($obj_id);
1253  switch ($type) {
1254  case 'crs':
1255  case 'grp':
1256 
1257  include_once './Services/Membership/classes/class.ilParticipants.php';
1259  $part = [];
1260  if (is_callable($this->user_filter)) {
1261  $part = call_user_func_array(
1262  $this->user_filter,
1263  [
1264  ilParticipants::getInstanceByObjId($obj_id)->getParticipants()
1265  ]
1266  );
1267  } else {
1268  $part = ilParticipants::getInstanceByObjId($obj_id)->getParticipants();
1269  }
1270 
1271  $members = array_merge((array) $members, $part);
1272  }
1273  break;
1274 
1275  case 'role':
1276  global $DIC;
1277 
1278  $rbacreview = $DIC['rbacreview'];
1279 
1280  $assigned = [];
1281  if (is_callable($this->user_filter)) {
1282  $assigned = call_user_func_array(
1283  $this->user_filter,
1284  [
1285  $rbacreview->assignedUsers($obj_id)
1286  ]
1287  );
1288  } else {
1289  $assigned = $rbacreview->assignedUsers($obj_id);
1290  }
1291 
1292  $members = array_merge($members, ilUserFilter::getInstance()->filter($assigned));
1293  break;
1294  case 'orgu':
1295  if ($ref_ids = ilObject::_getAllReferences($obj_id)) {
1297  ->getUserIdsOfOrgUnit(array_shift($ref_ids));
1298  if (is_callable($this->user_filter)) {
1299  $assigned = call_user_func_array(
1300  $this->user_filter,
1301  [$assigned]
1302  );
1303  }
1304 
1305  $members = array_merge(
1306  $members,
1307  $assigned
1308  );
1309  }
1310  break;
1311  }
1312  }
1313  $members = array_unique((array) $members);
1314  $this->__appendToStoredResults($members);
1315 
1316  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
1317 
1318  $this->addNewSearchButton();
1319  $this->showSearchUserTable($_SESSION['rep_search']['usr'], 'storedUserList');
1320  return true;
1321  }
$_SESSION["AccountId"]
$type
$_GET["client_id"]
addNewSearchButton()
Add new search button.
static getInstance()
Singelton get instance.
static hasParticipantListAccess($a_obj_id, $a_usr_id=null)
Check if (current) user has access to the participant list.
static _getAllReferences($a_id)
get all reference ids of object
global $DIC
Definition: goto.php:24
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
filter()
Definition: filter.php:2
showSearchUserTable($a_usr_ids, $a_parent_cmd)
Show usr table.
$_POST["username"]
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performSearch()

ilRepositorySearchGUI::performSearch ( )

Perform a search.

Returns

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

References $_POST, $_SESSION, $message, $res, __performCourseSearch(), __performGroupSearch(), __performRoleSearch(), __performUserSearch(), __updateResults(), ilObject\_lookupObjId(), filter(), ilUserFilter\getInstance(), getPrivacyMode(), listUsers(), ilUserAutoComplete\PRIVACY_MODE_RESPECT_USER_SETTING, QP_COMBINATION_OR, ROOT_FOLDER_ID, ilUtil\sendFailure(), ilUtil\sendInfo(), settings(), show(), showSearch(), start(), and ilUtil\stripSlashes().

Referenced by appendSearch().

788  {
789  // only autocomplete input field, no search form if user privay should be respected
790  // see bug 25481
792  return "";
793  }
794  $found_query = false;
795  foreach ((array) $_POST['rep_query'][$_POST['search_for']] as $field => $value) {
796  if (trim(ilUtil::stripSlashes($value))) {
797  $found_query = true;
798  break;
799  }
800  }
801  if (array_key_exists('rep_query_orgu', $_POST) && count($_POST['rep_query_orgu']) > 0) {
802  $found_query = true;
803  }
804  if (!$found_query) {
805  ilUtil::sendFailure($this->lng->txt('msg_no_search_string'));
806  $this->start();
807  return false;
808  }
809 
810  // unset search_append if called directly
811  if ($_POST['cmd']['performSearch']) {
812  unset($_SESSION['search_append']);
813  }
814 
815  switch ($this->search_type) {
816  case 'usr':
817  $this->__performUserSearch();
818  break;
819 
820  case 'grp':
821  $this->__performGroupSearch();
822  break;
823 
824  case 'crs':
825  $this->__performCourseSearch();
826  break;
827 
828  case 'role':
829  $this->__performRoleSearch();
830  break;
831  case 'orgu':
832  $_POST['obj'] = array_map(
833  function ($ref_id) {
834  return (int) ilObject::_lookupObjId($ref_id);
835  },
836  $_POST['rep_query_orgu']
837  );
838  return $this->listUsers();
839  default:
840  echo 'not defined';
841  }
842 
843  $this->result_obj->setRequiredPermission('read');
844  $this->result_obj->addObserver($this, 'searchResultFilterListener');
845  $this->result_obj->filter(ROOT_FOLDER_ID, QP_COMBINATION_OR);
846 
847  // User access filter
848  if ($this->search_type == 'usr') {
849  $callable_name = '';
850  if (is_callable($this->user_filter, true, $callable_name)) {
851  $result_ids = call_user_func_array($this->user_filter, [$this->result_obj->getResultIds()]);
852  } else {
853  $result_ids = $this->result_obj->getResultIds();
854  }
855 
856  include_once './Services/User/classes/class.ilUserFilter.php';
857  $this->search_results = array_intersect(
858  $result_ids,
859  ilUserFilter::getInstance()->filter($result_ids)
860  );
861  } else {
862  $this->search_results = array();
863  foreach ((array) $this->result_obj->getResults() as $res) {
864  $this->search_results[] = $res['obj_id'];
865  }
866  }
867 
868  if (!count($this->search_results)) {
869  ilUtil::sendFailure($this->lng->txt('search_no_match'));
870  $this->showSearch();
871  return true;
872  }
873  $this->__updateResults();
874  if ($this->result_obj->isLimitReached()) {
875  $message = sprintf($this->lng->txt('search_limit_reached'), $this->settings->getMaxHits());
877  return true;
878  }
879  // show results
880  $this->show();
881  return true;
882  }
settings()
Definition: settings.php:2
$_SESSION["AccountId"]
const ROOT_FOLDER_ID
Definition: constants.php:30
static getInstance()
Singelton get instance.
const QP_COMBINATION_OR
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
foreach($_POST as $key=> $value) $res
static _lookupObjId($a_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
listUsers()
List users of course/group/roles.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$message
Definition: xapiexit.php:14
filter()
Definition: filter.php:2
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeFromClipboard()

ilRepositorySearchGUI::removeFromClipboard ( )
protected

Remove from clipboard.

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

References $_POST, $GLOBALS, ilUserClipboard\getInstance(), and ilUtil\sendFailure().

548  {
549  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'user_type', (int) $_REQUEST['user_type']);
550  $users = (array) $_POST['uids'];
551  if (!count($users)) {
552  ilUtil::sendFailure($this->lng->txt('select_one'), true);
553  $GLOBALS['DIC']['ilCtrl']->redirect($this, 'showClipboard');
554  }
555 
556  include_once './Services/User/classes/class.ilUserClipboard.php';
557  $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
558  $clip->delete($users);
559  $clip->save();
560 
561  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
562  $this->ctrl->redirect($this, 'showClipboard');
563  }
static getInstance($a_usr_id)
Get singelton instance.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ searchResultFilterListener()

ilRepositorySearchGUI::searchResultFilterListener (   $a_ref_id,
  $a_data 
)

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

Parameters
int$a_id
array$a_data
Returns

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

References ANONYMOUS_USER_ID.

1343  {
1344  if ($a_data['type'] == 'usr') {
1345  if ($a_data['obj_id'] == ANONYMOUS_USER_ID) {
1346  return false;
1347  }
1348  }
1349  return true;
1350  }
const ANONYMOUS_USER_ID
Definition: constants.php:25

◆ selectObject()

ilRepositorySearchGUI::selectObject ( )
protected

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

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

References $_GET, $_POST, ilUtil\sendFailure(), and showSearchResults().

1366  {
1367  // get parameter is used e.g. in exercises to provide
1368  // "add members of course" link
1369  if ($_GET["list_obj"] != "" && !is_array($_POST['obj'])) {
1370  $_POST['obj'][0] = $_GET["list_obj"];
1371  }
1372  if (!is_array($_POST['obj']) or !$_POST['obj']) {
1373  ilUtil::sendFailure($this->lng->txt('select_one'));
1374  $this->showSearchResults();
1375  return false;
1376  }
1377 
1378  $this->ctrl->setParameter($this->callback["class"], "obj", implode(";", $_POST["obj"]));
1379  $this->ctrl->redirect($this->callback["class"], $this->callback["method"]);
1380  }
$_GET["client_id"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ setCallback()

ilRepositorySearchGUI::setCallback ( $class,
  $method,
  $a_add_options = array(),
  $default_option = '' 
)

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

References $default_option.

594  {
595  $this->callback = array('class' => $class,'method' => $method);
596  $this->add_options = $a_add_options ? $a_add_options : array();
597  $this->default_option = (string) $default_option;
598  }

◆ setPermissionQueryCallback()

ilRepositorySearchGUI::setPermissionQueryCallback (   $class,
  $method 
)

Set callback method for user permission access queries.

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

611  {
612  }

◆ setPrivacyMode()

ilRepositorySearchGUI::setPrivacyMode (   $privacy_mode)
Parameters
int$privacy_mode

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

References $privacy_mode.

170  {
171  $this->privacy_mode = $privacy_mode;
172  }

◆ setRoleCallback()

ilRepositorySearchGUI::setRoleCallback ( $class,
  $method,
  $a_add_options = array(),
  $default_option = '' 
)

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

References $default_option.

601  {
602  $this->role_callback = array('class' => $class,'method' => $method);
603  $this->add_options = $a_add_options ? $a_add_options : array();
604  $this->default_option = $default_option;
605  }

◆ setString()

ilRepositorySearchGUI::setString (   $a_str)

Set/get search string public.

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

References $_SESSION.

385  {
386  $_SESSION['search']['string'] = $this->string = $a_str;
387  }
$_SESSION["AccountId"]

◆ setTitle()

ilRepositorySearchGUI::setTitle (   $a_title)

Set form title.

Parameters
string$a_title

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

Referenced by __construct().

135  {
136  $this->search_title = $a_title;
137  }
+ Here is the caller graph for this function:

◆ setUserLimitations()

ilRepositorySearchGUI::setUserLimitations (   $a_limitations)

allow user limitations like inactive and access limitations

Parameters
bool$a_limitations

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

1388  {
1389  $this->user_limitations = (bool) $a_limitations;
1390  }

◆ show()

ilRepositorySearchGUI::show ( )

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

References showSearchResults().

Referenced by performSearch().

773  {
774  $this->showSearchResults();
775  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showClipboard()

ilRepositorySearchGUI::showClipboard ( )
protected

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

References $GLOBALS, and ilLoggerFactory\getLogger().

504  {
505  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'user_type', (int) $_REQUEST['user_type']);
506 
507  ilLoggerFactory::getLogger('crs')->dump($_REQUEST);
508 
509  $GLOBALS['DIC']['ilTabs']->clearTargets();
510  $GLOBALS['DIC']['ilTabs']->setBackTarget(
511  $GLOBALS['DIC']['lng']->txt('back'),
512  $GLOBALS['DIC']['ilCtrl']->getParentReturn($this)
513  );
514 
515  include_once './Services/User/classes/class.ilUserClipboardTableGUI.php';
516  $clip = new ilUserClipboardTableGUI($this, 'showClipboard', $GLOBALS['DIC']['ilUser']->getId());
517  $clip->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
518  $clip->init();
519  $clip->parse();
520 
521  $GLOBALS['DIC']['tpl']->setContent($clip->getHTML());
522  }
Show administrate clipboard content.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getLogger($a_component_id)
Get component logger.
getFormAction($a_cmd, $a_formaction="")
get form action for command (command is method name without "Object", e.g.
+ Here is the call graph for this function:

◆ showSearch()

ilRepositorySearchGUI::showSearch ( )

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

References getPrivacyMode(), initFormSearch(), and ilUserAutoComplete\PRIVACY_MODE_RESPECT_USER_SETTING.

Referenced by performSearch(), and start().

615  {
616  // only autocomplete input field, no search form if user privay should be respected
617  // see bug 25481
619  return;
620  }
621  $this->initFormSearch();
622  $this->tpl->setContent($this->form->getHTML());
623  }
initFormSearch(ilObjUser $user=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSearchCourseTable()

ilRepositorySearchGUI::showSearchCourseTable (   $a_obj_ids)
protected
Returns
Parameters
array$a_obj_ids

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

Referenced by showSearchResults().

1221  {
1222  include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1223 
1224  $table = new ilRepositoryObjectResultTableGUI($this, 'showSearchResults', $this->object_selection);
1225  $table->parseObjectIds($a_obj_ids);
1226 
1227  $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1228  }
TableGUI class object (course,group and role) search results Used in member search.
+ Here is the caller graph for this function:

◆ showSearchGroupTable()

ilRepositorySearchGUI::showSearchGroupTable (   $a_obj_ids)
protected
Returns
Parameters
array$a_obj_ids

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

Referenced by showSearchResults().

1206  {
1207  include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1208 
1209  $table = new ilRepositoryObjectResultTableGUI($this, 'showSearchResults', $this->object_selection);
1210  $table->parseObjectIds($a_obj_ids);
1211 
1212  $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1213  }
TableGUI class object (course,group and role) search results Used in member search.
+ Here is the caller graph for this function:

◆ showSearchResults()

ilRepositorySearchGUI::showSearchResults ( )

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

References $_SESSION, addNewSearchButton(), showSearchCourseTable(), showSearchGroupTable(), showSearchRoleTable(), and showSearchUserTable().

Referenced by addRole(), addUser(), handleMultiCommand(), listUsers(), selectObject(), and show().

1126  {
1127  $counter = 0;
1128  $f_result = array();
1129 
1130  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
1131  $this->addNewSearchButton();
1132 
1133  switch ($this->search_type) {
1134  case "usr":
1135  $this->showSearchUserTable($_SESSION['rep_search']['usr'], 'showSearchResults');
1136  break;
1137 
1138  case 'grp':
1139  $this->showSearchGroupTable($_SESSION['rep_search']['grp']);
1140  break;
1141 
1142  case 'crs':
1143  $this->showSearchCourseTable($_SESSION['rep_search']['crs']);
1144  break;
1145 
1146  case 'role':
1147  $this->showSearchRoleTable($_SESSION['rep_search']['role']);
1148  break;
1149  }
1150  }
$_SESSION["AccountId"]
addNewSearchButton()
Add new search button.
showSearchRoleTable($a_obj_ids)
Show usr table.
showSearchUserTable($a_usr_ids, $a_parent_cmd)
Show usr table.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSearchRoleTable()

ilRepositorySearchGUI::showSearchRoleTable (   $a_obj_ids)
protected

Show usr table.

Returns
Parameters
object$a_usr_ids

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

Referenced by showSearchResults().

1191  {
1192  include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1193 
1194  $table = new ilRepositoryObjectResultTableGUI($this, 'showSearchResults', $this->object_selection);
1195  $table->parseObjectIds($a_obj_ids);
1196 
1197  $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1198  }
TableGUI class object (course,group and role) search results Used in member search.
+ Here is the caller graph for this function:

◆ showSearchSelected()

ilRepositorySearchGUI::showSearchSelected ( )

submit from autocomplete

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

References addNewSearchButton(), and showSearchUserTable().

629  {
630  $selected = (int) $_REQUEST['selected_id'];
631 
632  #include_once './Services/Object/classes/class.ilObjectFactory.php';
633  #$factory = new ilObjectFactory();
634  #$user = $factory->getInstanceByObjId($selected);
635 
636  #$this->initFormSearch($user);
637  #$this->tpl->setContent($this->form->getHTML());
638 
639  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
640  $this->addNewSearchButton();
641  $this->showSearchUserTable(array($selected), 'showSearchResults');
642  }
addNewSearchButton()
Add new search button.
showSearchUserTable($a_usr_ids, $a_parent_cmd)
Show usr table.
+ Here is the call graph for this function:

◆ showSearchUserTable()

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

Show usr table.

Returns
Parameters
object$a_usr_ids

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

References $_SESSION, $default_option, and getUserLimitations().

Referenced by listUsers(), showSearchResults(), and showSearchSelected().

1158  {
1159  $is_in_admin = ($_REQUEST['baseClass'] == 'ilAdministrationGUI');
1160  if ($is_in_admin) {
1161  // remember link target to admin search gui (this)
1162  $_SESSION["usr_search_link"] = $this->ctrl->getLinkTarget($this, 'show');
1163  }
1164 
1165  include_once './Services/Search/classes/class.ilRepositoryUserResultTableGUI.php';
1166 
1167  $table = new ilRepositoryUserResultTableGUI($this, $a_parent_cmd, $is_in_admin);
1168  if (count($this->add_options)) {
1169  $table->addMultiItemSelectionButton(
1170  'selectedCommand',
1171  $this->add_options,
1172  'handleMultiCommand',
1173  $this->lng->txt('execute'),
1175  );
1176  } else {
1177  $table->addMultiCommand('addUser', $this->lng->txt('btn_add'));
1178  }
1179  $table->setUserLimitations($this->getUserLimitations());
1180  $table->parseUserIds($a_usr_ids);
1181 
1182  $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1183  }
$_SESSION["AccountId"]
getUserLimitations()
allow user limitations like inactive and access limitations
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

ilRepositorySearchGUI::start ( )

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

References __clearSession(), and showSearch().

Referenced by performSearch().

433  {
434  // delete all session info
435  $this->__clearSession();
436  $this->showSearch();
437 
438  return true;
439  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storedUserList()

ilRepositorySearchGUI::storedUserList ( )
protected

Called from table sort.

Returns

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

References $_POST, $_SESSION, and listUsers().

1328  {
1329  $_POST['obj'] = $_SESSION['rep_search']['objs'];
1330  $this->listUsers();
1331  return true;
1332  }
$_SESSION["AccountId"]
listUsers()
List users of course/group/roles.
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $add_options

ilRepositorySearchGUI::$add_options = array()
protected

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

◆ $default_option

ilRepositorySearchGUI::$default_option = ''
protected

◆ $object_selection

ilRepositorySearchGUI::$object_selection = false
protected

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

◆ $privacy_mode

ilRepositorySearchGUI::$privacy_mode = ilUserAutoComplete::PRIVACY_MODE_IGNORE_USER_SETTING
private

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

Referenced by getPrivacyMode(), and setPrivacyMode().

◆ $search_results

ilRepositorySearchGUI::$search_results = array()
private

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

◆ $search_title

ilRepositorySearchGUI::$search_title = ''
protected

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

Referenced by getTitle().

◆ $search_type

ilRepositorySearchGUI::$search_type = 'usr'

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

Referenced by __updateResults().

◆ $searchable_check

ilRepositorySearchGUI::$searchable_check = true
protected

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

Referenced by isSearchableCheckEnabled().

◆ $tree

ilRepositorySearchGUI::$tree
protected

◆ $ui_factory

ilRepositorySearchGUI::$ui_factory
protected

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

Referenced by __construct().

◆ $ui_renderer

ilRepositorySearchGUI::$ui_renderer
protected

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

Referenced by __construct().

◆ $user_filter

ilRepositorySearchGUI::$user_filter = null
protected

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

Referenced by addUserAccessFilterCallable().

◆ $user_limitations

ilRepositorySearchGUI::$user_limitations = true
protected

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

Referenced by getUserLimitations().


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