CmsLayoutTemplate
in package
A class to represent a smarty template.
Tags
Table of Contents
Methods
- add_design() : mixed
- Associate a new design with this template
- can_edit() : bool
- Test wether the user specified has edit ability for this template object
- create_by_type() : CmsLayoutTemplate
- Create a new template of the specific type
- delete() : mixed
- Delete this template object from the database
- generate_unique_name() : mixed
- Generate a unique name for a template
- get_additional_editors() : array<string|int, mixed>
- Get a list of user id's other than the owner that are allowed edit functionality to this template
- get_category() : mixed
- Get the category for this template A template is not required to be associated with a category
- get_category_id() : mixed
- Get the category id for this template A template is not required to be associated with a category
- get_content() : string
- Get the content of the template
- get_content_filename() : string
- Get the filename that will be used to read template contents from file.
- get_created() : int
- Get the date that this template was initially stored in the database The created date can not be externally modified
- get_description() : string
- Get the description for the template
- get_designs() : array<string|int, mixed>
- Get a list of the design id's that this template is associated with
- get_editable_templates() : mixed
- Get a list of the templates that a specific user can edit
- get_id() : int
- Get the integer id of this template
- get_listable() : bool
- Get wether this template is listable in public template lists.
- get_loaded_templates() : array<string|int, mixed>
- Get the ids of all loaded templates
- get_lock() : mixed
- Get any applicable lock for this template object
- get_modified() : int
- Get the date that this template was last saved to the database The modified date cannot be externally modified
- get_name() : string
- Get the template name
- get_owned_templates() : array<string|int, mixed>
- Get a list of the templates owned by a specific user
- get_owner_id() : int
- Get the integer owner id of this template
- get_type() : CmsLayoutTemplateType
- Return the template type object for this template.
- get_type_dflt() : bool
- Get the flag indicating that this template is the default template for its type
- get_type_id() : int
- Get the type id for the template
- get_usage_string() : string
- Get the usage string (if any) for this template.
- has_content_file() : bool
- Does this template have an associated file.
- is_listable() : bool
- Get wether this template is listable in public template lists.
- load() : CmsLayoutTemplate
- Load a specific template
- load_all_by_type() : array<string|int, mixed>
- Load all templates of a specific type
- load_bulk() : array<string|int, mixed>
- Load a bulk list of templates
- load_dflt_by_type() : CmsLayoutTemplate
- Load the default template of a specified type
- lock_expired() : booln
- Tests if any lock associated with this object is expired
- locked() : bool
- Test if this object currently has a lock
- process() : string
- Process the template through smarty
- process_by_name() : string
- Process a template through smarty given the template name
- process_dflt() : string
- Process the default template of a specified type
- remove_design() : mixed
- Remove a design from the list of associated designs
- save() : mixed
- Save this template object to the database
- set_additional_editors() : mixed
- Set the admin user accounts (other than the owner) that are allowed to edit this template object
- set_category() : mixed
- Set the category for a template
- set_content() : mixed
- Set the content of the template
- set_description() : mixed
- Set the description for the template
- set_designs() : mixed
- Set the list of designs that this template is associated with
- set_listable() : bool
- Get wether this template is listable in public template lists.
- set_name() : mixed
- Set the name of the template
- set_owner() : mixed
- Set the owner id
- set_type() : mixed
- Set the type id for the template
- set_type_dflt() : mixed
- Set the flag that indicates that this template is the default template for its type Only one template can be the default for a template type
- template_query() : mixed
- Perform an advanced query on templates
- user_can_edit() : bool
- Test if the user specified can edit the specified template This is a convenience method that loads the template, and then tests if the specified user has edit ability to it.
- validate() : mixed
- Validate that the data is complete enough to save to the database
Methods
add_design()
Associate a new design with this template
public
add_design(mixed $a) : mixed
Parameters
- $a : mixed
-
A CmsLayoutCollection object, an integer design id, or a string design name.
Tags
can_edit()
Test wether the user specified has edit ability for this template object
public
can_edit(mixed $a) : bool
Parameters
- $a : mixed
-
Either a username (string) or an integer user id.
Return values
boolcreate_by_type()
Create a new template of the specific type
public
static & create_by_type(mixed $t) : CmsLayoutTemplate
Parameters
- $t : mixed
-
A CmsLayoutTemplateType object, An integer template type id, or a string template type identifier
Tags
Return values
CmsLayoutTemplatedelete()
Delete this template object from the database
public
delete() : mixed
generate_unique_name()
Generate a unique name for a template
public
static generate_unique_name(string $prototype[, string $prefix = null ]) : mixed
Parameters
- $prototype : string
-
A prototype template name
- $prefix : string = null
-
An optional name prefix.
Tags
get_additional_editors()
Get a list of user id's other than the owner that are allowed edit functionality to this template
public
get_additional_editors() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of integer user ids
get_category()
Get the category for this template A template is not required to be associated with a category
public
& get_category() : mixed
Tags
get_category_id()
Get the category id for this template A template is not required to be associated with a category
public
get_category_id() : mixed
get_content()
Get the content of the template
public
get_content() : string
Return values
stringget_content_filename()
Get the filename that will be used to read template contents from file.
public
get_content_filename() : string
Tags
Return values
stringget_created()
Get the date that this template was initially stored in the database The created date can not be externally modified
public
get_created() : int
Return values
intget_description()
Get the description for the template
public
get_description() : string
Return values
stringget_designs()
Get a list of the design id's that this template is associated with
public
get_designs() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of integers
get_editable_templates()
Get a list of the templates that a specific user can edit
public
static get_editable_templates(mixed $a) : mixed
Parameters
- $a : mixed
-
An integer userid or a string username
Tags
get_id()
Get the integer id of this template
public
get_id() : int
Return values
intget_listable()
Get wether this template is listable in public template lists.
public
get_listable() : bool
Tags
Return values
boolget_loaded_templates()
Get the ids of all loaded templates
public
static get_loaded_templates() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of integer template ids
get_lock()
Get any applicable lock for this template object
public
get_lock() : mixed
Tags
get_modified()
Get the date that this template was last saved to the database The modified date cannot be externally modified
public
get_modified() : int
Return values
intget_name()
Get the template name
public
get_name() : string
Return values
stringget_owned_templates()
Get a list of the templates owned by a specific user
public
static get_owned_templates(mixed $a) : array<string|int, mixed>
Parameters
- $a : mixed
-
An integer user id, or a string user name
Tags
Return values
array<string|int, mixed> —Array of integer template ids
get_owner_id()
Get the integer owner id of this template
public
get_owner_id() : int
Return values
intget_type()
Return the template type object for this template.
public
& get_type() : CmsLayoutTemplateType
Tags
Return values
CmsLayoutTemplateTypeget_type_dflt()
Get the flag indicating that this template is the default template for its type
public
get_type_dflt() : bool
Tags
Return values
boolget_type_id()
Get the type id for the template
public
get_type_id() : int
Return values
intget_usage_string()
Get the usage string (if any) for this template.
public
get_usage_string() : string
Tags
Return values
string —A sample usage string for this template.
has_content_file()
Does this template have an associated file.
public
has_content_file() : bool
Tags
Return values
boolis_listable()
Get wether this template is listable in public template lists.
public
is_listable() : bool
Tags
Return values
boolload()
Load a specific template
public
static & load(mixed $a) : CmsLayoutTemplate
Parameters
- $a : mixed
-
Either an integer template id, or a template name (string)
Tags
Return values
CmsLayoutTemplateload_all_by_type()
Load all templates of a specific type
public
static load_all_by_type(CmsLayoutTemplateType $type) : array<string|int, mixed>
Parameters
- $type : CmsLayoutTemplateType
Tags
Return values
array<string|int, mixed> —Array of CmsLayoutTemplate objects
load_bulk()
Load a bulk list of templates
public
static load_bulk(array<string|int, int> $list[, bool $deep = true ]) : array<string|int, mixed>
Parameters
- $list : array<string|int, int>
-
Array of integer template ids
- $deep : bool = true
-
Optionally load attached data.
Return values
array<string|int, mixed> —Array of CmsLayoutTemplate objects
load_dflt_by_type()
Load the default template of a specified type
public
static load_dflt_by_type(mixed $t) : CmsLayoutTemplate
Parameters
- $t : mixed
-
A CmsLayoutTemplateType object, An integer template type id, or a string template type identifier
Tags
Return values
CmsLayoutTemplatelock_expired()
Tests if any lock associated with this object is expired
public
lock_expired() : booln
Return values
boolnlocked()
Test if this object currently has a lock
public
locked() : bool
Return values
boolprocess()
Process the template through smarty
public
process() : string
Return values
stringprocess_by_name()
Process a template through smarty given the template name
public
static process_by_name(string $name) : string
Parameters
- $name : string
Return values
stringprocess_dflt()
Process the default template of a specified type
public
static process_dflt(mixed $t) : string
Parameters
- $t : mixed
-
A CmsLayoutTemplateType object, An integer template type id, or a string template type identifier
Return values
stringremove_design()
Remove a design from the list of associated designs
public
remove_design(mixed $a) : mixed
Parameters
- $a : mixed
-
A CmsLayoutCollection object, an integer design id, or a string design name.
Tags
save()
Save this template object to the database
public
save() : mixed
set_additional_editors()
Set the admin user accounts (other than the owner) that are allowed to edit this template object
public
set_additional_editors(mixed $a) : mixed
Parameters
- $a : mixed
-
Accepts an array of strings (usernames) or an array of integers (user ids, and negative group ids)
Tags
set_category()
Set the category for a template
public
set_category(mixed $a) : mixed
Parameters
- $a : mixed
-
Either a CmsLayoutTemplateCategory object, a category name (string) or category id (int)
Tags
set_content()
Set the content of the template
public
set_content([string $str = '' ]) : mixed
Parameters
- $str : string = ''
-
Smarty template text
set_description()
Set the description for the template
public
set_description(string $str) : mixed
Parameters
- $str : string
set_designs()
Set the list of designs that this template is associated with
public
set_designs(array<string|int, mixed> $x) : mixed
Parameters
- $x : array<string|int, mixed>
-
Array of integers.
Tags
set_listable()
Get wether this template is listable in public template lists.
public
set_listable(bool $flag) : bool
Parameters
- $flag : bool
-
The value for the listable attribute.
Tags
Return values
boolset_name()
Set the name of the template
public
set_name(string $str) : mixed
The template name cannot be empty, can only consist of a few characters in the name and must be unique
Parameters
- $str : string
Tags
set_owner()
Set the owner id
public
set_owner(mixed $a) : mixed
Parameters
- $a : mixed
-
An integer admin user id, a string admin username, or an instance of a User object
Tags
set_type()
Set the type id for the template
public
set_type(mixed $a) : mixed
Parameters
- $a : mixed
-
Either an instance of CmsLayoutTemplateType object, an integer type id, or a string template type identifier
Tags
set_type_dflt()
Set the flag that indicates that this template is the default template for its type Only one template can be the default for a template type
public
set_type_dflt(bool $flag) : mixed
Parameters
- $flag : bool
Tags
template_query()
Perform an advanced query on templates
public
static template_query(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
Tags
user_can_edit()
Test if the user specified can edit the specified template This is a convenience method that loads the template, and then tests if the specified user has edit ability to it.
public
static user_can_edit(mixed $tpl[, mixed $userid = null ]) : bool
Parameters
- $tpl : mixed
-
An integer template id, or a string template name
- $userid : mixed = null
-
An integer user id, or a string user name. If no userid is specified the currently logged in userid is used
Tags
Return values
boolvalidate()
Validate that the data is complete enough to save to the database
protected
validate() : mixed