Select Git revision
Resource.class.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
-
David Siegfried authored
Closes #2606 Merge request studip/studip!1758
David Siegfried authoredCloses #2606 Merge request studip/studip!1758
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Resource.class.php 102.23 KiB
<?php
/**
* Resource.class.php - model class for a resource
*
* 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 Moritz Strohm <strohm@data-quest.de>
* @copyright 2017-2019
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
* @package resources
* @since 4.5
*
* @property string resource_id database column
* @property string id alias column for resource_id
* @property string parent_id database column
* @property string category_id database column
* @property string level database column
* @property string name database column
* @property string description database column
* @property string requestable database column
* @property string sort_position database column
* @property string mkdate database column
* @property string chdate database column
* @property SimpleORMapCollection category belongs_to ResourceCategory
* @property SimpleORMapCollection properties has_many ResourceProperty
* @property SimpleORMapCollection permissions has_many ResourcePermission
* @property SimpleORMapCollection bookings has_many ResourceBooking
* @property SimpleORMapCollection children has_many Resource
* @property FolderType folder
*/
/**
* The Resource class is the base class of the new
* Room and Resource management system in Stud.IP.
* It provides core functionality for handling general resources
* and can be derived for handling special resources.
*/
class Resource extends SimpleORMap implements StudipItem
{
protected static function configure($config = [])
{
$config['db_table'] = 'resources';
$config['belongs_to']['category'] = [
'class_name' => ResourceCategory::class,
'foreign_key' => 'category_id',
'assoc_func' => 'find'
];
$config['has_many']['properties'] = [
'class_name' => ResourceProperty::class,
'assoc_foreign_key' => 'resource_id',
'on_delete' => 'delete',
'on_store' => 'store'
];
$config['has_many']['permissions'] = [
'class_name' => ResourcePermission::class,
'assoc_foreign_key' => 'resource_id',
'on_delete' => 'delete',
'on_store' => 'store'
];
$config['has_many']['requests'] = [