\org_openpsa_relatedto_plugin

Class for handling "related to" information

Use the various event handlers to customize startup.

The basic idea is that you have separate instances of this type for the various operations in your main viewer class. This avoids cluttering up the viewer class and gives you better maintainability due to smaller code files.

Under normal operation within the same component you don't need to think about any specialties, the member variables are just references to the main request class (also known as "viewer class").

Noteworthy is the ability to export handlers for usage in other components in both libraries and full components. To make the exported handler work correctly, you need to set $this->_component to the corresponding value of the exporting component. In this case, the startup code will take the main l10n instance, the component data storage and the configuration from the exporting component. The configuration in this case is merged from the global defaults (constructed during component/library startup) and the configuration parameters set on the topic where it is invoked.

Note, that the export "mode" is only invoked if and only if the component of the handler is different of the component of the main request class.

Summary

Methods
Properties
Constants
initialize()
_on_initialize()
show()
add_breadcrumb()
populate_breadcrumb_line()
bind_view_to_object()
__construct()
__get()
__isset()
set_active_leaf()
add_stylesheet()
get_workflow()
create()
get2relatedto()
relatedto2get()
add_header_files()
add_button()
common_toolbar_buttons_defaults()
common_node_toolbar_buttons()
add_journal_entry_button()
$_topic
$_request_data
$_master
$_node_toolbar
$_view_toolbar
$_component
$_i18n
$_l10n
$_l10n_midcom
$_config
No constants found
No protected methods found
$router
N/A
common_node_toolbar_buttons_sanitycheck()
$_breadcrumbs
$_services
N/A

Properties

$_topic

$_topic : \midcom_db_topic

The topic for which we are handling a request.

Type

\midcom_db_topic

$_request_data

$_request_data : Array

Request specific data storage area. Registered in the component context as ''.

Type

Array

$_node_toolbar

$_node_toolbar : \midcom_helper_toolbar

The node toolbar for the current request context. Not available during the can_handle phase.

Type

\midcom_helper_toolbar

$_view_toolbar

$_view_toolbar : \midcom_helper_toolbar

The view toolbar for the current request context. Not available during the can_handle phase.

Type

\midcom_helper_toolbar

$_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

$router

$router : \Symfony\Component\Routing\Router

Type

\Symfony\Component\Routing\Router

$_breadcrumbs

$_breadcrumbs : array

Holds breadcrumb entries the handler wants to add

Type

array

$_services

$_services : array

Array that holds the already instantiated services

Type

array

Methods

initialize()

initialize(\midcom_baseclasses_components_request  $master, \Symfony\Component\Routing\Router  $router) 

Initializes the request handler class, called by the component interface after instantiation.

Be aware that it is possible that a handler can come from a different component (or library) than the master class. Take this into account when getting the component data storage, configuration and l10n instances. Configuration is merged during runtime based on the system defaults and all parameters attached to the topic we're currently operating on.

Parameters

\midcom_baseclasses_components_request $master

The request class

\Symfony\Component\Routing\Router $router

_on_initialize()

_on_initialize() 

Initialization event handler, called at the end of the initialization process.

Use this for all initialization work you need, as the component state is already populated when this event handler is called.

show()

show(string  $element) : \midcom_response_styled

Generates a response with a given style element

Parameters

string $element

Returns

\midcom_response_styled

add_breadcrumb()

add_breadcrumb(string  $url, string  $title) 

Registers a new breadcrumb entry

Parameters

string $url

The URL

string $title

The text to display

populate_breadcrumb_line()

populate_breadcrumb_line() 

Adds the registered breadcrumb entries to context_data

bind_view_to_object()

bind_view_to_object(\midcom_core_dbaobject  $object, string  $page_class = 'default') 

Binds the current page view to a particular object. This will automatically connect such things like metadata and toolbars to the correct object.

Parameters

\midcom_core_dbaobject $object

The DBA class instance to bind to.

string $page_class

String describing page type, will be used for substyling

__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

create()

create(object  $from_obj, string  $from_component, object  $to_obj, string  $to_component, integer  $status = false, array  $extra = false) : mixed

Shorthand for creating a relatedto object.

The from object is something that is related to the to object. For example, if a task is created under a sales project, that task is the from object, and the sales project the to object.

Parameters

object $from_obj

The from object

string $from_component

The from component name

object $to_obj

The to object

string $to_component

The to component name

integer $status

The status of the relation

array $extra

Array with the possible extra-properties

Returns

mixed —

The newly-created relatedto object or false on failure

get2relatedto()

get2relatedto() 

Parses relatedto information from request, returning either existing matching relatedtos or prefilled new ones for creation

relatedto2get()

relatedto2get(array  $array) 

Serializes an array or relatedto objects into GET parameters

NOTE: does not prefix the ? for the first parameter in case this needs to be used with some other GET parameters.

Parameters

array $array

add_header_files()

add_header_files() 

Add the necessary JS/CSS to HTML head

add_button()

add_button(\midcom_helper_toolbar  $toolbar,   $guid,   $mode = 'both') 

Parameters

\midcom_helper_toolbar $toolbar
$guid
$mode

common_toolbar_buttons_defaults()

common_toolbar_buttons_defaults() 

common_node_toolbar_buttons()

common_node_toolbar_buttons(\midcom_helper_toolbar  $toolbar,   $bind_object,   $calling_component,   $buttons = 'default') 

Parameters

\midcom_helper_toolbar $toolbar
$bind_object
$calling_component
$buttons

add_journal_entry_button()

add_journal_entry_button(\midcom_helper_toolbar  $toolbar,   $guid) 

function to add the button for journal_entry to the toolbar

Parameters

\midcom_helper_toolbar $toolbar
$guid

common_node_toolbar_buttons_sanitycheck()

common_node_toolbar_buttons_sanitycheck(array  $data,   $button_component,   $bind_object,   $calling_component) 

Parameters

array $data
$button_component
$bind_object
$calling_component