CmsLayoutTemplate View code

A class to represent a smarty template.

package

CMS

license

GPL

since 2.0
author

Robert Campbell calguy1000@gmail.com

Methods

get_id() : integer

Get the integer id of this template

Response

integer

get_name() : string

Get the template name

Response

string

set_name(string $str) 

Set the name of the template

The template name cannot be empty, can only consist of a few characters in the name and must be unique

Arguments

string $str

get_content() : string

Get the content of the template

Response

string

set_content(string $str) 

Set the content of the template

Arguments

string $str

Smarty template text

get_description() : string

Get the description for the template

Response

string

set_description(string $str) 

Set the description for the template

Arguments

string $str

get_type_id() : integer

Get the type id for the template

Response

integer

set_type(mixed $a) 

Set the type id for the template

Arguments

mixed $a

Either an instance of CmsLayoutTemplateType object, an integer type id, or a string template type identifier

get_type_dflt() : boolean

Get the flag indicating that this template is the default template for its type

Response

boolean

set_type_dflt(boolean $flag) 

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

Arguments

boolean $flag

get_category_id() 

Get the category id for this template A template is not required to be associated with a category

get_category() 

Get the category for this template A template is not required to be associated with a category

set_category(mixed $a) 

Set the category for a template

Arguments

mixed $a

Either a CmsLayoutTemplateCategory object, a category name (string) or category id (int)

get_designs() : array

Get a list of the design id's that this template is associated with

Response

array

Array of integers

set_designs(array $x) 

Set the list of designs that this template is associated with

Arguments

array $x

Array of integers.

add_design(mixed $a) 

Associate a new design with this template

Arguments

mixed $a

A CmsLayoutCollection object, an integer design id, or a string design name.

remove_design(mixed $a) 

Remove a design from the list of associated designs

Arguments

mixed $a

A CmsLayoutCollection object, an integer design id, or a string design name.

get_owner_id() : integer

Get the integer owner id of this template

Response

integer

set_owner(mixed $a) 

Set the owner id

Arguments

mixed $a

An integer admin user id, a string admin username, or an instance of a User object

get_created() : integer

Get the date that this template was initially stored in the database The created date can not be externally modified

Response

integer

get_modified() : integer

Get the date that this template was last saved to the database The modified date cannot be externally modified

Response

integer

get_additional_editors() : array

Get a list of user id's other than the owner that are allowed edit functionality to this template

Response

array

Array of integer user ids

set_additional_editors(mixed $a) 

Set the admin user accounts (other than the owner) that are allowed to edit this template object

Arguments

mixed $a

Accepts an array of strings (usernames) or an array of integers (user ids, and negative group ids)

can_edit(mixed $a) : boolean

Test wether the user specified has edit ability for this template object

Arguments

mixed $a

Either a username (string) or an integer user id.

Response

boolean

get_listable() : boolean

Get wether this template is listable in public template lists.

Response

boolean

is_listable() : boolean

Get wether this template is listable in public template lists.

Response

boolean

set_listable(boolean $flag) : boolean

Get wether this template is listable in public template lists.

Arguments

boolean $flag

The value for the listable attribute.

Response

boolean

process() : string

Process the template through smarty

Response

string

validate() 

Validate that the data is complete enough to save to the database

save() 

Save this template object to the database

delete() 

Delete this template object from the database

get_lock() 

Get any applicable lock for this template object

locked() : boolean

Test if this object currently has a lock

Response

boolean

lock_expired() : \booln

Tests if any lock associated with this object is expired

Response

\booln

load_bulk(array<mixed,integer> $list, boolean $deep = true) : array

Load a bulk list of templates

static

Arguments

array<mixed,integer> $list

Array of integer template ids

boolean $deep

Optionally load attached data.

Response

array

Array of CmsLayoutTemplate objects

load(mixed $a) : \CmsLayoutTemplate

Load a specific template

static

Arguments

mixed $a

Either an integer template id, or a template name (string)

Response

\CmsLayoutTemplate

get_owned_templates(mixed $a) : array

Get a list of the templates owned by a specific user

static

Arguments

mixed $a

An integer user id, or a string user name

Response

array

Array of integer template ids

template_query(array $params) 

Perform an advanced query on templates

static

Arguments

array $params

get_editable_templates(mixed $a) 

Get a list of the templates that a specific user can edit

static

Arguments

mixed $a

An integer userid or a string username

user_can_edit(mixed $tpl, mixed $userid = null) : boolean

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.

static

Arguments

mixed $tpl

An integer template id, or a string template name

mixed $userid

An integer user id, or a string user name. If no userid is specified the currently logged in userid is used

Response

boolean

create_by_type(mixed $t) : \CmsLayoutTemplate

Create a new template of the specific type

static

Arguments

mixed $t

A CmsLayoutTemplateType object, An integer template type id, or a string template type identifier

Response

\CmsLayoutTemplate

load_dflt_by_type(mixed $t) : \CmsLayoutTemplate

Load the default template of a specified type

static

Arguments

mixed $t

A CmsLayoutTemplateType object, An integer template type id, or a string template type identifier

Response

\CmsLayoutTemplate

load_all_by_type(\CmsLayoutTemplateType $type) : array

Load all templates of a specific type

static

Arguments

Response

array

Array of CmsLayoutTemplate objects

process_by_name(string $name) : string

Process a template through smarty given the template name

static

Arguments

string $name

Response

string

process_dflt(mixed $t) : string

Process the default template of a specified type

static

Arguments

mixed $t

A CmsLayoutTemplateType object, An integer template type id, or a string template type identifier

Response

string

get_loaded_templates() : array

Get the ids of all loaded templates

static

Response

array

Array of integer template ids

generate_unique_name(string $prototype, string $prefix = null) 

Generate a unique name for a template

static

Arguments

string $prototype

A prototype template name

string $prefix

An optional name prefix.

get_type() : \CmsLayoutTemplateType

Return the template type object for this template.

get_usage_string() : string

Get the usage string (if any) for this template.

Response

string

A sample usage string for this template.

get_content_filename() : string

Get the filename that will be used to read template contents from file.

Response

string

has_content_file() : boolean

Does this template have an associated file.

Response

boolean