/home/banprang/domains/nongpluang.go.th/public_html/coremain/module/news_tender/news_tender.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
<?php
if ($p_status_news_tender != "") {
  
$status_news_tender trim($p_status_news_tender);
}
if (
$p_id_deles != "") {
  
$id_deles trim($p_id_deles);
}

$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_tender""status""0""id"$id_hide);
  include(
'coremain/connec_out.php');
  
$sql "UPDATE cms_news_tender 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_tender""status""1""id"$id_show);
  include(
'coremain/connec_out.php');
  
$sql "UPDATE cms_news_tender 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
if ($id_deles != "") {
  
delete_news_tender("file""cms_news_tender""id"$id_deles);
}


if (
$_SESSION['admin_web'] == "admin" or ( id_top_permission("news_tender"))) {
  if (
$status_news_tender == "1") {
    
$sq "UPDATE cms_status_module set status='1' WHERE id='3'";
    
$re mysql_query($sq);
  } else if (
$status_news_tender == "0") {
    
$sq "UPDATE cms_status_module set status='0' WHERE id='3'";
    
$re mysql_query($sq);
  }
}

$x select_query("status""cms_status_module""id""3");

// ######################## DELETE 5 Field ###############################
function delete_news_tender($f1$field$wfield$ids) {
  
$sql "select $f1 from $field where $wfield='$ids'";
  
$result mysql_query($sql);
  
$data mysql_fetch_row($result);
  if (
$data[0] != "") {
    
unlink("$_SESSION[web_name]/mainfile/$data[0]");
  }
  
$sql "delete from $field where $wfield='$ids'";
  
$result mysql_query($sql) or die(mysql_error());
  return 
true;
  
mysql_close($handle);
}

// ซ่อน แสดง เนื้อหาข่าวจัดซื้อจัดจ้าง (ภายในหน่วยงาน)
//if ($x[0] == 1) {
  
if ($_SESSION['admin_web'] == "admin" or ( id_top_permission("news_tender"))) {
    
$query "select id,LEFT(topic, 200) as topic,date_post,status from cms_news_tender order by id desc Limit 5";
  } else {
    
$query "select id,LEFT(topic, 200) as topic,date_post,status from cms_news_tender WHERE status='1' and date_line>='$datenow' order by id desc Limit 5";
  }

  echo
"<table width='100%' align='right' cellpadding='1' cellspacing='1' bgcolor='$_SESSION[tb_head_bgcolor]'>";
  
$result mysql_query($query);
  
$count 0;
  while (
$data mysql_fetch_array($result)) {
    if (
$count == 0)
      
$bg "eeeeee";
    else
      
$bg "ffffff";
    echo 
"<tr height='25' bgcolor='$bg'>";
    echo 
"<td>";
    echo 
"&nbsp;&nbsp;<img src='coremain/images/marker.gif'> ";
    echo 
"<a href='index.php?mod=news_tender_full&path=news_tender&id_tender=$data[id]'>$data[topic]</a>";
    echo 
"</td>";
// สำหรับ admin
    
if ($_SESSION['admin_web'] == "admin" or ( id_top_permission("news_tender"))) {
      echo
"<td width=85 valign = 'top' align = 'center'>";
      
// show - hide
      
if ($data[status] == '1') {
        echo 
"<a href='index.php?mod=first_page&id_hide=$data[id]&path=first_page'><img SRC='coremain/images/show.gif' border='0' title='ซ่อนข้อมูลนี้'></a>";
      } else {
        echo 
"<a href='index.php?mod=first_page&id_show=$data[id]&path=first_page'><img SRC='coremain/images/hide.gif' border='0' title='แสดงข้อมูลนี้'></a>";
      }
      
// update
      
box_update("index.php?mod=news_tender_update&id_update=$data[id]&path=news_tender");
      
// del
      
echo"&nbsp; &nbsp;<a href='index.php?mod=first_page&id_deles=$data[id]&path=first_page' onclick='return del_popup();'><img src='coremain/images/del1.gif' border='0' title='ลบข้อมูลนี้'></a>";
      echo 
"</td>";
    }

    echo
"</tr>";
    
$count++;
    if (
$count >= "5") {
      echo
"<tr bgcolor=$_SESSION[tb_head_bgcolor]> ";
      echo
"<td align=center colspan=2><img src='coremain/images/arrow.gif' border='0'>";
      echo 
" <a href='index.php?mod=news_tender_old&path=news_tender'>ข่าวย้อนหลัง</a></td>";
      echo 
"</tr>";
    }
  }
  
  if(
$count == 0){
    echo 
'<tr><td colspan="2" align="center"><br/><br/>- ไม่มีข่าวจัดซื้อจัดจ้าง -<br/><br/><br/></td></tr>';
  }
  echo 
"</table>";
//}
// ####################### ข้อมูลย้อนหลัง

fieldset_down();
?>