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
|
<?php if($p_id_hide!="") { $id_hide=trim($p_id_hide); } if($p_id_show!="") { $id_show=trim($p_id_show); } if($p_id_delss!="") { $id_delss=trim($p_id_delss); }
$date=date("d"); $month=date("m"); $year=date("Y"); $yearthai=$year+543; $datenow=$yearthai.$month.$date;
fieldset_top("ข่าวประชาสัมพันธ์ (ภายใน)"); //###################### สำหรับ Admin ####################### // Hide - Show news if($id_hide!="") { update_query("cms_news","status","0","id",$id_hide); include('coremain/connec_out.php'); $sql="UPDATE cms_news SET status='0' WHERE id='$id_hide' and id_tumbon='$_SESSION[id_tumbon]'"; $result=mysql_query($sql); refresh_page(0,"index.php"); mysql_close($handle_out); include("$_SESSION[web_name]/connect.php"); } if($id_show!="") { update_query("cms_news","status","1","id",$id_show); include('coremain/connec_out.php'); $sql="UPDATE cms_news SET status='1' WHERE id='$id_show' and id_tumbon='$_SESSION[id_tumbon]'"; $result=mysql_query($sql); refresh_page(0,"index.php"); mysql_close($handle_out); include("$_SESSION[web_name]/connect.php"); }
// Delete News if($id_delss!="") { delete_query("pic1","pic2","pic3","pic4","files","cms_news","id",$id_delss); }
// ########################แสดงข่าวประชาสัมพันธ์ภายในหน่วยงาน ################### echo"<table width='98%' border='0' cellpadding='0' cellspacing='0' valign=top>";
$count_news=0; if($_SESSION[admin_web]=="admin" or (id_top_permission("news"))){ $sql="select id, topic ,LEFT(fulltexts, 255) as b,pic1,status,state from cms_news WHERE id_type='1' and id_sub='99999' order by orders desc Limit 3"; }else{ $sql="select id, topic ,LEFT(fulltexts, 255) as b,pic1,status,state from cms_news WHERE id_type='1' and status='1' and id_sub='99999' and date_line>='$datenow' order by orders desc Limit 3"; }
$result=mysql_query($sql); while($data = mysql_fetch_array($result)){ // ######################## แสดงหัวข้อข่าว และเนื้อหาข่าว echo"<tr>"; echo" <td width='20%' height='100' valign='top'>"; if($data['pic1']!="") { box_picture_firstpage($data['pic1'],"index.php?mod=news_full&id_news=$data[id]&path=news"); } else { box_nopicture_firstpage("index.php?mod=news_full&id_news=$data[id]&path=news"); } echo"</td>"; echo"<td width='3%' valign='top'></td>"; echo"<td width='75%' height='100' valign='top'>"; echo"<img SRC='coremain/images/marker.gif'> "; echo"<a href='index.php?mod=news_full&id_news=$data[id]&path=news'><b>$data[topic]</b></a> "; if($count_news<=1) echo"<img SRC='coremain/images/news.gif'>"; echo"<br> "; $num_msg = mb_strlen($data['b'], 'utf-8');//mb_substr($data[b],0,100,'UTF-8') $message = $num_msg > 100 ? mb_substr($data['b'], 0, 100, 'UTF-8').'...' : $data['b']; echo strip_tags($message); echo"</td>"; echo"</tr>";
// ################## สำหรับ Admin #################### if($_SESSION[admin_web]=="admin" or (id_top_permission("news"))){ echo"<tr>"; echo "<td colspan='3' align=right>"; // show - hide if($data[status]=='1') { box_hide("index.php?id_hide=$data[id]"); } else { box_show("index.php?id_show=$data[id]"); } // update box_update("index.php?mod=news_update&id_update=$data[id]&path=news"); // delete box_delete("index.php?id_delss=$data[id]","del_popup"); // จำนวนผู้เข้าชม number_format(box_counter($data[state]),'0'); echo"</td>"; echo "</tr>"; } echo '<tr><td colspan="3"><br/></td></tr>'; $count_news++; } echo"</table>";
// ####################### ข้อมูลย้อนหลัง
if($count_news>="3"){ echo"<table width='100%' border='0' align=center>"; echo"<tr> "; echo"<td align=center><img src='coremain/images/arrow.gif' border='0'>"; echo " <a href='index.php?mod=news_old&id_type=1&id_sub=$id_sub&path=news'>ข่าวย้อนหลัง</a></td>"; echo "</tr>"; echo "</table>"; }
fieldset_down(); ?>
|