Location: PHPKode > projects > DIY Blog > diy-blog/classes/diy-blog/frontend/view/postListYearly/YearlyPostListView.class.php
<?php

/**
 * Yearly blog post listing view.
 * @package diy-blog.frontend.view.postListYearly
 * @author	Martynas Jusevicius <hide@address.com>
 * @link	http://www.xml.lt
 */

class YearlyPostListView extends PostListView
{
	public function __construct(Resource $resource = null)
	{
		parent::__construct($resource);

		$this->template->load(APP_VIEW_DIR."postListYearly/YearlyPostList.xsl");
	}

	function display(Request $request, Response $response)
	{
		$urlParts = explode("/", $this->resource->getURI());
		$year = $urlParts[1];
		$fromDateTime = $year."-01-01 00:00:00";
		$toDateTime = $year."-12-31 23:59:59"; // Last day of the year!!!

		$criterion = $this->criteria->getNewCriterion(PagePeer::DATETIME, $fromDateTime, Criteria::GREATER_EQUAL);
		$criterion->addAnd($this->criteria->getNewCriterion(PagePeer::DATETIME, $toDateTime, Criteria::LESS_EQUAL));
		$this->criteria->add($criterion);

		parent::display($request, $response);

		$response->setStatus(Response::SC_OK);
	}

}

?>
Return current item: DIY Blog