Skip to content
Snippets Groups Projects
Select Git revision
  • 0852b9a360dcbb889a6f8eea527fcbf5d369caf0
  • main default protected
  • studip-rector
  • ci-opt
  • course-members-export-as-word
  • data-vue-app
  • pipeline-improvements
  • webpack-optimizations
  • rector
  • icon-renewal
  • http-client-and-factories
  • jsonapi-atomic-operations
  • vueify-messages
  • tic-2341
  • 135-translatable-study-areas
  • extensible-sorm-action-parameters
  • sorm-configuration-trait
  • jsonapi-mvv-routes
  • docblocks-for-magic-methods
19 results

Resource.class.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    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'] = [