Minahito
minah****@users*****
2006年 1月 12日 (木) 20:26:05 JST
Index: xoops2jp/html/modules/user/forms/MailjobFilterForm.class.php diff -u /dev/null xoops2jp/html/modules/user/forms/MailjobFilterForm.class.php:1.1.2.1 --- /dev/null Thu Jan 12 20:26:05 2006 +++ xoops2jp/html/modules/user/forms/MailjobFilterForm.class.php Thu Jan 12 20:26:05 2006 @@ -0,0 +1,127 @@ +<?php + +define('USER_SORT_KEY_DEFAULT', 0); +define('USER_SORT_KEY_ID', 1); +define('USER_SORT_KEY_LASTLOGIN', 2); +define('USER_SORT_KEY_LASTLOGIN_FLAG', 3); +define('USER_SORT_KEY_MAILOK', 4); +define('USER_SORT_KEY_ACTIVEUSER', 5); +define('USER_SORT_KEY_REGISTDATE', 6); +define('USER_SORT_KEY_REGISTDATE_FLAG', 7); +define('USER_SORT_KEY_SENDER', 8); +define('USER_SORT_KEY_EMAIL', 9); +define('USER_SORT_KEY_SUBJECT', 10); +define('USER_SORT_KEY_BODY', 11); +define('USER_SORT_KEY_BY_PM', 12); +define('USER_SORT_KEY_BY_EMAIL', 13); +define('USER_SORT_KEY_MAXVALUE', 13); + +class User_MailjobFilterForm +{ + var $mSort = 0; + var $_mSortKeys = array( + USER_SORT_KEY_DEFAULT => 'id', + USER_SORT_KEY_ID => 'id', + USER_SORT_KEY_LASTLOGIN => 'lastlogin', + USER_SORT_KEY_LASTLOGIN_FLAG => 'lastlogin_flag', + USER_SORT_KEY_MAILOK => 'mailok', + USER_SORT_KEY_ACTIVEUSER => 'activeuser', + USER_SORT_KEY_REGISTDATE => 'registdate', + USER_SORT_KEY_REGISTDATE_FLAG => 'registdate_flag', + USER_SORT_KEY_SENDER => 'sender', + USER_SORT_KEY_EMAIL => 'email', + USER_SORT_KEY_SUBJECT => 'subject', + USER_SORT_KEY_BODY => 'body', + USER_SORT_KEY_BY_PM => 'by_pm', + USER_SORT_KEY_BY_EMAIL => 'by_email' + ); + var $_mCriteria = null; + + function User_MailjobFilterForm() + { + $this->_mCriteria =& new CriteriaCompo(); + } + + function fetch() + { + $this->mSort = isset($_REQUEST['sort']) ? intval($_REQUEST['sort']) : 0; + + if ($this->mSort > USER_SORT_KEY_MAXVALUE) { + $this->mSort = USER_SORT_KEY_DEFAULT; + } + + if (isset($_REQUEST['id'])) { + $this->_mCriteria->add(new Criteria('id', array(XOBJ_DTYPE_INT, xoops_getrequest('id')))); + } + + if (isset($_REQUEST['lastlogin'])) { + $this->_mCriteria->add(new Criteria('lastlogin', array(XOBJ_DTYPE_INT, xoops_getrequest('lastlogin')))); + } + + if (isset($_REQUEST['lastlogin_flag'])) { + $this->_mCriteria->add(new Criteria('lastlogin_flag', array(XOBJ_DTYPE_BOOL, xoops_getrequest('lastlogin_flag')))); + } + + if (isset($_REQUEST['mailok'])) { + $this->_mCriteria->add(new Criteria('mailok', array(XOBJ_DTYPE_BOOL, xoops_getrequest('mailok')))); + } + + if (isset($_REQUEST['activeuser'])) { + $this->_mCriteria->add(new Criteria('activeuser', array(XOBJ_DTYPE_BOOL, xoops_getrequest('activeuser')))); + } + + if (isset($_REQUEST['registdate'])) { + $this->_mCriteria->add(new Criteria('registdate', array(XOBJ_DTYPE_INT, xoops_getrequest('registdate')))); + } + + if (isset($_REQUEST['registdate_flag'])) { + $this->_mCriteria->add(new Criteria('registdate_flag', array(XOBJ_DTYPE_BOOL, xoops_getrequest('registdate_flag')))); + } + + if (isset($_REQUEST['sender'])) { + $this->_mCriteria->add(new Criteria('sender', array(XOBJ_DTYPE_STRING, xoops_getrequest('sender')))); + } + + if (isset($_REQUEST['email'])) { + $this->_mCriteria->add(new Criteria('email', array(XOBJ_DTYPE_STRING, xoops_getrequest('email')))); + } + + if (isset($_REQUEST['subject'])) { + $this->_mCriteria->add(new Criteria('subject', array(XOBJ_DTYPE_STRING, xoops_getrequest('subject')))); + } + + if (isset($_REQUEST['by_pm'])) { + $this->_mCriteria->add(new Criteria('by_pm', array(XOBJ_DTYPE_BOOL, xoops_getrequest('by_pm')))); + } + + if (isset($_REQUEST['by_email'])) { + $this->_mCriteria->add(new Criteria('by_email', array(XOBJ_DTYPE_BOOL, xoops_getrequest('by_email')))); + } + } + + 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; + } +} + +?>