Skip to content
Snippets Groups Projects
Select Git revision
  • a815a566e2fb858f692eb15950fc538d45231e0a
  • 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

File.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.
    UnknownFileType.php 4.79 KiB
    <?php
    /**
     * UnknownFileType.php
     *
     * 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>
     * @copyright 2020 Stud.IP Core-Group
     * @license   http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
     * @category  Stud.IP
     */
    
    class UnknownFileType implements FileType, ArrayAccess
    {
        /**
         * @var FileRef
         */
        protected $fileref = null;
    
        public function __construct($fileref = null)
        {
            $this->fileref = $fileref;
        }
    
        /**
         * magic method for dynamic properties
         */
        public function __get($name)
        {
            return isset($this->fileref->$name) ? $this->fileref->$name : null;
        }
    
        /**
         * magic method for dynamic properties
         */
        public function __set($name, $value)
        {
            return isset($this->fileref->$name) ? $this->fileref->$name = $value : null;
        }
    
        /**
         * magic method for dynamic properties
         */
        public function __isset($name)
        {
            return isset($this->fileref->$name);
        }
    
        /**
         * ArrayAccess: Check whether the given offset exists.
         */
        public function offsetExists($offset)
        {
            return $this->__isset($offset);
        }
    
        /**
         * ArrayAccess: Get the value at the given offset.
         */
        public function offsetGet($offset)
        {
            return $this->__get($offset);
        }
    
        /**
         * ArrayAccess: Set the value at the given offset.
         */
        public function offsetSet($offset, $value)
        {
            $this->__set($offset, $value);
        }
    
        /**
         * ArrayAccess: unset the value at the given offset (not applicable)
         */
        public function offsetUnset($offset)
        {
    
        }
        /**
         * @inheritDoc
         */
        public function getIcon($role)
        {
            return Icon::create('file', $role);
        }
    
        /**
         * @inheritDoc
         */
        public function getId()
        {
            return $this->id;
        }
    
        /**
         * @inheritDoc
         */
        public function getFilename()
        {
            return trim($this->name . ' (' . _('Unbekannter Dateityp') .  ')');
        }
    
        /**
         * @inheritDoc
         */
        public function getUserId()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getUserName()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getUser()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getSize()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getDownloadURL()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getDownloads()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getPath(): string
        {
            return '';
        }
    
        /**
         * @inheritDoc
         */
        public function getLastChangeDate()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getMakeDate()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getDescription()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getMimeType()
        {
            return 'application/octet-stream';
        }
    
        /**
         * @inheritDoc
         */
        public function getTermsOfUse()
        {
            return new ContentTermsOfUse();
        }
    
        /**
         * @inheritDoc
         */
        public function getActionmenu()
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getInfoDialogButtons(array $extra_link_params = []): array
        {
            return [];
        }
    
        /**
         * @inheritDoc
         */
        public function delete()
        {
            return 0;
        }
    
        /**
         * @inheritDoc
         */
        public function getFolderType()
        {
            return $this->folder ? $this->folder->getTypedFolder() : null;
        }
    
        /**
         * @inheritDoc
         */
        public function isVisible($user_id = null)
        {
            return true;
        }
    
        /**
         * @inheritDoc
         */
        public function isDownloadable($user_id = null)
        {
            return false;
        }
    
        /**
         * @inheritDoc
         */
        public function isEditable($user_id = null)
        {
            return false;
        }
    
        /**
         * @inheritDoc
         */
        public function isWritable($user_id = null)
        {
            return false;
        }
    
        /**
         * @inheritDoc
         */
        public function convertToStandardFile()
        {
            throw new RuntimeException('object of type ' . __CLASS__ . ' could not be converted to StandardFile');
        }
    
        /**
         * @inheritDoc
         */
        public function getContentForAdditionalColumn($column_index)
        {
        }
    
        /**
         * @inheritDoc
         */
        public function getAdditionalColumnOrderWeigh($column_index)
        {
            return 0;
        }
    
        /**
         * @inheritDoc
         */
        public function getInfoTemplate(bool $include_downloadable_infos = false)
        {
            return '';
        }
    }