<?php
/**
 * This file is generated by Sort Filter Unit Class Maker.
 * @version $Id: ModuleListFilterForm.class.php,v 1.1.2.6 2006/09/02 16:20:48 minahito Exp $
 */

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

require_once XOOPS_ROOT_PATH . "/modules/base/class/AbstractFilterForm.class.php";

define("MODULE_SORT_KEY_MID",         1);
define("MODULE_SORT_KEY_NAME",        2);
define("MODULE_SORT_KEY_VERSION",     3);
define("MODULE_SORT_KEY_LASTUPDATE",  4);
define("MODULE_SORT_KEY_WEIGHT",      5);
define("MODULE_SORT_KEY_ISACTIVE",    6);
define("MODULE_SORT_KEY_DIRNAME",     7);
define("MODULE_SORT_KEY_HASMAIN",     8);
define("MODULE_SORT_KEY_HASADMIN",    9);
define("MODULE_SORT_KEY_HASSEARCH",  10);
define("MODULE_SORT_KEY_HASCONFIG",  11);
define("MODULE_SORT_KEY_HASCOMMENTS",12);

define("MODULE_SORT_KEY_DEFAULT",     MODULE_SORT_KEY_WEIGHT);
define("MODULE_SORT_KEY_MAXVALUE",   12);

/**
 *
 */
class Legacy_ModuleListFilterForm extends Legacy_AbstractFilterForm
{
	var $mSpecial = null;

	var $mSortKeys = array(
		MODULE_SORT_KEY_MID         => "mid",
		MODULE_SORT_KEY_NAME        => "name",
		MODULE_SORT_KEY_VERSION     => "version",
		MODULE_SORT_KEY_LASTUPDATE  => "last_update",
		MODULE_SORT_KEY_WEIGHT      => "weight",
		MODULE_SORT_KEY_ISACTIVE    => "isactive",
		MODULE_SORT_KEY_DIRNAME     => "dirname",
		MODULE_SORT_KEY_HASMAIN     => "hasmain",
		MODULE_SORT_KEY_HASADMIN    => "hasadmin",
		MODULE_SORT_KEY_HASSEARCH   => "hassearch",
		MODULE_SORT_KEY_HASCONFIG   => "hasconfig",
		MODULE_SORT_KEY_HASCOMMENTS => "hascomments"
	);

	function fetch()
	{
		$this->mSort = isset($_REQUEST['sort']) ? intval(xoops_getrequest('sort')) : MODULE_SORT_KEY_DEFAULT;
	
		if (!isset($this->mSortKeys[abs($this->mSort)])) {
			$this->mSort = MODULE_SORT_KEY_DEFAULT;
		}

		if (isset($_REQUEST['special'])) {
			$this->mSpecial = intval(xoops_getreqeust('special'));
		}

		$this->_mCriteria->addSort($this->getSort(), $this->getOrder());
	}
}

?>