1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: if (!defined('XOOPS_ROOT_PATH')) exit();
12:
13: require_once XOOPS_MODULE_PATH . "/legacy/class/AbstractFilterForm.class.php";
14:
15: define('IMAGECATEGORY_SORT_KEY_IMGCAT_ID', 1);
16: define('IMAGECATEGORY_SORT_KEY_IMGCAT_NAME', 2);
17: define('IMAGECATEGORY_SORT_KEY_IMGCAT_MAXSIZE', 3);
18: define('IMAGECATEGORY_SORT_KEY_IMGCAT_MAXWIDTH', 4);
19: define('IMAGECATEGORY_SORT_KEY_IMGCAT_MAXHEIGHT', 5);
20: define('IMAGECATEGORY_SORT_KEY_IMGCAT_DISPLAY', 6);
21: define('IMAGECATEGORY_SORT_KEY_IMGCAT_WEIGHT', 7);
22: define('IMAGECATEGORY_SORT_KEY_IMGCAT_TYPE', 8);
23: define('IMAGECATEGORY_SORT_KEY_IMGCAT_STORETYPE', 9);
24:
25: define('IMAGECATEGORY_SORT_KEY_DEFAULT', IMAGECATEGORY_SORT_KEY_IMGCAT_WEIGHT);
26: define('IMAGECATEGORY_SORT_KEY_MAXVALUE', 9);
27:
28: class Legacy_ImagecategoryFilterForm extends Legacy_AbstractFilterForm
29: {
30: var $mSortKeys = array(
31: IMAGECATEGORY_SORT_KEY_IMGCAT_ID => 'imgcat_id',
32: IMAGECATEGORY_SORT_KEY_IMGCAT_NAME => 'imgcat_name',
33: IMAGECATEGORY_SORT_KEY_IMGCAT_MAXSIZE => 'imgcat_maxsize',
34: IMAGECATEGORY_SORT_KEY_IMGCAT_MAXWIDTH => 'imgcat_maxwidth',
35: IMAGECATEGORY_SORT_KEY_IMGCAT_MAXHEIGHT => 'imgcat_maxheight',
36: IMAGECATEGORY_SORT_KEY_IMGCAT_DISPLAY => 'imgcat_display',
37: IMAGECATEGORY_SORT_KEY_IMGCAT_WEIGHT => 'imgcat_weight',
38: IMAGECATEGORY_SORT_KEY_IMGCAT_TYPE => 'imgcat_type',
39: IMAGECATEGORY_SORT_KEY_IMGCAT_STORETYPE => 'imgcat_storetype'
40: );
41:
42: var $mKeyword = "";
43: var $mOptionField = "";
44: var $mOptionField2 = "";
45:
46: function getDefaultSortKey()
47: {
48: return IMAGECATEGORY_SORT_KEY_DEFAULT;
49: }
50:
51: function fetch()
52: {
53: parent::fetch();
54:
55: $root =& XCube_Root::getSingleton();
56: $imgcat_name = $root->mContext->mRequest->getRequest('imgcat_name');
57: $imgcat_display = $root->mContext->mRequest->getRequest('imgcat_display');
58: $imgcat_type = $root->mContext->mRequest->getRequest('imgcat_type');
59: $imgcat_storetype = $root->mContext->mRequest->getRequest('imgcat_storetype');
60: $option_field = $root->mContext->mRequest->getRequest('option_field');
61: $option_field2 = $root->mContext->mRequest->getRequest('option_field2');
62: $search = $root->mContext->mRequest->getRequest('search');
63:
64:
65: if (isset($_REQUEST['imgcat_name'])) {
66: $this->mNavi->addExtra('imgcat_name', xoops_getrequest('imgcat_name'));
67: $this->_mCriteria->add(new Criteria('imgcat_name', xoops_getrequest('imgcat_name')));
68: }
69:
70: if (isset($_REQUEST['imgcat_display'])) {
71: $this->mNavi->addExtra('imgcat_display', xoops_getrequest('imgcat_display'));
72: $this->_mCriteria->add(new Criteria('imgcat_display', xoops_getrequest('imgcat_display')));
73: }
74:
75: if (isset($_REQUEST['imgcat_type'])) {
76: $this->mNavi->addExtra('imgcat_type', xoops_getrequest('imgcat_type'));
77: $this->_mCriteria->add(new Criteria('imgcat_type', xoops_getrequest('imgcat_type')));
78: }
79:
80: if (isset($_REQUEST['imgcat_storetype'])) {
81: $this->mNavi->addExtra('imgcat_storetype', xoops_getrequest('imgcat_storetype'));
82: $this->_mCriteria->add(new Criteria('imgcat_storetype', xoops_getrequest('imgcat_storetype')));
83: }
84:
85: if (isset($_REQUEST['option_field'])) {
86: $this->mNavi->addExtra('option_field', xoops_getrequest('option_field'));
87: $this->mOptionField = $option_field;
88: if ( $this->mOptionField == "visible" ) {
89: $this->_mCriteria->add(new Criteria('imgcat_display', xoops_getrequest('1')));
90: }
91: elseif ( $this->mOptionField == "invisible" ) {
92: $this->_mCriteria->add(new Criteria('imgcat_display', xoops_getrequest('0')));
93: }
94: else {
95:
96: }
97: }
98:
99: if (isset($_REQUEST['option_field2'])) {
100: $this->mNavi->addExtra('option_field2', xoops_getrequest('option_field2'));
101: $this->mOptionField2 = $option_field2;
102: if ( $this->mOptionField2 == "file" ) {
103: $this->_mCriteria->add(new Criteria('imgcat_storetype', xoops_getrequest('file')));
104: }
105: elseif ( $this->mOptionField2 == "db" ) {
106: $this->_mCriteria->add(new Criteria('imgcat_storetype', xoops_getrequest('db')));
107: }
108: else {
109:
110: }
111: }
112:
113:
114: if (!empty($search)) {
115: $this->mKeyword = $search;
116: $this->mNavi->addExtra('search', $this->mKeyword);
117: $this->_mCriteria->add(new Criteria('imgcat_name', '%' . $this->mKeyword . '%', 'LIKE'));
118: }
119:
120:
121:
122:
123: $this->_mCriteria->addSort($this->getSort(), $this->getOrder());
124: if (abs($this->mSort) != IMAGECATEGORY_SORT_KEY_IMGCAT_WEIGHT) {
125: $this->_mCriteria->addSort($this->mSortKeys[IMAGECATEGORY_SORT_KEY_IMGCAT_WEIGHT], $this->getOrder());
126: }
127: }
128: }
129:
130: ?>
131: