CmsAdminThemeBase View code

Base class for CMSMS Admin themes.

This is an abstract class that is used for building CMSMS Admin Themes. This is also a singleton object.

package

CMS

license

GPL

since 1.11
author

Robert Campbell

property-read

Return the theme name

property-read

Return the current logged in userid (deprecated)

property-read

The current page title

property-read

The current page subtitle

Methods

SetTitle(string $str) 

Set the page title.

This is used in the admin to set the title for the page, and for the visible page header. Note: if no title is specified, the theme will try to calculate one automatically.

Arguments

string $str

The page title.

SetSubTitle(string $str) 

Set the page subtitle.

This is used in the admin to set the title for the page, and for the visible page header. Note: if no title is specified, the theme will try to calculate one automatically.

Arguments

string $str

The page subtitle.

HasPerm(string $permission) : boolean

HasPerm

Check if the user has one of the aggregate permissions

Arguments

string $permission

the permission to check.

Response

boolean

get_admin_navigation() : array

A function to return the admin navigation This function returns a doubly linked list of arrays representing the admin navigation

deprecated

Response

array

Doubly linked list of menu nodes. The parent, and children members of each node represent the links. a parent value of -1 represents a top level node.

get_navigation_tree(string $parent = -1, integer $maxdepth = -1) : array

Retrieve the admin navigation tree

Arguments

string $parent

Indicates the parent to start at. use a value of -1 to indicate the top node.

integer $maxdepth

The maximum depth of the tree. -1 indicates no maximum depth

Response

array

A nested array of menu nodes. The children member represents the nesting.

set_action_module(string $module_name) 

Set the current action module

Arguments

string $module_name

the module name.

get_action_module() : string

Determine the module name (if any) associated with the current request.

Response

string

the module name for the current request, if any.

get_module_help_url(string $module_name = null) 

Get the help URL for a module.

Arguments

string $module_name

find_menuitem_by_title(string $title) : string

A function to return the name (key) of a menu item given it's title returns the first match.

Arguments

string $title

The title to search for

Response

string

The matching key, or null

get_bookmarks(boolean $pure = FALSE) : array

Return the list of bookmarks

Arguments

boolean $pure

if False the shortcuts for adding and managing bookmarks are added to the list.

Response

array

Array of Bookmark objects

get_breadcrumbs() : array

Return list of breadcrumbs

Response

array

Array of menu nodes representing the breadcrumb trail.

get_active_title() : string

Return the title of the active item.

Response

string

set_value(string $key, mixed $value) 

Attach some data to the admin theme.

Arguments

string $key

mixed $value

get_value(string $key) 

Return attached data

Arguments

string $key

HasDisplayableChildren(string $section) : boolean

HasDisplayableChildren This method returns a boolean, based upon whether the section in question has displayable children.

deprecated

Arguments

string $section

section to test

Response

boolean

DisplayImage(string $imageName, string $alt = '', integer $width = '', integer $height = '', string $class = '') 

DisplayImage will display the themed version of an image (if it exists),

Arguments

string $imageName

name of image

string $alt

alt text

integer $width

width

integer $height

height

string $class

class

ShowErrors(mixed $errors, string $get_var = '') 

Abstract function for showing errors in the admin theme.

abstract

Arguments

mixed $errors

The errors, either a string, or an array of strings

string $get_var

An optional get variable name that can contain an error string key. If specified, errors is ignored.

ShowMessage(mixed $message, string $get_var = '') 

Abstrct function for showing messages in the admin theme.

abstract

Arguments

mixed $message

The message, either a string, or an array of stri9ngs

string $get_var

An optional get variable name that can contain an error string key. If specified, message param is ignored.

ShowHeader(string $title_name, array $extra_lang_params = array(), string $link_text = '', mixed $module_help_type = FALSE) 

Abstract method for showing a header in the content area of a theme This is usually an advanced function with some special behaviour based on the module_help_type

deprecated abstract

Arguments

string $title_name

The name to show on the header. This will not be passed through the lang process if module_help_type is not FALSE.

array $extra_lang_params

Extra language parameters to pass to the title_name. Ignored if module_help_type is not FALSE

string $link_text

Text to show in the module help link (depends on the module_help_type param)

mixed $module_help_type

Flag for how to display module help types. Possible values are TRUE to display a simple link, FALSE for no help, and 'both' for both types of links

GetDefaultTheme() 

A function to return the name of the default admin theme.

static
GetAvailableThemes() : array

Retrieve a list of the available admin themes.

static

Response

array

A hash of strings.

GetThemeObject(string $name = '') : \CmsAdminThemeBase

A function to retrieve the global admin theme object.

static

This method will create the admin theme object if has not yet been created. It will read the cms preferences and cross reference with available themes.

Arguments

string $name

optional theme name.

Response

\CmsAdminThemeBase

Reference to the initialized admin theme.

add_notification(\CmsAdminThemeNotification &$notification) 

A public function to add a notification for display in the theme.

Arguments

\CmsAdminThemeNotification $notification

A reference to the new notification

AddNotification(integer $priority, string $module, string $html) 

A public function to add a notification for display in the theme.

deprecated

This is simply a compatibility wrapper around the add_notification method.

Arguments

integer $priority

priority level between 1 and 3

string $module

The module name.

string $html

The contents of the notification

get_notifications() : Array

Retrieve the current list of notifications.

Response

Array

Array of CmsAdminThemeNotification objects

BackUrl() 

BackUrl "Back" Url - link to the next-to-last item in the breadcrumbs for the back button.

add_headtext(string $txt) 

Add text to the head section of the output

The CMSMS core code calls this method to add text and javascript to output in the head section required for various functionality.

Arguments

string $txt

The text to add to the head section.

get_headtext() : string

Get text that needs to be injected into the head section of the output.

This method is typically called by the admin theme itself to get the text to render.

Response

string

add_footertext(string $txt) 

Add text to the footer of the output, immediately before the </body> tag.

Arguments

string $txt

The text to add to the end of the output.

get_footertext() : string

Get text that needs to be injected into the footer section of the output.

This method is typically called by the admin theme itself to get the text to render.

Response

string

do_header() : string

An abstract function to output the header html This function may not display anything, but may store data for use in the postprocess mechanism it should store, or output all of the information required for the head section of the page, and all admin navigation etc. Many admin themes may not do anything here.

deprecated abstract

Response

string

html contents.

do_toppage(string $section_name) : string

An abstract function to output the content for a top level navigation page This method is called when the user has browsed to the root of the admin site, or to any top level navigation item

abstract

Arguments

string $section_name

The section name. An empty string indicates that a navigation of all top level items should be created.

Response

string

html contents.

postprocess(string $html) : string

An abstract function for processing the content area of the page.

abstract

Many admin themes will do most of their work in this method (passing the html contents through a smarty template etc).

Arguments

string $html

HTML contents

Response

string

the HTML contents of the entire page.

StartTabHeaders() : string

Output a string suitable for staring tab headers i.e: echo $this->StartTabHeaders();

final

Response

string

SetTabHeader(string $tabid, string $title, boolean $active = false) : string

Set a specific tab header.

final

i.e: echo $this->SetTabHeader('preferences',$this->Lang('preferences'));

Arguments

string $tabid

The tab id

string $title

The tab title

boolean $active

A flag indicating wether this tab is active.

Response

string

EndTabHeaders() : string

Output a string to stop the output of headers and close the necessary XHTML div.

final

Response

string

StartTabContent() : string

Output a string to indicate the start of XHTML areas for tabs.

final

Response

string

EndTabContent() : string

Output a string to indicate the end of XHTML areas for tabs.

final

Response

string

StartTab(string $tabid, array $params = array()) : string

Output a string to indicate the start of the output for a specific tab

final

Arguments

string $tabid

The tabid (see SetTabHeader)

array $params

Parameters

Response

string

EndTab() : string

Output a string to indicate the end of the output for a specific tab.

final

Response

string

Properties

themeName

themeName : string

Return the theme name

Type(s)

string

userid

userid : integer

Return the current logged in userid (deprecated)

Type(s)

integer

title

title : string

The current page title

Type(s)

string

subtitle

subtitle : string

The current page subtitle

Type(s)

string