Location: PHPKode > projects > DIY Blog > diy-blog/classes/diy-blog/frontend/controller/forms/PagingForm.class.php
<?php

/**
 * Abstracts post list/search results paging request parameters.
 * @package diy-blog.frontend.controller.forms
 * @author	Martynas Jusevicius <hide@address.com>
 * @link	http://www.xml.lt
 */

class PagingForm extends Form
{
	private $offset = null;
	private $limit = null;
	private $desc = null;
	
	public function __construct(Request $request)
	{
		$this->offset = $request->getParameter("offset");
		$this->limit = $request->getParameter("limit");
		$this->desc = $request->getParameter("desc");
	}
	
	public function getOffset()
	{
		return $this->offset;
	}

	public function getLimit()
	{
		return $this->limit;
	}

	public function getDesc()
	{
		return $this->desc;
	}

	public function validate()
	{
		$errors = array();

		if ((string)(int)$this->offset != $this->offset) $errors[] = new Error("invalidOffset");
		if ($this->offset < 0) $errors[] = new Error("invalidOffset");
		if ((string)(int)$this->limit != $this->limit) $errors[] = new Error("invalidLimit");
		if ($this->limit < 1) $errors[] = new Error("invalidLimit");

		return $errors;
	}
}

?>
Return current item: DIY Blog