<?php
include 'admin/include/connect_wang.php';
include 'admin/include/function.php';
$active="public";
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <?php 
    include "meta.php";
    ?>
    <title>โรงพยาบาลหนองวัวซอ | Nongwuaso Hospital : ข่าวประชาสัมพันธ์</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" >
    <link rel="stylesheet" href="css/scrolltop.css" type="text/css" />
    <link rel="stylesheet" href="css/submenu.css" type="text/css" />
    <link rel="stylesheet" href="css/style.css" type="text/css" />
    <link rel="stylesheet" href="css/font-awesome.min.css" type="text/css" />
    <script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="js/jssor.slider.mini.js"></script>
    <script type="text/javascript" src="js/scrolltop.js"></script>
    <link rel="stylesheet" type="text/css" href="admin/css/datatables.css">
    <script type="text/javascript" charset="utf8" src="admin/js/datatables.js"></script>
    <script type="text/javascript">
      $(document).ready(function() {
            $('#example').DataTable({
                    "language": {
                    "lengthMenu": "แสดงจำนวน _MENU_ ต่อหน้า",
                    "zeroRecords": "ยังไม่มีข้อมูลในระบบ",
                    "info": "แสดงหน้า _PAGE_ ถึง _PAGES_",
                    "infoEmpty": "ยังไม่มีข้อมูลในระบบ",
                    "infoFiltered": "(filtered from _MAX_ total records)"
                    }
            });
        });
      function countdownload(id){
         $.post("countdownload.php",{id:id},function(data){
          //window.open('file_download/'+data,'_blank');
        });
      }
    </script>
    <!-- Go to www.addthis.com/dashboard to customize your tools -->
    <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5b1b6c2db2ba667c"></script>
  </head>
  <body id="top">
    <?php include 'navbar.php'; ?> 
    <div class="container">
      <div class='col-md-12' align='center' style="padding-top:40px;">
          <h1><i class="fa fa-paper-plane"></i>&nbsp;ข่าวประชาสัมพันธ์</h1>
          <p style='font-size:16px; font-weight:bold;'>แจ้งข่าวข่าวประชาสัมพันธ์ของโรงพยาบาล</p>
      </div>
      <div class="row">
        <div class='col-md-12'>
        <div class="table-responsive">
        <table id='example'  class='table table-bordered' style='font-size:13px;' width="100%">
          <thead>
            <tr bgcolor='#f5f5f5'>
            <td width='3%' class="clearfix hidden-xs"><strong>ลำดับ</strong></td>
              <th width="12%"><span class='glyphicon glyphicon-calendar'></span> วันที่</th>
              <th width="61%"><i class="fa fa-paper-plane"></i> ชื่อหัวข้อ</th>
              <th width="12%" align='center'><span class="glyphicon glyphicon-download"></span> ดาวน์โหลด </th> 
              <th width="12%" align='center' class="clearfix hidden-xs"><span class="glyphicon glyphicon-search"></span> ดูรายละเอียด </th>
            </tr>
          </thead> 
          <tbody>
        <?php
        $n=1;
        $result1=mysql_query("select * from public where ref_public_type='1'  order by public_id desc");
        while($data1=mysql_fetch_assoc($result1)){
          $id=$data1['public_id'];
          $ref_public_type=$data1['ref_public_type'];
          $result_type1=mysql_query("select * from public_type where public_type_id='$ref_public_type'");
          $data_type1=mysql_fetch_assoc($result_type1);
          echo "<tr>
                    <td align='center' class='clearfix hidden-xs'>$n</td>
                    <td><span class='glyphicon glyphicon-calendar'></span> ".show_date($data1['public_date'])."<br/> <span class='glyphicon glyphicon-time'></span> เวลา ".$data1['public_time']." น. </td>
                    <td><a href='public_detail.php?id=".$data1['public_id']."'><i class='fa fa-paper-plane'></i> ".$data1['public_name']."</a>
                    <br><span class='glyphicon glyphicon-eye-open'></span> ".$data1['public_view']." <span class='glyphicon glyphicon-save'></span> ".$data1['public_download']."</td>   
                    <td align='center'>"; if($data1['public_file']!=""){ echo "<a class='btn btn-link' href='file_download/".$data1['public_file']."' target='_blank' onclick='countdownload($id)'><span class='glyphicon glyphicon-download'></span> ดาวน์โหลด</a>"; }else{ echo "<button class='btn btn-link'><span class='glyphicon glyphicon-remove-circle'></span> ไม่มีไฟล์แนบ</button>"; } echo"</td>
                    <td align='center' class='clearfix hidden-xs'><a class='btn btn-link' href='public_detail.php?id=".$data1['public_id']."'><span class='glyphicon glyphicon-search'></span> ดูรายละเอียด </a></td>
                    </tr>";
        $n++;
        }
        ?>
          </tbody>
          </table>
        </div>
        </div>
      </div>
      </div><!-- /.container -->
      <?php
      include "footer.php";
      ?>
    <!--<script src="js/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')</script>-->
    <script src="js/bootstrap.min.js"></script>
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
    <script src="js/holder.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="js/ie10-viewport-bug-workaround.js"></script>
  </body>
</html>