CmsLayoutTemplateType View code

A class to manage template types

package

CMS

license

GPL

since 2.0
author

Robert Campbell calguy1000@gmail.com

Methods

get_id() : integer

Get the template type id

Response

integer

type id, or null if this record has no id.

get_originator(boolean $viewable = FALSE) : string

Get the template originator (this is usually a module name)

Arguments

boolean $viewable

Should the originator name be the viewable (friendly) string?

Response

string

set_originator(string $str) 

Set the template originator string.

Arguments

string $str

The originator string, usually a module name.

get_name() : string

Return the template type name.

Response

string

the template type

set_name(\sting $str) 

Set the template type name

Arguments

\sting $str

The template type name.

get_dflt_flag() : boolean

Get the flag indicating if this template type can have a 'default'

Response

boolean

set_dflt_flag(boolean $flag = TRUE) 

Set the flag indicating if this template type can have a 'default'

Arguments

boolean $flag

get_dflt_contents() : string

Get the default contents used when creating a new template of this type.

Response

string

set_dflt_contents(string $str) 

Set the default content used when creating a new templateof this type.

Arguments

string $str

The default template contents.

get_description() : string

Get the template type description.

Response

string

set_description(string $str) 

Set the description for this template.

Arguments

string $str

The default template contents.

get_owner() : integer

Get the owner of this template type.

Response

integer

set_owner(integer $owner) 

Set the owner of this template type

Arguments

integer $owner

get_create_date() : \intUnix

Get the date that this object was created.

Response

\intUnix

timestamp representing the creation date. or null if this object has not been saved.

get_modified_date() : \intUnix

Get the date that this object was last modified

Response

\intUnix

timestamp representing the modification date. or null if this object has not been saved.

set_lang_callback(callable $data) 

Set a callback to be used to retrieve a translated version of the originator and name strings.

This callback must be a static string representing a static function name, or an array representing a class name and method name. This callback (if set) will be used to translate the originator string, and the name string to something suitable to users language.

Arguments

callable $data

A static function name string, or an array of class name and member name.

get_lang_callback() : mixed

Return the callback used to translate the originator and name strings.

Response

mixed

set_help_callback(callable $callback) 

Set a callback to be used to display help for this template when editing.

Arguments

callable $callback

A static function name, or an array of a class name and member name.

get_help_callback() : mixed

Return the callback used to retrieve help for this template type.

Response

mixed

set_oneonly_flag(boolean $flag = TRUE) 

Set the flag indicating that a maximum of one template of this type is permitted.

Arguments

boolean $flag

get_oneonly_flag() : boolean

Get the flag indicating that a maximum of one template of this type is permitted.

Response

boolean

set_content_callback(callable $data) 

Set a callback to be used when restoring the 'default content' to system default values.

Modules typically distribut sample templates. This callback function is used when the user clicks on a button to reset the selected template type to it's factory default values.

Arguments

callable $data

A static function name string, or an array of class name and member name.

get_content_callback() : mixed

Return the callback used to reset a template to its factory default values.

Response

mixed

get_content_block_flag() : boolean

Get the content block flag The content block flag indicates that this template type requires content blocks

Response

boolean

set_content_block_flag(boolean $flag) 

Set the content block flag to indicate that this template type requires content blocks

Arguments

boolean $flag

validate(boolean $is_insert = TRUE) 

Validate the integrity of a template type object.

This method will check the contents of the object for validity, and ensure that the originator/name combination are unique.

This method throws an exception if an error is found in the integrity of the object.

Arguments

boolean $is_insert

Wether this is a new insert, or an update.

_insert() 

A function to insert the current type object into the database.

This method will ensure that the current object is valid, generate an id, and insert the record into the database. An exception will be thrown if errors occur.

_update() 

A function to update the contents of the database to match th current record.

This method will ensure that the current object is valid, generate an id, and update the record in the database. An exception will be thrown if errors occur.

save() 

Save the current record to the database.

get_template_list() : Array

Get a list of templates for the current template type.

Response

Array

of CmsLayoutTemplate objects. or null.

delete() 

Delete the current object from the database (if it has been saved).

create_new_template(string $name = '') : \CmsLayoutTemplate

Create a new template of ths type

This method will throw an exception if the template cannot be created.

Arguments

string $name

The template name

Response

\CmsLayoutTemplate

object, or null.

get_dflt_template() : \CmsLayoutTemplate

Get the default template of ths type

This method will throw an exception if the template cannot be created.

Response

\CmsLayoutTemplate

object, or null.

get_template_helptext() 

Get HTML text for help with respect to the variables available in this template type.

get_langified_display_value() 

Get a translated/pretty displayable name for this template type including the originator.

reset_content_to_factory() 

Reset the default contens of this template type back to factory defaults

load(mixed $val) : \CmsLayoutTemplateType

Load a CmsLayoutTemplateType object from the database.

static

This method throws an exception when the requested object cannot be found.

Arguments

mixed $val

An integer template type id, or a string in the form of Originator::Name

Response

\CmsLayoutTemplateType

load_all_by_originator(string $originator) : array

Load all of the template types for a certain originator.

static

This method will throw exceptions if an error is encounted.

Arguments

string $originator

The origiator name

Response

array

An array of CmsLayoutTemplateType objects, or null if no matches are found.

get_all() : array

Load all template types

static

Response

array

Array of CmsLayoutTemplateType objects

load_bulk(array<mixed,integer> $list) 

Load template type objects by specifying an array of ids

static

Arguments

array<mixed,integer> $list

Array of template type ids

get_loaded_types() : array

Return the names of all loaded template types

static

Response

array

Associative array of loaded type objects.

get_assistant() : \CMSMS\Layout\TemplateTypeAssistant

Get the assistant object with utility methods for this template type (if such an assistant object can be instantiated)

get_usage_string(string $name) : string

Get a usage string for this template type.

Arguments

string $name

The name of the template object.

Response

string

Constants

This constant indicates a core template type

CORE