<?php
/**
* @version 1.0.0
* @category Anahita Social Engineâ¢
* @copyright Copyright (C) 2008 - 2010 rmdStudio Inc. and Peerglobe Technology Inc. All rights reserved.
* @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
* @link http://www.anahitapolis.com
*/
class AnUikitPageMixin extends KMixinAbstract
{
/**
* max limit
*
* @var integer
*/
protected $_max_limit;
/**
*
* @return
*/
public function __construct()
{
parent::__construct();
$this->_max_limit = 30;
}
/**
* Return the limit from the request. It ensures the limit does not exceed the set limit
* @return
* @param $param Object
*/
public function getLimit($param = 'limit')
{
$params = JComponentHelper::getParams('com_socialengine');
$params->get('list_length', 20);
$limit = KRequest::get("request.$param", 'int', $params->get('list_length', 20));
return min($limit, $this->getMaxLimit());
}
/**
* Set maximum allowed limit
* @return AnUikitPageMixin
* @param $limit String
*/
public function setMaxLimit($limit)
{
$this->_max_limit = $limit;
return $this;
}
/**
* Return max limit allowed
* @return Integer
*/
public function getMaxLimit()
{
return (int) $this->_max_limit;
}
/**
* Return the offset from request.
* @return
* @param $param String[optional]
*/
public function getOffset($param = 'start')
{
return KRequest::get("request.$param", 'int', 0);
}
}