Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
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 (   $setId = '')

Member Function Documentation

__clone ( )
__toString ( )
addAdmissionRule (   $rule)

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

Parameters
AdmissionRulerule
Returns
CourseSet
addCourse (   $courseId)

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

Parameters
StringcourseId
Returns
CourseSet
static addCourseToSet (   $set_id,
  $course_id 
)
static
addInstitute (   $newId)

Adds a new institute ID.

Parameters
StringnewId
Returns
CourseSet
addInstitutes (   $newIds)

Adds several institute IDs to the existing institute assignments.

Parameters
ArraynewIds
Returns
CourseSet
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 (   $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 ( )

Removes all admission rules at once.

Returns
CourseSet
delete ( )

Deletes the course set and all associated data.

distributeSeats ( )

Starts the seat distribution algorithm.

getAdmissionRule (   $class_name)
getAdmissionRules ( )

Get all admission rules belonging to the course set.

Returns
AdmissionRule[]
getAlgorithm ( )

Get the currently used distribution algorithm.

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

Returns the date of the last change.

Returns
int
getCourses ( )

Gets the course IDs belonging to the course set.

Returns
Array
static getCoursesByCourseSetId (   $courseSetId)
static

Gets all courses belonging to the given course set ID.

Parameters
String$courseSetId
Returns
Array
static getCoursesetsByInstituteId (   $instituteId,
  $filter = [] 
)
static

Gets all course sets belonging to the given institute ID.

Parameters
String$instituteId
Returns
Array
static getGlobalCoursesets (   $filter = [])
static

Gets all global course sets

Parameters
array$filter
Returns
Array
static getGlobalLockedAdmissionSetId ( )
static
getId ( )

Get the identifier of the course set.

Returns
String
getInfoText ( )

Get the course set's info text.

Returns
String
getInstituteIds ( )

Which institutes does the rule belong to?

Returns
Array
getName ( )

Gets this course set's display name.

getNumApplicants ( )
getPriorities ( )

Retrieves the priorities given to the courses in this set.

Returns
Array
getPrivate ( )

Is the current courseset private?

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

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

Returns
string id of semester
static getSetForCourse (   $courseId)
static

Gets the course sets the given course belongs to.

Parameters
StringcourseId
Returns
CourseSet
static getSetForRule (   $rule_id)
static

Gets the course sets the given rule belongs to.

Parameters
String$rule_id
Returns
CourseSet
getUserFactorList ( )
getUserId ( )

Gets the owner of this course set.

getUserLists ( )

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

Returns
Array
hasAdmissionRule (   $rule)

check if course set has given admission rule

Parameters
string$rulename of AdmissionRule class
Returns
boolean
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 (   $admission_rule)

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

Parameters
AdmissionRule | string$admission_rule
Returns
boolean
isGlobal ( )
isSeatDistributionEnabled ( )

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

Returns
boolean
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 (   $user_id)

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

Parameters
string$user_id
Returns
boolean
load ( )

Helper function for loading data from DB.

removeAdmissionRule (   $ruleId)

Removes the rule with the given ID from the set.

Parameters
StringruleId
Returns
CourseSet
removeCourse (   $courseId)

Removes the course with the given ID from the set.

Parameters
StringcourseId
Returns
CourseSet
static removeCourseFromSet (   $set_id,
  $course_id 
)
static
removeInstitute (   $instituteId)

Removes the institute with the given ID from the set.

Parameters
StringinstituteId
Returns
CourseSet
removeUserlist (   $listId)

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

Parameters
StringlistId
Returns
CourseSet
setAdmissionRules (   $newRules)

Adds several admission rules after clearing the existing rule assignments.

Parameters
ArraynewIds
Returns
CourseSet
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 (   $state)
setCourses (   $newIds)

Adds several course IDs after clearing the existing course assignments.

Parameters
ArraynewIds
Returns
CourseSet
setInfoText (   $newText)

Set the course set's info text.

Returns
CourseSet
setInstitutes (   $newIds)

Adds several institute IDs after clearing the existing institute assignments.

Parameters
ArraynewIds
Returns
CourseSet
setName (   $newName)
setPrivate (   $newPrivate)

Set a new value for courseset privacy.

Parameters
bool$newPrivate
Returns
CourseSet
setUserId (   $user_id)
setUserlists (   $newIds)

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

Parameters
ArraynewIds
Returns
CourseSet
store ( )
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 = []
protected

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

$algorithm = null
protected

Seat distribution algorithm.

$chdate = null
protected

When was the course set changed?

$courses = []
protected

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

$hasAlgorithmRun = false
protected

Has the seat distribution algorithm already been executed?

$id = ''
protected

Unique identifier for this set.

$infoText = ''
protected

Some extensive descriptional text for informing confused students.

$institutes = []
protected

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

$name = ''
protected

Some display name for this course set.

$private = false
protected

Is the course set only visible for the creator?

$user_id = false
protected

Who owns this course set?

$userlists = []
protected

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