FileAccess Orion

Storage extends FolderTree
in package

Define system storage object

Is a sub tyüpe of folder with some additional functions like language independent name And a possibility to assign articles with a custom method.

Tags
category

Core content type

author

Tobias Teichner webmaster@teichner.biz

since

File available since v3.11.46

Table of Contents

$relations  : array<string|int, mixed>
$_access_list  : array<string|int, mixed>|null
The locale access list
$default_search_fields  : array<string|int, mixed>
$rights  : array<string|int, mixed>
The available rights
$_data_storage  : string
The root path
$_request  : Request|null
$children  : array<string|int, stdClass>
The child nodes
$contents  : array<string|int, stdClass>
The contents
$known_events  : array<string|int, mixed>
$parent  : Folder|null
The parent folder
$root  : string
The root storage folder starting at %DATA%/folder/
$template  : Template|null
The template
__construct()  : mixed
Instance project Construct a new project object
AddArticle()  : Result
Assign and create article in this storage folder
AssignImage()  : Result
Assign an image from instance
CheckAccess()  : bool
Check access Test if the group has the given right
Children()  : array<string|int, FolderTree>
Get raw list of children for this specific tree element reads all children of this folder and returns them as plain list
Contents()  : array<string|int, Relation>
Get raw list of child relations for this folder Reads all content children relations of this folder and returns them as plain list
Copy()  : Result
Copy this folder
CountRelations()  : int
Count the relations of the folder
Create()  : Result
Create a new folder
Delete()  : Result
delete entity from file system and git repo this method can delete this content object from our local storage system
ExternalLinkTarget()  : string|null
Get external link target
FetchExtension()  : Extension
Get extension relation Fetch an extension relation object by id
FetchRelation()  : Relation|AmountRelation|null
GeneralSearchFields()  : mixed
GetAccessPath()  : string
Get access path Return the absolute path to access list file
GetAccessRules()  : Result
Get the access list
GetDirectory()  : string
expose root path cut the index.json from the localy stored path argument
GetFilters()  : array<string|int, mixed>
Get custom filters for this folder
GetLoginTemplatePath()  : string
expose login template path abstract method to load the path to the index template
GetMainCompany()  : Company|null
Get company Get the main company from content
GetParent()  : Folder|null
Get parent object
GetPrimaryPicture()  : Asset|null
Get the primary picture
GetRelativeFolderPath()  : string
Get relative path Return the relative path to data list file
GetSort()  : array<string|int, mixed>
Get the custom sorting definition for the folder
GetTemplate()  : Template|null
load template abstract method to load the assigned template and return as object
GetTemplateHook()  : null|object
Get template hook function Load the template hook of this folder will return null when folder han none
GetTemplatePath()  : string
expose main template path abstract method to load the path to the index template
GetTplPath()  : string|null
load template path abstract method to load the path to a file from assigned template object will return null if file not found or template not registered
HasUniversalCache()  : bool
Is universal cached
Images()  : array<string|int, mixed>|array<string|int, Asset>
List images
IsActive()  : bool
Check is active state
IsLink()  : bool
LinkTarget()  : string|null
Return the active link target
LinkTargetDomain()  : Domain|null
Get internal link domain
LinkTargetFolder()  : Folder|null
Return the active link target folder
MainImage()  : Asset|null
Get main image
MirrorPermissions()  : Result
Mirror the permissions of a certain base group to a target group
Move()  : Result
Move this folder
Name()  : string
Get name Get the folder name without /
Parents()  : array<string|int, Folder>
Get list of parents
RegisteredEvent()  : Event|null
Get registered event
Reload()  : mixed
Reload from storage
Request()  : Request|null
Request context getter / setter
ResolveToBase()  : stdClass
Get as plain object with resolved path
Save()  : Result
Save this folder entry in file system and git repo
SearchFields()  : mixed
SeoDescription()  : string|null
Get translated seo description
SeoTitle()  : string|null
Get translated seo title
SetChildrenInactive()  : mixed
Set children inactive Set all children inactive
ToPlainObject()  : object
convert to plain data set translate and expose the current data attribute as plain resolved object
ToRecursiveObject()  : stdClass
Convert to raw recursive tree element
ToRecursiveObjectWithRelation()  : stdClass
Convert to plain object with relations
UpdateAccessRules()  : Result
update access rules for this folder update and store the access rules file, also do the stage operation
UpdateAttributeName()  : Result
Callback on update validate name
UpdateAttributeShort()  : Result
Handle renaming of folder by attribute handler
loadFromSrcCached()  : void
Load cached data

Properties

$relations

public array<string|int, mixed> $relations = array()

$_access_list

The locale access list

protected array<string|int, mixed>|null $_access_list = null

The list

$default_search_fields

protected array<string|int, mixed> $default_search_fields = ['title', 'description', 'short']
Tags
inheritdoc

$rights

The available rights

protected array<string|int, mixed> $rights = array('view', 'add', 'edit', 'rules')

List of rights

$_data_storage

The root path

private string $_data_storage = FAA_PATHS_DATAABS . 'folder/'

$children

The child nodes

private array<string|int, stdClass> $children = null

The child nodes as serializable entity

List of children

$contents

The contents

private array<string|int, stdClass> $contents = null

The assigned child nodes as serializable entity

List of children

$known_events

private array<string|int, mixed> $known_events = array()

Event[]

$root

The root storage folder starting at %DATA%/folder/

private string $root = 'media/storage/'

$template

The template

private Template|null $template = null

A local instance of the assigned template

Methods

__construct()

Instance project Construct a new project object

public __construct(string $path[, string $language = null ]) : mixed
Parameters
$path : string

The relative object storage path

$language : string = null

The setup language

Return values
mixed

AddArticle()

Assign and create article in this storage folder

public AddArticle(string $type, array<string|int, mixed> $data) : Result
Parameters
$type : string

The article type

$data : array<string|int, mixed>

Data of the article assignment

Return values
Result

A system result object

AssignImage()

Assign an image from instance

public AssignImage(Asset $asset) : Result
Parameters
$asset : Asset

An asset instance

Return values
Result

The result object

CheckAccess()

Check access Test if the group has the given right

public CheckAccess(string $group[, string $flag = 'view' ]) : bool
Parameters
$group : string

Group id

$flag : string = 'view'

Right key to test against

Return values
bool

True when group access given

Children()

Get raw list of children for this specific tree element reads all children of this folder and returns them as plain list

public Children([string|null $language = null ][, bool $plain = false ]) : array<string|int, FolderTree>
Parameters
$language : string|null = null

The language to load the child nodes in

$plain : bool = false

Convert to plain on demand

Return values
array<string|int, FolderTree>

A list of children with type FolderTree

Contents()

Get raw list of child relations for this folder Reads all content children relations of this folder and returns them as plain list

public Contents([string|null $language = null ][, bool $recursive = false ][, bool $include_extensions = false ]) : array<string|int, Relation>
Parameters
$language : string|null = null

The language to load the child nodes in

$recursive : bool = false

When set to true all sub nodes will be listed

$include_extensions : bool = false

When set to true include extension relations

Return values
array<string|int, Relation>

A list of children with type Relation

Copy()

Copy this folder

public Copy([string|null $target = null ]) : Result
Parameters
$target : string|null = null

The target folder

Return values
Result

A system result object

CountRelations()

Count the relations of the folder

public CountRelations() : int
Return values
int

Create()

Create a new folder

public Create(string $dir, array<string|int, mixed> $payload) : Result

Abstract method to create a new physical folder

Parameters
$dir : string

A system object storage path relative

$payload : array<string|int, mixed>

A folder dataset defined in Obj\Folder

Return values
Result

A system result object

Delete()

delete entity from file system and git repo this method can delete this content object from our local storage system

public Delete([bool $skip = false ][, bool $full = false ]) : Result
Parameters
$skip : bool = false

Skip hooks on demand

$full : bool = false

Delete also the assigned contents

Return values
Result

A default system result set

ExternalLinkTarget()

Get external link target

public ExternalLinkTarget([string|null $lang = null ]) : string|null
Parameters
$lang : string|null = null
Return values
string|null

FetchExtension()

Get extension relation Fetch an extension relation object by id

public FetchExtension(string $id[, string|null $language = null ]) : Extension
Parameters
$id : string

The relation id

$language : string|null = null

The language to resolve by

Return values
Extension

A system extension relation object

FetchRelation()

public FetchRelation(string $id[, string|null $language = null ][, string $type = 'amountrelation' ]) : Relation|AmountRelation|null
Parameters
$id : string
$language : string|null = null
$type : string = 'amountrelation'
Tags
inheritDoc
Return values
Relation|AmountRelation|null

GeneralSearchFields()

public GeneralSearchFields() : mixed
Tags
inheritDoc
Return values
mixed

GetAccessPath()

Get access path Return the absolute path to access list file

public GetAccessPath() : string
Return values
string

The absolute path

GetAccessRules()

Get the access list

public GetAccessRules() : Result

This method is cached by object cache.

Return values
Result

A system result

GetDirectory()

expose root path cut the index.json from the localy stored path argument

public GetDirectory() : string
Return values
string

absolute path to the root node of this folder

GetFilters()

Get custom filters for this folder

public GetFilters() : array<string|int, mixed>

It is only possible to have 1 filter per position in the template. The last one in the list will win.

Return values
array<string|int, mixed>

The list of filters for this folder

GetLoginTemplatePath()

expose login template path abstract method to load the path to the index template

public GetLoginTemplatePath() : string
Return values
string

absolute path to the login template

GetMainCompany()

Get company Get the main company from content

public GetMainCompany([bool $with_parents = false ]) : Company|null
Parameters
$with_parents : bool = false
Return values
Company|null

A company object or null when list is empty

GetParent()

Get parent object

public GetParent() : Folder|null

Get the parent folder object. This method is cached

Return values
Folder|null

The parent folder or, when root reached null

GetPrimaryPicture()

Get the primary picture

public GetPrimaryPicture() : Asset|null
Return values
Asset|null

GetRelativeFolderPath()

Get relative path Return the relative path to data list file

public GetRelativeFolderPath() : string
Return values
string

The relative path

GetSort()

Get the custom sorting definition for the folder

public GetSort([string|null $language = null ]) : array<string|int, mixed>

It is only possible to have 1 custom sort per position in the template. The last one in the list will win.

Parameters
$language : string|null = null

Special for this language

Return values
array<string|int, mixed>

The list of sort commands

GetTemplate()

load template abstract method to load the assigned template and return as object

public GetTemplate() : Template|null
Return values
Template|null

A system template object covered in a result object

GetTemplateHook()

Get template hook function Load the template hook of this folder will return null when folder han none

public GetTemplateHook(Request $request) : null|object
Parameters
$request : Request
Return values
null|object

GetTemplatePath()

expose main template path abstract method to load the path to the index template

public GetTemplatePath() : string
Return values
string

absolute path to the main template

GetTplPath()

load template path abstract method to load the path to a file from assigned template object will return null if file not found or template not registered

public GetTplPath(string $file[, string $ext = 'html' ]) : string|null
Parameters
$file : string

Name of the template file that

$ext : string = 'html'

File extension of searched template

Return values
string|null

Absolute path to the template or null if none was found

HasUniversalCache()

Is universal cached

public HasUniversalCache() : bool
Return values
bool

Images()

List images

public Images([bool $resolved = false ]) : array<string|int, mixed>|array<string|int, Asset>

Get the content of the images attribute relation Will generate and return an empty array hen attribute is not filled

Parameters
$resolved : bool = false
Return values
array<string|int, mixed>|array<string|int, Asset>

IsActive()

Check is active state

public IsActive([array<string|int, mixed>|null $row = null ][, string $from = 'datefrom' ][, string $to = 'dateto' ][, int|null $now = null ]) : bool

Check if the element is active and valid at the current time

Parameters
$row : array<string|int, mixed>|null = null
$from : string = 'datefrom'
$to : string = 'dateto'
$now : int|null = null
Return values
bool

Entry is active based on date from and date to property

public IsLink() : bool
Return values
bool

LinkTarget()

Return the active link target

public LinkTarget() : string|null

When the folder is a link and has a defined target folder, then, return the target folder path

Return values
string|null

LinkTargetDomain()

Get internal link domain

public LinkTargetDomain() : Domain|null
Return values
Domain|null

LinkTargetFolder()

Return the active link target folder

public LinkTargetFolder() : Folder|null

When the folder is a link return the set target folder object

Return values
Folder|null

The instance or, null

MainImage()

Get main image

public MainImage() : Asset|null
Return values
Asset|null

MirrorPermissions()

Mirror the permissions of a certain base group to a target group

public MirrorPermissions(string $source, string $target) : Result
Parameters
$source : string

The source group

$target : string

The target group

Return values
Result

A result object

Move()

Move this folder

public Move(string $target) : Result

Move this folder to another system data folder.

Parameters
$target : string

The target path, relative to folder root

Return values
Result

A system result object

Name()

Get name Get the folder name without /

public Name() : string
Return values
string

The folder name

Parents()

Get list of parents

public Parents() : array<string|int, Folder>
Return values
array<string|int, Folder>

RegisteredEvent()

Get registered event

public RegisteredEvent(string $name) : Event|null
Parameters
$name : string
Return values
Event|null

Reload()

Reload from storage

public Reload() : mixed
Return values
mixed

Request()

Request context getter / setter

public Request([Request|null $request = null ]) : Request|null
Parameters
$request : Request|null = null
Return values
Request|null

ResolveToBase()

Get as plain object with resolved path

public ResolveToBase( $l) : stdClass
Parameters
$l :
Return values
stdClass

Save()

Save this folder entry in file system and git repo

public Save([bool $force_new_id = false ]) : Result

Store the current payload inside the system storage and stage the changes to the local repository. Will handle prepared rename operation as well when the storage paths was changed by changing the key.

Parameters
$force_new_id : bool = false

Create with new id when set to true

Return values
Result

A default system result set

SearchFields()

public SearchFields() : mixed
Tags
inheritDoc
Return values
mixed

SeoDescription()

Get translated seo description

public SeoDescription(string $l[, bool $fallback = true ]) : string|null
Parameters
$l : string

The target language

$fallback : bool = true

When true and seo field is empty it will return the real description

Return values
string|null

The found translation

SeoTitle()

Get translated seo title

public SeoTitle(string $l[, bool $fallback = true ]) : string|null
Parameters
$l : string

The target language

$fallback : bool = true

When true and seo field is empty it will return the real title

Return values
string|null

The found translation

SetChildrenInactive()

Set children inactive Set all children inactive

public SetChildrenInactive() : mixed
Return values
mixed

ToPlainObject()

convert to plain data set translate and expose the current data attribute as plain resolved object

public ToPlainObject([string|null $language = null ][, bool $with_parent = true ]) : object
Parameters
$language : string|null = null

A system language code or empty for raw setup

$with_parent : bool = true

When set to true the attributes will be resolved witch parent attributes included

Return values
object

A simple attribute based php object

ToRecursiveObject()

Convert to raw recursive tree element

public ToRecursiveObject([string|null $language = null ]) : stdClass

Create a folder tree limb starting with the current folder

Parameters
$language : string|null = null

The language to load the object in

Return values
stdClass

A plain raw system/php object

ToRecursiveObjectWithRelation()

Convert to plain object with relations

public ToRecursiveObjectWithRelation([string|null $language = null ]) : stdClass
Parameters
$language : string|null = null

Translate to this language

Return values
stdClass

UpdateAccessRules()

update access rules for this folder update and store the access rules file, also do the stage operation

public UpdateAccessRules(array<string|int, mixed> $data) : Result
Parameters
$data : array<string|int, mixed>

A list of access rules like given from GetAccessRules()

Return values
Result

A system result object

UpdateAttributeName()

Callback on update validate name

public UpdateAttributeName(object $attr, string $data) : Result

This function is called when the primary identifier is changed

Parameters
$attr : object

The changed attribute

$data : string

The new attribute value

Return values
Result

A system result object

UpdateAttributeShort()

Handle renaming of folder by attribute handler

public UpdateAttributeShort(object $attr, string $data) : Result
Parameters
$attr : object

The attribute 'short'

$data : string

The new technical folder name

Return values
Result

loadFromSrcCached()

Load cached data

protected loadFromSrcCached() : void
Return values
void

Search results