Public Member Functions | Data Fields

ilUserSearchOptions Class Reference

Public Member Functions

 ilUserSearchOptions ()
 _getSearchableFieldsInfo ()
 _getPossibleFields ()
 _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 39 of file class.ilUserSearchOptions.php.


Member Function Documentation

ilUserSearchOptions::__appendUserDefinedFields ( fields,
counter 
)

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

References $counter, $fields, __prepareValues(), and ilUserDefinedFields::_getInstance().

Referenced by _getSearchableFieldsInfo().

        {
                include_once './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'])
                        {
                                case UDF_TYPE_TEXT:
                                        $fields[$counter]['type'] = FIELD_TYPE_UDF_TEXT;
                                        break;

                                case UDF_TYPE_SELECT:
                                        $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 169 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 (  ) 

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

Referenced by _getSearchableFieldsInfo(), and _isSearchable().

        {
                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 (  ) 

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

References $counter, $fields, $lng, __appendUserDefinedFields(), _getPossibleFields(), and _isEnabled().

Referenced by ilRepositorySearchGUI::__fillUserSearch(), and ilRepositorySearchGUI::__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() as $field)
                {
                        // TODO: check enabled
                        // DONE
                        if(!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');
                        }
                        ++$counter;
                }
                // TODO: add udf fields
                // DONE
                 $fields = ilUserSearchOptions::__appendUserDefinedFields($fields,$counter);

                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 121 of file class.ilUserSearchOptions.php.

References $ilias.

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 116 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 134 of file class.ilUserSearchOptions.php.

References $ilias.

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 43 of file class.ilUserSearchOptions.php.

        {
                global $ilDB;

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


Field Documentation

ilUserSearchOptions::$db = null

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


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