Select Git revision
Semester.class.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
Closes #2356 Merge request studip/studip!1540
Closes #2356 Merge request studip/studip!1540
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Semester.class.php 16.35 KiB
<?php
/**
* Semester.class.php
* model class for table semester_data
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* @author André Noack <noack@data-quest.de>
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
*
* @property string semester_id database column
* @property string id alias column for semester_id
* @property string name database column
* @property string description database column
* @property string semester_token database column
* @property string beginn database column
* @property string ende database column
* @property string vorles_beginn database column
* @property string vorles_ende database column
* @property string first_sem_week computed column
* @property string last_sem_week computed column
* @property string past computed column
*/
class Semester extends SimpleORMap
{
/**
* Configures this model.
*
* @param array $config
*/
protected static function configure($config = [])
{
$config['db_table'] = 'semester_data';
$config['additional_fields']['first_sem_week']['get'] = 'getFirstSemesterWeek';
$config['additional_fields']['last_sem_week']['get'] = 'getLastSemesterWeek';
$config['additional_fields']['current']['get'] = 'isCurrent';
$config['additional_fields']['past']['get'] = 'isPast';
$config['additional_fields']['short_name']['get'] = function($semester) {
return (string) $semester->semester_token ?: (string) $semester->name;
};
$config['additional_fields']['absolute_seminars_count'] = [
'get' => 'seminarCounter',
'set' => false,
];
$config['additional_fields']['duration_seminars_count'] = [
'get' => 'seminarCounter',
'set' => false,
];
$config['additional_fields']['continuous_seminars_count'] = [
'get' => 'seminarCounter',
'set' => false,
];
$config['alias_fields']['token'] = 'semester_token';
$config['registered_callbacks']['after_store'][] = 'refreshCache';
$config['registered_callbacks']['after_delete'][] = 'refreshCache';
$config['i18n_fields']['name'] = true;
$config['i18n_fields']['description'] = true;
$config['i18n_fields']['semester_token'] = true;
parent::configure($config);