Skip to content
Snippets Groups Projects
Select Git revision
  • 737c0b2ade4ea92ea85ad9c536553abfcbc96877
  • main default protected
  • step-3263
  • feature/plugins-cli
  • feature/vite
  • step-2484-peerreview
  • biest/issue-5051
  • tests/simplify-jsonapi-tests
  • fix/typo-in-1a70031
  • feature/broadcasting
  • database-seeders-and-factories
  • feature/peer-review-2
  • feature-feedback-jsonapi
  • feature/peerreview
  • feature/balloon-plus
  • feature/stock-images-unsplash
  • tic-2588
  • 5.0
  • 5.2
  • biest/unlock-blocks
  • biest-1514
21 results

admin_sem_classes.js

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.
    studip_controller_properties_trait.php 1.53 KiB
    <?php
    /**
     * This trait manages all variable assignments to the controller and templates.
     *
     * @author Jan-Hendrik Willms <tleilax+studip@gmail.com>
     * @license GPL2 or any later version
     * @since Stud.IP 5.2
     */
    trait StudipControllerPropertiesTrait
    {
        /**
         * Stores the assigned variables.
         * @var array
         */
        protected $_template_variables = [];
    
        /**
         * Returns whether a variable is set.
         *
         * @param string $offset
         * @return bool
         */
        public function __isset(string $offset): bool
        {
            return isset($this->_template_variables[$offset]);
        }
    
        /**
         * Stores a variable.
         *
         * @param string $offset
         * @param mixed $value
         */
        public function __set(string $offset, $value): void
        {
            $this->_template_variables[$offset] = $value;
        }
    
        /**
         * Returns a previously set variable.
         *
         * @param string $offset
         * @return mixed
         */
        public function &__get(string $offset)
        {
            $result = null;
            if (isset($this->_template_variables[$offset])) {
                $result = &$this->_template_variables[$offset];
            }
            return $result;
        }
    
        /**
         * Unsets a previously set variable
         *
         * @param string $offset
         */
        public function __unset(string $offset): void
        {
            unset($this->_template_variables[$offset]);
        }
    
        public function get_assigned_variables(): array
        {
            $variables = $this->_template_variables;
            $variables['controller'] = $this;
            return $variables;
        }
    }