\net_nehmer_comments_handler_view

Comments view handler.

This handler is a single handler which displays the thread for a given object GUID. It checks for various commands in $_REQUEST during startup and processes them if applicable. It relocates to the same page (using $_SERVER info) to prevent duplicate request runs.

Summary

Methods
Properties
Constants
populate_post_toolbar()
initialize()
_on_initialize()
show()
add_breadcrumb()
populate_breadcrumb_line()
bind_view_to_object()
__construct()
__get()
__isset()
set_active_leaf()
add_stylesheet()
get_workflow()
_handler_comments()
_show_comments()
$_topic
$_request_data
$_master
$_node_toolbar
$_view_toolbar
$_component
$_i18n
$_l10n
$_l10n_midcom
$_config
No constants found
No protected methods found
$router
N/A
_prepare_request_data()
_init_display_datamanager()
_load_schemadb()
_init_post_controller()
_process_post()
_get_last_modified()
_relocate_to_self()
$_breadcrumbs
$_services
$_schemadb
$_comments
$_new_comment
$_objectguid
$_post_controller
$_display_datamanager
$custom_view
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

$_comments

$_comments : Array

List of comments we are currently working with.

Type

Array

$_objectguid

$_objectguid : string

The GUID of the object we're bound to.

Type

string — GUID

$_post_controller

$_post_controller : \midcom\datamanager\controller

The controller used to post a new comment. Only set if we have a valid user.

Type

\midcom\datamanager\controller

$_display_datamanager

$_display_datamanager : \midcom\datamanager\datamanager

This datamanager instance is used to display an existing comment. only set if there are actually comments to display.

Type

\midcom\datamanager\datamanager

$custom_view

$custom_view : 

Type

Methods

populate_post_toolbar()

populate_post_toolbar(\net_nehmer_comments_comment  $comment,   $viewtype = null) 

Parameters

\net_nehmer_comments_comment $comment
$viewtype

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

_handler_comments()

_handler_comments(mixed  $handler_id, array  $args, array  $data) 

Loads the comments, does any processing according to the state of the GET list.

On successful processing we relocate once to ourself.

Parameters

mixed $handler_id

The ID of the handler.

array $args

The argument list.

array $data

_show_comments()

_show_comments(mixed  $handler_id, array  $data) 

Display the comment list and the submit-comment form.

Parameters

mixed $handler_id

The ID of the handler.

array $data

_prepare_request_data()

_prepare_request_data() 

Prepares the request data

_init_display_datamanager()

_init_display_datamanager() 

Prepares the _display_datamanager member.

_load_schemadb()

_load_schemadb() 

Loads the schemadb (unless it has already been loaded).

_init_post_controller()

_init_post_controller() 

Initializes a DM for posting.

_process_post()

_process_post() 

Checks if a new post has been submitted.

_get_last_modified()

_get_last_modified() : integer

Determines the last modified timestamp. It is the max out of all revised timestamps of the comments (or 0 in case nothing was found).

Returns

integer —

Last-Modified Timestamp

_relocate_to_self()

_relocate_to_self() 

This is a shortcut for midcom::get()->relocate which relocates to the very same page we are viewing right now, including all GET parameters we had in the original request.

We do this by taking the $_SERVER['REQUEST_URI'] variable.