Location: PHPKode > projects > DIY Blog > diy-blog/classes/diy-blog/backend/view/comments/CommentsView.class.php
<?php

/**
 * Comment listing view
 * @package diy-blog.backend.view.comments
 * @author	Martynas Jusevicius <hide@address.com>
 * @link	http://www.xml.lt
 */

class CommentsView extends BackEndView
{
	
	public function __construct(Resource $resource = null)
	{
		parent::__construct($resource);
		$this->criteria = new Criteria();

		$this->template->load(APP_VIEW_DIR."comments/Comments.xsl");
	}

	public function display(Request $request, Response $response)
	{
		$c1 = new Criteria();
		$c1->add(PagePeer::TYPE, PagePeer::CLASSKEY_POSTPAGE);
		$c1->addJoin(CommentPeer::PAGEID, PagePeer::ID);

		$posts = PagePeer::doSelectJoinAll($c1);

		$c = new Criteria();
		$c->addDescendingOrderByColumn(CommentPeer::DATETIME);
		//$c->addAscendingOrderByColumn(CommentPeer::TITLE);
		//$c->addAscendingOrderByColumn(CommentPeer::NAME);

		$comments = CommentPeer::doSelectJoinAll($c); //QUIRK!!!

		if ($request->getAttribute("comment-result") != null)
		{
			$this->proc->setParameter("", "comment-result", $request->getAttribute("comment-result"));

			$this->resolver->setArgument("comment-errors", XMLSerializer::serialize($request->getAttribute("comment-errors")));
			$this->resolver->setArgument("comment-form", XMLSerializer::serialize($request->getAttribute("comment-form")));
		}
		$this->resolver->setArgument("comments", XMLSerializer::serialize($comments));
		$this->resolver->setArgument("posts", XMLSerializer::serialize($posts));

		parent::display($request, $response);
		$response->setStatus(Response::SC_OK);
	}

}

?>
Return current item: DIY Blog