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

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

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

		$this->template->load(APP_VIEW_DIR."postListMonthly/MonthlyPostList.xsl");
	}

	function display(Request $request, Response $response)
	{
		$urlParts = explode("/", $this->resource->getURI());
		$year = $urlParts[1];
		$month = $urlParts[2];
		$fromDateTime = $year."-".$month."-01 00:00:00";
		$toDateTime = $year."-".$month."-".date('d', mktime(0, 0, 0, ($month + 1), 0, $year))." 23:59:59"; // Last day of the month!!!

		$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