CMSModuleContentType View code

Extends \ContentBase

Class that module defined content types must extend.

This is the base level content class. It is an abstract object and cannot be instantiated directly. All content pages in the database are required to be drived from this class.

since 0.9
package

CMS

Methods

ModuleName() : string

A method for returning the module that the content type belongs to.

abstract

Response

string

Lang(string $name, array $params = array()) 

Retrieve a language string from the module.

Arguments

string $name

The key for the language string

array $params

Optional parameters for use in vsprintf

GetModuleInstance() 

Returns the instance of the module this content type belongs to

final
__construct() 

Generic constructor. Runs the SetInitialValues fuction.

inherited
SetProperties() 

Subclasses should override this to set their property types using a lot of mProperties.Add statements

inherited
Id() 

Returns the ID

inherited
FriendlyName() : string

Returns a friendly name for this content type

inherited abstract

Normally the content type returns a string representing the name of the content type translated into the users current language

Response

string

Name() : string

Returns the Name

inherited

Response

string

SetName(string $name) 

Set the the page name

inherited

Arguments

string $name

The name.

Alias() : string

Returns the Alias

inherited

Response

string

Type() : string

Returns the Type

inherited

Response

string

Owner() : integer

Returns the Owners user id

inherited

Response

integer

SetOwner(integer $owner) 

Set the page owner.

inherited

No validation is performed.

Arguments

integer $owner

Owner's user id

HandlesAlias() : boolean

Content object handles the alias

inherited

Response

boolean

default is false.

TabIndex() : integer

Return the page tabindex value

inherited

Response

integer

SetTabIndex(integer $tabindex) 

Set the page tabindex value

inherited

Arguments

integer $tabindex

tabindex

TitleAttribute() : string

Return the page title attribute

inherited

Response

string

GetCreationDate() : integer

Retrieve the creation date of this content object.

inherited

Response

integer

Unix Timestamp of the creation date

GetModifiedDate() : integer

Retrieve the date of the last modification of this content object.

inherited

Response

integer

Unix Timestamp of the modification date.

SetTitleAttribute(string $titleattribute) 

Set the title attribute of the page

inherited

The title attribue can be used in navigations to set the "title=" attribute of a link some menu templates may ignore this.

Arguments

string $titleattribute

The title attribute

AccessKey() : string

Get the access key (for accessibility) for this page.

inherited

Response

string

SetAccessKey(string $accesskey) 

Set the access key (for accessibility) for this page

inherited

Arguments

string $accesskey

ParentId() : integer

Returns the id of this pages parent.

inherited

The parent id may be -2 to indicate a new page. A parent id value of -1 indicates that the page has no parent. oterwise a positive integer is returned.

Response

integer

SetParentId(integer $parentid) 

Sets the parent of this page.

inherited

Arguments

integer $parentid

The numeric page parent id. Use -1 for no parent.

TemplateId() : \int.

Return the id of the template associated with this content page.

inherited

Response

\int.

SetTemplateId(integer $templateid) 

Set the id of the template associated with this content page.

inherited

Arguments

integer $templateid

ItemOrder() : integer

Returns the ItemOrder The ItemOrder is used to specify the order of this page amongst its peers

inherited

Response

integer

OldItemOrder() : integer

Returns the OldItemOrder.

inherited deprecated

The OldItemOrder is used to specify the item order before changes were done

Response

integer

Hierarchy() : string

Returns the Hierarchy of the current page.

inherited

A string like #.##.## indicating the path to this page and it's order this value uses the item order when calculating the output i.e: 3.3.3 to indicate the third grandghild of the third child of the third root page.

Response

string

IdHierarchy() : string

Returns the Id Hierarchy.

inherited final

A string like #.##.## indicating the path to the page and it's order this property uses the id's of pages when calculating the output i.e: 21.5.17 to indicate that page id 17 is the child of page with id 5 which is inturn the child of the page with id 21

Response

string

HierarchyPath() : string

Returns the Hierarchy Path.

inherited final

Similar to the Hierarchy and IdHierarchy this string uses page aliases and outputs a string like root_alias/parent_alias/page_alias

Response

string

Active() : boolean

Returns the Active state

inherited

Response

boolean

SetActive(boolean $active) 

Sets this page as active

inherited

Arguments

boolean $active

HasPreview() : boolean

Returns whether preview should be available for this content type

inherited

Response

boolean

ShowInMenu() : boolean

Returns whether this content item should (by default) be shown in navigation menus.

inherited

Response

boolean

SetShowInMenu(boolean $showinmenu) 

Sets whether this page should be (by default) shown in menus

inherited

Arguments

boolean $showinmenu

DefaultContent() : boolean

Returns if the page is the default.

inherited final

The default page is the one that is displayed when no alias or pageid is specified in the route Only one content page can be the default.

Response

boolean

SetDefaultContent(boolean $defaultcontent) 

Sets if this page should be considered the default.

inherited

Note: does not modify the flags for any other content page.

Arguments

boolean $defaultcontent

Cachable() : boolean

Return whether this page is cachable.

inherited

Cachable pages (when enabled in global settings) are cached by the browser (also server side caching of HTML output may be enabled)

Response

boolean

SetCachable(boolean $cachable) 

Set whether this page is cachable

inherited

Arguments

boolean $cachable

Secure() : boolean

Return whether this page should be accessed via a secure protocol.

inherited

The secure flag effects whether the ssl protocol and appropriate config entries are used when generating urls to this page.

Response

boolean

SetSecure(boolean $secure) 

Set whether this page should be accessed via a secure protocol.

inherited

The secure flag effectsw whether the ssl protocol and appropriate config entries are used when generating urls to this page.

Arguments

boolean $secure

URL() : string

Return the page url (if any) associated with this content page.

inherited

The page url is not the complete URL to the content page, but merely the 'stub' or 'slug' appended after the root url when accessing the site If the page is specified as the default page then the "page url" will be ignored. Some content types do not support page urls.

Response

string

SetURL(string $url) 

Set the page url (if any) associated with this content page.

inherited

Note: some content types do not support page urls. The url should be relative to the root url. i.e: /some/path/to/the/page

Arguments

string $url

LastModifiedBy() : integer

Return the integer id of the admin user that last modified this content item.

inherited

Response

integer

SetLastModifiedBy(integer $lastmodifiedby) 

Set the last modified date for this item

inherited

Arguments

integer $lastmodifiedby

RequiresAlias() : boolean

Indicates whether this content type requires an alias.

inherited

Some content types that are not directly navigable do not require page aliases.

Response

boolean

IsViewable() : boolean

Indicates whether this content type is viewable (i.e: can be rendered).

inherited

some content types (like redirection links) are not viewable.

Response

boolean

Default is True

IsPermitted() : boolean

Indicates wether the current user is permitted to view this content page.

inherited

Response

boolean

IsSearchable() : boolean

Indicates whether this content type is searchable.

inherited

Searchable pages can be indexed by the search module.

This function by default uses a combination of other abstract methods to determine if the page is searchable but extended content types can override this.

Response

boolean

HasSearchableContent() : boolean

Indicates whether this content type may have content that can be used by a search module.

inherited

Content types should override this method if they are special purpose content types and they cannot support searchable content in any way. Content types such as ErrorPage, Section Header, and Separator are examples.

Response

boolean

IsDefaultPossible() 

Indicates whether this content type can be the default page for a CMSMS website.

inherited

The content editor module may adjust it's user interface to not allow setting pages that return false for this method as the default page.

SetAlias(string $alias = null, boolean $doAutoAliasIfEnabled = true) 

Set the page alias for this content page.

inherited

If an empty alias is supplied, and depending upon the doAutoAliasIfEnabled flag, and config entries a suitable alias may be calculated from other data in the page object This method relies on the menutext and the name of the content page already being set.

Arguments

string $alias

The alias

boolean $doAutoAliasIfEnabled

Whether an alias should be calculated or not.

MenuText() : string

Returns the menu text for this content page.

inherited

The MenuText is by default used as the text portion of a navigation link.

Response

string

SetMenuText(string $menutext) 

Sets the menu text for this content page

inherited

Arguments

string $menutext

ChildCount() : integer

Returns number of immediate child content items of this content item.

inherited

Response

integer

Properties() : array

Content page objects only directly store enough information to build a basic navigation from content objects.

inherited

This method will return all of the other parts of the content object.

Note: this method does not directly load properties.

Response

array

HasProperty(string $name) : boolean

Test whether this content page has the named property.

inherited

Properties will be loaded from the database if necessary.

Arguments

string $name

Response

boolean

GetPropertyValue(string $name) : mixed

Get the value for the named property.

inherited

Properties will be loaded from the database if necessary.

Arguments

string $name

Response

mixed

String value, or null if the property does not exist.

SetPropertyValue(string $name, string $value) 

Set the value of a the named property.

inherited

This method will load properties for this content page if necessary.

Arguments

string $name

The property name

string $value

The property value.

SetPropertyValueNoLoad(string $name, string $value) 

Set the value of a the named property.

inherited

This method will not load properties

Arguments

string $name

The property name

string $value

The property value.

WantsChildren() : boolean

An abstract method that extended content types can use to indicate whether or not they want children.

inherited

Some content types, such as a separator do not want to have any children.

Response

boolean

Default TRUE

IsCopyable() : boolean

An abstract method indicating whether the content type is copyable.

inherited

Response

boolean

default FALSE

IsSystemPage() : boolean

An abstract method to indicate whether this content type generates a system page.

inherited

System pages are used to handle things like 404 errors etc.

Response

boolean

default FALSE

HasTemplate() : boolean

Indicates whether ths page type uses a template.

inherited

i.e: some content types like sectionheader and separator do not.

Response

boolean

default FALSE

LoadFromData(array &$data, boolean $loadProperties = false) 

Load the content of the object from an array.

inherited

This method modifies the current object.

There is no check on the data provided, because this is the job of ValidateData

Upon failure the object comes back to initial values and returns FALSE

Arguments

array $data

Data as loaded from the database

boolean $loadProperties

Optionally load content properties at the same time.

ToData() : array

Convert the current object to an array.

inherited

This can be considered a simple DTO (Data Transfer Object)

Response

array

Load() 

Callback function for content types to use to preload content or other things if necessary.

inherited

This is called right after the content is loaded from the database.

Save() 

Save or update the content.

inherited
Update() 

Update the database with the contents of the content object.

inherited

This method will calculate a new item order for the object if necessary and then save the content record, the additional editors, and the properties. Additionally, if a page url is specified a static route will be created

Because multiple content objects may be modified in one batch the calling function is responsible for ensuring that page hierarchies are updated.

Insert() 

Initially save a content object with no id to the database.

inherited

Like the Update method this method will determine a new item order save the record, save properties and additional editors, but will not update the hierarchy positions.

ValidateData() 

Test if the content object is valid.

inherited

This function is used to check that no compulsory argument has been forgotten by the user

We do not check the Id because there can be no Id (new content) That's up to Save to check this.

Delete() 

Delete the current content object from the database.

inherited
FillParams(array $params, boolean $editing = false) 

Function for the subclass to parse out data for it's parameters.

inherited

This method is typically called from an editor form to allow modifying the content object from form input fields (usually $_POST)

Arguments

array $params

The input array (usually from $_POST)

boolean $editing

Indicates wether this is an edit or add operation.

GetURL(boolean $rewrite = true) : string

A function to get the internally generated URL for this content type.

inherited

This method may be overridden by content types.

Arguments

boolean $rewrite

if true, and mod_rewrite is enabled, build a URL suitable for mod_rewrite.

Response

string

ChangeItemOrder(integer $direction) 

Move this content up, or down with respect to its peers.

inherited

Note: This method modifies two content objects.

Arguments

integer $direction

direction. negative value indicates up, positive value indicates down.

Show(string $propname = 'content_en') : string

Return the raw value for a content property.

inherited

If no proeprty name is specified 'content_en' is assumed

Arguments

string $propname

An optional property name to display. If none specified, the system should assume content_en.

Response

string

GetEditableProperties() : array

Return a list of all of the properties that may be edited by the current user when editing this content item in a content editor form.

inherited

Other content types may override this method, but should call the base method at the start.

Response

array

Array of stdclass objects containing name (string), tab (string), priority (integer), required (bool) members

GetTabNames() : Array

Used from a page that allows content editing.

inherited

This method provides a list of distinct sections that devides up the various logical sections that this content type supports for editing.

Response

Array

associative array list of tab keys and labels.

GetTabMessage(string $key) : string

Get an optional message for each tab.

inherited

Arguments

string $key

the tab key (as returned with GetTabNames)

Response

string

html text to display at the top of the tab.

GetTabElements(string $key, boolean $adding = FALSE) : array

Get the elements for a specific tab.

inherited

Arguments

string $key

tab key

boolean $adding

Whether this is an add or edit operation.

Response

array

An array of arrays. Index 0 of each element should be a prompt field, and index 1 should be the input field for the prompt.

HasChildren(boolean $activeonly = false) : boolean

Method to indicate whether the current page has children.

inherited

Arguments

boolean $activeonly

Should we test only for active children.

Response

boolean

GetAdditionalEditors() : mixed

Return a list of additional editors.

inherited

Note: in the returned array, group id's are specified as negative integers.

Response

mixed

Array of uids and group ids, or null

SetAdditionalEditors(mixed $editorarray) 

Set the list of additional editors.

inherited

Note: in the provided array, group id's are specified as negative integers.

Arguments

mixed $editorarray

Array of uids and group ids, or null

GetAdditionalEditorOptions() : array

A utility method to return all of the userid and group ids in a format that is suitable to be used in a select field.

inherited static

Note: group ids are expressed as negative integers in the keys.

Response

array

GetAdditionalEditorInput(array $addteditors, integer $owner_id = -1) : string

A utility method to generate a <select> field for selecting additional editors.

inherited static

If a positive owner id is specified that user will be excluded from output select element.

Arguments

array $addteditors

Array of additional editors

integer $owner_id

The current owner of the page.

Response

string

HTML output

ShowAdditionalEditors(array $addteditors = '') : string

Provides an input element to display the list of additional editors.

inherited

This method is usually called from within this object.

Arguments

array $addteditors

An optional array of additional editor id's (group ids specified with negative values)

Response

string

The input element.

RemoveProperty(string $name, string $dflt) 

Remove a property from the known property list.

inherited

Specify a default value to use if the property is called.

Arguments

string $name

The property name

string $dflt

The default value.

AddProperty(string $name, integer $priority, string $tab = self::TAB_MAIN, boolean $required = FALSE, boolean $basic = FALSE) 

Add a property definition.

inherited

Arguments

string $name

The property name

integer $priority

The property priority, for sorting.

string $tab

The tab for the property (see tab constants)

boolean $required

(whether the property is required)

boolean $basic

Whether or not the property is a basic property (editable by even restricted editors)

GetProperties() : array

Get all of the properties for this content object. independent of whether the user is entitled to view them, or not.

inherited

Response

array

of stdclass objects

AddBaseProperty(string $name, integer $priority, boolean $is_required) 

Add a property that is directly associtated with a field in the content table.

inherited deprecated

Arguments

string $name

The property name

integer $priority

The priority

boolean $is_required

Whether this field is required for this content type

AddContentProperty(string $name, integer $priority, boolean $is_required) 

Alias for AddBaseProperty.

inherited deprecated

Arguments

string $name

integer $priority

boolean $is_required

display_single_element(string $one, boolean $adding) : array

A method to display a single input element for an object basic, or extended property.

inherited

Arguments

string $one

The property name

boolean $adding

Whether or not we are in add or edit mode.

Response

array

consisting of two elements. A label, and the input element.

Properties

The ID of the parent, 0 if none Integer

mParentId : 
inherited

Type(s)

The item order of the content in his level Integer

mItemOrder : 
inherited

Type(s)