Stud.IP  5.4
ModuleManagementModel Class Reference
Inheritance diagram for ModuleManagementModel:
SimpleORMap ModuleManagementInterface AbschlussZuord Aufbaustudiengang FachFachbereich LvgruppeModulteil LvgruppeSeminar ModulDeskriptor ModuleManagementModelTreeItem ModulInst ModulLanguage ModulteilDeskriptor ModulteilLanguage ModulteilStgteilabschnitt MvvContact MvvContactRange MvvExternContact MvvFile MvvFileFileref MvvFileRange StgteilBezeichnung StudiengangStgteil StudycourseLanguage StudycourseType

Public Member Functions

 verifyPermission ($user_id=null)
 
 store ()
 
 validate ()
 
 delete ()
 
 setNewId ()
 
 getDisplayName ()
 
 getAvailableTranslations ()
 
 getStatus ()
 
 hasPublicStatus ($filter=null)
 
 getResponsibleInstitutes ()
 
 getVariant ()
 
- Public Member Functions inherited from SimpleORMap
 __construct ($id=null)
 
 __clone ()
 
 getRelationOptions ($relation)
 
 getTableMetadata ()
 
 hasAutoIncrementColumn ()
 
 setId ($id)
 
 getId ()
 
 getNewId ()
 
 toArray ($only_these_fields=null)
 
 toRawArray ($only_these_fields=null)
 
 toArrayRecursive ($only_these_fields=null)
 
 getValue ($field)
 
 getRelationValue ($relation, $field)
 
 getDefaultValue ($field)
 
 setValue ($field, $value)
 
 __get ($field)
 
 __set ($field, $value)
 
 __isset ($field)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 getIterator ()
 
 count ()
 
 isField ($field)
 
 isRelation ($field)
 
 isAdditionalField ($field)
 
 isAliasField ($field)
 
 isI18nField ($field)
 
 setData ($data, $reset=false)
 
 isNew ()
 
 isDeleted ()
 
 setNew ($is_new)
 
 getWhereQuery ()
 
 restore ()
 
 store ()
 
 triggerChdate ()
 
 delete ()
 
 isDirty ()
 
 isFieldDirty ($field)
 
 revertValue ($field)
 
 getPristineValue ($field)
 
 initRelation ($relation)
 
 resetRelation ($relation)
 
 cleanup ()
 
- Public Member Functions inherited from ModuleManagementInterface
 __construct ($id=null)
 

Static Public Member Functions

static findBySearchTerm ($search_term, $filter=null)
 
static getAll ()
 
static get ($id=null)
 
static getEnriched ($id)
 
static getEnrichedByQuery ($query=null, $params=[], $row_count=null, $offset=null)
 
static getClassDisplayName ($long=false)
 
static getFilterSql ($filter, $where=false, $or_sql=null)
 
static getContentArray (SimpleORMap $sorm, $to_utf8=true)
 
static getCount ($filter=null)
 
static getCountBySql ($sql, $filter=null)
 
static setLanguage ($language)
 
static setContentLanguage ($language)
 
static getLanguage () = htmlReady($modul['name'])
 
static getLocaleOrdinalNumberSuffix ($num)
 
static getPublicStatus ($class_name=null)
 
static findCached ($id, $index=null)
 
static clearCache ($index=null)
 
- Static Public Member Functions inherited from SimpleORMap
static tableScheme ($db_table)
 
static expireTableScheme ()
 
static exists ($id)
 
static countBySql ($sql='1', $params=[])
 
static create ($data)
 
static build ($data, $is_new=true)
 
static buildExisting ($data)
 
static import ($data)
 
static findBySQL ($sql, $params=[])
 
static findOneBySQL ($where, $params=[])
 
static findThru ($foreign_key_value, $options)
 
static findEachBySQL ($callable, $sql, $params=[])
 
static findMany ($pks=[], $order='', $order_params=[])
 
static findEachMany ($callable, $pks=[], $order='', $order_params=[])
 
static findAndMapBySQL ($callable, $where, $params=[])
 
static findAndMapMany ($callable, $pks=[], $order='', $order_params=[])
 
static deleteBySQL ($where, $params=[])
 
static toObject ($id_or_object)
 
static __callStatic (string $name, array $arguments)
 

Data Fields

 $object_real_name = ''
 
- Data Fields inherited from SimpleORMap
const ID_SEPARATOR = '_'
 

Protected Member Functions

 logChanges ($action=null)
 
- Protected Member Functions inherited from SimpleORMap
 _getId ($field)
 
 _setId ($field, $value)
 
 _getAdditionalValueFromRelation ($field)
 
 _setAdditionalValueFromRelation ($field, $value)
 
 _getAdditionalValue ($field)
 
 _setAdditionalValue ($field, $value)
 
 parseRelationOptions ($type, $name, $options)
 
 storeRelations ($only_these=null)
 
 deleteRelations ()
 
 initializeContent ()
 
 applyCallbacks ($type)
 
 cbNotificationMapper ($cb_type)
 
 cbAfterInitialize ($cb_type)
 
 setSerializedValue ($field, $value)
 
 setI18nValue ($field, $value)
 

Static Protected Member Functions

static configure ($config=[])
 
static checkSortFields ($sort, $standard_field=null, $additional_fields=[])
 
static createSortStatement ($sort, $order='ASC', $standard_field=null, $additional_fields=[])
 
static fromCache ($index, $id, Callable $finder)
 
static formatDisplayName (string $template, array $placeholders, array $replacements)
 
- Static Protected Member Functions inherited from SimpleORMap
static db_table ()
 
static db_fields ()
 
static pk ()
 
static default_values ()
 
static serialized_fields ()
 
static alias_fields ()
 
static i18n_fields ()
 
static additional_fields ()
 
static has_many ()
 
static has_one ()
 
static belongs_to ()
 
static has_and_belongs_to_many ()
 
static registered_callbacks ()
 
static known_slots ()
 
static notification_map ()
 
static getter_setter_map ()
 
static configure ($config=[])
 
static config ($key)
 
static registerCallback ($types, $cb)
 
static unregisterCallback ($types, $cb)
 

Protected Attributes

 $is_dirty = false
 
- Protected Attributes inherited from SimpleORMap
 $content = []
 
 $content_db = []
 
 $is_new = true
 
 $is_deleted = false
 
 $relations = []
 
 $additional_data = []
 

Static Protected Attributes

static $filter_params = []
 
static $perm_object = null
 
static $object_cache = []
 
- Static Protected Attributes inherited from SimpleORMap
static $config = []
 
static $reserved_slots = ['value','newid','iterator','tablemetadata', 'relationvalue','wherequery','relationoptions','data','new','id']
 
static $performs_batch_operation = false
 

Additional Inherited Members

- Static Public Attributes inherited from SimpleORMap
static $schemes = null
 

Member Function Documentation

◆ checkSortFields()

static checkSortFields (   $sort,
  $standard_field = null,
  $additional_fields = [] 
)
staticprotected

Verifies a field name or an array of field names if they are permitted for sorting the result. If ok returns the given sort fields. If not, returns the given standard_field or null.

Parameters
string | array$sortthe fields to check
string$additional_fieldsadditional allowed fields
Returns
string|null the verified sort fields

◆ clearCache()

static clearCache (   $index = null)
static

Clears the cache for a given index or completely. If this method is called on this abstract class, it will always clear the whole cache. Otherwise it will clear the cache for the subclass of this class or the given index.

Parameters
mixed$indexOptional index to clear

◆ configure()

static configure (   $config = [])
staticprotected

Common configuration for all module management models. This will ensure that the caches are flushed whenever an object changes or is removed.

Parameters
array$configConfiguration from derived class

◆ createSortStatement()

static createSortStatement (   $sort,
  $order = 'ASC',
  $standard_field = null,
  $additional_fields = [] 
)
staticprotected

Checks for valid fields and creates a sort statement for queries.

Parameters
string | array$sortThe field(s) to sort by.
string$orderThe direction (ASC|DESC)
string$standard_field
array$additional_fieldsCalculated columns.
Returns
string The sort query part.

◆ delete()

delete ( )
See also
SimpleOrMap::delete() Triggers logging.

◆ findBySearchTerm()

static findBySearchTerm (   $search_term,
  $filter = null 
)
static

Returns a collection of a MVV object type found by search term optionally filtered.

See also
ModuleManagementModel::getFilterSql()
Parameters
string$search_termThe term to search for.
array$filterFilter parameters as key value pairs.
Returns
SimpleORMapCollection A collection of "self" objects.

◆ findCached()

static findCached (   $id,
  $index = null 
)
static

Locates and returns an item from cache

Parameters
string$idId of the item
string$indexOptional index for the cache, defaults to class name
Returns
ModuleManagementModel object or null

◆ formatDisplayName()

static formatDisplayName ( string  $template,
array  $placeholders,
array  $replacements 
)
staticprotected

Formats the name of the object by given template and appropriate placeholders and replacements.

Parameters
string$templateThe template.
array$placeholdersAll placeholders (words) without regeexp stuff.
array$valuesValues to replace the placeholders. Empty strings will be ignored.
Returns
string The formatted name.
Exceptions
ExceptionIf the template is not usable.

◆ fromCache()

static fromCache (   $index,
  $id,
Callable  $finder 
)
staticprotected

Loads an item from cache and retrieves and stores it if it is not present.

Parameters
string$indexIndex for the cache
string$idId of the item
Callable$finderFunction to actually locate the item.
Returns
ModuleManagementModel object or null

◆ get()

static get (   $id = null)
static

Returns an object by given id or a new object.

Parameters
string$idThe id of the object.
Returns
ModuleManagementModel An object of "self" type.

◆ getAll()

static getAll ( )
static

Returns an array of all objects of "self" type.

Returns
array An array of "self" objects.

◆ getAvailableTranslations()

getAvailableTranslations ( )

◆ getClassDisplayName()

static getClassDisplayName (   $long = false)
static

Returns the display name of this class.

Returns
string the display name of this class

◆ getContentArray()

static getContentArray ( SimpleORMap  $sorm,
  $to_utf8 = true 
)
static

Returns an SimpleOrMap object as an Array. Its like a static version of SimpleOrMap::toArray but returns all content fields. Usefull as callback function.

Parameters
SimpleORMap$sormThe SimpleOrMap object to transform
bool$to_utf8If true (default), the data will be utf8 transformed.
Returns
array The array with all content fields from object.

◆ getCount()

static getCount (   $filter = null)
static

Returns the number of objects of this type. Optionally reduced by filter criteria.

Parameters
arrayAn array with filter criteria. See ApplicationSimpleORMap::getFilter().
Returns
int The number of rows.

◆ getCountBySql()

static getCountBySql (   $sql,
  $filter = null 
)
static

Returns the number of rows found by the given sql and filters.

Parameters
string$sqlThe sql query part.
array$filterAn array of filters with respect to the query part.
Returns
int The number of rows.

◆ getDisplayName()

getDisplayName ( )

Returns the name of the object to display in a specific context. The default is the value from the db fields "name" or "bezeichnung" or an empty string if no such fields exist. This method is overwritten by most of the mvv objects to display more complex names glued together from fields of related objects.

Returns
string The display name for this object

◆ getEnriched()

static getEnriched (   $id)
static

Returns an object by given id with all relations and additional fields.

Parameters
string$idThe id of the object.
Returns
ModuleManagementModel

◆ getEnrichedByQuery()

static getEnrichedByQuery (   $query = null,
  $params = [],
  $row_count = null,
  $offset = null 
)
static

Enriches the model with data from other joined tables.

Parameters
string$querycomplete sql with all fields in select statement from main table
array$paramsArray with the parameters used in query
int$row_countNumber of rows to return
int$offsetOffset where the result set starts
Returns
SimpleOrMapCollection with all found objects or empty array

◆ getFilterSql()

static getFilterSql (   $filter,
  $where = false,
  $or_sql = null 
)
static

Creates a sql clause to set constraints in a query by given filters.

The values of the given filters can be either a scalar value or an array.

If the value of the given filter is 'undefined' then it matches against NULL or an empty string.

If the column name has a comparison operator at its end (delimited by a blank), this operator is used.

To filter for semesters the column name has to be 'start_sem.beginn' for the start semester and 'end_sem.ende' for the end semester according to the joins with the semester_data table and table aliases in the sql statement.

Parameters
array$filterAn associative array with filters where the key is the column name to filter against the given value.
bool$whereif true returns a complete where statement
stringSQL-where part glued with an "OR" at the end of the filter sql part.
Returns
string The sql clause

◆ getLanguage()

</td ><? endif ?><? endfor ?></tr ><? endforeach ?><? if(! $displayedModulName):?>< tr ><? if(! $displayedAbschnittName) :?><? $displayedAbschnittName=true ?>< td rowspan="<?= $abschnitt['rowspan'] ?: 1 ?><?= htmlReady($abschnitt['name']) ?><br/><?= $abschnitt['creditPoints'] ? $abschnitt['creditPoints'] . ' ' . _('CP') : '' ?><? if (trim($abschnitt['kommentar'])) : ?><a data-dialog title="<?=sprintf(_('%s(Kommentar)'), htmlReady( $abschnitt[ 'name'])) ?> href endif endifif( $modul[ 'veranstaltungen'])( 'shared/modul/overview', $modul_id, $active_sem->getId(), [ 'display_language'=> getLanguage ( ) = htmlReady($modul['name'])
staticfinal

Returns the currently selected language.

Returns
string The currently selected language.

◆ getLocaleOrdinalNumberSuffix()

static getLocaleOrdinalNumberSuffix (   $num)
static

Returns the suffix for ordinal numbers if the selected locale is EN or a simple point if not.

Parameters
int$num
Returns
string The ordinal suffix or a point.

◆ getPublicStatus()

static getPublicStatus (   $class_name = null)
static

Returns an array of all values for given class with status "public" defined by configuration.

Returns
array Array of defined values for status "public".

◆ getResponsibleInstitutes()

getResponsibleInstitutes ( )

◆ getStatus()

getStatus ( )

Returns the status of this object. Some MVV objects have a status declared in mvv_config.php.

Returns
string|null The status or null if the object has no status.

◆ getVariant()

getVariant ( )

Returns a string that identify a variant of this object. Returns an empty string if no variant exists for this object.

Returns
string String to identify a variant.

◆ hasPublicStatus()

hasPublicStatus (   $filter = null)

Returns whether this object has a public status. Public status means that this object is public visible. The possible status are defined in mvv_config.php. The set of possible status can be restricted by an optional filter. Only the statis given in filter are checkrd.

Parameters
array$filterAn array of status keys.
Returns
boolean True if object has an public status.

◆ logChanges()

logChanges (   $action = null)
protected

Logs all changes of this object.

Parameters
string$actionnew, update or delete
Returns
boolean Return true if logging was successful.

◆ setContentLanguage()

static setContentLanguage (   $language)
static

Switches the content to the given language. Compared to ModuleManagementModel::setLanguage() strings translated with gettext are always in the prefered language selected by the user.

Parameters
string$languageThe language code (see mvv_config.php)

◆ setLanguage()

static setLanguage (   $language)
staticfinal

Sets the language for localized fields and the locale environment globally. Possible values are configured in mvv_config.php.

See also
mvv_config.php
Parameters
string$languageThe language.

◆ setNewId()

setNewId ( )

Sets a new id for this object.

◆ store()

store ( )
See also
SimpleOrMap::store() Optional validation of values. Triggers logging of changes.
Parameters
boolean$validateTrue to validate values.

◆ validate()

validate ( )

Validates the values before store. Throws an InvalidValuesException normally catched by form validation.

Exceptions
InvalidValuesException

◆ verifyPermission()

verifyPermission (   $user_id = null)

Verifies whether the given user has sufficient rights to create, modify or delete this object and throws an exception if not.

Parameters
string$user_idThe user's id.
Returns
boolean True if rights are sufficient
Exceptions
Exceptionif rights are not sufficient.

Field Documentation

◆ $filter_params

$filter_params = []
staticprotected

◆ $is_dirty

$is_dirty = false
protected

◆ $object_cache

$object_cache = []
staticprotected

◆ $object_real_name

$object_real_name = ''

◆ $perm_object

$perm_object = null
staticprotected

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