Comments view handler.

This handler is a sigle 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.

package net.nehmer.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.



mixedThe ID of the handler.


arrayThe argument list.


array&$data The local request data.

_init_display_datamanager ()

Prepares the _display_datamanager member.
access private

_init_post_controller ()

Initializes a DM2 for posting.

_load_schemadb ()

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

_prepare_request_data ()

Prepares the request data

_process_admintoolbar ()

Checks if a button of the admin toolbar was pressed.

Detected by looking for the net_nehmer_comment_adminsubmit value in the Request.

As of this point, this tool assumes at least owner level privileges for all

_process_post ()

Checks if a new post has been submitted.

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

_show_comments (mixed $handler_id, array $data)

Display the comment list and the submit-comment form.



mixedThe ID of the handler.


array&$data The local request data.

dm2_create_callback ($controller)

DM2 creation callback, binds the new object directly to the _objectguid.



_get_last_modified ()

Determines the last modified timestamp.

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


intLast-Modified Timestamp



mixed $custom_view


Array $_comments

List of comments we are currently working with.

\midcom_helper_datamanager2_datamanager $_display_datamanager

This datamanager instance is used to display an existing comment.

only set if there are actually comments to display.


\net_nehmer_comments_comment $_new_comment

A new comment just created for posting.

string $_objectguid

The GUID of the object we're bound to.

\midcom_helper_datamanager2_controller_create $_post_controller

The controller used to post a new comment.

Only set if we have a valid user.

This is a Creation Mode DM2 controller.


Array $_schemadb

The schema database to use.