Stud.IP  5.4
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 roleFilter ($needles)
 
static roleValues ()
 

Static Protected Attributes

static $types
 

Member Function Documentation

◆ abschlussFilter()

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

◆ abschlussValues()

static abschlussValues ( )
staticprotected

Return all studydegrees

Returns
array Associative array of abschluss ids and abschluss names

◆ addType()

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

clearFilters ( )

Clears all defined filters.

Returns
UserLookup Returns itself to allow chaining

◆ domainFilter()

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

◆ domainValues()

static domainValues ( )
staticprotected

Return all valid domains

Returns
array Associative array of domain id and name

◆ execute()

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

◆ fachFilter()

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

◆ fachsemesterFilter()

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

◆ fachsemesterValues()

static fachsemesterValues ( )
staticprotected

Create a array with all possible values for studysemesters

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

◆ fachValues()

static fachValues ( )
staticprotected

Return all studycourses

Returns
array Associative array of studiengang ids and studiengang names

◆ getFilters()

getFilters ( )
protected

◆ getValuesForType()

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

◆ institutFilter()

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

◆ institutValues()

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)

◆ roleFilter()

static roleFilter (   $needles)
staticprotected

Return all users with a matching assigned role given in $needles

Parameters
array$needlesList of domain ids to filter against
Returns
array List of user ids matching the given filter

◆ roleValues()

static roleValues ( )
staticprotected

Return all valid roles

Returns
array Associative array of domain id and name

◆ setFilter()

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

◆ statusFilter()

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

◆ statusValues()

static statusValues ( )
staticprotected

Return all valid statusses

Returns
array Associative array of status name and description

Field Documentation

◆ $types

$types
staticprotected
Initial value:
= [
'abschluss' => [
'filter' => self::USE_COMBINED_STUDYGROUP_FILTER

◆ CACHE_DURATION

const CACHE_DURATION = 3600

◆ FLAG_RETURN_FULL_INFO

const FLAG_RETURN_FULL_INFO = 2

◆ FLAG_SORT_NAME

const FLAG_SORT_NAME = 1

◆ USE_CACHE

const USE_CACHE = false

◆ USE_COMBINED_STUDYGROUP_FILTER

const USE_COMBINED_STUDYGROUP_FILTER = 'use-combined-studygroup-filter'

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