HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/kemi.komma.pro/app/KommaApp/Kms/Core/Attributes/Documents.php
<?php
namespace App\KommaApp\Kms\Core\Attributes;
use App\KommaApp\Documents\Models\Document;
use App\KommaApp\Kms\Core\Attributes\Models\AbstractImageProperty;
use App\KommaApp\Kms\Core\Attributes\Models\ImageProperty;
use App\KommaApp\Kms\Core\Attributes\Traits\LabelTrait;

/**
 * Class Documents
 *
 * Note: the mapValueFrom reference value for this attribute can be anything as long as it is unique.
 *
 * @package App\KommaApp\Kms\Core\Attributes
 */
class Documents extends Attribute
{
    use LabelTrait;

    /** @var string $subFolder This is the subfolder of the path public/uploads/documents where the documents for this attribute wil be placed in*/
    private $subFolder;

    /** @var int $maxDocuments The maximum amount of documents the attribute can hold*/
    private $maxDocuments;

    /**
     * @var ImageProperty[] $imageProperties When you upload an image, the image will be processed and saved in the sizes you've specified with this variable
     */
    private $imageProperties;

    /** @var $accept string which mime types to accept. Example: video/*,.jpeg */
    private $accept;

    /**
     * @var $extensionThumbsFolder string the folder in which extension thumbs can be found. Relative to the document root
     */
    private $extensionThumbsFolder;

    /**
     * @var $enablePreviewsIfPossible bool whether or not to show thumb previews if possible
     */
    private $enablePreviewsIfPossible;

    /**
     * @var $isSortable bool whether or not the items are sortable
     */
    private $isSortable;

    public function __construct()
    {
        $this->subFolder = '';
        $this->maxDocuments = 0;
        $this->accept = '';
        $this->extensionThumbsFolder = '/img/extensionthumbs/';
        $this->enablePreviewsIfPossible = true;
        $this->isSortable = true;
        $this->imageProperties = [];
        parent::__construct();
    }

    /**
     * Returns a view that visually represents this attribute
     */
    public function render()
    {
        $documentIds = explode('|' ,$this->value);
        $documents = Document::findMany($documentIds);

        $view = \View::make('kms/attributes.documents', [
            'attribute' => $this,
            'documents' => $documents
        ]);

        return $view;
    }

    /**
     * @return string
     */
    public function getSubFolder(): string
    {
        return $this->subFolder;
    }

    /**
     * @param string $subFolder
     * @return Documents
     */
    public function setSubFolder(string $subFolder): Documents
    {
        $this->subFolder = $subFolder;
        return $this;
    }

    /**
     * @return int
     */
    public function getMaxDocuments(): int
    {
        return $this->maxDocuments;
    }

    /**
     * @param int $maxDocuments
     * @return Documents
     */
    public function setMaxDocuments(int $maxDocuments): Documents
    {
        $this->maxDocuments = $maxDocuments;
        return $this;
    }

    /**
     * @return string
     */
    public function getAccept(): string
    {
        return $this->accept;
    }

    /**
     * @param string $accept
     */
    public function setAccept(string $accept)
    {
        $this->accept = $accept;
    }

    /**
     * @return AbstractImageProperty[]
     */
    public function getImageProperties(): array
    {
        return $this->imageProperties;
    }

    /**
     * @param AbstractImageProperty[] $imageProperties
     * @return Images
     */
    public function setImageProperties(array $imageProperties): Documents
    {
        $this->imageProperties = $imageProperties;
        return $this;
    }

    /**
     * @return string
     */
    public function getExtensionThumbsFolder(): string
    {
        return $this->extensionThumbsFolder;
    }

    /**
     * @param string $extensionThumbsFolder
     * @return Documents
     */
    public function setExtensionThumbsFolder(string $extensionThumbsFolder): Documents
    {
        $this->extensionThumbsFolder = $extensionThumbsFolder;
        return $this;
    }

    /**
     * @return bool
     */
    public function getEnablePreviewsIfPossible(): bool
    {
        return $this->enablePreviewsIfPossible;
    }

    /**
     * @param bool $enablePreviewsIfPossible
     * @return Documents
     */
    public function setEnablePreviewsIfPossible(bool $enablePreviewsIfPossible): Documents
    {
        $this->enablePreviewsIfPossible = $enablePreviewsIfPossible;
        return $this;
    }

    /**
     * @return bool
     */
    public function getIsSortable(): bool
    {
        return $this->isSortable;
    }

    /**
     * @param bool $isSortable
     */
    public function setIsSortable(bool $isSortable)
    {
        $this->isSortable = $isSortable;
    }
}