Project
extends FolderTree
in package
Implement extended project object
This class provides general interfaces to trigger extended project reactions. This class holds additional methods to interact witch project objects in a tree context. With this class some methods to modify the access settings are shipped.
Tags
Table of Contents
- $ : string
- $_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, mixed>|null
- Cache of services assigned to this folder
- $next_bill_date : bool|null|int
- $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
- 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
- CreateBill() : Result
- Create all bills recurring in this project Create a pdf bill and return the download path
- 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
- FormattedBillNumber() : string
- Get bill number Get the formatted bill number with pad left and prefix
- 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
- GetEmailSetup() : EmailSetup|null
- Get notification email Get the main notification from content
- 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
- HasNotRecurring() : int
- Has no recurring Check if this project has not recurring services
- HasRecurring() : int
- Has recurring Check if this project has recurring services
- 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 /
- NextBillDate() : int|string|null
- Get next bill iteration date
- Parents() : array<string|int, Folder>
- Get list of parents
- Prefix() : string|null
- Project based bill number prefix
- Reload() : mixed
- Reload from storage
- Request() : Request|null
- Request context getter / setter
- ResolveToBase() : stdClass
- Get as plain object with resolved path
- Save() : mixed
- SearchFields() : mixed
- SeoDescription() : string|null
- Get translated seo description
- SeoTitle() : string|null
- Get translated seo title
- Services() : array<string|int, Service>
- List of services A list of services that are assigned to this project and the sub projects
- SetChildrenInactive() : mixed
- Set children inactive Set all children inactive
- SkontoTable() : array<string|int, mixed>|null
- 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
- UpdateAttributeActive() : Result
- Callback on update validate active state This function is called when the create bill status is changed
- UpdateAttributeName() : Result
- Callback on update validate name This function is called when the primary identifier is changed
- UpdateAttributeShort() : Result
- Handle renaming of folder by attribute handler
- loadFromSrcCached() : void
- Load cached data
- getService() : Service|null
- Get service object
- startDate() : int
Properties
$
public
string
$
default_storage_folder The default storage folder for newly generated articles
$_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
$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/'
$_request
private
Request|null
$_request
= null
$children
The child nodes
private
array<string|int, stdClass>
$children
= null
The child nodes as serializable entity
List of children
$contents
Cache of services assigned to this folder
private
array<string|int, mixed>|null
$contents
= null
The buffer
$next_bill_date
private
bool|null|int
$next_bill_date
= null
$parent
The parent folder
private
Folder|null
$parent
= null
$root
The root storage folder starting at %DATA%/folder/
private
string
$root
= 'media/projects/'
$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|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
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
CreateBill()
Create all bills recurring in this project Create a pdf bill and return the download path
public
CreateBill([bool $recurring = false ][, AppContext|null $cron = null ]) : Result
Parameters
- $recurring : bool = false
-
When set to true list the recurring prices
- $cron : AppContext|null = null
-
A cron job object or null
Return values
Result —A default 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
FormattedBillNumber()
Get bill number Get the formatted bill number with pad left and prefix
public
FormattedBillNumber() : string
Return values
string —The formatted bill number
GeneralSearchFields()
public
GeneralSearchFields() : mixed
Tags
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
GetEmailSetup()
Get notification email Get the main notification from content
public
GetEmailSetup() : EmailSetup|null
Return values
EmailSetup|null —An email setup object or null when list is empty
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
HasNotRecurring()
Has no recurring Check if this project has not recurring services
public
HasNotRecurring([bool $only_active = false ]) : int
Parameters
- $only_active : bool = false
-
Count only active services
Return values
int —The length of registered assigned recurring contents
HasRecurring()
Has recurring Check if this project has recurring services
public
HasRecurring([bool $only_active = false ]) : int
Parameters
- $only_active : bool = false
-
Count only active services
Return values
int —The length of registered assigned recurring contents
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
IsLink()
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
NextBillDate()
Get next bill iteration date
public
NextBillDate([bool $raw = false ]) : int|string|null
Calculate the next iteration for recurring bills on this project
Parameters
- $raw : bool = false
-
When set to true, return as timestamp
Return values
int|string|null —The next formatted billing date
Parents()
Get list of parents
public
Parents() : array<string|int, Folder>
Return values
array<string|int, Folder> —Prefix()
Project based bill number prefix
public
Prefix(int|string $date[, string $name = 'bill' ]) : string|null
Parameters
- $date : int|string
-
The date to create for
- $name : string = 'bill'
-
Bill or offer
Return values
string|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
Return values
stdClass —Save()
public
Save([mixed $force_new_id = false ]) : mixed
Parameters
- $force_new_id : mixed = false
Tags
Return values
mixed —SearchFields()
public
SearchFields() : mixed
Tags
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
Services()
List of services A list of services that are assigned to this project and the sub projects
public
Services([array<string|int, mixed> $filter = [] ]) : array<string|int, Service>
ToDo: Migrate this method to use the search functions instead of file based loader aka "Contents" method
Parameters
- $filter : array<string|int, mixed> = []
-
When set to true list the recurring prices bool $recurring When set to true list the recurring prices bool $only_active Count only active services
Return values
array<string|int, Service> —A list of service objects
SetChildrenInactive()
Set children inactive Set all children inactive
public
SetChildrenInactive() : mixed
Return values
mixed —SkontoTable()
public
SkontoTable() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —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
UpdateAttributeActive()
Callback on update validate active state This function is called when the create bill status is changed
public
UpdateAttributeActive(object $attr, bool $data) : Result
Parameters
- $attr : object
-
The changed attribute
- $data : bool
-
The new attribute value
Return values
Result —A system result object
UpdateAttributeName()
Callback on update validate name This function is called when the primary identifier is changed
public
UpdateAttributeName(stdClass $attr, string $data) : Result
Parameters
- $attr : stdClass
-
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 —getService()
Get service object
private
getService(string $id, string $sub_type) : Service|null
Parameters
- $id : string
-
A service id
- $sub_type : string
-
A service sub type name
Return values
Service|null —A service object or null
startDate()
private
startDate() : int