Stud.IP  2.4 Revision 48548
 All Data Structures Namespaces Files Functions Variables Groups Pages
SemClass Class Reference
Inheritance diagram for SemClass:
Inheritance graph
Collaboration diagram for SemClass:
Collaboration graph

Public Member Functions

 __construct ($data)
 countSeminars ()
 getSlotModule ($slot)
 setSlotModule ($slot, $module)
 getModuleMetadata ($modulename)
 setModules ($module_array)
 getModules ()
 isModuleAllowed ($modulename)
 isModuleMandatory ($module)
 isSlotMandatory ($slot)
 isSlotModule ($module)
 getModule ($slot_or_plugin)
 getNavigationForSlot ($slot, $course_id=null)
 getSemTypes ()
 store ()
 delete ()
 set ($offset, $value)
 offsetSet ($offset, $value)
 offsetGet ($offset)
 offsetExists ($offset)
 offsetUnset ($offset)

Static Public Member Functions

static getDefaultSemClass ()
static getClasses ()
static refreshClasses ()
static object2array ($obj)
static getSlots ()

Protected Attributes

 $data = array()

Static Protected Attributes

static $slots
static $core_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

Here is the call graph for this function:

Member Function Documentation

countSeminars ( )

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

Returns
integer

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the call graph for this function:

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
array of SemClass

Here is the call graph for this function:

Here is the caller graph for this function:

static getDefaultSemClass ( )
static

Here is the caller graph for this function:

getModule (   $slot_or_plugin)

returns an instance of the module of a given slotname or pluginclassname

Parameters
string$slot_or_plugin
Returns
StudipModule | null

Here is the call graph for this function:

Here is the caller graph for this function:

getModuleMetadata (   $modulename)

Returns the metadata of a module regarding this sem_class object.

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

Returns all metadata of the modules at once.

Returns
array: array($module_name => array('sticky' => (bool), 'activated' => (bool)), ...)
getNavigationForSlot (   $slot,
  $course_id = null 
)

Returns an array of navigation-objects. Those are for the tabs. And yes, a slot can contain more than one tab, but usually contains only one. The keys of the array are the names within the navigation-tree.

Parameters
string$slot
Returns
array('navigation_name' => Navigation $nav, ...)

Here is the call graph for this function:

getSemTypes ( )

Here is the call graph for this function:

getSlotModule (   $slot)

Returns the name of the module of the slot or the module itself, if it is a plugin.

Parameters
string$slot
Returns
string

Here is the caller graph for this function:

static getSlots ( )
static

Returns an array of all slot-names.

Returns
array of strings

Here is the caller graph for this function:

isModuleAllowed (   $modulename)

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

Parameters
string$modulename
Returns
boolean

Here is the call graph for this function:

Here is the caller graph for this function:

isModuleMandatory (   $module)

Returns if a module is mandatory for this sem_class.

Parameters
string$module
Returns
boolean

Here is the call graph for this function:

Here is the caller graph for this function:

isSlotMandatory (   $slot)

Returns if the slot is mandatory, which it is if the module in this slot is mandatory.

Parameters
string$slot
Returns
boolean

Here is the call graph for this function:

isSlotModule (   $module)

Returns if a module is a slot module. Good for plugins that should be displayed on a specific place only if they are no slot modules.

Parameters
string$module
Returns
boolean

Here is the call graph for this function:

Here is the caller graph for this function:

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

Here is the caller graph for this function:

offsetExists (   $offset)

ArrayAccess method to check if an attribute exists.

Parameters
type$offset
Returns
type
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

Here is the call graph for this function:

Here is the caller graph for this function:

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)), ...)
setSlotModule (   $slot,
  $module 
)

Defines a module for a slot and overwrites previous module.

Parameters
string$slot
string$module(coremodule or classname of plugin)
store ( )

stores all data in the database

Returns
boolean success

Here is the call graph for this function:

Field Documentation

$core_modules
staticprotected
Initial value:
array(
"CoreOverview",
"CoreAdmin",
"CoreStudygroupAdmin",
"CoreStudygroupOverview",
"CoreDocuments",
"CoreParticipants",
"CoreStudygroupParticipants",
"CoreSchedule",
"CoreLiterature",
"CoreScm",
"CoreWiki",
"CoreResources",
"CoreCalendar",
"CoreElearningInterface"
)
$data = array()
protected
$sem_classes = null
staticprotected
$slots
staticprotected
Initial value:
array(
"overview",
"forum",
"admin",
"documents",
"schedule",
"participants",
"literature",
"scm",
"wiki",
"resources",
"calendar",
"elearning_interface"
)

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