1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
You may not change or alter any portion of this comment or credits |
5
|
|
|
of supporting developers from this source code or any supporting source code |
6
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
7
|
|
|
|
8
|
|
|
This program is distributed in the hope that it will be useful, |
9
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11
|
|
|
*/ |
12
|
|
|
/** |
13
|
|
|
* Module: Equipment |
14
|
|
|
* |
15
|
|
|
* @category Module |
16
|
|
|
* @package equipment |
17
|
|
|
* @author XOOPS Development Team <[email protected]> - <http://xoops.org> |
18
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
19
|
|
|
* @license GPL 2.0 or later |
20
|
|
|
* @link https://xoops.org/ |
21
|
|
|
* @since 1.0.0 |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
require_once dirname(__DIR__) . '/class/utility.php'; |
25
|
|
|
/** |
26
|
|
|
* @param $options |
27
|
|
|
* |
28
|
|
|
* @return array |
29
|
|
|
*/ |
30
|
|
|
function showEquipmentCustomer($options) |
31
|
|
|
{ |
32
|
|
|
require_once dirname(__DIR__) . '/class/customer.php'; |
33
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
34
|
|
|
//$myts = MyTextSanitizer::getInstance(); |
|
|
|
|
35
|
|
|
|
36
|
|
|
$block = array(); |
37
|
|
|
$blockType = $options[0]; |
38
|
|
|
$customerCount = $options[1]; |
39
|
|
|
//$titleLenght = $options[2]; |
|
|
|
|
40
|
|
|
|
41
|
|
|
/** @var XoopsObjectHandler $customerHandler */ |
42
|
|
|
$customerHandler = xoops_getModuleHandler('customer', $moduleDirName); |
43
|
|
|
$criteria = new CriteriaCompo(); |
44
|
|
|
array_shift($options); |
45
|
|
|
array_shift($options); |
46
|
|
|
array_shift($options); |
47
|
|
|
if ($blockType) { |
48
|
|
|
$criteria->add(new Criteria('id', 0, '!=')); |
49
|
|
|
$criteria->setSort('id'); |
50
|
|
|
$criteria->setOrder('ASC'); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$criteria->setLimit($customerCount); |
54
|
|
|
$customerArray = $customerHandler->getAll($criteria); |
55
|
|
|
foreach (array_keys($customerArray) as $i) { |
|
|
|
|
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
return $block; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param $options |
63
|
|
|
* |
64
|
|
|
* @return string |
65
|
|
|
*/ |
66
|
|
View Code Duplication |
function editEquipmentCustomer($options) |
|
|
|
|
67
|
|
|
{ |
68
|
|
|
require_once dirname(__DIR__) . '/class/customer.php'; |
69
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
70
|
|
|
|
71
|
|
|
$form = MB_EQUIPMENT_DISPLAY; |
72
|
|
|
$form .= "<input type='hidden' name='options[0]' value='" . $options[0] . "' />"; |
73
|
|
|
$form .= "<input name='options[1]' size='5' maxlength='255' value='" . $options[1] . "' type='text' /> <br>"; |
74
|
|
|
$form .= MB_EQUIPMENT_TITLELENGTH . " : <input name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' type='text' /><br><br>"; |
75
|
|
|
|
76
|
|
|
/** @var XoopsObjectHandler $'. customer . 'Handler */ |
77
|
|
|
$customerHandler = xoops_getModuleHandler('customer', $moduleDirName); |
78
|
|
|
$criteria = new CriteriaCompo(); |
79
|
|
|
array_shift($options); |
80
|
|
|
array_shift($options); |
81
|
|
|
array_shift($options); |
82
|
|
|
$criteria->add(new Criteria('id', 0, '!=')); |
83
|
|
|
$criteria->setSort('id'); |
84
|
|
|
$criteria->setOrder('ASC'); |
85
|
|
|
$customerArray = $customerHandler->getAll($criteria); |
86
|
|
|
$form .= MB_EQUIPMENT_CATTODISPLAY . "<br><select name='options[]' multiple='multiple' size='5'>"; |
87
|
|
|
$form .= "<option value='0' " . (in_array(0, $options) === false ? '' : "selected='selected'") . '>' . MB_EQUIPMENT_ALLCAT . '</option>'; |
88
|
|
|
foreach (array_keys($customerArray) as $i) { |
89
|
|
|
$id = $customerArray[$i]->getVar('id'); |
90
|
|
|
$form .= "<option value='" . $id . "' " . (in_array($id, $options) === false ? '' : "selected='selected'") . '>' . $customerArray[$i]->getVar('last') . '</option>'; |
91
|
|
|
} |
92
|
|
|
$form .= '</select>'; |
93
|
|
|
|
94
|
|
|
return $form; |
95
|
|
|
} |
96
|
|
|
|
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.