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 swt02026 (https://github.com/swt02026/) |
18
|
|
|
* @author XOOPS Development Team <http://xoops.org> |
19
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
20
|
|
|
* @license GPL 2.0 or later |
21
|
|
|
* @link https://xoops.org/ |
22
|
|
|
* @since 1.0.0 |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
use Xmf\Request; |
26
|
|
|
use Xmf\Language; |
27
|
|
|
use Xmf\Module\Admin; |
28
|
|
|
|
29
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'equipment_customer_list.tpl'; |
30
|
|
|
require_once __DIR__ . '/header.php'; |
31
|
|
|
$start = Request::getInt('start', 0); |
32
|
|
|
// Define Stylesheet |
33
|
|
|
$xoTheme->addStylesheet($stylesheet); |
34
|
|
|
// Get Handler |
35
|
|
|
/** @var XoopsObjectHandler $customerHandler */ |
36
|
|
|
$customerHandler = xoops_getModuleHandler('customer', $moduleDirName); |
37
|
|
|
$customerPaginationLimit = $GLOBALS['xoopsModuleConfig']['userpager']; |
38
|
|
|
|
39
|
|
|
$criteria = new CriteriaCompo(); |
40
|
|
|
|
41
|
|
|
$criteria->setOrder('DESC'); |
42
|
|
|
$criteria->setLimit($customerPaginationLimit); |
43
|
|
|
$criteria->setStart($start); |
44
|
|
|
|
45
|
|
|
$customerCount = $customerHandler->getCount($criteria); |
46
|
|
|
$customerArray = $customerHandler->getAll($criteria); |
47
|
|
|
if ($customerCount > 0) { |
48
|
|
|
foreach (array_keys($customerArray) as $i) { |
49
|
|
|
$customer['id'] = $customerArray[$i]->getVar('id'); |
50
|
|
|
$customer['first'] = $customerArray[$i]->getVar('first'); |
51
|
|
|
$customer['last'] = $customerArray[$i]->getVar('last'); |
52
|
|
|
$customer['address'] = $customerArray[$i]->getVar('address'); |
53
|
|
|
$customer['city'] = $customerArray[$i]->getVar('city'); |
54
|
|
|
$customer['country'] = $customerArray[$i]->getVar('country'); |
55
|
|
|
$customer['created'] = date(_SHORTDATESTRING, strtotime($customerArray[$i]->getVar('created'))); |
56
|
|
|
$GLOBALS['xoopsTpl']->append('customer', $customer); |
57
|
|
|
$keywords[] = $customerArray[$i]->getVar('last'); |
58
|
|
|
unset($customer); |
59
|
|
|
} |
60
|
|
|
// Display Navigation |
61
|
|
View Code Duplication |
if ($customerCount > $customerPaginationLimit) { |
|
|
|
|
62
|
|
|
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
63
|
|
|
$pagenav = new XoopsPageNav($customerCount, $customerPaginationLimit, $start, 'start'); |
64
|
|
|
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
//keywords |
68
|
|
View Code Duplication |
if (isset($keywords)) { |
|
|
|
|
69
|
|
|
EquipmentUtility::meta_keywords(xoops_getModuleOption('keywords', $moduleDirName) . ', ' . implode(', ', $keywords)); |
70
|
|
|
} |
71
|
|
|
//description |
72
|
|
|
EquipmentUtility::meta_description(MD_EQUIPMENT_CUSTOMER_DESC); |
73
|
|
|
// |
74
|
|
|
$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MD_EQUIPMENT_URL . '/customer.php'); |
75
|
|
|
$GLOBALS['xoopsTpl']->assign('equipment_url', MD_EQUIPMENT_URL); |
76
|
|
|
$GLOBALS['xoopsTpl']->assign('adv', xoops_getModuleOption('advertise', $moduleDirName)); |
77
|
|
|
// |
78
|
|
|
$GLOBALS['xoopsTpl']->assign('bookmarks', xoops_getModuleOption('bookmarks', $moduleDirName)); |
79
|
|
|
$GLOBALS['xoopsTpl']->assign('fbcomments', xoops_getModuleOption('fbcomments', $moduleDirName)); |
80
|
|
|
// |
81
|
|
|
$GLOBALS['xoopsTpl']->assign('admin', MD_EQUIPMENT_ADMIN); |
82
|
|
|
$GLOBALS['xoopsTpl']->assign('copyright', $copyright); |
83
|
|
|
// |
84
|
|
|
require_once XOOPS_ROOT_PATH . '/footer.php'; |
85
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.