Blog Archive pages handler

Shows the various archive views.

package net.nehmer.blog

 Methods

_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

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_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

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_on_initialize ()

Maps the content topic from the request data to local member variables.

_show_list (mixed $handler_id, array $data)

Displays the archive.

Parameters

$handler_id

mixedThe ID of the handler.

$data

array&$data The local request data.

_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

$handler_id

mixedThe ID of the handler.

$data

array&$data The local request data.

_compute_welcome_data ()

Computes the data nececssary for the welcome screen.

Automatically put into the request data array.

_compute_welcome_first_post ()

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 excute().

Returns

\DateTimeThe time of the first posting or null on failure.

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

Computes the number of postings in a given timeframe.

Parameters

$start

\DateTimeStart of the timeframe (inclusive)

$end

\DateTimeEnd of the timeframe (exclusive)

Returns

intPosting count

_get_month_names ()

_prepare_request_data ()

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

_set_startend_from_month (int $year, int $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

$year

intThe year to query.

$month

intThe month to query.

_set_startend_from_year (int $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

$year

intThe year to query.

 Properties

 

array $_articles

The articles to display
 

\midcom_db_topic $_content_topic

The content topic to use
 

\midcom_helper_datamanager2_datamanager $_datamanager

The datamanager for the currently displayed article.
 

\DateTime $_end

The end date of the Archive listing.
 

\DateTime $_start

The start date of the Archive listing.