Mini Shell

Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/sp/admin/
Upload File :
Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/sp/admin/show_trainuser.php

<?php
       include 'head.php';
?>
<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
 <script language="javascript">
  window.onload = function () {    
        var a=document.getElementById('mytable'); // อ้างอิงตารางด้วยตัวแปร a
        for(i=0;i<a.rows.length;i++){ // วน Loop นับจำนวนแถวในตาราง
            if(i>0){  // ตรวจสอบถ้าไม่ใช่แถวหัวข้อ
                if(i%2==1){   // ตรวจสอบถ้าไม่ใช่แถวรายละเอียด
                    a.rows[i].className="";     // กำหนด class แถวแรก
                }else{
                    a.rows[i].className="info";  // กำหนด class แถวที่สอง
                }   
            }else{ // ถ้าเป็นแถวหัวข้อกำหนด class 
                a.rows[i].className="active";  
            }   
        }
 }
 </script>
<!--
BODY TAG OPTIONS:
=================
Apply one or more of the following classes to get the
desired effect
|---------------------------------------------------------|
| SKINS         | skin-blue                               |
|               | skin-black                              |
|               | skin-purple                             |
|               | skin-yellow                             |
|               | skin-red                                |
|               | skin-green                              |
|---------------------------------------------------------|
|LAYOUT OPTIONS | fixed                                   |
|               | layout-boxed                            |
|               | layout-top-nav                          |
|               | sidebar-collapse                        |
|               | sidebar-mini                            |
|---------------------------------------------------------|
-->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<!-- Main Header -->
<?php include 'header.php'; ?>
    <!-- Left side column. contains the logo and sidebar -->
<?php include 'leftside.php'; ?> 
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        ประวัติการอบรม/สัมมนา
        <small>จัดการข้อมูลประวัติการอบรม/สัมมนา</small>
      </h1>
      <ol class="breadcrumb">
          <li><a href="index.php"><i class="fa fa-home"></i> หน้าหลัก</a></li>
        <li class="active">ประวัติการอบรม/สัมมนา</li>
      </ol>
        
    </section>
    
     <?php
            $teacherID = $session_teacherID;
            $sql1 = "SELECT * FROM teacher AS t1 INNER JOIN title_name AS t2 ON (t1.titleID = t2.titleID)      
             LEFT JOIN  train AS t3   ON (t1.teacherID = t3.teachertrID ) WHERE (`teacherID`='$teacherID') ";                                 
             $result = mysqli_query($link, $sql1);
              $row = mysqli_fetch_assoc($result)
          ?>
    
    <!-- Main content -->
        <section class="content">
            
          <br>

          <!-- Your Page Content Here -->
         
          <div class="box box-primary">
         <div class="box-header with-border">
             <h3 class="box-title">ประวัติการอบรม/สัมมนา &nbsp;<span class="label label-success"><?php echo $row['titleName']; ?><?php echo $row['name']; ?> &nbsp; &nbsp;<?php echo $row['lastName']; ?></span></h3>
         <div class="box-tools pull-right">
      <!-- Buttons, labels, and many other things can be placed here! -->
      <!-- Here is a label for example -->
      </div><!-- /.box-tools -->
  </div><!-- /.box-header -->
  <div class="box-body">
     
      <div class="box box-solid box-primary">
        <div class="box-header">
          <h3 class="box-title"><i class="fa fa-handshake-o"></i>&nbsp;รหัสบุคลากร <?php echo $teacherID; ?></h3>
        </div>
          <div class="table-responsive">
              <table id="mytable" class="table table-hover table-bordered">
    <thead style="background-color: #F5F5F5;">
      <tr>
        <th  style="width: 10px;text-align: center;">ลำดับ</th>
        <th style="text-align: center;">วันที่อบรม/สัมมนา</th>
        <th style="text-align: center;">จำนวนวัน</th>
        <th >เรื่องที่อบรม/สัมมนา</th>
        <th >สถานที่อบรม/สัมมนา</th>  
        <th style="text-align: center;" >ภาพอบรม1</th> 
        <th style="text-align: center;" >ภาพอบรม2</th>        
       
      </tr>
    </thead>
    <tbody>
        
         <?php 
          $rows = 5;  
          $sql2 = "SELECT * FROM train where teachertrID = '$teacherID'";
          $result = mysqli_query($link, $sql2);
          $row = mysqli_num_rows($result);
          $total_page = ceil($row/$rows);
          if(empty($_GET['page'])){ 
              $page=1;
          } else {
              $page=$_GET['page'];
            }  
          if($page>=$total_page) $page=$total_page; 
          $start=($page-1)*$rows;
          
          $sql3 = "SELECT * FROM teacher AS t1 INNER JOIN title_name AS t2 ON (t1.titleID = t2.titleID)      
           LEFT JOIN  train AS t3   ON (t1.teacherID = t3.teachertrID ) WHERE (`teacherID`='$teacherID') order By trainID DESC Limit $start,$rows  ";                                 
             $result = mysqli_query($link, $sql3);
          $i=1;
          if($page > 1)
            {
	    $i = ($rows * ($page-1)) + 1; 
            }
            
            if(!empty($row)){
            
         while ($row1 = mysqli_fetch_array($result))  {    ?>
      <tr>
      <?php       
             $date1 = $row1['traindate'];
         if ($date1 == "0000-00-00"){
              $startdate = "";
         }else if ($date1 == "") {
              $startdate = "";
        }else{       
        $startdate=displaydate($date1);
        } 
        
         $date2 = $row1['endtraindate'];
         if ($date2 == "0000-00-00"){
              $enddate = "";
         }else if ($date2 == "") {
              $enddate = "";
        }else{       
        $enddate=displaydate($date2);
        } 
       ?> 
          
          <?php
    /*---------------------------------------------------
    |  ประกาศตัวแปรเพื่อเก็บวันที่เริ่มต้น และ วันที่สิ้นสุดก่อน
     ---------------------------------------------------*/
     $begin_date = $date1;
     $end_date   = $date2;

  /*---------------------------------------------------
  |  ใช้คำสั่ง Explode เพื่อแยก วัน/เดือน/ปี ออกมา
   ---------------------------------------------------*/
  /* Explod สำหรับวันที่เริ่มต้น */
    $begin_explode = explode('-', $begin_date);
    $begin_day     = $begin_explode[2];
    $begin_month   = $begin_explode[1];
    $begin_year    = $begin_explode[0];

 /*---------------------------------------------------
 |  ใช้คำสั่ง Explode เพื่อแยก วัน/เดือน/ปี ออกมา
 ---------------------------------------------------*/
 /* Explod สำหรับวันที่สิ้นสุด */
   $end_explode = explode('-', $end_date);
   $end_day     = $end_explode[2];
   $end_month   = $end_explode[1];
   $end_year    = $end_explode[0];

 /*---------------------------------------------------
  |  ใช้ฟังก์ชั่น gregoriantojd ของ PHP เพื่อหาจำนวนวัน
  |  แต่ต้องเปิด Extension calendar ของ PHP ก่อน
  ---------------------------------------------------*/
  $start = GregorianToJD($begin_month,$begin_day,$begin_year);
  $end   = GregorianToJD($end_month,$end_day,$end_year);

  /*---------------------------------------------------
  |  เอาวันที่ ที่ได้จากการเข้าฟังก์ชั่น GregorianToJD มาลบกัน
  ---------------------------------------------------*/
   $period_time  = $end-$start;
   $sumdate = $period_time+1;
        ?> 
        <td  style="width: 10px;text-align: center;"><?php echo $i; ?></td>
        <td style="text-align: center;"><?php echo $startdate; ?>&nbsp; ถึง &nbsp;<?php echo $enddate ?></td>
        <td style="text-align: center;"><?php echo $sumdate; ?> </td>
        <td><?php echo $row1['subjecttrain'] ?> </td>
        <td><?php echo $row1['placetrain'] ?> </td>
        <?php
      $pic_name1 = $row1['imagetrain1'];
      if (empty($pic_name1)){
       $pic_name1 = 'nopicture.jpg';
         }
      ?>
           <td style="text-align: center;">
               <a data-lity href="./dist/img/train/<?php echo $pic_name1 ?>" target="_blank"><img class="img-thumbnail" src="./dist/img/train/<?php echo $pic_name1 ?>" alt="./dist/img/train/<?php echo $pic_name1 ?>" width= "60" height="60"></a>
            </td>
      <?php
      $pic_name2 = $row1['imagetrain2'];
      if (empty($pic_name2)){
       $pic_name2 = 'nopicture.jpg';
         }
      ?>   
        <td style="text-align: center;"> 
            <a data-lity href="./dist/img/train/<?php echo $pic_name2 ?>" target="_blank"><img class="img-thumbnail" src="./dist/img/train/<?php echo $pic_name2 ?>" alt="./dist/img/train/<?php echo $pic_name2 ?>" width= "60" height="60"></a>
        </td>
        
      </tr> 
        <?php  $i++; }  ?>
      <?php  
        }else if(empty($row)){ 
            ?>
       <tr>
        <td colspan="6"><div align="center"><i class="fa fa-folder-open"></i>&nbsp;ไม่พบข้อมูล</div></td>  
        </tr>
     <?php  }  ?>
    </tbody>
  </table>
 </div>
 <nav aria-label="Page navigation">
 <div class="text-center">
  <ul class="pagination">    
    <li <?php if($page==1)echo'class="disabled"';  ?>>
      <a href="show_trainuser.php?teacherID=<?php echo $teacherID ?>&page=<?php echo $page-1; ?>"aria-label="Previous">&laquo;  ก่อนหน้า
      </a>
    </li>
    <?php  for($i=1;$i<=$total_page;$i++) {
        if($page-2>=2 and ($i>2and$i<$page-2)){
            echo "<li><a href=>...</a></li>";
            $i=$page-2;
        }
        if($page+5<=$total_page and ($i>=$page+3 and $i<=$total_page-2)){
            echo "<li><a href=>...</a></li>";
            $i=$total_page-1;
        }
    ?>
    <li <?php if($page==$i)echo'class="active"';  ?>><a href="show_trainuser.php?teacherID=<?php echo $teacherID ?>&page=<?php echo $i; ?>"> <?php echo $i;?></a></li>
    <?php } ?>
    <li <?php if($page==$total_page)echo'class="disabled"';  ?>>
      <a href="show_trainuser.php?teacherID=<?php echo $teacherID ?>&page=<?php echo $page+1; ?>"aria-label="Previous"> ถัดไป  &raquo;
      </a>
    </li>
  </ul>
      <ul class="pagination">
      <li>
      <a aria-label="Previous">
       ทั้งหมด <span class="badge"><?php echo $row;?></span> รายการ
      </a>
    </li> 
    </ul>
</div>
</nav>         
  </div>
  </div><!-- /.box-body -->
  <div class="box-footer">
    <?php  include 'editmodal_train.php'; ?>
  </div><!-- box-footer -->
</div><!-- /.box -->   
      
          
          
          <!-- Your Page Content Here -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <!-- Main Footer -->
 <?php include 'footer.php'; ?>

  
</div>
<!-- ./wrapper -->

<!-- REQUIRED JS SCRIPTS -->

<!-- jQuery 2.2.3 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/select2/select2.full.min.js"></script>
<script src="bootstrap/js/smoke.min.js"></script>
<script src="bootstrap/js/spin.min.js"></script>
<script src="bootstrap/js/moment.js"></script>
<script src="bootstrap/js/bootstrap-datetimepicker.min.js"></script>
<script src="bootstraptable/bootstrap-table.min.js"></script>
<script src="bootstrap/js/lity.min.js"></script>

<!-- Optionally, you can add Slimscroll and FastClick plugins.
     Both of these plugins are recommended to enhance the
     user experience. Slimscroll is required when using the
     fixed layout. -->
</body>
</html>

Zerion Mini Shell 1.0