Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
UserLookup Class Reference

Public Member Functions

 setFilter ($type, $value)
 
 execute ($flags=null)
 
 clearFilters ()
 

Static Public Member Functions

static addType ($name, $values_callback, $filter_callback)
 
static getValuesForType ($type)
 

Data Fields

const USE_CACHE = false
 
const CACHE_DURATION = 3600
 
const FLAG_SORT_NAME = 1
 
const FLAG_RETURN_FULL_INFO = 2
 
const USE_COMBINED_STUDYGROUP_FILTER = 'use-combined-studygroup-filter'
 

Protected Member Functions

 getFilters ()
 

Static Protected Member Functions

static fachFilter ($needles)
 
static fachValues ()
 
static abschlussFilter ($needles)
 
static abschlussValues ()
 
static fachsemesterFilter ($needles)
 
static fachsemesterValues ()
 
static institutFilter ($needles)
 
static institutValues ()
 
static statusFilter ($needles)
 
static statusValues ()
 
static domainFilter ($needles)
 
static domainValues ()
 

Static Protected Attributes

static $types
 

Member Function Documentation

static abschlussFilter (   $needles)
staticprotected

Return all user with matching abschluss_id in $needles

Parameters
array$needlesList of abschluss ids to filter against
Returns
array List of user ids matching the given filter
static abschlussValues ( )
staticprotected

Return all studydegrees

Returns
array Associative array of abschluss ids and abschluss names
static addType (   $name,
  $values_callback,
  $filter_callback 
)
static

Adds or updates a filter criterion the global set of criteria.

Parameters
string$nameName of the criterion type
callback$values_callbackCallback for the type's values
callback$filter_callbackActual filter callback for a defined set of needles
clearFilters ( )

Clears all defined filters.

Returns
UserLookup Returns itself to allow chaining
static domainFilter (   $needles)
staticprotected

Return all users with a matching domain given in $needles

Parameters
array$needlesList of domain ids to filter against
Returns
array List of user ids matching the given filter
static domainValues ( )
staticprotected

Return all valid domains

Returns
array Associative array of domain id and name
execute (   $flags = null)

Executes the actual lookup by executing all individual filter types and returning the intersection of all according result sets.

Possible flags:

  • FLAG_SORT_NAME Sorts the user ids in the result by the actual user names
  • FLAG_RETURN_FULL_INFO Returns rudimental user info instead of just the ids (as an array with the user id as key and an array containting the info as value)
Parameters
int$flagsOptional set of flags as seen above
Returns
array Either a simple list of user ids or an associative array of user ids and user info if FLAG_RETURN_FULL_INFO is set
static fachFilter (   $needles)
staticprotected

Return all user with matching studiengang_id in $needles

Parameters
array$needlesList of studiengang ids to filter against
Returns
array List of user ids matching the given filter
static fachsemesterFilter (   $needles)
staticprotected

Return all users with a matching fachsemester given in $needles

Parameters
array$needlesList of fachsemesters to filter against
Returns
array List of user ids matching the given filter
static fachsemesterValues ( )
staticprotected

Create a array with all possible values for studysemesters

Returns
array Associative array of fachsemesters and fachsemesters (pretty dull, i know)
static fachValues ( )
staticprotected

Return all studycourses

Returns
array Associative array of studiengang ids and studiengang names
getFilters ( )
protected
static getValuesForType (   $type)
static

Returns all valid values for a certain criterion type.

Parameters
string$typeName of the criterion type
Returns
array Associative array containing the values as keys and descriptive names as values
static institutFilter (   $needles)
staticprotected

Return all users with a matching institut_id given in $needles

Parameters
array$needlesList of institut ids to filter against
Returns
array List of user ids matching the given filter
static institutValues ( )
staticprotected

Return all faculty's and instituts

Returns
array Associative array of institut ids and institut data (Be aware that this array is multidimensional)
setFilter (   $type,
  $value 
)

Adds another type filter to the set of current filters.

Multiple filters for the same filter type result in an AND filter within this type while multiple filters across filter types result in an OR filter across these types.

Parameters
string$typeType of filter to add
string$valueValue to filter against
Returns
UserLookup Returns itself to allow chaining
static statusFilter (   $needles)
staticprotected

Return all users with a matching status given in $needles

Parameters
array$needlesList of statusses to filter against
Returns
array List of user ids matching the given filter
static statusValues ( )
staticprotected

Return all valid statusses

Returns
array Associative array of status name and description

Field Documentation

$types
staticprotected
Initial value:
= [
'abschluss' => [
'filter' => self::USE_COMBINED_STUDYGROUP_FILTER
const CACHE_DURATION = 3600
const FLAG_RETURN_FULL_INFO = 2
const FLAG_SORT_NAME = 1
const USE_CACHE = false
const USE_COMBINED_STUDYGROUP_FILTER = 'use-combined-studygroup-filter'

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