ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUserSearchOptions Class Reference
+ Collaboration diagram for ilUserSearchOptions:

Public Member Functions

 ilUserSearchOptions ()
 _getSearchableFieldsInfo ($a_admin=false)
 _getPossibleFields ($a_admin=false)
 _isSearchable ($a_key)
 _isEnabled ($a_key)
 _saveStatus ($a_key, $a_enabled)
 __appendUserDefinedFields ($fields, $counter)
 __prepareValues ($a_values)

Data Fields

 $db = null

Detailed Description

Definition at line 38 of file class.ilUserSearchOptions.php.

Member Function Documentation

ilUserSearchOptions::__appendUserDefinedFields (   $fields,
  $counter 
)

Definition at line 167 of file class.ilUserSearchOptions.php.

References __prepareValues(), ilUserDefinedFields\_getInstance(), FIELD_TYPE_UDF_SELECT, FIELD_TYPE_UDF_TEXT, UDF_TYPE_SELECT, and UDF_TYPE_TEXT.

Referenced by _getSearchableFieldsInfo().

{
include_once './Services/User/classes/class.ilUserDefinedFields.php';
$user_defined_fields =& ilUserDefinedFields::_getInstance();
foreach($user_defined_fields->getSearchableDefinitions() as $definition)
{
$fields[$counter]['values'] = ilUserSearchOptions::__prepareValues($definition['field_values']);
$fields[$counter]['lang'] = $definition['field_name'];
$fields[$counter]['db'] = $definition['field_id'];
switch($definition['field_type'])
{
$fields[$counter]['type'] = FIELD_TYPE_UDF_TEXT;
break;
$fields[$counter]['type'] = FIELD_TYPE_UDF_SELECT;
break;
}
++$counter;
}
return $fields ? $fields : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilUserSearchOptions::__prepareValues (   $a_values)

Definition at line 194 of file class.ilUserSearchOptions.php.

Referenced by __appendUserDefinedFields().

{
$new_values = array(0 => $this->lng->txt('please_choose'));
foreach($a_values as $value)
{
$new_values[$value] = $value;
}
return $new_values ? $new_values : array();
}

+ Here is the caller graph for this function:

ilUserSearchOptions::_getPossibleFields (   $a_admin = false)

Definition at line 104 of file class.ilUserSearchOptions.php.

Referenced by _getSearchableFieldsInfo(), and _isSearchable().

{
if ($a_admin === true)
{
return array(
// 'active',
'gender',
'login',
'lastname',
'firstname',
'title',
'institution',
'department',
'street',
'zipcode',
'city',
'country',
'email',
'matriculation');
}
return array('gender',
'login',
'lastname',
'firstname',
'title',
'institution',
'department',
'street',
'zipcode',
'city',
'country',
'email',
'hobby',
'matriculation');
}

+ Here is the caller graph for this function:

ilUserSearchOptions::_getSearchableFieldsInfo (   $a_admin = false)

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

References $lng, __appendUserDefinedFields(), _getPossibleFields(), _isEnabled(), FIELD_TYPE_SELECT, and FIELD_TYPE_TEXT.

Referenced by ilRepositorySearchGUI\__fillUserSearch(), ilAdminUserSearchGUI\__fillUserSearch(), ilRepositorySearchGUI\__performUserSearch(), and ilAdminUserSearchGUI\__performUserSearch().

{
global $lng;
// Search for login is always enabled
#$fields[0]['values'] = array();
#$fields[0]['type'] = FIELD_TYPE_TEXT;
#$fields[0]['lang'] = $this->lng->txt('login');
#$fields[0]['db'] = 'login';
$counter = 1;
foreach(ilUserSearchOptions::_getPossibleFields($a_admin) as $field)
{
// TODO: check enabled
// DONE
if($a_admin == false and !ilUserSearchOptions::_isEnabled($field))
{
continue;
}
$fields[$counter]['values'] = array();
$fields[$counter]['type'] = FIELD_TYPE_TEXT;
$fields[$counter]['lang'] = $this->lng->txt($field);
$fields[$counter]['db'] = $field;
if($field == 'gender')
{
$fields[$counter]['values'] = array(0 => $lng->txt('please_choose'),
'f' => $lng->txt('gender_f'),
'm' => $lng->txt('gender_m'));
$fields[$counter]['type'] = FIELD_TYPE_SELECT;
}
if($field == 'title')
{
$fields[$counter]['lang'] = $lng->txt('person_title');
}
/*if($field == 'active')
{
$fields[$counter]['values'] = array(-1 => $lng->txt('please_choose'),
'1' => $lng->txt('active'),
'0' => $lng->txt('inactive'));
$fields[$counter]['type'] = FIELD_TYPE_SELECT;
}*/
++$counter;
}
// TODO: add udf fields
// DONE
return $fields ? $fields : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilUserSearchOptions::_isEnabled (   $a_key)

Definition at line 146 of file class.ilUserSearchOptions.php.

Referenced by _getSearchableFieldsInfo(), and ilObjUserFolderGUI\settingsObject().

{
global $ilias;
// login is always enabled
if($a_key == 'login')
{
return true;
}
return (bool) $ilias->getSetting('search_enabled_'.$a_key);
}

+ Here is the caller graph for this function:

ilUserSearchOptions::_isSearchable (   $a_key)

Definition at line 141 of file class.ilUserSearchOptions.php.

References _getPossibleFields().

Referenced by ilObjUserFolderGUI\saveGlobalUserSettingsObject(), and ilObjUserFolderGUI\settingsObject().

{
return in_array($a_key,ilUserSearchOptions::_getPossibleFields());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilUserSearchOptions::_saveStatus (   $a_key,
  $a_enabled 
)

Definition at line 159 of file class.ilUserSearchOptions.php.

Referenced by ilObjUserFolderGUI\saveGlobalUserSettingsObject().

{
global $ilias;
$ilias->setSetting('search_enabled_'.$a_key,(int) $a_enabled);
return true;
}

+ Here is the caller graph for this function:

ilUserSearchOptions::ilUserSearchOptions ( )

Definition at line 42 of file class.ilUserSearchOptions.php.

{
global $ilDB;
$this->db =& $ilDB;
$this->__read();
}

Field Documentation

ilUserSearchOptions::$db = null

Definition at line 40 of file class.ilUserSearchOptions.php.


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