Stud.IP  5.4
CourseSet Class Reference

Public Member Functions

 __construct ($setId='')
 
 addAdmissionRule ($rule)
 
 addCourse ($courseId)
 
 addInstitute ($newId)
 
 addInstitutes ($newIds)
 
 addUserList ($listId)
 
 checkAdmission ($userId, $courseId)
 
 clearAdmissionRules ()
 
 delete ()
 
 distributeSeats ()
 
 setAlgorithmRun ($state)
 
 isSeatDistributionEnabled ()
 
 getSeatDistributionTime ()
 
 getAdmissionRules ()
 
 getAdmissionRule ($class_name)
 
 hasAdmissionRule ($rule)
 
 getAlgorithm ()
 
 getAllowedUserCount ()
 
 getCourses ()
 
 getId ()
 
 getInfoText ()
 
 getInstituteIds ()
 
 isGlobal ()
 
 getName ()
 
 getChdate ()
 
 getPriorities ()
 
 getNumApplicants ()
 
 getPrivate ()
 
 getSemester ()
 
 getUserId ()
 
 setUserId ($user_id)
 
 getUserLists ()
 
 getUserFactorList ()
 
 hasAlgorithmRun ()
 
 load ()
 
 removeCourse ($courseId)
 
 removeAdmissionRule ($ruleId)
 
 removeInstitute ($instituteId)
 
 removeUserlist ($listId)
 
 setAdmissionRules ($newRules)
 
 setAlgorithm ($newAlgorithm)
 
 setCourses ($newIds)
 
 setInstitutes ($newIds)
 
 setInfoText ($newText)
 
 setName ($newName)
 
 setPrivate ($newPrivate)
 
 setUserlists ($newIds)
 
 store ()
 
 toString ($short=false)
 
 __toString ()
 
 isUserAllowedToAssignCourse ($user_id, $course_id)
 
 isUserAllowedToEdit ($user_id)
 
 isAdmissionRuleAllowed ($admission_rule)
 
 __clone ()
 

Static Public Member Functions

static getCoursesByCourseSetId ($courseSetId)
 
static getCoursesetsByInstituteId ($instituteId, $filter=[])
 
static getGlobalCoursesets ($filter=[])
 
static getSetForCourse ($courseId)
 
static getSetForRule ($rule_id)
 
static getGlobalLockedAdmissionSetId ()
 
static addCourseToSet ($set_id, $course_id)
 
static removeCourseFromSet ($set_id, $course_id)
 

Protected Attributes

 $admissionRules = []
 
 $algorithm = null
 
 $courses = []
 
 $hasAlgorithmRun = false
 
 $id = ''
 
 $infoText = ''
 
 $institutes = []
 
 $name = ''
 
 $private = false
 
 $user_id = false
 
 $chdate = null
 
 $userlists = []
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $setId = '')

Member Function Documentation

◆ __clone()

__clone ( )

◆ __toString()

__toString ( )

◆ addAdmissionRule()

addAdmissionRule (   $rule)

Adds the given admission rule to the list of rules for the course set.

Parameters
AdmissionRulerule
Returns
CourseSet

◆ addCourse()

addCourse (   $courseId)

Adds the course with the given ID to the course set.

Parameters
StringcourseId
Returns
CourseSet

◆ addCourseToSet()

static addCourseToSet (   $set_id,
  $course_id 
)
static

◆ addInstitute()

addInstitute (   $newId)

Adds a new institute ID.

Parameters
StringnewId
Returns
CourseSet

◆ addInstitutes()

addInstitutes (   $newIds)

Adds several institute IDs to the existing institute assignments.

Parameters
ArraynewIds
Returns
CourseSet

◆ addUserList()

addUserList (   $listId)

Adds a UserList to the course set. The list contains several users and a factor that changes seat distribution chances for these users;

Parameters
StringlistId
Returns
CourseSet

◆ checkAdmission()

checkAdmission (   $userId,
  $courseId 
)

Is the given user allowed to register as participant in the given course according to the rules of this course set?

Parameters
StringuserId
StringcourseId
Returns
Array Optional error messages from rules if something went wrong.

◆ clearAdmissionRules()

clearAdmissionRules ( )

Removes all admission rules at once.

Returns
CourseSet

◆ delete()

delete ( )

Deletes the course set and all associated data.

◆ distributeSeats()

distributeSeats ( )

Starts the seat distribution algorithm.

◆ getAdmissionRule()

getAdmissionRule (   $class_name)

◆ getAdmissionRules()

getAdmissionRules ( )

Get all admission rules belonging to the course set.

Returns
AdmissionRule[]

◆ getAlgorithm()

getAlgorithm ( )

Get the currently used distribution algorithm.

Returns
AdmissionAlgorithm

◆ getAllowedUserCount()

getAllowedUserCount ( )

How many users will be allowed to register according to the defined rules? This can help in estimating whether the combination of the defined rules makes sense.

Returns
int

◆ getChdate()

getChdate ( )

Returns the date of the last change.

Returns
int

◆ getCourses()

getCourses ( )

Gets the course IDs belonging to the course set.

Returns
Array

◆ getCoursesByCourseSetId()

static getCoursesByCourseSetId (   $courseSetId)
static

Gets all courses belonging to the given course set ID.

Parameters
String$courseSetId
Returns
Array

◆ getCoursesetsByInstituteId()

static getCoursesetsByInstituteId (   $instituteId,
  $filter = [] 
)
static

Gets all course sets belonging to the given institute ID.

Parameters
String$instituteId
Returns
Array

◆ getGlobalCoursesets()

static getGlobalCoursesets (   $filter = [])
static

Gets all global course sets

Parameters
array$filter
Returns
Array

◆ getGlobalLockedAdmissionSetId()

static getGlobalLockedAdmissionSetId ( )
static

◆ getId()

getId ( )

Get the identifier of the course set.

Returns
String

◆ getInfoText()

getInfoText ( )

Get the course set's info text.

Returns
String

◆ getInstituteIds()

getInstituteIds ( )

Which institutes does the rule belong to?

Returns
Array

◆ getName()

getName ( )

Gets this course set's display name.

◆ getNumApplicants()

getNumApplicants ( )

◆ getPriorities()

getPriorities ( )

Retrieves the priorities given to the courses in this set.

Returns
Array

◆ getPrivate()

getPrivate ( )

Is the current courseset private?

Returns
bool

◆ getSeatDistributionTime()

getSeatDistributionTime ( )

returns timestamp of distribution time or null if no distribution time available may return 0 if first-come-first-serve is enabled

Returns
integer|null timestamp of distribution

◆ getSemester()

getSemester ( )

returns latest semester id from assigned courses if no courses are assigned current semester

Returns
string id of semester

◆ getSetForCourse()

static getSetForCourse (   $courseId)
static

Gets the course sets the given course belongs to.

Parameters
StringcourseId
Returns
CourseSet

◆ getSetForRule()

static getSetForRule (   $rule_id)
static

Gets the course sets the given rule belongs to.

Parameters
String$rule_id
Returns
CourseSet

◆ getUserFactorList()

getUserFactorList ( )

◆ getUserId()

getUserId ( )

Gets the owner of this course set.

◆ getUserLists()

getUserLists ( )

Retrieves the lists of users that are considered specially in seat distribution.

Returns
Array

◆ hasAdmissionRule()

hasAdmissionRule (   $rule)

check if course set has given admission rule

Parameters
string$rulename of AdmissionRule class
Returns
boolean

◆ hasAlgorithmRun()

hasAlgorithmRun ( )

Evaluates whether the seat distribution algorithm has already been executed on this course set.

Returns
boolean True if algorithm has already run, otherwise false.

◆ isAdmissionRuleAllowed()

isAdmissionRuleAllowed (   $admission_rule)

checks if given rule is allowed to be added to current set of rules

Parameters
AdmissionRule | string$admission_rule
Returns
boolean

◆ isGlobal()

isGlobal ( )

◆ isSeatDistributionEnabled()

isSeatDistributionEnabled ( )

returns true if the set allows only a limited number of places

Returns
boolean

◆ isUserAllowedToAssignCourse()

isUserAllowedToAssignCourse (   $user_id,
  $course_id 
)

is user with given user id allowed to assign/unassign given course to courseset

Parameters
string$user_id
string$course_id
Returns
boolean

◆ isUserAllowedToEdit()

isUserAllowedToEdit (   $user_id)

is user with given user id allowed to edit or delete the courseset

Parameters
string$user_id
Returns
boolean

◆ load()

load ( )

Helper function for loading data from DB.

◆ removeAdmissionRule()

removeAdmissionRule (   $ruleId)

Removes the rule with the given ID from the set.

Parameters
StringruleId
Returns
CourseSet

◆ removeCourse()

removeCourse (   $courseId)

Removes the course with the given ID from the set.

Parameters
StringcourseId
Returns
CourseSet

◆ removeCourseFromSet()

static removeCourseFromSet (   $set_id,
  $course_id 
)
static

◆ removeInstitute()

removeInstitute (   $instituteId)

Removes the institute with the given ID from the set.

Parameters
StringinstituteId
Returns
CourseSet

◆ removeUserlist()

removeUserlist (   $listId)

Removes the user list with the given ID from the set.

Parameters
StringlistId
Returns
CourseSet

◆ setAdmissionRules()

setAdmissionRules (   $newRules)

Adds several admission rules after clearing the existing rule assignments.

Parameters
ArraynewIds
Returns
CourseSet

◆ setAlgorithm()

setAlgorithm (   $newAlgorithm)

Sets a seat distribution algorithm for this course set. This will only have an effect in conjunction with a TimedAdmission, as the algorithm needs a defined point in time where it will start.

Parameters
StringnewAlgorithm
Returns
CourseSet

◆ setAlgorithmRun()

setAlgorithmRun (   $state)

◆ setCourses()

setCourses (   $newIds)

Adds several course IDs after clearing the existing course assignments.

Parameters
ArraynewIds
Returns
CourseSet

◆ setInfoText()

setInfoText (   $newText)

Set the course set's info text.

Returns
CourseSet

◆ setInstitutes()

setInstitutes (   $newIds)

Adds several institute IDs after clearing the existing institute assignments.

Parameters
ArraynewIds
Returns
CourseSet

◆ setName()

setName (   $newName)

◆ setPrivate()

setPrivate (   $newPrivate)

Set a new value for courseset privacy.

Parameters
bool$newPrivate
Returns
CourseSet

◆ setUserId()

setUserId (   $user_id)

◆ setUserlists()

setUserlists (   $newIds)

Adds several user list IDs after clearing the existing user list assignments.

Parameters
ArraynewIds
Returns
CourseSet

◆ store()

store ( )

◆ toString()

toString (   $short = false)

A textual description of the current rule.

Parameters
boolshort Show only short info without overview of assigned courses and institutes.
Returns
String

Field Documentation

◆ $admissionRules

$admissionRules = []
protected

Admission rules that are applied to the courses belonging to this set.

◆ $algorithm

$algorithm = null
protected

Seat distribution algorithm.

◆ $chdate

$chdate = null
protected

When was the course set changed?

◆ $courses

$courses = []
protected

IDs of courses that are aggregated into this set. The array is in the form ($courseId1 => true, $courseId2 => true).

◆ $hasAlgorithmRun

$hasAlgorithmRun = false
protected

Has the seat distribution algorithm already been executed?

◆ $id

$id = ''
protected

Unique identifier for this set.

◆ $infoText

$infoText = ''
protected

Some extensive descriptional text for informing confused students.

◆ $institutes

$institutes = []
protected

Which Stud.IP institute does the course set belong to?

◆ $name

$name = ''
protected

Some display name for this course set.

◆ $private

$private = false
protected

Is the course set only visible for the creator?

◆ $user_id

$user_id = false
protected

Who owns this course set?

◆ $userlists

$userlists = []
protected

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