Stud.IP  6.0
PreferentialAdmission Class Reference
Inheritance diagram for PreferentialAdmission:
AdmissionRule

Public Member Functions

 __construct ($ruleId='')
 
 addCondition ($condition)
 
 afterSeatDistribution ($courseset)
 
 beforeSeatDistribution ($courseset)
 
 delete ()
 
 getAffectedUsers ()
 
 getConditions ()
 
 getFavorSemester ()
 
 getSemesterGroups ($users, $considerConditions, $exclude=[])
 
 getTemplate ()
 
 load ()
 
 removeCondition ($conditionId)
 
 ruleApplies ($userId, $courseId)
 
 setAllData ($data)
 
 setFavorSemester ($newFavorSemester)
 
 setSemesterBonus ($courseset, $grouped, $baseBonus=1)
 
 store ()
 
 toString ()
 
 validate ($data)
 
 __clone ()
 
- Public Member Functions inherited from AdmissionRule
 __construct ($ruleId='', $courseSetId='')
 
 afterSeatDistribution ($courseset)
 
 checkTimeFrame ()
 
 delete ()
 
 generateId ($tableName)
 
 getAffectedUsers ()
 
 getEndTime ()
 
 getInput ()
 
 getId ()
 
 getMessage ()
 
 getStartTime ()
 
 getTemplate ()
 
 load ()
 
 beforeSeatDistribution ($courseset)
 
 ruleApplies ($userId, $courseId)
 
 setAllData ($data)
 
 setEndTime ($newEndTime)
 
 setMessage ($newMessage)
 
 setStartTime ($newStartTime)
 
 store ()
 
 toString ()
 
 validate ($data)
 
 __toString ()
 
 loadSiblings ()
 
 getSiblings ()
 
 setSiblings ($siblings=[])
 
 isCombinationAllowed ($admission_rule)
 
 __clone ()
 

Static Public Member Functions

static getDescription ()
 
static getName ()
 
- Static Public Member Functions inherited from AdmissionRule
static getAvailableAdmissionRules ($activeOnly=true)
 
static getInputFrame ()
 
static getDescription ()
 
static getName ()
 

Data Fields

 $userlists = []
 
 $conditions = []
 
 $favorSemester = false
 
 $bonus_difference = 100
 
 $courseset = null
 
- Data Fields inherited from AdmissionRule
 $endTime = 0
 
 $id = ''
 
 $message = ''
 
 $default_message = ''
 
 $startTime = 0
 
 $courseSetId = ''
 
 $siblings = []
 
 $siblings_override = false
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $ruleId = '')

Standard constructor.

Parameters
StringruleId If this rule has been saved previously, it will be loaded from database.
Returns
AdmissionRule the current object (this).

Member Function Documentation

◆ __clone()

__clone ( )

◆ addCondition()

addCondition (   $condition)

Adds a new UserFilter to this rule.

Parameters
UserFiltercondition
Returns
PreferentialAdmission

◆ afterSeatDistribution()

afterSeatDistribution (   $courseset)

Hook that can be called after the seat distribution on the courseset has completed. User lists that were generated before are removed now.

◆ beforeSeatDistribution()

beforeSeatDistribution (   $courseset)

Hook that can be called when the seat distribution on the courseset starts. This type of admission rule gets all users that fulfill the specified conditions and generates user lists with modified chances in seat distribution.

Parameters
CourseSetThe courseset this rule belongs to.

◆ delete()

delete ( )

Deletes the admission rule and all associated data.

◆ getAffectedUsers()

getAffectedUsers ( )

Gets all users that are matched by thís rule.

Returns
Array An array containing IDs of users who are matched by this rule.

◆ getConditions()

getConditions ( )

Gets all defined conditions.

Returns
Array

◆ getDescription()

static getDescription ( )
static

Gets some text that describes what this AdmissionRule (or respective subclass) does.

◆ getFavorSemester()

getFavorSemester ( )

Returns whether higher semesters of study should be favored.

Returns
bool

◆ getName()

static getName ( )
static

Return this rule's name.

◆ getSemesterGroups()

getSemesterGroups (   $users,
  $considerConditions,
  $exclude = [] 
)

Gets the semesters of study for the given users. If conditions are set and should be considered, only the semesters of study belonging to the given conditions are set.

Parameters
$usersuser IDs to process
$considerConditionsshould only the semesters of study belonging to given conditions be considered?
array$excludeuser IDs to exclude
Returns
array Users with their maximal semester of study.

◆ getTemplate()

getTemplate ( )

Gets the template that provides a configuration GUI for this rule.

Returns
String

◆ load()

load ( )

Helper function for loading data from DB. Generic AdmissionRule data is loaded with the parent load() method.

◆ removeCondition()

removeCondition (   $conditionId)

Removes the condition with the given ID from the rule.

Parameters
StringconditionId
Returns
PreferentialAdmission

◆ ruleApplies()

ruleApplies (   $userId,
  $courseId 
)

Admission is open for everyone. On seat distribution, the rule conditions will be used to generate user lists with the specified chance.

Parameters
String$userId
String$courseId
Returns
Array Is the user allowed to register or are there any errors?

◆ setAllData()

setAllData (   $data)

Uses the given data to fill the object values. This can be used as a generic function for storing data if the concrete rule type isn't known in advance.

Parameters
Array$data
Returns
AdmissionRule This object.

◆ setFavorSemester()

setFavorSemester (   $newFavorSemester)

New setting for favoring higher semesters of study.

Parameters
bool$newFavorSemester
Returns
PreferentialAdmission

◆ setSemesterBonus()

setSemesterBonus (   $courseset,
  $grouped,
  $baseBonus = 1 
)

Create user lists and set bonus corresponding to the maximal available semester of study for given users.

Parameters
$coursesetCourseSet to add user lists to
$groupedassociative array of users in the form <semester> => array(<user_id1>, <user_id2, ...))
$baseBonusbasic bonus to start with, defaults to 0.

◆ store()

store ( )

Helper function for storing data to DB.

◆ toString()

toString ( )

A textual description of the current rule.

Returns
String

◆ validate()

validate (   $data)

Validates if the given request data is sufficient to configure this rule (e.g. if required values are present).

Parameters
ArrayRequest data
Returns
Array Error messages.

Field Documentation

◆ $bonus_difference

$bonus_difference = 100

If semesters are favored, which bonus difference shall be set between each semester of study?

◆ $conditions

$conditions = []

Conditions for selecting the favored people in seat distribution.

◆ $courseset

$courseset = null

The courseset this rule belongs to.

◆ $favorSemester

$favorSemester = false

Should higher semesters of study be favored?

◆ $userlists

$userlists = []

Stores IDs of userlists generated for representing the selected conditions. These lists are created on seat distribution in the course set and are deleted immediately after.


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