<?php

if (!defined('XOOPS_ROOT_PATH')) exit();

require_once XOOPS_MODULE_PATH . "/base/class/PageNavigator.class.php";

class Legacy_AbstractListAction extends Legacy_Action
{
	var $mObjects = array();
	var $mFilter = null;
	var $mNavi = null;

	function &_getHandler()
	{
	}

	function &_getFilterForm(&$navi)
	{
	}

	function _getBaseUrl()
	{
	}

	function getDefaultView(&$controller, &$xoopsUser)
	{
		$this->mNavi =& new Legacy_PageNavigator($this->_getBaseUrl(), 0, XCUBE_PAGENAVI_START | XCUBE_PAGENAVI_PERPAGE);
		
		$this->mFilter =& $this->_getFilterForm($this->mNavi);
		$this->mFilter->fetch();
		$handler =& $this->_getHandler();
		
		$total = $handler->getCount($this->mFilter->getCriteria());
		
		$this->mNavi->setTotal($total);
		$this->mNavi->fetch();
		
		$criteria = $this->mFilter->getCriteria($this->mNavi->getStart(), $this->mNavi->getPerpage());
		$this->mObjects =& $handler->getObjects($criteria);
		
		return LEGACY_FRAME_VIEW_INDEX;
	}
}

?>
