ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilRepositorySearchGUI Class Reference
+ Collaboration diagram for ilRepositorySearchGUI:

Public Member Functions

 ilRepositorySearchGUI ()
 Constructor public.
 setTitle ($a_title)
 Set form title.
 getTitle ()
 Get search form title.
 enableSearchableCheck ($a_status)
 En/disable the validation of the searchable flag.
 isSearchableCheckEnabled ()
 setString ($a_str)
 Set/get search string public.
 getString ()
executeCommand ()
 Control public.
 __clearSession ()
 cancel ()
 start ()
 addUser ()
 setCallback (&$class, $method, $a_add_options=array())
 showSearch ()
 showSearchSelected ()
 submit from autocomplete
 initFormSearch (ilObjUser $user=NULL)
 show ()
 appendSearch ()
 performSearch ()
 Perform a search.
 __performUserSearch ()
 __performGroupSearch ()
 Search groups.
 __performRoleSearch ()
 Search roles.
__parseQueryString ($a_string, $a_combination_or=true)
 parse query string, using query parser instance
 __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.
 allowObjectSelection ($a_value=false)
 Toggle object selection status.

Static Public Member Functions

static fillAutoCompleteToolbar ($parent_object, ilToolbarGUI $toolbar=null, $a_options=array())
 fill toolbar with

Data Fields

 $search_type = 'usr'

Protected Member Functions

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

Protected Attributes

 $add_options = array()
 $object_selection = false
 $searchable_check = true
 $search_title = ''

Private Attributes

 $search_results = array()

Detailed Description

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

Member Function Documentation

ilRepositorySearchGUI::__appendToStoredResults (   $a_usr_ids)

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

References $_SESSION.

Referenced by listUsers().

{
if(!$_SESSION['search_append'])
{
return $_SESSION['rep_search']['usr'] = $a_usr_ids;
}
$_SESSION['rep_search']['usr'] = array();
foreach($a_usr_ids as $usr_id)
{
$_SESSION['rep_search']['usr'][] = $usr_id;
}
return $_SESSION['rep_search']['usr'] ? array_unique($_SESSION['rep_search']['usr']) : array();
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::__clearSession ( )

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

References $_SESSION.

Referenced by start().

{
unset($_SESSION['rep_search']);
unset($_SESSION['append_results']);
unset($_SESSION['rep_query']);
unset($_SESSION['rep_search_type']);
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::__loadQueries ( )

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

References $_POST, and $_SESSION.

Referenced by ilRepositorySearchGUI().

{
if(is_array($_POST['rep_query']))
{
$_SESSION['rep_query'] = $_POST['rep_query'];
}
}

+ Here is the caller graph for this function:

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

parse query string, using query parser instance

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

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

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

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

{
$query_parser = new ilQueryParser(ilUtil::stripSlashes($a_string));
$query_parser->setCombination($a_combination_or ? QP_COMBINATION_OR : QP_COMBINATION_AND);
$query_parser->setMinWordLength(1);
$query_parser->setGlobalMinLength(3); // #14768
$query_parser->parse();
if(!$query_parser->validate())
{
return $query_parser->getMessage();
}
return $query_parser;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::__performCourseSearch ( )
protected

Search courses.

Returns

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

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

Referenced by performSearch().

{
include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
$query_string = $_SESSION['rep_query']['crs']['title'];
if(!is_object($query_parser = $this->__parseQueryString($query_string)))
{
ilUtil::sendInfo($query_parser,true);
return false;
}
include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
$object_search = new ilLikeObjectSearch($query_parser);
$object_search->setFilter(array('crs'));
$this->__storeEntries($object_search->performSearch());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::__performGroupSearch ( )

Search groups.

Returns

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

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

Referenced by performSearch().

{
include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
$query_string = $_SESSION['rep_query']['grp']['title'];
if(!is_object($query_parser = $this->__parseQueryString($query_string)))
{
ilUtil::sendInfo($query_parser,true);
return false;
}
include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
$object_search = new ilLikeObjectSearch($query_parser);
$object_search->setFilter(array('grp'));
$this->__storeEntries($object_search->performSearch());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::__performRoleSearch ( )

Search roles.

Returns

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

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

Referenced by performSearch().

{
include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
$query_string = $_SESSION['rep_query']['role']['title'];
if(!is_object($query_parser = $this->__parseQueryString($query_string)))
{
ilUtil::sendInfo($query_parser,true);
return false;
}
// Perform like search
include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
$object_search = new ilLikeObjectSearch($query_parser);
$object_search->setFilter(array('role'));
$this->__storeEntries($object_search->performSearch());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::__performUserSearch ( )

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

References $_SESSION, __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(), isSearchableCheckEnabled(), and ilUtil\sendInfo().

Referenced by performSearch().

{
include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
{
$name = $info['db'];
$query_string = $_SESSION['rep_query']['usr'][$name];
// continue if no query string is given
if(!$query_string)
{
continue;
}
if(!is_object($query_parser = $this->__parseQueryString($query_string)))
{
ilUtil::sendInfo($query_parser);
return false;
}
switch($info['type'])
{
// Do a phrase query for select fields
$query_parser = $this->__parseQueryString('"'.$query_string.'"');
$udf_search->setFields(array($name));
$result_obj = $udf_search->performSearch();
// Store entries
$this->__storeEntries($result_obj);
break;
// Do a phrase query for select fields
$query_parser = $this->__parseQueryString('"'.$query_string.'"');
$user_search =& ilObjectSearchFactory::_getUserSearchInstance($query_parser);
$user_search->setFields(array($name));
$result_obj = $user_search->performSearch();
// store entries
$this->__storeEntries($result_obj);
break;
$multi_search->setFields(array($name));
$result_obj = $multi_search->performSearch();
$this->__storeEntries($result_obj);
break;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::__setSearchType ( )

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

References $_POST, and $_SESSION.

Referenced by ilRepositorySearchGUI().

{
// Update search type. Default to user search
if($_POST['search_for'])
{
#echo 1;
$_SESSION['rep_search_type'] = $_POST['search_for'];
}
if(!$_POST['search_for'] and !$_SESSION['rep_search_type'])
{
#echo 2;
$_SESSION['rep_search_type'] = 'usr';
}
$this->search_type = $_SESSION['rep_search_type'];
#echo $this->search_type;
return true;
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::__storeEntries ( $new_res)

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

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

{
if($this->stored == false)
{
$this->result_obj->mergeEntries($new_res);
$this->stored = true;
return true;
}
else
{
$this->result_obj->intersectEntries($new_res);
return true;
}
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::__updateResults ( )

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

References $_SESSION, $result, and $search_type.

Referenced by performSearch().

{
if(!$_SESSION['search_append'])
{
$_SESSION['rep_search'] = array();
}
foreach($this->search_results as $result)
{
$_SESSION['rep_search'][$this->search_type][] = $result;
}
if(!$_SESSION['rep_search'][$this->search_type])
{
$_SESSION['rep_search'][$this->search_type] = array();
}
else
{
// remove duplicate entries
$_SESSION['rep_search'][$this->search_type] = array_unique($_SESSION['rep_search'][$this->search_type]);
}
return true;
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::addNewSearchButton ( )
protected

Add new search button.

Returns

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

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

{
include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
$toolbar = new ilToolbarGUI();
$toolbar->addButton(
$this->lng->txt('search_new'),
$this->ctrl->getLinkTarget($this,'showSearch')
);
$this->tpl->setVariable('ACTION_BUTTONS',$toolbar->getHTML());
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::addUser ( )

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

References $_POST, and showSearchResults().

{
$class = $this->callback['class'];
$method = $this->callback['method'];
// call callback if that function does give a return value => show error message
// listener redirects if everything is ok.
$class->$method($_POST['user']);
}

+ Here is the call graph for this function:

ilRepositorySearchGUI::addUserFromAutoComplete ( )
protected

Add user from auto complete input.

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

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

{
$class = $this->callback['class'];
$method = $this->callback['method'];
$users = explode(',', $_POST['user_login']);
$user_ids = array();
foreach($users as $user)
{
$user_id = ilObjUser::_lookupId($user);
if($user_id)
{
$user_ids[] = $user_id;
}
}
$user_type = isset($_POST['user_type']) ? $_POST['user_type'] : 0;
if(!$class->$method($user_ids,$user_type))
{
$GLOBALS['ilCtrl']->returnToParent($this);
}
}

+ Here is the call graph for this function:

ilRepositorySearchGUI::allowObjectSelection (   $a_value = false)

Toggle object selection status.

Parameters
bool$a_value

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

{
$this->object_selection = (bool)$a_value;
}
ilRepositorySearchGUI::appendSearch ( )

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

References $_SESSION, and performSearch().

{
$_SESSION['search_append'] = true;
$this->performSearch();
}

+ Here is the call graph for this function:

ilRepositorySearchGUI::cancel ( )

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

{
$this->ctrl->returnToParent($this);
}
ilRepositorySearchGUI::doUserAutoComplete ( )
protected

Do auto completion.

Returns
void

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

References $_GET, $_REQUEST, exit, and ilUserAutoComplete\MAX_ENTRIES.

{
if(!isset($_GET['autoCompleteField']))
{
$a_fields = array('login','firstname','lastname','email');
$result_field = 'login';
}
else
{
$a_fields = array((string) $_GET['autoCompleteField']);
$result_field = (string) $_GET['autoCompleteField'];
}
include_once './Services/User/classes/class.ilUserAutoComplete.php';
$auto = new ilUserAutoComplete();
if(($_REQUEST['fetchall']))
{
}
$auto->setMoreLinkAvailable(true);
$auto->setSearchFields($a_fields);
$auto->setResultField($result_field);
$auto->enableFieldSearchableCheck(true);
echo $auto->getList($_REQUEST['term']);
exit();
}
ilRepositorySearchGUI::enableSearchableCheck (   $a_status)

En/disable the validation of the searchable flag.

Parameters
bool$a_status

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

{
$this->searchable_check = $a_status;
}
& ilRepositorySearchGUI::executeCommand ( )

Control public.

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

References $cmd.

{
global $rbacsystem;
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
$this->ctrl->setReturn($this,'');
switch($next_class)
{
default:
if(!$cmd)
{
$cmd = "showSearch";
}
$this->$cmd();
break;
}
return true;
}
static ilRepositorySearchGUI::fillAutoCompleteToolbar (   $parent_object,
ilToolbarGUI  $toolbar = null,
  $a_options = array() 
)
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 128 of file class.ilRepositorySearchGUI.php.

References $ilCtrl, $lng, $si, ilObject\_lookupObjId(), ilSubmitButton\getInstance(), and ilLinkButton\getInstance().

Referenced by ilOrgUnitStaffGUI\addOtherRolesToolbar(), ilOrgUnitStaffGUI\addStaffToolbar(), ilObjBlogGUI\contributors(), ilSurveyParticipantsGUI\editRatersObject(), ilSurveyParticipantsGUI\inviteObject(), ilSurveyParticipantsGUI\listAppraiseesObject(), ilObjGroupGUI\membersObject(), ilObjExerciseGUI\membersObject(), ilObjCourseGUI\membersObject(), ilObjTestGUI\participantsObject(), ilSkillProfileGUI\showUsers(), ilObjExerciseGUI\submissionScreenTeamObject(), ilObjRoleGUI\userassignmentObject(), and ilObjPaymentSettingsGUI\vendorsObject().

{
global $ilToolbar, $lng, $ilCtrl, $tree;
if(!$toolbar instanceof ilToolbarGUI)
{
$toolbar = $ilToolbar;
}
// Fill default options
if(!isset($a_options['auto_complete_name']))
{
$a_options['auto_complete_name'] = $lng->txt('obj_user');
}
if(!isset($a_options['auto_complete_size']))
{
$a_options['auto_complete_size'] = 15;
}
if(!isset($a_options['submit_name']))
{
$a_options['submit_name'] = $lng->txt('btn_add');
}
$ajax_url = $ilCtrl->getLinkTargetByClass(array(get_class($parent_object),'ilRepositorySearchGUI'),
'doUserAutoComplete', '', true,false);
include_once("./Services/Form/classes/class.ilTextInputGUI.php");
$ul = new ilTextInputGUI($a_options['auto_complete_name'], 'user_login');
$ul->setDataSource($ajax_url);
$ul->setSize($a_options['auto_complete_size']);
$toolbar->addInputItem($ul, true);
if(count((array) $a_options['user_type']))
{
include_once './Services/Form/classes/class.ilSelectInputGUI.php';
$si = new ilSelectInputGUI("", "user_type");
$si->setOptions($a_options['user_type']);
$toolbar->addInputItem($si);
}
include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
$button->setCaption($a_options['submit_name'], false);
$button->setCommand('addUserFromAutoComplete');
$toolbar->addButtonInstance($button);
if((bool)$a_options['add_search'] ||
is_numeric($a_options['add_from_container']))
{
$lng->loadLanguageModule("search");
$toolbar->addSeparator();
if((bool)$a_options['add_search'])
{
include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
$button->setCaption("search_users");
$button->setUrl($ilCtrl->getLinkTargetByClass('ilRepositorySearchGUI',''));
$toolbar->addButtonInstance($button);
}
if(is_numeric($a_options['add_from_container']))
{
$parent_ref_id = (int)$a_options['add_from_container'];
$parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "grp");
$parent_container_type = "grp";
if(!$parent_container_ref_id)
{
$parent_container_ref_id = $tree->checkForParentType($parent_ref_id, "crs");
$parent_container_type = "crs";
}
if($parent_container_ref_id)
{
if((bool)$a_options['add_search'])
{
$toolbar->addSpacer();
}
$ilCtrl->setParameterByClass('ilRepositorySearchGUI', "list_obj", ilObject::_lookupObjId($parent_container_ref_id));
include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
$button->setCaption("search_add_members_from_container_".$parent_container_type);
$button->setUrl($ilCtrl->getLinkTargetByClass(array(get_class($parent_object),'ilRepositorySearchGUI'), 'listUsers'));
$toolbar->addButtonInstance($button);
}
}
}
$toolbar->setFormAction(
$ilCtrl->getFormActionByClass(
array(
get_class($parent_object),
'ilRepositorySearchGUI')
)
);
return $toolbar;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::getString ( )

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

{
return $this->string;
}
ilRepositorySearchGUI::getTitle ( )

Get search form title.

Returns
string

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

References $search_title.

Referenced by initFormSearch().

{
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::handleMultiCommand ( )
protected

Handle multi command.

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

References $_POST, and showSearchResults().

{
$class = $this->callback['class'];
$method = $this->callback['method'];
// Redirects if everything is ok
if(!$class->$method((array) $_POST['user'],$_POST['selectedCommand']))
{
}
}

+ Here is the call graph for this function:

ilRepositorySearchGUI::ilRepositorySearchGUI ( )

Constructor public.

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

References $ilCtrl, $lng, $tpl, __loadQueries(), __setSearchType(), and setTitle().

{
global $ilCtrl,$tpl,$lng;
$this->ctrl =& $ilCtrl;
$this->tpl =& $tpl;
$this->lng =& $lng;
$this->lng->loadLanguageModule('search');
$this->lng->loadLanguageModule('crs');
$this->setTitle($this->lng->txt('add_members_header'));
$this->__setSearchType();
$this->__loadQueries();
$this->result_obj = new ilSearchResult();
$this->result_obj->setMaxHits(1000000);
$this->settings =& new ilSearchSettings();
}

+ Here is the call graph for this function:

ilRepositorySearchGUI::initFormSearch ( ilObjUser  $user = NULL)

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

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

Referenced by showSearch().

{
global $ilCtrl;
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this,'search'));
$this->form->setTitle($this->getTitle());
$this->form->addCommandButton('performSearch', $this->lng->txt('search'));
$this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
$kind = new ilRadioGroupInputGUI($this->lng->txt('search_type'),'search_for');
$kind->setValue($this->search_type);
$this->form->addItem($kind);
// Users
$users = new ilRadioOption($this->lng->txt('search_for_users'),'usr');
// UDF
include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
{
switch($info['type'])
{
$sel = new ilSelectInputGUI($info['lang'],"rep_query[usr][".$info['db']."]");
$sel->setOptions($info['values']);
$users->addSubItem($sel);
break;
if(isset($info['autoComplete']) and $info['autoComplete'])
{
$ilCtrl->setParameterByClass(get_class($this),'autoCompleteField',$info['db']);
$ul = new ilTextInputGUI($info['lang'], "rep_query[usr][".$info['db']."]");
$ul->setDataSourceSubmitOnSelection(TRUE);
$ul->setDataSourceSubmitUrl(
$this->ctrl->getLinkTarget(
$this,
'showSearchSelected',
'',
FALSE,
FALSE
)
);
$ul->setDataSource($ilCtrl->getLinkTarget($this,
"doUserAutoComplete", "", true));
$ul->setSize(30);
$ul->setMaxLength(120);
if($user instanceof ilObjUser)
{
switch($info['db'])
{
case 'firstname':
$ul->setValue($user->getFirstname());
break;
case 'lastname':
$ul->setValue($user->getLastname());
break;
case 'login':
$ul->setValue($user->getLogin());
break;
}
}
$users->addSubItem($ul);
}
else
{
$txt = new ilTextInputGUI($info['lang'],"rep_query[usr][".$info['db']."]");
$txt->setSize(30);
$txt->setMaxLength(120);
$users->addSubItem($txt);
}
break;
}
}
$kind->addOption($users);
// Role
$roles = new ilRadioOption($this->lng->txt('search_for_role_members'),'role');
$role = new ilTextInputGUI($this->lng->txt('search_role_title'),'rep_query[role][title]');
$role->setSize(30);
$role->setMaxLength(120);
$roles->addSubItem($role);
$kind->addOption($roles);
// Course
$groups = new ilRadioOption($this->lng->txt('search_for_crs_members'),'crs');
$group = new ilTextInputGUI($this->lng->txt('search_crs_title'),'rep_query[crs][title]');
$group->setSize(30);
$group->setMaxLength(120);
$groups->addSubItem($group);
$kind->addOption($groups);
// Group
$groups = new ilRadioOption($this->lng->txt('search_for_grp_members'),'grp');
$group = new ilTextInputGUI($this->lng->txt('search_grp_title'),'rep_query[grp][title]');
$group->setSize(30);
$group->setMaxLength(120);
$groups->addSubItem($group);
$kind->addOption($groups);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::isSearchableCheckEnabled ( )
Returns
bool

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

References $searchable_check.

Referenced by __performUserSearch(), and initFormSearch().

+ Here is the caller graph for this function:

ilRepositorySearchGUI::listUsers ( )
protected

List users of course/group/roles.

Returns

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

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

Referenced by storedUserList().

{
// get parameter is used e.g. in exercises to provide
// "add members of course" link
if ($_GET["list_obj"] != "" && !is_array($_POST['obj']))
{
$_POST['obj'][0] = $_GET["list_obj"];
}
if(!is_array($_POST['obj']) or !$_POST['obj'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return false;
}
$_SESSION['rep_search']['objs'] = $_POST['obj'];
// Get all members
$members = array();
foreach($_POST['obj'] as $obj_id)
{
$type = ilObject::_lookupType($obj_id);
switch($type)
{
case 'crs':
case 'grp':
include_once './Services/Membership/classes/class.ilParticipants.php';
{
$members = array_merge((array) $members, ilParticipants::getInstanceByObjId($obj_id)->getParticipants());
}
break;
case 'role':
global $rbacreview;
include_once './Services/User/classes/class.ilUserFilter.php';
$members = array_merge($members, ilUserFilter::getInstance()->filter($rbacreview->assignedUsers($obj_id)));
break;
}
}
$members = array_unique((array) $members);
$this->__appendToStoredResults($members);
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.rep_search_result.html','Services/Search');
$this->showSearchUserTable($_SESSION['rep_search']['usr'],'storedUserList');
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::performSearch ( )

Perform a search.

Returns

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

References $_POST, $_SESSION, $res, __performCourseSearch(), __performGroupSearch(), __performRoleSearch(), __performUserSearch(), __updateResults(), ilUserFilter\getInstance(), QP_COMBINATION_OR, ilUtil\sendFailure(), ilUtil\sendInfo(), show(), showSearch(), start(), and ilUtil\stripSlashes().

Referenced by appendSearch().

{
$found_query = false;
foreach((array) $_POST['rep_query'][$_POST['search_for']] as $field => $value)
{
if(trim(ilUtil::stripSlashes($value)))
{
$found_query = true;
break;
}
}
if(!$found_query)
{
ilUtil::sendFailure($this->lng->txt('msg_no_search_string'));
$this->start();
return false;
}
// unset search_append if called directly
if($_POST['cmd']['performSearch'])
{
unset($_SESSION['search_append']);
}
switch($this->search_type)
{
case 'usr':
break;
case 'grp':
break;
case 'crs':
break;
case 'role':
break;
default:
echo 'not defined';
}
$this->result_obj->setRequiredPermission('read');
$this->result_obj->addObserver($this, 'searchResultFilterListener');
$this->result_obj->filter(ROOT_FOLDER_ID,QP_COMBINATION_OR);
// User access filter
if($this->search_type == 'usr')
{
include_once './Services/User/classes/class.ilUserFilter.php';
$this->search_results = array_intersect(
$this->result_obj->getResultIds(),
ilUserFilter::getInstance()->filter($this->result_obj->getResultIds())
);
}
else
{
$this->search_results = array();
foreach((array) $this->result_obj->getResults() as $res)
{
$this->search_results[] = $res['obj_id'];
}
}
if(!count($this->search_results))
{
ilUtil::sendFailure($this->lng->txt('search_no_match'));
$this->showSearch();
return true;
}
$this->__updateResults();
if($this->result_obj->isLimitReached())
{
$message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
ilUtil::sendInfo($message);
return true;
}
// show results
$this->show();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

{
if($a_data['type'] == 'usr')
{
if($a_data['obj_id'] == ANONYMOUS_USER_ID)
{
return false;
}
}
return true;
}
ilRepositorySearchGUI::selectObject ( )
protected

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

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

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

{
// get parameter is used e.g. in exercises to provide
// "add members of course" link
if ($_GET["list_obj"] != "" && !is_array($_POST['obj']))
{
$_POST['obj'][0] = $_GET["list_obj"];
}
if(!is_array($_POST['obj']) or !$_POST['obj'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return false;
}
$this->ctrl->setParameter($this->callback["class"], "obj", implode(";", $_POST["obj"]));
$this->ctrl->redirect($this->callback["class"], $this->callback["method"]);
}

+ Here is the call graph for this function:

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

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

{
$this->callback = array('class' => $class,'method' => $method);
$this->add_options = $a_add_options ? $a_add_options : array();
}
ilRepositorySearchGUI::setString (   $a_str)

Set/get search string public.

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

References $_SESSION.

{
$_SESSION['search']['string'] = $this->string = $a_str;
}
ilRepositorySearchGUI::setTitle (   $a_title)

Set form title.

Parameters
string$a_title

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

Referenced by ilRepositorySearchGUI().

{
$this->search_title = $a_title;
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::show ( )

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

References showSearchResults().

Referenced by performSearch().

{
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::showSearch ( )

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

References initFormSearch().

Referenced by performSearch(), and start().

{
$this->initFormSearch();
$this->tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Referenced by showSearchResults().

{
include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
$table = new ilRepositoryObjectResultTableGUI($this,'showSearchResults',$this->object_selection);
$table->parseObjectIds($a_obj_ids);
$this->tpl->setVariable('RES_TABLE',$table->getHTML());
}

+ Here is the caller graph for this function:

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

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

Referenced by showSearchResults().

{
include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
$table = new ilRepositoryObjectResultTableGUI($this,'showSearchResults',$this->object_selection);
$table->parseObjectIds($a_obj_ids);
$this->tpl->setVariable('RES_TABLE',$table->getHTML());
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::showSearchResults ( )

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

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

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

{
$counter = 0;
$f_result = array();
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.rep_search_result.html','Services/Search');
switch($this->search_type)
{
case "usr":
$this->showSearchUserTable($_SESSION['rep_search']['usr'],'showSearchResults');
break;
case 'grp':
$this->showSearchGroupTable($_SESSION['rep_search']['grp']);
break;
case 'crs':
$this->showSearchCourseTable($_SESSION['rep_search']['crs']);
break;
case 'role':
$this->showSearchRoleTable($_SESSION['rep_search']['role']);
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::showSearchRoleTable (   $a_obj_ids)
protected

Show usr table.

Returns
Parameters
object$a_usr_ids

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

Referenced by showSearchResults().

{
include_once './Services/Search/classes/class.ilRepositoryObjectResultTableGUI.php';
$table = new ilRepositoryObjectResultTableGUI($this,'showSearchResults',$this->object_selection);
$table->parseObjectIds($a_obj_ids);
$this->tpl->setVariable('RES_TABLE',$table->getHTML());
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::showSearchSelected ( )

submit from autocomplete

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

References $_REQUEST, addNewSearchButton(), and showSearchUserTable().

{
$selected = (int) $_REQUEST['selected_id'];
#include_once './Services/Object/classes/class.ilObjectFactory.php';
#$factory = new ilObjectFactory();
#$user = $factory->getInstanceByObjId($selected);
#$this->initFormSearch($user);
#$this->tpl->setContent($this->form->getHTML());
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.rep_search_result.html','Services/Search');
$this->showSearchUserTable(array($selected),'showSearchResults');
}

+ Here is the call graph for this function:

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

Show usr table.

Returns
Parameters
object$a_usr_ids

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

References $_REQUEST, and $_SESSION.

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

{
$is_in_admin = ($_REQUEST['baseClass'] == 'ilAdministrationGUI');
if($is_in_admin)
{
// remember link target to admin search gui (this)
$_SESSION["usr_search_link"] = $this->ctrl->getLinkTarget($this,'show');
}
include_once './Services/Search/classes/class.ilRepositoryUserResultTableGUI.php';
$table = new ilRepositoryUserResultTableGUI($this,$a_parent_cmd,$is_in_admin);
if(count($this->add_options))
{
$table->addMultiItemSelectionButton(
'selectedCommand',
$this->add_options,
'handleMultiCommand',
$this->lng->txt('execute')
);
}
else
{
$table->addMultiCommand('addUser', $this->lng->txt('btn_add'));
}
$table->parseUserIds($a_usr_ids);
$this->tpl->setVariable('RES_TABLE',$table->getHTML());
}

+ Here is the caller graph for this function:

ilRepositorySearchGUI::start ( )

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

References __clearSession(), and showSearch().

Referenced by performSearch().

{
// delete all session info
$this->__clearSession();
$this->showSearch();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilRepositorySearchGUI::storedUserList ( )
protected

Called from table sort.

Returns

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

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

{
$_POST['obj'] = $_SESSION['rep_search']['objs'];
$this->listUsers();
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilRepositorySearchGUI::$add_options = array()
protected

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

ilRepositorySearchGUI::$object_selection = false
protected

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

ilRepositorySearchGUI::$search_results = array()
private

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

ilRepositorySearchGUI::$search_title = ''
protected

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

Referenced by getTitle().

ilRepositorySearchGUI::$search_type = 'usr'

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

Referenced by __updateResults().

ilRepositorySearchGUI::$searchable_check = true
protected

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

Referenced by isSearchableCheckEnabled().


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