/home/banprang/domains/plai.go.th/public_html/coremain/module/e_service1/e_service1_detail.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
<?php
$navig
['e_service1']="E-Services";
$navig['e_service1_report']="รายงาน";
$navig['e_service1_detail']="รายละเอียด";
navigator($navig);

import_request_variables('pG''p_');

$sel_title "select * from cms_service_title1 where title_id = '$p_type'";
$que_title mysql_query($sel_title);
$obj_title mysql_fetch_assoc($que_title);

echo
"<br>";
bar_header($obj_title['title_name']); // Bar_Header
fieldset_top($obj_title['title_name']);

$row_per_page 1//กำหนดจำนวนบรรทัดต่อหน้า 
if (empty($p_startrow)) { //ลองตรวจดูว่าค่าแถวเริ่มต้นที่จะแสดงไม่ได้กำหนดหรือเปล่า ถ้าไม่ได้กำหนด จะกำหนดให้เป็น 0 
  
$startrow 0
}else{
  
$startrow $p_startrow;
}

$count_esv "select count(id) from cms_eservice1 where type_id = '$p_type' order by id desc";
$result mysql_query($count_esv);
$row mysql_fetch_array($result); 

$total_row $row[0]; //ได้ค่าจำนวนบรรทัดทั้งหมดที่จะต้องแสดง 
$total_page intval((($total_row-1)/$row_per_page)+1); //หาค่าจำนวนหน้าทั้งหมดที่ต้องแสดง 
$current_page = (($startrow)/$row_per_page)+1//หาว่าหน้าที่แสดงอยู่ปัจจุบันเป็นหน้าที่เท่าไหร่ 

$eservice = array();
$sel_esv "select * from cms_eservice1 where type_id = '$p_type' order by id desc limit $startrow$row_per_page";
$que_esv mysql_query($sel_esv);
while(
$obj_esv mysql_fetch_assoc($que_esv)){
  
$eservice[$obj_esv['id']] = $obj_esv;
}

if (
$total_page>1) { //ตรวจดูว่าถ้าจำนวนหน้าทั้งหมดมีไม่เกิน 1 หน้า ต้องแสดงบรรทัดที่จะให้เลือกหน้า 
  
$previous_page $current_page-1//หาว่าหน้าก่อนหน้าปัจจุบันคือหน้าอะไร 
  
$next_page $current_page+1//หาว่าหน้าถัดจากหน้าปัจจุบันคืออะไร 
  
if ($previous_page >0) { //ถ้าหน้าก่อนหน้าติดลบหรือเป็นศูนย์แสดงว่าไม่สามารถแสดงหน้าก่อนหน้าได้ 
    
$new_startrow $startrow $row_per_page 
    
$left_page_show '<a href="index.php?mod=e_service1_detail&path=e_service1&type='.$p_type.'&startrow='.$new_startrow.'"><b>ก่อนหน้า</b></a>&nbsp;';
  } else { 
    
$left_page_show "<b>ก่อนหน้า</b>&nbsp;"
  } 
  if (
$next_page $total_page) { //ถ้าหน้าถัดไป มากกว่าจำนวนหน้าทั้งหมด แสดงว่าไม่สามารถแสดงหน้าถัดไปได้ 
    
$right_page_show "&nbsp;<b>ต่อไป</b>"
  } else { 
    
$new_startrow $startrow $row_per_page
    
$right_page_show '&nbsp;<a href="index.php?mod=e_service1_detail&path=e_service1&type='.$p_type.'&startrow='.$new_startrow.'"><b>ต่อไป</b></a>';
  } 

  
$middle_page_show ""
  for (
$i=1;$i<=$total_page;$i++) { //วนลูปแสดงหน้าทั้งหมด 
    
if ($i == $current_page) { //ถ้าหน้าที่พิมพ์เป็นหน้าเดียวกับหน้าปัจจุบัน แสดงให้ไม่สามารถคลิ๊กได้ 
      
$middle_page_show .= "&nbsp;<font color='ff0000'><b>[$i]</b></font>&nbsp;"
    } else { 
      
$new_startrow = (($i-1)*$row_per_page); 
      
$middle_page_show .= '&nbsp;<b><a href="index.php?mod=e_service1_detail&path=e_service1&type='.$p_type.'&startrow='.$new_startrow.'">'$i .'</a></b>&nbsp;';
    } 
  } 
  
$page_show $left_page_show $middle_page_show $right_page_show
} else { 
  
$page_show ""
}

#0:receive, 1:waiting, 2:complete, 3:information
//$status = array(0 => 'รับเรื่อง', 1 => 'อยู่ระหว่างดำเนินการ', 2 => 'แก้ไขเรียบร้อยแล้ว', 3 => 'รับทราบปัญหา');
?>
<font color='0000ff' class='Menu'><?= $page_show ?></font>
<br/><br/>

<?php if(count($eservice) == 0){ ?>
  <center><h4>- ยังไม่มีผลสำรวจ -</h4></center>
<?php }else{ ?>
  <?php foreach($eservice as $e_id => $data){ ?>
  <table width="97%" border="0" cellpadding="0" cellspacing="0" align="center">
    <tr>
      <td style="padding-bottom: 10px;" align="right">เมื่อวันที่ <?= $data['send_date'?></td><!--[IP : <?//= $header['ip_answer'] ?>]  ?>-->
    </tr>
    <tr>
      <td>
        <table width="100%" border="1" cellpadding="5 " cellspacing="0" style="border-collapse: collapse; border-color: #f0e8d0;">
          <tr>
            <td width="20%" bgcolor="#f0e8d0"><img src="coremain/images/bot1.gif" />&nbsp;<b>เรื่อง</b></td>
            <td width="80%"><?= $data['topic'?></td>
          </tr>
          <tr valign="top">
            <td bgcolor="#f0e8d0"><img src="coremain/images/bot1.gif" />&nbsp;<b>รายละเอียด</b></td>
            <td><?= nl2br($data['detail']) ?></td>
          </tr>
          <tr valign="top">
            <td bgcolor="#f0e8d0"><img src="coremain/images/bot1.gif" />&nbsp;<b>ไฟล์แนบ</b></td>
            <td>
              <?php
                
if(file_exists($_SESSION['web_name'].'/module_eservice1/'.$data['file_attach'])){
                  
$ftype get_file_type($data['file_attach']);
                  if(
in_array($ftype, array('.jpg''.jpeg''.png''.gif'))){
                    echo 
'<img src="'.$_SESSION['web_name'].'/module_eservice1/'.$data['file_attach'].'" style="max-width: 300px;" />';
                  }else{
                    echo 
'<a href="'.$_SESSION['web_name'].'/module_eservice1/'.$data['file_attach'].'"><img src="coremain/images/bu.gif" height="16" /> เอกสารประกอบ</a>';
                  }
                }
              
?>
            </td>
          </tr>
          <tr>
            <td bgcolor="#f0e8d0"><img src="coremain/images/bot1.gif" />&nbsp;<b>ชื่อผู้ติดต่อ</b></td>
            <td><?= $data['sender_name'?></td>
          </tr>
          <tr>
            <td bgcolor="#f0e8d0"><img src="coremain/images/bot1.gif" />&nbsp;<b>โทรศัพท์</b></td>
            <td><?= $data['sender_tel'?></td>
          </tr>
          <tr>
            <td bgcolor="#f0e8d0"><img src="coremain/images/bot1.gif" />&nbsp;<b>อีเมล์</b></td>
            <td><?= $data['sender_mail'?></td>
          </tr>
<!--          <tr>
            <td bgcolor="#f0e8d0"><img src="coremain/images/bot1.gif" />&nbsp;<b>สถานะ</b></td>
            <td><?//= $status[$data['service_status']] ?></td>
          </tr>-->
        </table>
      </td>
    </tr>
  </table>
  <hr/>
  <?php ?>
<?php 
?>