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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
<?php
import_request_variables('pG', 'p_'); if ($p_id_home != "") { $id_home = trim($p_id_home); } if ($p_id_hide_home != "") { $id_hide_home = trim($p_id_hide_home); } if ($p_id_show_home != "") { $id_show_home = trim($p_id_show_home); } if ($p_id_orderxx != "") { $id_orderxx = trim($p_id_orderxx); }
// ########################################## if ($id_ != "" and $id_orderxx != "") { $sql = "SELECT * FROM `cms_home` WHERE id_home='$id_'"; $re = mysql_query($sql); $data = mysql_fetch_array($re); if ($id_orderxx == 1) { $up = $data['position'] - 1; } if ($id_orderxx == 2) { $up = $data['position'] + 1; } $sql = "UPDATE `cms_home` SET position='$up' WHERE id_home ='$data[id_home]'"; $re = mysql_query($sql); // $sql = "UPDATE `cms_home` SET position='$data[position]' WHERE id_home !='$data[id_home]' and position='$up'"; $re = mysql_query($sql);
echo "<meta http-equiv='refresh' content='0; url=index.php'>"; }
// DELETE if ($id_home != "") { $sql = "DELETE FROM cms_home WHERE id_home='$id_home'"; $re = mysql_query($sql); } // SHOW-HIDE if ($id_hide_home != "") { $sql = "UPDATE cms_home SET status='0' WHERE id_home='$id_hide_home'"; mysql_query($sql);
echo "<meta http-equiv='refresh' content='0; url=index.php'>"; } if ($id_show_home != "") { $sql = "UPDATE cms_home SET status='1' WHERE id_home='$id_show_home'"; mysql_query($sql);
echo "<meta http-equiv='refresh' content='0; url=index.php'>"; }
$sql_num = "SELECT count(*) FROM cms_home WHERE status='1 ' order by id_home asc"; $re_num = mysql_query($sql_num); $data_num = mysql_fetch_array($re_num);
if ($_SESSION['admin_web'] == "admin") $sql = "SELECT * FROM cms_home order by position asc"; else $sql = "SELECT * FROM cms_home WHERE status='1 ' order by position asc"; $re = mysql_query($sql); $count = 0; while ($data = mysql_fetch_array($re)) { $count++; echo '<fieldset class="canvas-corner" style="margin-bottom: 10px;">'; bar_header("$data[bar]"); fieldset_top($data[bar]);
echo"<table width='100%' border='0' cellpadding='0' cellspacing='0'>"; if ($_SESSION['admin_web'] == "admin") { echo "<tr><td align=right>"; // Up if ($count > 1) { echo"<a href='index.php?id_=$data[id_home]&id_orderxx=1'><img src='coremain/images/up.gif' border='0' title='$web_home[6]'></a> "; }
// Down if ($count < $data_num[0]) { echo"<a href='index.php?id_=$data[id_home]&id_orderxx=2'><img src='coremain/images/down.gif' border='0' title='$web_home[7]'></a> "; }
// show - hide if ($data['status'] == '1') { box_hide("index.php?id_hide_home=$data[id_home]"); } else { box_show("index.php?id_show_home=$data[id_home]"); }
echo" <a href='index.php?mod=home_update&path=home&id_update=$data[id_home]'><img src='coremain/images/edit.gif' border='0' title='edit'></a> "; echo"<a href='index.php?id_home=$data[id_home]'><img src='coremain/images/del1.gif' border='0' title='del' onclick='return goURLdel()'></a>"; echo"</td></tr>"; } if($data['status'] == '1'){ echo "<tr><td>"; if(strpos($data['fulltexts'], 'dla.go.th') > -1){ $URL = 'http://www.dla.go.th/servlet/RssServlet'; $xml = @simplexml_load_file($URL); // or die("Error: Cannot create object"); $ArrayDocument = array(); if($xml){ foreach ($xml->children() as $child) { $role = $child->attributes(); $row = array(); foreach ($child as $key => $value) { if(strpos($key, 'UPLOAD_FILE') > -1 && $key != 'UPLOAD_FILE1'){ $no = substr($key, -1); $row['UPLOAD'][$no]['FILE'] = (string) $value; }else if(strpos($key, 'UPLOAD_DESC') > -1 && $key != 'UPLOAD_DESC1'){ $no = substr($key, -1); $row['UPLOAD'][$no]['DESC'] = (string) $value; }else{ $row[(string) $key] = (string) $value; } } $_date = explode('/', $child->RECORD_DATE); $date = ($_date[2] - 543).'-'.$_date[1].'-'.$_date[0]; $ArrayDocument[$date][(int) $role->id] = $row; } krsort($ArrayDocument);
$today = Date('Y-m-d'); if(isset($ArrayDocument[$today])){ krsort($ArrayDocument[$today]); $CenterDocDLA['today'] = $ArrayDocument[$today]; unset($ArrayDocument[$today]); } $CenterDocDLA['all'] = $ArrayDocument;
$txtContent = '<div style="height: 300px; overflow: auto;"><table class="table" width="100%">'; if(isset($CenterDocDLA['today'])){ $txtContent .= '<thead style="background: #F5F5F5;"> <tr> <th><h4>หนังสือราชการ สถ. ประจำวันที่ '. Date('d').'/'.Date('m').'/'.(Date('Y')+543) .'</h4></th> </tr> </thead>'; foreach($CenterDocDLA['today'] as $id => $detail){ $txtContent .= '<tr> <td style="border-bottom: 1px solid #DDD;"> <a href="'. $detail['UPLOAD_FILE1'] .'" target="_blank" style="text-decoration: none;"><i class="fa fa-arrow-circle-right"></i> <b>'. $detail['DOCUMENT_NO'] .' |</b> '. $detail['DOCUMENT_TOPIC'] .'</a><br/> <div class="col-md-12">'; foreach($detail['UPLOAD'] as $no => $attach){ if($no > 1 && $attach['FILE'] != '' && $attach['DESC'] != 'เอกสารไฟล์ word') { $txtContent .= ' <img src="'.$_SESSION['web_name'].'/theme/'.$_SESSION['themes_'].'/'.$_SESSION['image_menu'].'" border=0> <a href="'. $attach['FILE'] .'" target="_blank" style="text-decoration: none;">'. $attach['DESC'] .'</a> '; } } $txtContent .= '</div> <div style="text-align: right;"> <small class="col-md-5 text-right"> <i class="fa fa-user"></i> <b>หน่วยงาน :</b> '. $detail['ORG'] .' </small> <small class="col-md-7 text-right"> <i class="fa fa-calendar"></i> <b>หนังสือลงวันที่ :</b> '. $detail['DOCUMENT_DATE'] .' </small> </div> </td> </tr>'; } }
if(isset($CenterDocDLA['all'])){ $txtContent .= '<thead style="background: #F5F5F5;"> <tr class="bg-gray-light"> <th><h4>หนังสือราชการ สถ.</h4></th> </tr> </thead>'; foreach ($CenterDocDLA['all'] as $RecordDate => $arrDoc) { if(is_array($arrDoc)){ krsort($arrDoc); foreach($arrDoc as $id => $detail){ $txtContent .= '<tr> <td style="border-bottom: 1px solid #DDD;"> <a href="'. $detail['UPLOAD_FILE1'] .'" target="_blank" style="text-decoration: none;"><i class="fa fa-arrow-circle-right"></i> <b>'. $detail['DOCUMENT_NO'] .' |</b> '. $detail['DOCUMENT_TOPIC'] .'</a><br/> <div class="col-md-12">'; foreach($detail['UPLOAD'] as $no => $attach){ if($no > 1 && $attach['FILE'] != '' && $attach['DESC'] != 'เอกสารไฟล์ word') { $txtContent .= ' <img src="'.$_SESSION['web_name'].'/theme/'.$_SESSION['themes_'].'/'.$_SESSION['image_menu'].'" border=0> <a href="'. $attach['FILE'] .'" target="_blank" style="text-decoration: none;">'. $attach['DESC'] .'</a> '; } } $txtContent .= '</div> <div style="text-align: right;"> <small class="col-md-5 text-right"> <i class="fa fa-user"></i> <b>หน่วยงาน :</b> '. $detail['ORG'] .' </small> <small class="col-md-7 text-right"> <i class="fa fa-calendar"></i> <b>หนังสือลงวันที่ :</b> '. $detail['DOCUMENT_DATE'] .' </small> </div> </td> </tr>'; } } } } $txtContent .= '</table></div>';
echo $txtContent; }else{ echo '<center style="color: green;"><i>- อยู่ระหว่างรอข้อมูลจากเว็บหลัก -</i><br/><br/></center>'; } }else if(strpos($data['fulltexts'], 'gprocurement.go.th') > -1){ if ($_SESSION['admin_web'] == "admin") { getGProcurement($data['fulltexts'], $data['id_home']); } $sel_egp = "select *, DATE_FORMAT(egp_rss_pub_date, '%d/%m/%Y') as egp_rss_pub_date from cms_egprss where id_home = '$data[id_home]'"; $que_egp = mysql_query($sel_egp); $num_egp = mysql_num_rows($que_egp); if($num_egp > 0){ echo '<div style="max-height: 300px; overflow: auto;">' . '<table width="100%" border="0" cellpadding="3" cellspacing="0" style="border-collapse: collapse;">' . '<tr bgcolor="#f0e8d0">' . '<th width="80%">เรื่อง</th>' . '<th width="20%">วันที่ประกาศ</th>' . '</tr>'; $n = 0; while($obj_egp = mysql_fetch_assoc($que_egp)){ $bg_row = $n%2 == 1 ? '#efefef' : ''; echo '<tr valign="top" bgcolor="'.$bg_row.'">' . '<td><img src="coremain/images/bot1.gif" /> <a href="'.$obj_egp['egp_rss_link'].'" target="_blank">'.$obj_egp['egp_rss_title'].'</a></td>' . '<td align="center">'.$obj_egp['egp_rss_pub_date'].'</td>' . '</tr>'; ++$n; } echo '</table>' . '</div>'; }else{ echo '<center style="color: green;"><i>- อยู่ระหว่างรอข้อมูลจากเว็บหลัก -</i><br/><br/></center>'; } }else{ echo $data['fulltexts']; } echo"</td></tr>"; }
echo"</table>";
fieldset_down(); echo '</fieldset>'; } ?>
|