Completed
Push — master ( 00e474...9d3fbd )
by Michael
04:26
created

include/product_search_form.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * oledrion
14
 *
15
 * @copyright   {@link http://xoops.org/ XOOPS Project}
16
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
17
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
18
 */
19
20
/**
21
 * Recherche avancée dans les produits, formulaire de sélection des critères
22
 */
23
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
24
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
25
require_once OLEDRION_PATH . 'class/tree.php';
26
27
$sform = new XoopsThemeForm(Oledrion_utils::getModuleName() . ' - ' . _OLEDRION_SEARCHFOR, 'productsSearchForm', OLEDRION_URL . 'search.php', 'post');
28
$sform->addElement(new XoopsFormText(_OLEDRION_TEXT, 'product_text', 50, 255, ''), false);
29
$sform->addElement(new XoopsFormSelectMatchOption(_OLEDRION_TYPE, 'search_type', 3), false);
30
31
// Sélecteur de catégories ****************************************************
32
if (Oledrion_utils::getModuleOption('search_category')) {
33
    $categorySelect = new XoopsFormSelect(_OLEDRION_CATEGORY, 'product_category', 0);
34
    $treeObject     = new Oledrion_XoopsObjectTree($categories, 'cat_cid', 'cat_pid');
35
    $tree           = $treeObject->makeTreeAsArray('cat_title', '-', 0, _OLEDRION_ALL_CATEGORIES);
36
    $categorySelect->addOptionArray($tree);
37
    $sform->addElement($categorySelect, false);
38
}
39
40
// Sélecteur pour les fabricants *************************************************
41
if (Oledrion_utils::getModuleOption('search_manufacturers')) {
42
    $authorSelect = new XoopsFormSelect(_OLEDRION_MANUFACTURER, 'product_manufacturers', 0, 5, true);
43
    $tblTmp       = array();
44
    $tblTmp[0]    = _OLEDRION_ALL_MANUFACTURERS;
45
    foreach ($manufacturers as $item) {
46
        $tblTmp[$item->getVar('manu_id')] = $item->getVar('manu_commercialname') . ' ' . $item->getVar('manu_name');
47
    }
48
    $authorSelect->addOptionArray($tblTmp);
49
    $sform->addElement($authorSelect, false);
50
}
51
52
// Sélecteur pour les vendeurs *************************************************
53
if (Oledrion_utils::getModuleOption('search_vendors')) {
54
    $languageSelect = new XoopsFormSelect(_OLEDRION_VENDOR, 'product_vendors', 0, 1, false);
55
    $tblTmp         = array();
56
    $tblTmp[0]      = _OLEDRION_ALL_VENDORS;
57
    foreach ($vendors as $item) {
58
        $tblTmp[$item->getVar('vendor_id')] = $item->getVar('vendor_name');
59
    }
60
    $languageSelect->addOptionArray($tblTmp);
61
    $sform->addElement($languageSelect, false);
62
}
63
64
//
65
if (Oledrion_utils::getModuleOption('search_price')) {
66
    $sform->addElement(new XoopsFormText(_OLEDRION_FROM, 'product_from', 10, 10, ''), false);
67
    $sform->addElement(new XoopsFormText(_OLEDRION_TO, 'product_to', 10, 10, ''), false);
68
}
69
70
//
71 View Code Duplication
if (Oledrion_utils::getModuleOption('search_stocks')) {
72
    $stockselect = new XoopsFormSelect(_OLEDRION_QUANTITYS, 'product_stock', 1);
73
    $stockselect->addOption(1, _OLEDRION_QUANTITYALL);
74
    $stockselect->addOption(2, _OLEDRION_QUANTITY1);
75
    $stockselect->addOption(0, _OLEDRION_QUANTITY2);
76
    $sform->addElement($stockselect, false);
77
}
78
79
//
80 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property1') && Oledrion_utils::getModuleOption('product_property1')) {
81
    $property1select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property1_title'), 'product_property1', '');
82
    $property1Array  = explode('|', Oledrion_utils::getModuleOption('product_property1'));
83
    foreach ($property1Array as $property1) {
84
        $property1select->addOption($property1);
85
    }
86
    $sform->addElement($property1select, false);
87
}
88
89
//
90 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property2') && Oledrion_utils::getModuleOption('product_property2')) {
91
    $property2select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property2_title'), 'product_property2', '');
92
    $property2Array  = explode('|', Oledrion_utils::getModuleOption('product_property2'));
93
    foreach ($property2Array as $property2) {
94
        $property2select->addOption($property2);
95
    }
96
    $sform->addElement($property2select, false);
97
}
98
99
//
100 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property3') && Oledrion_utils::getModuleOption('product_property3')) {
101
    $property3select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property3_title'), 'product_property3', '');
102
    $property3Array  = explode('|', Oledrion_utils::getModuleOption('product_property3'));
103
    foreach ($property3Array as $property3) {
104
        $property3select->addOption($property3);
105
    }
106
    $sform->addElement($property3select, false);
107
}
108
109
//
110 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property4') && Oledrion_utils::getModuleOption('product_property4')) {
111
    $property4select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property4_title'), 'product_property4', '');
112
    $property4Array  = explode('|', Oledrion_utils::getModuleOption('product_property4'));
113
    foreach ($property4Array as $property4) {
114
        $property4select->addOption($property4);
115
    }
116
    $sform->addElement($property4select, false);
117
}
118
119
//
120 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property5') && Oledrion_utils::getModuleOption('product_property5')) {
121
    $property5select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property5_title'), 'product_property5', '');
122
    $property5Array  = explode('|', Oledrion_utils::getModuleOption('product_property5'));
123
    foreach ($property5Array as $property5) {
124
        $property5select->addOption($property5);
125
    }
126
    $sform->addElement($property5select, false);
127
}
128
129
//
130 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property6') && Oledrion_utils::getModuleOption('product_property6')) {
131
    $property6select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property6_title'), 'product_property6', '');
132
    $property6Array  = explode('|', Oledrion_utils::getModuleOption('product_property6'));
133
    foreach ($property6Array as $property6) {
134
        $property6select->addOption($property6);
135
    }
136
    $sform->addElement($property6select, false);
137
}
138
139
//
140 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property7') && Oledrion_utils::getModuleOption('product_property7')) {
141
    $property7select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property7_title'), 'product_property7', '');
142
    $property7Array  = explode('|', Oledrion_utils::getModuleOption('product_property7'));
143
    foreach ($property7Array as $property7) {
144
        $property7select->addOption($property7);
145
    }
146
    $sform->addElement($property7select, false);
147
}
148
149
//
150 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property8') && Oledrion_utils::getModuleOption('product_property8')) {
151
    $property8select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property8_title'), 'product_property8', '');
152
    $property8Array  = explode('|', Oledrion_utils::getModuleOption('product_property8'));
153
    foreach ($property8Array as $property8) {
154
        $property8select->addOption($property8);
155
    }
156
    $sform->addElement($property8select, false);
157
}
158
159
//
160 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property9') && Oledrion_utils::getModuleOption('product_property9')) {
161
    $property9select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property9_title'), 'product_property9', '');
162
    $property9Array  = explode('|', Oledrion_utils::getModuleOption('product_property9'));
163
    foreach ($property9Array as $property9) {
164
        $property9select->addOption($property9);
165
    }
166
    $sform->addElement($property9select, false);
167
}
168
169
//
170 View Code Duplication
if (Oledrion_utils::getModuleOption('search_property10') && Oledrion_utils::getModuleOption('product_property10')) {
171
    $property10select = new XoopsFormSelect(Oledrion_utils::getModuleOption('product_property10_title'), 'product_property10', '');
172
    $property10Array  = explode('|', Oledrion_utils::getModuleOption('product_property10'));
173
    foreach ($property10Array as $property10) {
174
        $property10select->addOption($property10);
175
    }
176
    $sform->addElement($property10select, false);
177
}
178
179
$sform->addElement(new XoopsFormHidden('op', 'go'));
180
181
$button_tray = new XoopsFormElementTray('', '');
182
$submit_btn  = new XoopsFormButton('', 'post', _SUBMIT, 'submit');
183
$button_tray->addElement($submit_btn);
184
$sform->addElement($button_tray);
185