Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
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 (   $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 (   $module)
Parameters
string$module
Returns
false|int
countSeminars ( )

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

Returns
integer
deActivateModuleInCourses (   $module)
Parameters
string$module
Returns
false|int
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 ( )
Returns
StudipModule[]
getActivatedModules ( )
Returns
string[]
getAdminModuleObject ( )
Returns
mixed|object
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
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
static getDefaultSemClass ( )
static
static getGroupClasses ( )
static

Checks if any SemClasses exist that provide grouping functionality.

Returns
SimpleCollection
getModuleMetadata (   $modulename)

Returns the metadata of a module regarding this sem_class object.

Parameters
string$modulename
Returns
array('sticky' => (bool), 'activated' => (bool))
getModuleObjects ( )
Returns
StudipModule[]
getModules ( )

Returns all metadata of the modules at once.

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

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

isModuleActivated (   $modulename)

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

Parameters
string$modulename
Returns
boolean
isModuleAllowed (   $modulename)

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

Parameters
string$modulename
Returns
boolean
isModuleForbidden (   $modulename)
Parameters
string$modulename
Returns
bool
isModuleMandatory (   $module)

Returns if a module is mandatory for this sem_class.

Parameters
string$module
Returns
boolean
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 (   $offset)

ArrayAccess method to check if an attribute exists.

Parameters
int$offset
Returns
bool
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 (   $offset,
  $value 
)

deprecated, does nothing, should not be used

Parameters
string$offset
mixed$value
offsetUnset (   $offset)

deprecated, does nothing, should not be used

Parameters
string$offset
static refreshClasses ( )
static

Refreshes the internal $sem_classes cache-variable.

Returns
array of SemClass
set (   $offset,
  $value 
)

Sets an attribute of sem_class->data

Parameters
string$offset
mixed$value
setModules (   $module_array)

Sets the metadata for each module at once.

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

stores all data in the database

Returns
boolean success

Field Documentation

$data = []
protected
$sem_classes = null
staticprotected
$studygroup_forbidden_modules
staticprotected
Initial value:
= [
'CoreAdmin',
'CoreParticipants',
'CoreSchedule'
]

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