Properties

$_context_data

$_context_data : 

This variable holds the context-specific data during processing.

It is indexed first by context ID and second by a string key. Currently defined keys are:

  • config holds the configuration for this context
  • handler The class handling the request.

Type

$_component

$_component : string

The name of the component, e.g. net.nehmer.static. Should be used whenever the component's name is required instead of hardcoding it.

Type

string

$_i18n

$_i18n : \midcom_services_i18n

A handle to the i18n service.

Type

\midcom_services_i18n

$_l10n

$_l10n : \midcom_services_i18n_l10n

The components' L10n string database.

Type

\midcom_services_i18n_l10n

$_l10n_midcom

$_l10n_midcom : \midcom_services_i18n_l10n

The global MidCOM string database.

Type

\midcom_services_i18n_l10n

$_config

$_config : \midcom_helper_configuration

The current configuration.

Type

\midcom_helper_configuration

$_nap_class_suffix

$_nap_class_suffix : string

Class suffix used when constructing the NAP handler class.

It is appended to the component class prefix, f.x. resulting in net_nehmer_static_navigation (as a default).

Type

string

$_site_class_suffix

$_site_class_suffix : string

Class suffix used when constructing the on-site handler class.

It is appended to the component class prefix, f.x. resulting in net_nehmer_static_viewer (as a default).

Type

string

$_services

$_services : array

Array that holds the already instantiated services

Type

array

Methods

initialize()

initialize(  $component) 

Initializes the component.

Parameters

$component

configure()

configure(mixed  $configuration, integer  $contextid) 

Configures the component for usage. The configuration is merged, and, if necessary, an existing handler object is purged.

Parameters

mixed $configuration

A configuration data list, suitable for merging with a midcom_helper_configuration object.

integer $contextid

The ID of the context we are associated with.

can_handle()

can_handle(\midcom_db_topic  $current_object, \Symfony\Component\HttpFoundation\Request  $request, integer  $contextid) : boolean

Relays the can_handle call to the component, instantiating a new site class. It will execute can_handle of that class, returning its result to MidCOM.

Parameters

\midcom_db_topic $current_object

The topic in question.

\Symfony\Component\HttpFoundation\Request $request
integer $contextid

The id of the context we are operating in.

Returns

boolean —

True, if the component can handle the request, false otherwise.

handle()

handle() : \midcom_response|boolean

Relays the handle call to the component.

Returns

\midcom_response|boolean —

True, if the component successfully handle the request, false otherwise.

show_content()

show_content(integer  $contextid) 

Relays the show content call to the component, invoking output.

Parameters

integer $contextid

The id of the context we are operating in.

set_object()

set_object(\midcom_db_topic  $object) : boolean

Relays the set_object call to the nap instance. Checks if the NAP instance has already been created beforehand.

Parameters

\midcom_db_topic $object

The midcom_db_topic that should be processed.

Returns

boolean —

Indicating success.

get_node()

get_node() : Array

Relays the get_node call to the NAP instance.

Returns

Array —

A NAP compliant NODE structure.

get_leaves()

get_leaves() : Array

Relays the get_leaves call to the NAP instance.

Returns

Array —

An Array of NAP compliant leaf structures.

get_current_leaf()

get_current_leaf() : integer

Returns the currently selected leaf of the request.

Returns

integer —

The active leaf ID out of the component data storage.

reindex()

reindex(\midcom_db_topic  $topic) : boolean

Initiate a reindex run for the given component and topic.

Parameters

\midcom_db_topic $topic

The topic that should be reindexed.

Returns

boolean —

Indicating success.

get_config_for_topic()

get_config_for_topic(\midcom_db_topic  $topic = null) : \midcom_helper_configuration

Get the full configuration set active for a given topic.

If no topic is passed, the system wide default configuration is returned.

Be aware, that this call does not check if the passed topic is actually handled by this component, as it is theoretically possible for components to drop configuration information on other topics as well.

Parameters

\midcom_db_topic $topic

The topic which should be queried, omit to get the systemwide defaults.

Returns

\midcom_helper_configuration

MidCOM configuration object

trigger_watch()

trigger_watch(integer  $operation, \midcom_core_dbaobject  $object) 

Delegate all watched operations, in two phases. First, the general _on_watched_operation handler is called, to allow for handling generic operations. After that, the individual watches are called, to allow for more specific processing.

Parameters

integer $operation

The operation that has occurred.

\midcom_core_dbaobject $object

The object on which the operation occurred. The system will do is_a checks against any registered class restriction on the watch.

_on_watched_operation()

_on_watched_operation(integer  $operation, \midcom_core_dbaobject  $object) 

This function is triggered at the end of the request for each watched operation that has been done during the request.

It will be called once per operation and unique object, where object uniqueness is determined by the combination of object class and guid. The object has been refreshed before being passed to this event handler.

Parameters

integer $operation

The operation identifier (one of the MIDCOM_OPERATION constants) which applies.

\midcom_core_dbaobject $object

The object on which the operation has occurred.

_on_watched_dba_create()

_on_watched_dba_create(\midcom_core_dbaobject  $object) 

This function is triggered at the end of the request for each watched create operation that has been done during the request.

It will be called once per operation and unique object, where object uniqueness is determined by the combination of object class and guid. The object has been refreshed before being passed to this event handler.

It is called after the generic _on_watched_operation event handler.

Parameters

\midcom_core_dbaobject $object

The object on which the operation has occurred.

_on_watched_dba_update()

_on_watched_dba_update(\midcom_core_dbaobject  $object) 

This function is triggered at the end of the request for each watched update operation that has been done during the request.

It will be called once per operation and unique object, where object uniqueness is determined by the combination of object class and guid. The object has been refreshed before being passed to this event handler.

It is called after the generic _on_watched_operation event handler.

Parameters

\midcom_core_dbaobject $object

The object on which the operation has occurred.

_on_watched_dba_delete()

_on_watched_dba_delete(\midcom_core_dbaobject  $object) 

This function is triggered at the end of the request for each watched delete operation that has been done during the request.

It is called after the generic _on_watched_operation event handler.

Parameters

\midcom_core_dbaobject $object

The object on which the operation has occurred.

_on_watched_dba_import()

_on_watched_dba_import(object  $object) 

This function is triggered at the end of the request for each watched import operation that has been done during the request.

It is called after the generic _on_watched_operation event handler.

Parameters

object $object

The object on which the operation has occurred.

_on_reindex()

_on_reindex(\midcom_db_topic  $topic, \midcom_helper_configuration  $config,   $indexer) : boolean

Reindex the given topic. The complete configuration set is already available in $config. The original index records are already deleted, so you do not need to bother about this.

The default event handler does nothing.

Parameters

\midcom_db_topic $topic

The topic to reindex.

\midcom_helper_configuration $config

The configuration associated with this topic.

$indexer

Returns

boolean —

Indicating success.

__construct()

__construct() 

Initialize all member variables, remember to set $_component before calling this constructor from your derived classes.

__get()

__get(  $field) 

Parameters

$field

__isset()

__isset(  $field) 

Parameters

$field

set_active_leaf()

set_active_leaf(  $leaf_id) 

Parameters

$leaf_id

add_stylesheet()

add_stylesheet(string  $url, string  $media = false) 

Convenience shortcut for adding CSS files

Parameters

string $url

The stylesheet URL

string $media

The media type(s) for the stylesheet, if any

get_workflow()

get_workflow(string  $identifier, array  $options = array()) : \midcom\workflow\dialog

Parameters

string $identifier
array $options

Returns

\midcom\workflow\dialog

_check_nap_instance()

_check_nap_instance() 

Checks, whether an instance of the NAP interface class has already been created and creates it if not.

This check is only done during the set_object calls, which will always be the first calls in a sequence of NAP calls. (For performance reasons.)