Stud.IP  5.4
SemClass Class Reference
Inheritance diagram for SemClass:

Public Member Functions

 __construct ($data)
 
 activateModuleInCourses ($module)
 
 deActivateModuleInCourses ($module)
 
 countSeminars ()
 
 isModuleForbidden ($modulename)
 
 getModuleMetadata ($modulename)
 
 setModules ($module_array)
 
 getModules ()
 
 getModuleObjects ()
 
 getActivatedModules ()
 
 getActivatedModuleObjects ()
 
 getAdminModuleObject ()
 
 isModuleActivated ($modulename)
 
 isModuleAllowed ($modulename)
 
 isModuleMandatory ($module)
 
 getSemTypes ()
 
 isGroup ()
 
 store ()
 
 delete ()
 
 set ($offset, $value)
 
 offsetSet ($offset, $value)
 
 offsetGet ($offset)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 

Static Public Member Functions

static getDefaultSemClass ()
 
static getDefaultInstituteClass ($type)
 
static getGroupClasses ()
 
static getClasses ()
 
static refreshClasses ()
 
static object2array ($obj)
 

Protected Attributes

 $data = []
 

Static Protected Attributes

static $studygroup_forbidden_modules
 
static $sem_classes = null
 

Detailed Description

Class to define and manage attributes of seminar classes (or seminar categories). Usually all sem-classes are stored in a global variable $SEM_CLASS which is an array of SemClass objects.

SemClass::getClasses() gets you all seminar classes in an array.

You can access the attributes of a sem-class like an associative array with $sem_class['default_read_level']. The uinderlying data is stored in the database in the table sem_classes.

If you want to have a name of a sem-class like "Lehre", please use $sem_class['name'] and you will get a fully localized name and not the pure database entry.

This class manages also which modules are contained in which course-slots, like "what module is used as a forum in my seminars". In the database stored is the name of the module like "CoreForum" or a classname of a plugin or null if the forum is completely disabled by root for this sem-class. Core-modules can only be used within a standard slot. Plugins may also be used as optional modules not contained in a slot.

In the field 'modules' in the database is for each modules stored in a json-string if the module is activatable by the teacher or not and if it is activated as a default. Please use the methods SemClass::isSlotModule, SemClass::getSlotModule, SemClass::isModuleAllowed, SemClass::isModuleMandatory, SemClass::isSlotMandatory or even more simple SemClass::getNavigationForSlot (see documentation there).

Constructor & Destructor Documentation

◆ __construct()

__construct (   $data)

Constructor can be set with integer of sem_class_id or an array of the old $SEM_CLASS style.

Parameters
integer  |  array$data

Member Function Documentation

◆ activateModuleInCourses()

activateModuleInCourses (   $module)
Parameters
string$module
Returns
false|int

◆ countSeminars()

countSeminars ( )

Returns the number of seminars of this sem_class in Stud.IP

Returns
integer

◆ deActivateModuleInCourses()

deActivateModuleInCourses (   $module)
Parameters
string$module
Returns
false|int

◆ delete()

delete ( )

Deletes the sem_class-object and all its sem_types. Will only delete, if there are no seminars in this sem_class. Remember to refresh the global $SEM_CLASS and $SEM_TYPE array.

Returns
boolean : success of deletion

◆ getActivatedModuleObjects()

getActivatedModuleObjects ( )
Returns
StudipModule[]

◆ getActivatedModules()

getActivatedModules ( )
Returns
string[]

◆ getAdminModuleObject()

getAdminModuleObject ( )
Returns
mixed|object

◆ getClasses()

static getClasses ( )
static

Returns an array of all SemClasses in Stud.IP. Equivalent to global $SEM_CLASS variable. This variable is statically stored in this class.

Returns
SemClass[] of SemClass

◆ getDefaultInstituteClass()

static getDefaultInstituteClass (   $type)
static

Generates a dummy SemClass for institutes of this type (as defined in config.inc.php).

Parameters
integer$typeinstitute type
Returns
SemClass

◆ getDefaultSemClass()

static getDefaultSemClass ( )
static

◆ getGroupClasses()

static getGroupClasses ( )
static

Checks if any SemClasses exist that provide grouping functionality.

Returns
SimpleCollection

◆ getModuleMetadata()

getModuleMetadata (   $modulename)

Returns the metadata of a module regarding this sem_class object.

Parameters
string$modulename
Returns
array('sticky' => (bool), 'activated' => (bool))

◆ getModuleObjects()

getModuleObjects ( )
Returns
StudipModule[]

◆ getModules()

getModules ( )

Returns all metadata of the modules at once.

Returns
array: array($module_name => array('sticky' => (bool), 'activated' => (bool)), ...)

◆ getSemTypes()

getSemTypes ( )

◆ isGroup()

isGroup ( )

Checks if the current sem class is usable for course grouping.

◆ isModuleActivated()

isModuleActivated (   $modulename)

Returns true if a module is activated on default for this sem_class.

Parameters
string$modulename
Returns
boolean

◆ isModuleAllowed()

isModuleAllowed (   $modulename)

Returns if a module is allowed to be displayed for this sem_class.

Parameters
string$modulename
Returns
boolean

◆ isModuleForbidden()

isModuleForbidden (   $modulename)
Parameters
string$modulename
Returns
bool

◆ isModuleMandatory()

isModuleMandatory (   $module)

Returns if a module is mandatory for this sem_class.

Parameters
string$module
Returns
boolean

◆ object2array()

static object2array (   $obj)
static

Static method to recursively transform an object into an associative array.

Parameters
mixed$obj,should be of class StdClass
Returns
array

◆ offsetExists()

offsetExists (   $offset)

ArrayAccess method to check if an attribute exists.

Parameters
int$offset
Returns
bool

◆ offsetGet()

offsetGet (   $offset)

Compatibility function with old $SEM_CLASS variable for plugins. Maps the new array-structure to the old boolean values.

Parameters
integer$offset,name of attribute
Returns
boolean|(localized)string

◆ offsetSet()

offsetSet (   $offset,
  $value 
)

deprecated, does nothing, should not be used

Parameters
string$offset
mixed$value

◆ offsetUnset()

offsetUnset (   $offset)

deprecated, does nothing, should not be used

Parameters
string$offset

◆ refreshClasses()

static refreshClasses ( )
static

Refreshes the internal $sem_classes cache-variable.

Returns
array of SemClass

◆ set()

set (   $offset,
  $value 
)

Sets an attribute of sem_class->data

Parameters
string$offset
mixed$value

◆ setModules()

setModules (   $module_array)

Sets the metadata for each module at once.

Parameters
array$module_array,array($module_name => array('sticky' => (bool), 'activated' => (bool)), ...)

◆ store()

store ( )

stores all data in the database

Returns
boolean success

Field Documentation

◆ $data

$data = []
protected

◆ $sem_classes

$sem_classes = null
staticprotected

◆ $studygroup_forbidden_modules

$studygroup_forbidden_modules
staticprotected
Initial value:
= [
'CoreAdmin',
'CoreParticipants',
]

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