FileAccess Orion

Folder extends BaseContent
in package
Uses RangeActive, Images

Implement folder object

Folders require specific handling but is pretty similar to contents. This class provides general interfaces to trigger folder specific reactions. In addition this class holds methods to load relations of the folder.

Tags
category

Content type

author

Tobias Teichner webmaster@teichner.biz

since

File available since v0.01

Table of Contents

$_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
$parent  : Folder|null
The parent folder
$template  : Template|null
The template
__construct()  : mixed
Construct a new folder object
AssignImage()  : Result
Assign an image from instance
CheckAccess()  : bool
Check access Test if the group has the given right
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
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
Get relation Fetch a relation object by id
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
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
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
Parents()  : array<string|int, Folder>
Get list of parents
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
UpdateAccessRules()  : Result
update access rules for this folder update and store the access rules file, also do the stage operation
UpdateAttributeShort()  : Result
Handle renaming of folder by attribute handler
loadFromSrcCached()  : void
Load cached data

Properties

$_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/'

$template

The template

private Template|null $template = null

A local instance of the assigned template

Methods

__construct()

Construct a new folder object

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

The relative object storage path

$language : string|null = null

The setup language

Return values
mixed

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

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

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()

Get relation Fetch a relation object by id

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

The relation id

$language : string|null = null

The language to resolve by

$type : string = ''

The language to resolve by

Return values
Relation|AmountRelation|null

A system relation object

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

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

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

Parents()

Get list of parents

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

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

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

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