ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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())
 
 setRoleCallback (&$class, $method, $a_add_options=array())
 
 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()
 
 $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 84 of file class.ilRepositorySearchGUI.php.

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

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

Member Function Documentation

◆ __appendToStoredResults()

ilRepositorySearchGUI::__appendToStoredResults (   $a_usr_ids)

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

References $_SESSION.

Referenced by listUsers().

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

◆ __clearSession()

ilRepositorySearchGUI::__clearSession ( )

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

References $_SESSION.

Referenced by start().

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

◆ __loadQueries()

ilRepositorySearchGUI::__loadQueries ( )

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

References $_POST, and $_SESSION.

Referenced by __construct().

1040  {
1041  if (is_array($_POST['rep_query'])) {
1042  $_SESSION['rep_query'] = $_POST['rep_query'];
1043  }
1044  }
$_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 1019 of file class.ilRepositorySearchGUI.php.

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

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

1020  {
1021  $query_parser = new ilQueryParser(ilUtil::stripSlashes($a_string));
1022  $query_parser->setCombination($a_combination_or ? QP_COMBINATION_OR : QP_COMBINATION_AND);
1023  $query_parser->setMinWordLength(1);
1024 
1025  // #17502
1026  if (!(bool) $a_ignore_length) {
1027  $query_parser->setGlobalMinLength(3); // #14768
1028  }
1029 
1030  $query_parser->parse();
1031 
1032  if (!$query_parser->validate()) {
1033  return $query_parser->getMessage();
1034  }
1035  return $query_parser;
1036  }
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
+ 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 973 of file class.ilRepositorySearchGUI.php.

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

Referenced by performSearch().

974  {
975  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
976 
977  $query_string = $_SESSION['rep_query']['crs']['title'];
978  if (!is_object($query_parser = $this->__parseQueryString($query_string))) {
979  ilUtil::sendInfo($query_parser, true);
980  return false;
981  }
982 
983  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
984  $object_search = new ilLikeObjectSearch($query_parser);
985  $object_search->setFilter(array('crs'));
986  $this->__storeEntries($object_search->performSearch());
987 
988  return true;
989  }
$_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 951 of file class.ilRepositorySearchGUI.php.

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

Referenced by performSearch().

952  {
953  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
954 
955  $query_string = $_SESSION['rep_query']['grp']['title'];
956  if (!is_object($query_parser = $this->__parseQueryString($query_string))) {
957  ilUtil::sendInfo($query_parser, true);
958  return false;
959  }
960 
961  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
962  $object_search = new ilLikeObjectSearch($query_parser);
963  $object_search->setFilter(array('grp'));
964  $this->__storeEntries($object_search->performSearch());
965 
966  return true;
967  }
$_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 995 of file class.ilRepositorySearchGUI.php.

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

Referenced by performSearch().

996  {
997  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
998 
999  $query_string = $_SESSION['rep_query']['role']['title'];
1000  if (!is_object($query_parser = $this->__parseQueryString($query_string))) {
1001  ilUtil::sendInfo($query_parser, true);
1002  return false;
1003  }
1004 
1005  // Perform like search
1006  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
1007  $object_search = new ilLikeObjectSearch($query_parser);
1008  $object_search->setFilter(array('role'));
1009  $this->__storeEntries($object_search->performSearch());
1010 
1011  return true;
1012  }
$_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 881 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().

882  {
883  include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
884  include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
885 
887  $name = $info['db'];
888  $query_string = $_SESSION['rep_query']['usr'][$name];
889 
890  // continue if no query string is given
891  if (!$query_string) {
892  continue;
893  }
894 
895  if (!is_object($query_parser = $this->__parseQueryString($query_string, true, ($info['type'] == FIELD_TYPE_SELECT)))) {
896  ilUtil::sendInfo($query_parser);
897  return false;
898  }
899  switch ($info['type']) {
901  // Do a phrase query for select fields
902  $query_parser = $this->__parseQueryString('"' . $query_string . '"');
903 
904  // no break
905  case FIELD_TYPE_UDF_TEXT:
907  $udf_search->setFields(array($name));
908  $result_obj = $udf_search->performSearch();
909 
910  // Store entries
911  $this->__storeEntries($result_obj);
912  break;
913 
914  case FIELD_TYPE_SELECT:
915 
916  if ($info['db'] == 'org_units') {
917  $user_search = ilObjectSearchFactory::getUserOrgUnitAssignmentInstance($query_parser);
918  $result_obj = $user_search->performSearch();
919  $this->__storeEntries($result_obj);
920  break;
921  }
922 
923  // Do a phrase query for select fields
924  $query_parser = $this->__parseQueryString('"' . $query_string . '"', true, true);
925 
926  // no break
927  case FIELD_TYPE_TEXT:
928  $user_search = &ilObjectSearchFactory::_getUserSearchInstance($query_parser);
929  $user_search->setFields(array($name));
930  $result_obj = $user_search->performSearch();
931 
932  // store entries
933  $this->__storeEntries($result_obj);
934  break;
935 
936  case FIELD_TYPE_MULTI:
937  $multi_search = ilObjectSearchFactory::getUserMultiFieldSearchInstance($query_parser);
938  $multi_search->setFields(array($name));
939  $result_obj = $multi_search->performSearch();
940  $this->__storeEntries($result_obj);
941  break;
942 
943  }
944  }
945  }
$_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 1047 of file class.ilRepositorySearchGUI.php.

References $_POST, and $_SESSION.

Referenced by __construct().

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

◆ __storeEntries()

ilRepositorySearchGUI::__storeEntries ( $new_res)

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

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

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

◆ __updateResults()

ilRepositorySearchGUI::__updateResults ( )

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

References $_SESSION, $result, and $search_type.

Referenced by performSearch().

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

◆ addFromClipboard()

ilRepositorySearchGUI::addFromClipboard ( )
protected

add users from clipboard

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

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

527  {
528  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'user_type', (int) $_REQUEST['user_type']);
529  $users = (array) $_POST['uids'];
530  if (!count($users)) {
531  ilUtil::sendFailure($this->lng->txt('select_one'), true);
532  $GLOBALS['DIC']['ilCtrl']->redirect($this, 'showClipboard');
533  }
534  $class = $this->callback['class'];
535  $method = $this->callback['method'];
536  $user_type = isset($_REQUEST['user_type']) ? $_REQUEST['user_type'] : 0;
537 
538  if (!$class->$method($users, $user_type)) {
539  $GLOBALS['DIC']['ilCtrl']->returnToParent($this);
540  }
541  }
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 1111 of file class.ilRepositorySearchGUI.php.

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

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

◆ addRole()

ilRepositorySearchGUI::addRole ( )

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

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

442  {
443  $class = $this->role_callback['class'];
444  $method = $this->role_callback['method'];
445 
446  // call callback if that function does give a return value => show error message
447  // listener redirects if everything is ok.
448  $obj_ids = (array) $_POST['obj'];
449  $role_ids = array();
450  foreach ($obj_ids as $id) {
451  $obj_type = ilObject::_lookupType($id);
452  if ($obj_type == "crs" || $obj_type == "grp") {
453  $refs = ilObject::_getAllReferences($id);
454  $ref_id = end($refs);
455  $mem_role = ilParticipants::getDefaultMemberRole($ref_id);
456  $role_ids[] = $mem_role;
457  } else {
458  $role_ids[] = $id;
459  }
460  }
461  $class->$method((array) $role_ids);
462 
463  $this->showSearchResults();
464  }
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 466 of file class.ilRepositorySearchGUI.php.

References $_POST, and showSearchResults().

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

References $user_filter.

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

◆ addUserFromAutoComplete()

ilRepositorySearchGUI::addUserFromAutoComplete ( )
protected

Add user from auto complete input.

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

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

482  {
483  $class = $this->callback['class'];
484  $method = $this->callback['method'];
485 
486  $users = explode(',', $_POST['user_login']);
487  $user_ids = array();
488  foreach ($users as $user) {
489  $user_id = ilObjUser::_lookupId($user);
490  if ($user_id) {
491  $user_ids[] = $user_id;
492  }
493  }
494 
495  $user_type = isset($_REQUEST['user_type']) ? $_REQUEST['user_type'] : 0;
496 
497  if (!$class->$method($user_ids, $user_type)) {
498  $GLOBALS['DIC']['ilCtrl']->returnToParent($this);
499  }
500  }
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 1353 of file class.ilRepositorySearchGUI.php.

1354  {
1355  $this->object_selection = (bool) $a_value;
1356  }

◆ appendSearch()

ilRepositorySearchGUI::appendSearch ( )

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

References $_SESSION, and performSearch().

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

◆ cancel()

ilRepositorySearchGUI::cancel ( )

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

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

◆ doUserAutoComplete()

ilRepositorySearchGUI::doUserAutoComplete ( )
protected

Do auto completion.

Returns
void

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

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

340  {
341  // hide anonymout request
342  if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) {
343  include_once './Services/JSON/classes/class.ilJsonUtil.php';
344  return ilJsonUtil::encode(new stdClass());
345  exit;
346  }
347 
348 
349  if (!isset($_GET['autoCompleteField'])) {
350  $a_fields = array('login','firstname','lastname','email');
351  $result_field = 'login';
352  } else {
353  $a_fields = array((string) $_GET['autoCompleteField']);
354  $result_field = (string) $_GET['autoCompleteField'];
355  }
356 
357  include_once './Services/User/classes/class.ilUserAutoComplete.php';
358  $auto = new ilUserAutoComplete();
359  $auto->setPrivacyMode($this->getPrivacyMode());
360 
361  if (($_REQUEST['fetchall'])) {
362  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
363  }
364 
365  $auto->setMoreLinkAvailable(true);
366  $auto->setSearchFields($a_fields);
367  $auto->setResultField($result_field);
368  $auto->enableFieldSearchableCheck(true);
369  $auto->setUserLimitations($this->getUserLimitations());
370  if (is_callable($this->user_filter)) { // #0024249
371  $auto->addUserAccessFilterCallable($this->user_filter);
372  }
373 
374  echo $auto->getList($_REQUEST['term']);
375  exit();
376  }
exit
Definition: login.php:29
$_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 567 of file class.ilRepositorySearchGUI.php.

References $GLOBALS, and ilUserClipboard\getInstance().

568  {
569  include_once './Services/User/classes/class.ilUserClipboard.php';
570  $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
571  $clip->clear();
572  $clip->save();
573 
574  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
575  $this->ctrl->returnToParent($this);
576  }
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 151 of file class.ilRepositorySearchGUI.php.

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

◆ executeCommand()

ilRepositorySearchGUI::executeCommand ( )

Control public.

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

References $DIC.

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

◆ 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 195 of file class.ilRepositorySearchGUI.php.

References $DIC, $GLOBALS, $ilCtrl, $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().

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

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

◆ getTitle()

ilRepositorySearchGUI::getTitle ( )

Get search form title.

Returns
string

Definition at line 142 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 1392 of file class.ilRepositorySearchGUI.php.

References $user_limitations.

Referenced by doUserAutoComplete(), and showSearchUserTable().

1393  {
1394  return $this->user_limitations;
1395  }
+ Here is the caller graph for this function:

◆ handleMultiCommand()

ilRepositorySearchGUI::handleMultiCommand ( )
protected

Handle multi command.

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

References $_POST, and showSearchResults().

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

◆ initFormSearch()

ilRepositorySearchGUI::initFormSearch ( ilObjUser  $user = null)

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

References $DIC, $ilCtrl, $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().

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

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

Referenced by performSearch(), and storedUserList().

1231  {
1232  // get parameter is used e.g. in exercises to provide
1233  // "add members of course" link
1234  if ($_GET["list_obj"] != "" && !is_array($_POST['obj'])) {
1235  $_POST['obj'][0] = $_GET["list_obj"];
1236  }
1237  if (!is_array($_POST['obj']) or !$_POST['obj']) {
1238  ilUtil::sendFailure($this->lng->txt('select_one'));
1239  $this->showSearchResults();
1240  return false;
1241  }
1242 
1243  $_SESSION['rep_search']['objs'] = $_POST['obj'];
1244 
1245  // Get all members
1246  $members = array();
1247  foreach ($_POST['obj'] as $obj_id) {
1248  $type = ilObject::_lookupType($obj_id);
1249  switch ($type) {
1250  case 'crs':
1251  case 'grp':
1252 
1253  include_once './Services/Membership/classes/class.ilParticipants.php';
1255  $part = [];
1256  if (is_callable($this->user_filter)) {
1257  $part = call_user_func_array(
1258  $this->user_filter,
1259  [
1260  ilParticipants::getInstanceByObjId($obj_id)->getParticipants()
1261  ]
1262  );
1263  } else {
1264  $part = ilParticipants::getInstanceByObjId($obj_id)->getParticipants();
1265  }
1266 
1267  $members = array_merge((array) $members, $part);
1268  }
1269  break;
1270 
1271  case 'role':
1272  global $DIC;
1273 
1274  $rbacreview = $DIC['rbacreview'];
1275 
1276  $assigned = [];
1277  if (is_callable($this->user_filter)) {
1278  $assigned = call_user_func_array(
1279  $this->user_filter,
1280  [
1281  $rbacreview->assignedUsers($obj_id)
1282  ]
1283  );
1284  } else {
1285  $assigned = $rbacreview->assignedUsers($obj_id);
1286  }
1287 
1288  $members = array_merge($members, ilUserFilter::getInstance()->filter($assigned));
1289  break;
1290  case 'orgu':
1291  if ($ref_ids = ilObject::_getAllReferences($obj_id)) {
1293  ->getUserIdsOfOrgUnit(array_shift($ref_ids));
1294  if (is_callable($this->user_filter)) {
1295  $assigned = call_user_func_array(
1296  $this->user_filter,
1297  [$assigned]
1298  );
1299  }
1300 
1301  $members = array_merge(
1302  $members,
1303  $assigned
1304  );
1305  }
1306  break;
1307  }
1308  }
1309  $members = array_unique((array) $members);
1310  $this->__appendToStoredResults($members);
1311 
1312  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
1313 
1314  $this->addNewSearchButton();
1315  $this->showSearchUserTable($_SESSION['rep_search']['usr'], 'storedUserList');
1316  return true;
1317  }
$_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
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$DIC
Definition: xapitoken.php:46
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 784 of file class.ilRepositorySearchGUI.php.

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

Referenced by appendSearch().

785  {
786  // only autocomplete input field, no search form if user privay should be respected
787  // see bug 25481
789  return "";
790  }
791  $found_query = false;
792  foreach ((array) $_POST['rep_query'][$_POST['search_for']] as $field => $value) {
793  if (trim(ilUtil::stripSlashes($value))) {
794  $found_query = true;
795  break;
796  }
797  }
798  if (array_key_exists('rep_query_orgu', $_POST) && count($_POST['rep_query_orgu']) > 0) {
799  $found_query = true;
800  }
801  if (!$found_query) {
802  ilUtil::sendFailure($this->lng->txt('msg_no_search_string'));
803  $this->start();
804  return false;
805  }
806 
807  // unset search_append if called directly
808  if ($_POST['cmd']['performSearch']) {
809  unset($_SESSION['search_append']);
810  }
811 
812  switch ($this->search_type) {
813  case 'usr':
814  $this->__performUserSearch();
815  break;
816 
817  case 'grp':
818  $this->__performGroupSearch();
819  break;
820 
821  case 'crs':
822  $this->__performCourseSearch();
823  break;
824 
825  case 'role':
826  $this->__performRoleSearch();
827  break;
828  case 'orgu':
829  $_POST['obj'] = array_map(
830  function ($ref_id) {
831  return (int) ilObject::_lookupObjId($ref_id);
832  },
833  $_POST['rep_query_orgu']
834  );
835  return $this->listUsers();
836  default:
837  echo 'not defined';
838  }
839 
840  $this->result_obj->setRequiredPermission('read');
841  $this->result_obj->addObserver($this, 'searchResultFilterListener');
842  $this->result_obj->filter(ROOT_FOLDER_ID, QP_COMBINATION_OR);
843 
844  // User access filter
845  if ($this->search_type == 'usr') {
846  $callable_name = '';
847  if (is_callable($this->user_filter, true, $callable_name)) {
848  $result_ids = call_user_func_array($this->user_filter, [$this->result_obj->getResultIds()]);
849  } else {
850  $result_ids = $this->result_obj->getResultIds();
851  }
852 
853  include_once './Services/User/classes/class.ilUserFilter.php';
854  $this->search_results = array_intersect(
855  $result_ids,
856  ilUserFilter::getInstance()->filter($result_ids)
857  );
858  } else {
859  $this->search_results = array();
860  foreach ((array) $this->result_obj->getResults() as $res) {
861  $this->search_results[] = $res['obj_id'];
862  }
863  }
864 
865  if (!count($this->search_results)) {
866  ilUtil::sendFailure($this->lng->txt('search_no_match'));
867  $this->showSearch();
868  return true;
869  }
870  $this->__updateResults();
871  if ($this->result_obj->isLimitReached()) {
872  $message = sprintf($this->lng->txt('search_limit_reached'), $this->settings->getMaxHits());
874  return true;
875  }
876  // show results
877  $this->show();
878  return true;
879  }
settings()
Definition: settings.php:2
$_SESSION["AccountId"]
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
$_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 546 of file class.ilRepositorySearchGUI.php.

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

547  {
548  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'user_type', (int) $_REQUEST['user_type']);
549  $users = (array) $_POST['uids'];
550  if (!count($users)) {
551  ilUtil::sendFailure($this->lng->txt('select_one'), true);
552  $GLOBALS['DIC']['ilCtrl']->redirect($this, 'showClipboard');
553  }
554 
555  include_once './Services/User/classes/class.ilUserClipboard.php';
556  $clip = ilUserClipboard::getInstance($GLOBALS['DIC']['ilUser']->getId());
557  $clip->delete($users);
558  $clip->save();
559 
560  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
561  $this->ctrl->redirect($this, 'showClipboard');
562  }
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 1338 of file class.ilRepositorySearchGUI.php.

1339  {
1340  if ($a_data['type'] == 'usr') {
1341  if ($a_data['obj_id'] == ANONYMOUS_USER_ID) {
1342  return false;
1343  }
1344  }
1345  return true;
1346  }

◆ selectObject()

ilRepositorySearchGUI::selectObject ( )
protected

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

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

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

1362  {
1363  // get parameter is used e.g. in exercises to provide
1364  // "add members of course" link
1365  if ($_GET["list_obj"] != "" && !is_array($_POST['obj'])) {
1366  $_POST['obj'][0] = $_GET["list_obj"];
1367  }
1368  if (!is_array($_POST['obj']) or !$_POST['obj']) {
1369  ilUtil::sendFailure($this->lng->txt('select_one'));
1370  $this->showSearchResults();
1371  return false;
1372  }
1373 
1374  $this->ctrl->setParameter($this->callback["class"], "obj", implode(";", $_POST["obj"]));
1375  $this->ctrl->redirect($this->callback["class"], $this->callback["method"]);
1376  }
$_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() 
)

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

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

◆ setPermissionQueryCallback()

ilRepositorySearchGUI::setPermissionQueryCallback (   $class,
  $method 
)

Set callback method for user permission access queries.

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

608  {
609  }

◆ setPrivacyMode()

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

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

References $privacy_mode.

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

◆ setRoleCallback()

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

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

599  {
600  $this->role_callback = array('class' => $class,'method' => $method);
601  $this->add_options = $a_add_options ? $a_add_options : array();
602  }

◆ setString()

ilRepositorySearchGUI::setString (   $a_str)

Set/get search string public.

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

References $_SESSION.

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

◆ setTitle()

ilRepositorySearchGUI::setTitle (   $a_title)

Set form title.

Parameters
string$a_title

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

Referenced by __construct().

134  {
135  $this->search_title = $a_title;
136  }
+ 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 1383 of file class.ilRepositorySearchGUI.php.

1384  {
1385  $this->user_limitations = (bool) $a_limitations;
1386  }

◆ show()

ilRepositorySearchGUI::show ( )

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

References showSearchResults().

Referenced by performSearch().

770  {
771  $this->showSearchResults();
772  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showClipboard()

ilRepositorySearchGUI::showClipboard ( )
protected

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

References $GLOBALS, and ilLoggerFactory\getLogger().

503  {
504  $GLOBALS['DIC']['ilCtrl']->setParameter($this, 'user_type', (int) $_REQUEST['user_type']);
505 
506  ilLoggerFactory::getLogger('crs')->dump($_REQUEST);
507 
508  $GLOBALS['DIC']['ilTabs']->clearTargets();
509  $GLOBALS['DIC']['ilTabs']->setBackTarget(
510  $GLOBALS['DIC']['lng']->txt('back'),
511  $GLOBALS['DIC']['ilCtrl']->getParentReturn($this)
512  );
513 
514  include_once './Services/User/classes/class.ilUserClipboardTableGUI.php';
515  $clip = new ilUserClipboardTableGUI($this, 'showClipboard', $GLOBALS['DIC']['ilUser']->getId());
516  $clip->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
517  $clip->init();
518  $clip->parse();
519 
520  $GLOBALS['DIC']['tpl']->setContent($clip->getHTML());
521  }
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.
+ Here is the call graph for this function:

◆ showSearch()

ilRepositorySearchGUI::showSearch ( )

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

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

Referenced by performSearch(), and start().

612  {
613  // only autocomplete input field, no search form if user privay should be respected
614  // see bug 25481
616  return;
617  }
618  $this->initFormSearch();
619  $this->tpl->setContent($this->form->getHTML());
620  }
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 1216 of file class.ilRepositorySearchGUI.php.

Referenced by showSearchResults().

1217  {
1218  include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1219 
1220  $table = new ilRepositoryObjectResultTableGUI($this, 'showSearchResults', $this->object_selection);
1221  $table->parseObjectIds($a_obj_ids);
1222 
1223  $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1224  }
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 1201 of file class.ilRepositorySearchGUI.php.

Referenced by showSearchResults().

1202  {
1203  include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1204 
1205  $table = new ilRepositoryObjectResultTableGUI($this, 'showSearchResults', $this->object_selection);
1206  $table->parseObjectIds($a_obj_ids);
1207 
1208  $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1209  }
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 1122 of file class.ilRepositorySearchGUI.php.

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

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

1123  {
1124  $counter = 0;
1125  $f_result = array();
1126 
1127  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
1128  $this->addNewSearchButton();
1129 
1130  switch ($this->search_type) {
1131  case "usr":
1132  $this->showSearchUserTable($_SESSION['rep_search']['usr'], 'showSearchResults');
1133  break;
1134 
1135  case 'grp':
1136  $this->showSearchGroupTable($_SESSION['rep_search']['grp']);
1137  break;
1138 
1139  case 'crs':
1140  $this->showSearchCourseTable($_SESSION['rep_search']['crs']);
1141  break;
1142 
1143  case 'role':
1144  $this->showSearchRoleTable($_SESSION['rep_search']['role']);
1145  break;
1146  }
1147  }
$_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 1186 of file class.ilRepositorySearchGUI.php.

Referenced by showSearchResults().

1187  {
1188  include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
1189 
1190  $table = new ilRepositoryObjectResultTableGUI($this, 'showSearchResults', $this->object_selection);
1191  $table->parseObjectIds($a_obj_ids);
1192 
1193  $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1194  }
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 625 of file class.ilRepositorySearchGUI.php.

References addNewSearchButton(), and showSearchUserTable().

626  {
627  $selected = (int) $_REQUEST['selected_id'];
628 
629  #include_once './Services/Object/classes/class.ilObjectFactory.php';
630  #$factory = new ilObjectFactory();
631  #$user = $factory->getInstanceByObjId($selected);
632 
633  #$this->initFormSearch($user);
634  #$this->tpl->setContent($this->form->getHTML());
635 
636  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.rep_search_result.html', 'Services/Search');
637  $this->addNewSearchButton();
638  $this->showSearchUserTable(array($selected), 'showSearchResults');
639  }
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 1154 of file class.ilRepositorySearchGUI.php.

References $_SESSION, and getUserLimitations().

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

1155  {
1156  $is_in_admin = ($_REQUEST['baseClass'] == 'ilAdministrationGUI');
1157  if ($is_in_admin) {
1158  // remember link target to admin search gui (this)
1159  $_SESSION["usr_search_link"] = $this->ctrl->getLinkTarget($this, 'show');
1160  }
1161 
1162  include_once './Services/Search/classes/class.ilRepositoryUserResultTableGUI.php';
1163 
1164  $table = new ilRepositoryUserResultTableGUI($this, $a_parent_cmd, $is_in_admin);
1165  if (count($this->add_options)) {
1166  $table->addMultiItemSelectionButton(
1167  'selectedCommand',
1168  $this->add_options,
1169  'handleMultiCommand',
1170  $this->lng->txt('execute')
1171  );
1172  } else {
1173  $table->addMultiCommand('addUser', $this->lng->txt('btn_add'));
1174  }
1175  $table->setUserLimitations($this->getUserLimitations());
1176  $table->parseUserIds($a_usr_ids);
1177 
1178  $this->tpl->setVariable('RES_TABLE', $table->getHTML());
1179  }
$_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 431 of file class.ilRepositorySearchGUI.php.

References __clearSession(), and showSearch().

Referenced by performSearch().

432  {
433  // delete all session info
434  $this->__clearSession();
435  $this->showSearch();
436 
437  return true;
438  }
+ 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 1323 of file class.ilRepositorySearchGUI.php.

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

1324  {
1325  $_POST['obj'] = $_SESSION['rep_search']['objs'];
1326  $this->listUsers();
1327  return true;
1328  }
$_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.

◆ $object_selection

ilRepositorySearchGUI::$object_selection = false
protected

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

◆ $privacy_mode

ilRepositorySearchGUI::$privacy_mode = ilUserAutoComplete::PRIVACY_MODE_IGNORE_USER_SETTING
private

Definition at line 64 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 51 of file class.ilRepositorySearchGUI.php.

Referenced by getTitle().

◆ $search_type

ilRepositorySearchGUI::$search_type = 'usr'

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

Referenced by __updateResults().

◆ $searchable_check

ilRepositorySearchGUI::$searchable_check = true
protected

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

Referenced by isSearchableCheckEnabled().

◆ $tree

ilRepositorySearchGUI::$tree
protected

◆ $ui_factory

ilRepositorySearchGUI::$ui_factory
protected

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

Referenced by __construct().

◆ $ui_renderer

ilRepositorySearchGUI::$ui_renderer
protected

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

Referenced by __construct().

◆ $user_filter

ilRepositorySearchGUI::$user_filter = null
protected

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

Referenced by addUserAccessFilterCallable().

◆ $user_limitations

ilRepositorySearchGUI::$user_limitations = true
protected

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

Referenced by getUserLimitations().


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