Minahito
minah****@users*****
2006年 7月 10日 (月) 20:12:12 JST
Index: xoops2jp/html/modules/legacyRender/admin/forms/TplsetFilterForm.class.php diff -u xoops2jp/html/modules/legacyRender/admin/forms/TplsetFilterForm.class.php:1.1.2.5 xoops2jp/html/modules/legacyRender/admin/forms/TplsetFilterForm.class.php:1.1.2.6 --- xoops2jp/html/modules/legacyRender/admin/forms/TplsetFilterForm.class.php:1.1.2.5 Tue Mar 28 22:30:48 2006 +++ xoops2jp/html/modules/legacyRender/admin/forms/TplsetFilterForm.class.php Mon Jul 10 20:12:11 2006 @@ -2,66 +2,37 @@ if (!defined('XOOPS_ROOT_PATH')) exit(); -define('TPLSET_SORT_KEY_DEFAULT', 0); +require_once XOOPS_MODULE_PATH . "/legacyRender/class/AbstractFilterForm.class.php"; + define('TPLSET_SORT_KEY_TPLSET_ID', 1); -define('TPLSET_SORT_KEY_NAME', 2); -define('TPLSET_SORT_KEY_DESC', 3); -define('TPLSET_SORT_KEY_LOCK', 4); -define('TPLSET_SORT_KEY_MAXVALUE', 4); +define('TPLSET_SORT_KEY_TPLSET_NAME', 2); +define('TPLSET_SORT_KEY_TPLSET_DESC', 3); +define('TPLSET_SORT_KEY_TPLSET_CREDITS', 4); +define('TPLSET_SORT_KEY_TPLSET_CREATED', 5); + +define('TPLSET_SORT_KEY_DEFAULT', TPLSET_SORT_KEY_TPLSET_ID); +define('TPLSET_SORT_KEY_MAXVALUE', 5); -class LegacyRender_TplsetFilterForm +class LegacyRender_TplsetFilterForm extends LegacyRender_AbstractFilterForm { - var $mSort = 0; - var $_mSortKeys = array( + var $mSortKeys = array( TPLSET_SORT_KEY_DEFAULT => 'tplset_id', TPLSET_SORT_KEY_TPLSET_ID => 'tplset_id', - TPLSET_SORT_KEY_NAME => 'name', - TPLSET_SORT_KEY_DESC => 'desc', - TPLSET_SORT_KEY_LOCK => 'lock' + TPLSET_SORT_KEY_TPLSET_NAME => 'tplset_name', + TPLSET_SORT_KEY_TPLSET_DESC => 'tplset_desc', + TPLSET_SORT_KEY_TPLSET_CREDITS => 'tplset_credits', + TPLSET_SORT_KEY_TPLSET_CREATED => 'tplset_created' ); - var $_mCriteria = null; - - var $_mNavi = null; - - function LegacyRender_TplsetFilterForm(&$navi) - { - $this->_mNavi =& $navi; - $this->_mCriteria =& new CriteriaCompo(); - } function fetch() { $this->mSort = isset($_REQUEST['sort']) ? intval($_REQUEST['sort']) : 0; - if (abs($this->mSort) > TPLSET_SORT_KEY_MAXVALUE) { + if (!isset($this->mSort[abs($this->mSort)])) { $this->mSort = TPLSET_SORT_KEY_DEFAULT; } - - $this->_mNavi->addExtra('sort', $this->mSort); - } - - function getSort() - { - $sortkey = abs($this->mSort); - return $this->_mSortKeys[$sortkey]; - } - - function getOrder() - { - return ($this->mSort < 0) ? "DESC" : "ASC"; - } - - function getCriteria($start = 0, $limit = 0) - { - $criteria = $this->_mCriteria; - - $criteria->setStart($start); - $criteria->setLimit($limit); - - $criteria->setSort($this->getSort()); - $criteria->setOrder($this->getOrder()); - return $criteria; + $this->_mCriteria->addSort($this->getSort(), $this->getOrder()); } }