CMS Made Simple API

CmsLayoutTemplate
in package

A class to represent a smarty template.

Tags
license

GPL

since
2.0
author

Robert Campbell calguy1000@gmail.com

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

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
bool

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
throws
CmsInvalidDataException
throws
CmsLogicException

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

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

public get_content_filename() : string
Tags
since
2.2
Return values
string

get_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
int

get_description()

Get the description for the template

public get_description() : string
Return values
string

get_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
throws
CmsInvalidDataException

get_listable()

Get wether this template is listable in public template lists.

public get_listable() : bool
Tags
since
2.1
Return values
bool

get_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_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
int

get_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
throws
CmsInvalidDataException
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
int

get_usage_string()

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

public get_usage_string() : string
Tags
since
2.2
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
since
2.2
Return values
bool

is_listable()

Get wether this template is listable in public template lists.

public is_listable() : bool
Tags
since
2.1
Return values
bool

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

lock_expired()

Tests if any lock associated with this object is expired

public lock_expired() : booln
Return values
booln

process_by_name()

Process a template through smarty given the template name

public static process_by_name(string $name) : string
Parameters
$name : string
Return values
string

process_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
string

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
throws
CmsInvalidDataException

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
throws
CmsInvalidDataException

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
since
2.1
Return values
bool

set_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
throws
CmsInvalidDataException

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
see
CmsLayoutTemplateType

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
see
CmsLayoutTemplate::load()
Return values
bool

        
On this page

Search results