1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @订房搜索 |
4
|
|
|
* @license http://www.blags.org/ |
5
|
|
|
* @created :2010年05月19日 22时38分 |
6
|
|
|
* @copyright 1997-2010 The Martin Group |
7
|
|
|
* @author Martin <[email protected]> |
8
|
|
|
* */ |
9
|
|
|
if (!defined('XOOPS_ROOT_PATH')) { |
10
|
|
|
exit(); |
11
|
|
|
} |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* hoel search show function |
15
|
|
|
* @param $options |
16
|
|
|
* @return |
17
|
|
|
*/ |
18
|
|
|
function martin_hotel_search_show($options) |
19
|
|
|
{ |
20
|
|
|
global $xoopsModuleConfig, $xoopsModule, $xoopsTpl; |
21
|
|
|
//新闻 |
22
|
|
|
/*if($xoopsModule->dirname() != 'martin') |
23
|
|
|
{*/ |
24
|
|
|
$module_handler =& xoops_gethandler('module'); |
25
|
|
|
$config_handler =& xoops_gethandler('config'); |
26
|
|
|
$xoopsModule =& $module_handler->getByDirname('martin'); |
27
|
|
|
$xoopsModuleConfig =& $config_handler->getConfigsByCat(0, $xoopsModule->getVar('mid')); |
28
|
|
|
/*}*/ |
29
|
|
|
//var_dump($xoopsModuleConfig); |
30
|
|
|
|
31
|
|
|
include_once XOOPS_ROOT_PATH . '/modules/martin/include/functions.php'; |
32
|
|
|
$hotel_handler =& xoops_getmodulehandler("hotel", 'martin'); |
33
|
|
|
$group_handler =& xoops_getmodulehandler("group", 'martin'); |
34
|
|
|
$auction_handler =& xoops_getmodulehandler("auction", 'martin'); |
35
|
|
|
$news_handler =& xoops_getmodulehandler("hotelnews", 'martin'); |
36
|
|
|
|
37
|
|
|
$hotel_guide = explode(",", $xoopsModuleConfig['hotel_guide']); |
38
|
|
|
$hotel_today_special = explode(",", $xoopsModuleConfig['hotel_today_special']); |
39
|
|
|
$hotel_news_ids = (is_array($hotel_guide) && is_array($hotel_today_special)) ? array_merge($hotel_guide, $hotel_today_special) : null; |
40
|
|
|
$hotelnews = $news_handler->GetHotelNews($hotel_news_ids); |
41
|
|
|
|
42
|
|
|
$hotel_guide_rows = array(); |
43
|
|
|
$hotel_today_special_rows = array(); |
44
|
|
View Code Duplication |
foreach ($hotelnews as $key => $row) { |
|
|
|
|
45
|
|
|
if (in_array($key, $hotel_guide) && count($hotel_guide_rows) < 6) { |
46
|
|
|
$hotel_guide_rows[] = $row; |
47
|
|
|
} |
48
|
|
|
if (in_array($key, $hotel_today_special) && count($hotel_today_special_rows) < 6) { |
49
|
|
|
$hotel_today_special_rows[] = $row; |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$block['module_url'] = XOOPS_URL . '/modules/martin/'; |
|
|
|
|
54
|
|
|
$block['hotelrank'] = getModuleArray('hotelrank', 'hotelrank', true, null, $xoopsModuleConfig); |
55
|
|
|
$block['groupList'] = $group_handler->GetGroupList(); |
56
|
|
|
$block['auctionList'] = $auction_handler->GetAuctionList(); |
57
|
|
|
$block['hotel_guide_rows'] = $hotel_guide_rows; |
58
|
|
|
$block['hotel_today_special_rows'] = $hotel_today_special_rows; |
59
|
|
|
$block['cityList'] = $hotel_handler->GetCityList('WHERE city_parentid = 0'); |
60
|
|
|
$block['hotel_static_prefix'] = $xoopsModuleConfig['hotel_static_prefix']; |
61
|
|
|
|
62
|
|
|
unset($hotel_handler, $group_handler, $auction_handler, $news_handler, $hotel_guide_rows, $hotel_today_special_rows); |
63
|
|
|
|
64
|
|
|
//var_dump($block); |
65
|
|
|
return $block; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* hoel search edit function |
70
|
|
|
* @param $options |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
function martin_hotel_search_edit($options) |
|
|
|
|
74
|
|
|
{ |
75
|
|
|
return ''; |
76
|
|
|
} |
77
|
|
|
|
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.