-
Notifications
You must be signed in to change notification settings - Fork 0
/
monthlyreport.php
217 lines (186 loc) · 6.46 KB
/
monthlyreport.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
include_once 'config.php';
include_once INC_PATH.'headleader.php';
require_once INC_PATH.'aunav.php';
$shownum = 6;
$p = isset($_GET["p"]) ? $p = $_GET["p"] : $p = 1;
$db = new JPDO();
$data = array();
$where_search = empty($_GET['search']) ? "1" : "`report`.`title` LIKE :search OR `report`.`stitle` LIKE :search OR `report_group`.`name` LIKE :search";
if( !empty($_GET['search']) ) $data[':search']=$_GET['search'];
$where_group_id = empty($_GET['group_id']) ? "1" : "`report`.`group_id`=:group_id";
if( !empty($_GET['group_id']) ) $data[':group_id']=$_GET['group_id'];
$sql = "SELECT `report`.* ,
`report_group`.`name` AS `group_name`
FROM `report`
INNER JOIN `report_group` ON `report`.`group_id`=`report_group`.`id`
WHERE `report`.`enable`='Y'
AND ({$where_search})
AND ({$where_group_id})
";
$rowPerPage = $shownum;
$pageNo = $p-1;
$arrOrderBy = isset($_GET['_orderBy']) ? $_GET['_orderBy'] : array('`report_group`.`ord` ASC', '`report`.`id` DESC');
$pager = $db->queryFetchPage( $sql, $pageNo, $shownum, $arrOrderBy, $data );
$start = ($p-1)*$shownum;
// 總頁數
$maxPage = $pager->pageNum;
/*
if ($p>$maxPage || $p<1 || !is_int($p*1) || !isset($_GET["p"])) {
$p = 1;
header("Location: monthlyreport.php?p={$p}");
}
*/
?>
<title>投資月報 | <?php echo $webTitle; ?></title>
<?php
// -------------------------------
// SEO
// CSS
// Script in the HEAD
// -------------------------------
include_once INC_PATH.'head.php';
?>
<?php
//app
include_once INC_PATH.'social.php';
?>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="service_page serviceCnt">
<?php
//app
include_once INC_PATH.'header.php';
?>
<div id="bannerTrigger"></div>
<section id="pageBanner" class="banner" style="background-image: url('<?php path_au('img'); ?>banner-service.jpg')">
</section>
<main class="">
<section class="row1">
<div class="wrapper small">
<header class="txtImg_title-title-monthlyreport cnt_title <?php isPhone('mobile_title-group'); ?>">
<h1 class="hidden <?php isPhone('mobile_title'); ?> title-1" data-lang="en">Monthly Report</h1>
<h2 class="hidden <?php isPhone('mobile_title'); ?> title-2" data-lang="tw">投資月報</h2>
</header>
</div>
</section>
<section class="fullbg row2 monthlyreport-wrap serviceCnt-wrap">
<div class="bg"></div>
<div class="wrapper">
<div class="monthlyreport-container serviceCnt-container">
<?php
$group = new JTReportGroup();
$rsGroup = $group->all();
?>
<div class="row1 cf">
<form method="get" action="monthlyreport.php" class="cf">
<input type="hidden" name="p" value="1" />
<div class="col-2">
<span class="txt-1">分類</span>
<select name="group_id" class="monthlyreport-select" onchange="location='monthlyreport.php?group_id='+$(this).val();">
<option value="">所有</option>
<?php
foreach( $rsGroup as $d ) {
?>
<option value="<?=$d->id?>" <?=(isset($_GET['group_id'])&&$_GET['group_id']==$d->id)?' selected':''?>><?=$d->name?></option>
<?php
}
?>
</select>
</div>
<div class="col-2">
<span class="txt-1">搜尋</span>
<div>
<input type="text" name="search" value="<?=isset($_GET['search']) ? $_GET['search'] : '' ?>" class="art_search-input frm__field left" placeholder="輸入關鍵字...">
<input type="submit" name="" id="" class="art_search-btn frm__btn left" value="search" onclick="">
</div>
</div>
</form>
</div>
<ul class="art_search-list monthlyreport-list">
<?php
function month_name( $month ) {
$monthName = date("F", mktime(0, 0, 0, $month, 10));
return strtoupper( $monthName );
}
foreach( $pager->rsData as $d) {
?>
<li class="art_search-item monthlyreport-item cf">
<div class="news-pic pic left">
<img src="<?=$d->icon?>" />
</div>
<div class="news-intro left">
<hgroup class="cnt_title">
<h1 class="txt-1_1"><?=$d->title?></h1>
<p class="txt-1_4"><?=$d->stitle?></p>
</hgroup>
<div class="monthlyreport-time">
<span class="txt-4 txt-ff1"><span class="txt-5"><?=$d->month?></span>月</span>
<span class="txt-1"><?=str_replace( '年', ' / ', $d->group_name )?> / <?=month_name($d->month)?></span>
</div>
<div class="news-link">
<a href="<?=$d->link?>" class="btn btn-goComputer txt-1 link-2" style="width:70px;" target="_blank">查看</a>
<!-- <a href="<?//=$d->link?>" class="txt-r1"><?//=$d->link?></a> -->
</div>
</div>
</li>
<?php
}
?>
</ul>
</div>
</div>
<div class="pages_btn">
<ul>
<?php
$add_url = '';
if( !empty($_GET['search']) ) $add_url.= '&search='.urlencode($_GET['search']);
if( !empty($_GET['group_id']) ) $add_url.= '&group_id='.urlencode($_GET['group_id']);
if ($p>1) {
$prevPage = $p-1;
echo "<li class=\"prev\"><a href=\"monthlyreport.php?p={$prevPage}{$add_url}\"><i class=\"icon ib\"></i><span class=\"txt ib\">上一頁</span></a></li><!-- 在第一頁時不顯示 -->";
}
// 頁碼
$end = $p+2 <= $maxPage ? $p+2 : $maxPage;
$start = $end-4 >= 1 ? $end-4 : 1;
if ($end - $start < 4) {
$end = $start+4 <= $maxPage ? $start+4 : $maxPage;
}
for ($i=$start; $i <= $end ; $i++) {
if ($i == $p) {
echo "<li class=\"number active\"><a href=\"javascript:void 0;\">{$i}</a></li>";
}else {
echo "<li class=\"number\"><a href=\"monthlyreport.php?p={$i}{$add_url}\">{$i}</a></li>";
}
}
if ($p<$maxPage) {
$nextPage = $p+1;
echo "<li class=\"next\"><a href=\"monthlyreport.php?p={$nextPage}{$add_url}\"><span class=\"txt ib\">下一頁</span><i class=\"icon ib\"></i></a></li>";
}
?>
</ul>
</div>
<div class="" style="display: table; margin: auto; width: 134px;"><a href="service.php" class="txt_img-goService hide_txt btn-goService btn link-2">回客服中心</a></div>
</section>
</main>
<?php
//app
include_once INC_PATH.'footer.php';
?>
<?php
// -------------------------------
// Script in the FOOT
// -------------------------------
include_once INC_PATH.'scriptfoot.php';
?>
<?php
// -------------------------------
// google analytics
// -------------------------------
include_once INC_PATH.'ga.php';
?>
</body>
</html>