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

$_articles

$_articles : array

The articles to display

Type

array

$_start

$_start : \DateTime

The start date of the Archive listing.

Type

\DateTime

$_end

$_end : \DateTime

The end date of the Archive listing.

Type

\DateTime

Methods

get_url()

get_url(\midcom_db_article  $article,   $allow_external = false) 

Parameters

\midcom_db_article $article
$allow_external

article_qb_constraints()

article_qb_constraints(\midgard_query_builder  $qb) 

Sets the constraints for QB for articles

Parameters

\midgard_query_builder $qb

The QB object

apply_category_constraint()

apply_category_constraint(\midgard_query_builder  $qb, string  $category) 

Parameters

\midgard_query_builder $qb
string $category

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_welcome()

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

Shows the archive welcome page: A listing of years/months along with total post counts and similar stuff.

The handler computes all necessary data and populates the request array accordingly.

Parameters

mixed $handler_id

The ID of the handler.

array $args

The argument list.

array $data

_show_welcome()

_show_welcome(mixed  $handler_id, array  $data) 

Displays the welcome page.

Element sequence:

  • archive-welcome-start (Start of the archive welcome page)
  • archive-welcome-year (Display of a single year, may not be called when there are no postings)
  • archive-welcome-end (End of the archive welcome page)

Context data for all elements:

  • int total_count (total number of postings w/o ACL restrictions)
  • DateTime first_post (the first posting date, may be null)
  • Array year_data (the year data, contains the year context info as outlined below)

Context data for year elements:

  • int year (the year displayed)
  • string url (url to display the complete year)
  • int count (Number of postings in that year)
  • array month_data (the monthly data)

month_data will contain an associative array containing the following array of data indexed by month number (1-12):

  • string 'url' => The URL to the month.
  • string 'name' => The localized name of the month.
  • int 'count' => The number of postings in that month.

Parameters

mixed $handler_id

The ID of the handler.

array $data

_handler_list()

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

Shows the archive. Depending on the selected handler various constraints are added to the QB. See the add_*_constraint methods for details.

Parameters

mixed $handler_id

The ID of the handler.

array $args

The argument list.

array $data

_show_list()

_show_list(mixed  $handler_id, array  $data) 

Displays the archive.

Parameters

mixed $handler_id

The ID of the handler.

array $data

_prepare_request_data()

_prepare_request_data() 

Simple helper which references all important members to the request data listing for usage within the style listing.

_compute_welcome_first_post()

_compute_welcome_first_post() : \DateTime

Loads the first posting time from the DB. This is the base for all operations on the resultset.

This is done under sudo if possible, to avoid problems arising if the first posting is hidden. This keeps up performance, as an execute_unchecked() can be made in this case. If sudo cannot be acquired, the system falls back to execute().

Returns

\DateTime —

The time of the first posting or null on failure.

_compute_welcome_posting_count()

_compute_welcome_posting_count(\DateTime  $start, \DateTime  $end) : integer

Computes the number of postings in a given timeframe.

Parameters

\DateTime $start

Start of the timeframe (inclusive)

\DateTime $end

End of the timeframe (exclusive)

Returns

integer —

Posting count

_compute_welcome_data()

_compute_welcome_data() 

Computes the data nececssary for the welcome screen. Automatically put into the request data array.

_get_month_names()

_get_month_names() 

_set_startend_from_year()

_set_startend_from_year(integer  $year) 

Computes the start/end dates to only query a given year. It will do validation before processing, throwing 404 in case of incorrectly formatted dates.

This is used by the archive-year handler, which expects the year to be in $args[0].

Parameters

integer $year

The year to query.

_set_startend_from_month()

_set_startend_from_month(integer  $year, integer  $month) 

Computes the start/end dates to only query a given month. It will do validation before processing, throwing 404 in case of incorrectly formatted dates.

This is used by the archive-month handler, which expects the year to be in $args[0] and the month to be in $args[1].

Parameters

integer $year

The year to query.

integer $month

The month to query.