Minahito
minah****@users*****
2006年 1月 19日 (木) 21:12:42 JST
Index: xoops2jp/html/modules/user/class/AbstractListAction.class.php diff -u /dev/null xoops2jp/html/modules/user/class/AbstractListAction.class.php:1.1.2.1 --- /dev/null Thu Jan 19 21:12:42 2006 +++ xoops2jp/html/modules/user/class/AbstractListAction.class.php Thu Jan 19 21:12:42 2006 @@ -0,0 +1,43 @@ +<?php + +require_once XOOPS_MODULE_PATH . "/user/class/PageNavigator.class.php"; + +class User_AbstractListAction extends User_Action +{ + var $mObjects = array(); + var $mFilter = null; + var $mNavi = null; + + function &_getHandler() + { + } + + function &_getFilterForm(&$navi) + { + } + + function _getBaseUrl() + { + } + + function getDefaultView(&$controller, &$xoopsUser) + { + $this->mNavi =& new User_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 USER_FRAME_VIEW_INDEX; + } +} + +?> Index: xoops2jp/html/modules/user/class/AbstractFilterForm.class.php diff -u /dev/null xoops2jp/html/modules/user/class/AbstractFilterForm.class.php:1.1.2.1 --- /dev/null Thu Jan 19 21:12:42 2006 +++ xoops2jp/html/modules/user/class/AbstractFilterForm.class.php Thu Jan 19 21:12:42 2006 @@ -0,0 +1,45 @@ +<?php + +class User_AbstractFilterForm +{ + var $mSort = 0; + var $mSortKeys = array(); + var $_mCriteria = null; + var $_mNavi = null; + + function User_AbstractFilterForm(&$navi) + { + $this->mNavi =& $navi; + $this->_mCriteria =& new CriteriaCompo(); + } + + function fetch() + { + } + + 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; + } +} + +?>