\midcom_services_toolbars

On-site toolbar service.

This service manages the toolbars used for the on-site administration system. For each context, it provides the following set of toolbars:

  1. The Node toolbar is applicable to the current node, which is usually a topic. MidCOM places the topic management operations into this toolbar, where applicable.

  2. The View toolbar is applicable to the specific view ("url"). Usually this maps to a single displayed object (see also the bind_to_object() member function). MidCOM places the object-specific management operations (like Metadata controls) into this toolbar, if it is bound to an object. Otherwise, this toolbar is not touched by MidCOM.

It is important to understand that the default toolbars made available through this service are completely specific to a given request context. If you have a dynamic_load running on a given site, it will have its own set of toolbars for each instance.

In addition, components may retrieve a third kind of toolbars, which are not under the general control of MidCOM, the Object toolbars. They apply to a single database object (like a bound View toolbar). The usage of this kind of toolbars is completely component-specific.

Implementation notes

It has yet to prove if the toolbar system is needed for a dynamic_load environments. The main reason for this is that dl'ed stuff is often quite tight in space and thus cannot display any toolbars in a sane way. Usually, the administrative tasks will be bound to the main request.

This could be different for portal applications, which display several components on the welcome page, each with its own management options.

Configuration See midcom_config for configuration options.

Summary

Methods
Properties
Constants
__construct()
get_class_magic_default_privileges()
get_host_toolbar()
get_node_toolbar()
get_view_toolbar()
get_help_toolbar()
add_toolbar()
bind_toolbar_to_object()
_render_toolbar()
render_node_toolbar()
render_view_toolbar()
render_host_toolbar()
render_help_toolbar()
show_node_toolbar()
show_host_toolbar()
show_view_toolbar()
show_help_toolbar()
show()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
_get_toolbar()
_create_toolbars()
$_toolbars
$_enable_centralized
$_centralized_mode
N/A

Properties

$_toolbars

$_toolbars : array

The toolbars currently available.

This array is indexed by context id; each value consists of a flat array of two toolbars, the first object being the Node toolbar, the second View toolbar. The toolbars are created on-demand.

Type

array

$_enable_centralized

$_enable_centralized : boolean

midcom.services.toolbars has two modes, it can either display one centralized toolbar for authenticated users, or the node and view toolbars separately for others. This property controls whether centralized mode is enabled.

Type

boolean

$_centralized_mode

$_centralized_mode : boolean

Whether we're in centralized mode, i.e. centralized toolbar has been shown

Type

boolean

Methods

__construct()

__construct() 

Simple constructor

get_class_magic_default_privileges()

get_class_magic_default_privileges() 

get_host_toolbar()

get_host_toolbar(integer  $context_id = null) : \midcom_helper_toolbar_host

Returns the host toolbar of the specified context. The toolbars will be created if this is the first request.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

Returns

\midcom_helper_toolbar_host

get_node_toolbar()

get_node_toolbar(integer  $context_id = null) : \midcom_helper_toolbar_node

Returns the node toolbar of the specified context. The toolbars will be created if this is the first request.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

Returns

\midcom_helper_toolbar_node

get_view_toolbar()

get_view_toolbar(integer  $context_id = null) : \midcom_helper_toolbar_view

Returns the view toolbar of the specified context. The toolbars will be created if this is the first request.

Parameters

integer $context_id

The context to retrieve the view toolbar for, this defaults to the current context.

Returns

\midcom_helper_toolbar_view

get_help_toolbar()

get_help_toolbar(integer  $context_id = null) : \midcom_helper_toolbar_help

Returns the help toolbar of the specified context. The toolbars will be created if this is the first request.

Parameters

integer $context_id

The context to retrieve the help toolbar for, this defaults to the current context.

Returns

\midcom_helper_toolbar_help

add_toolbar()

add_toolbar(string  $identifier, \midcom_helper_toolbar  $toolbar, integer  $context_id = null) 

Add a toolbar

Parameters

string $identifier
\midcom_helper_toolbar $toolbar
integer $context_id

The context to retrieve the help toolbar for, this defaults to the current context.

bind_toolbar_to_object()

bind_toolbar_to_object(\midcom_helper_toolbar  $toolbar,   $object) 

Binds the a toolbar to a DBA object. This will append a number of globally available toolbar options. For example, expect Metadata- and Version Control-related options to be added.

This call is available through convenience functions throughout the framework: The toolbar main class has a mapping for it (midcom_helper_toolbar::bind_to($object)) and object toolbars created by this service will automatically be bound to the specified object.

Repeated bind calls are intercepted, you can only bind a toolbar to a single object.

Parameters

\midcom_helper_toolbar $toolbar
$object

_render_toolbar()

_render_toolbar(integer  $toolbar_identifier, integer  $context_id = null) : string

Renders the specified toolbar for the indicated context.

If the toolbar is undefined, an empty string is returned.

Parameters

integer $toolbar_identifier

The toolbar identifier constant (one of MIDCOM_TOOLBAR_NODE or MIDCOM_TOOLBAR_VIEW etc.)

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

Returns

string —

The rendered toolbar

render_node_toolbar()

render_node_toolbar(integer  $context_id = null) : string

Renders the node toolbar for the indicated context. If the toolbar is undefined, an empty string is returned. If you want to show the toolbar directly, look for the show_xxx_toolbar methods.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

Returns

string —

The rendered toolbar

render_view_toolbar()

render_view_toolbar(integer  $context_id = null) : string

Renders the view toolbar for the indicated context. If the toolbar is undefined, an empty string is returned. If you want to show the toolbar directly, look for the show_xxx_toolbar methods.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

Returns

string —

The rendered toolbar

render_host_toolbar()

render_host_toolbar(integer  $context_id = null) : string

Renders the host toolbar for the indicated context. If the toolbar is undefined, an empty string is returned. If you want to show the toolbar directly, look for the show_xxx_toolbar methods.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

Returns

string —

The rendered toolbar

render_help_toolbar()

render_help_toolbar(integer  $context_id = null) : string

Renders the help toolbar for the indicated context. If the toolbar is undefined, an empty string is returned. If you want to show the toolbar directly, look for the show_xxx_toolbar methods.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

Returns

string —

The rendered toolbar

show_node_toolbar()

show_node_toolbar(integer  $context_id = null) 

Displays the node toolbar for the indicated context. If the toolbar is undefined, an empty string is returned.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

show_host_toolbar()

show_host_toolbar(integer  $context_id = null) 

Displays the host toolbar for the indicated context. If the toolbar is undefined, an empty string is returned.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

show_view_toolbar()

show_view_toolbar(integer  $context_id = null) 

Displays the view toolbar for the indicated context. If the toolbar is undefined, an empty string is returned.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

show_help_toolbar()

show_help_toolbar(integer  $context_id = null) 

Displays the help toolbar for the indicated context. If the toolbar is undefined, an empty string is returned.

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

show()

show(integer  $context_id = null) 

Displays the combined MidCOM toolbar system

Parameters

integer $context_id

The context to retrieve the node toolbar for, this defaults to the current context.

_get_toolbar()

_get_toolbar(integer  $context_id, string  $identifier) : \midcom_helper_toolbar

Parameters

integer $context_id
string $identifier

Returns

\midcom_helper_toolbar

_create_toolbars()

_create_toolbars(integer  $context_id) 

Creates the node and view toolbars for a given context ID.

Parameters

integer $context_id

The context ID for which the toolbars should be created.