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/teacher.php

<?php
include 'head.php';
 if ($s_status_user == 3) {
     header("Location: login.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>

<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-dashboard"></i> เมนูหลัก</a></li>
        <li class="active">ข้อมูลบุคลากร</li>
      </ol>
    </section>
    
    <!-- Main content -->
        <section class="content">
          <!-- Your Page Content Here -->
          <a href="frm_teacher.php" class="btn btn-primary"><i class="fa fa-user-plus"></i> เพิ่มรายการ</a>
          <br><br>
          <div class="box box-primary">
         <div class="box-header with-border">
         <h3 class="box-title">ข้อมูลบุคลากร</h3>
         <div class="box-tools pull-right">
        <button id="remove" class="btn btn-danger" disabled>
                                    <i class="glyphicon glyphicon-remove"></i> ลบรายการ
                                </button>
      <!-- Buttons, labels, and many other things can be placed here! -->
      <!-- Here is a label for example -->
      <?php
      $sql_teacher = "SELECT COUNT(*) AS COUNTTH FROM teacher WHERE status_user = 1 or status_user = 2 or status_user = 3 ";
      $result_teacher = mysqli_query($link, $sql_teacher);
      $count_teacher = mysqli_fetch_assoc($result_teacher);
      ?>
      <span class="label label-primary">ทั้งหมด <?php echo $count_teacher['COUNTTH'];?> รายการ</span>
    </div><!-- /.box-tools -->
  </div><!-- /.box-header -->
  <div class="box-body">
      
  <table id="table" data-toggle="table" data-locale="th-TH" data-url="teacher_json.php"
         data-pagination = "true"
         data-page-size="10"
         data-page-list ="[5,10,15,ALL]"
         data-search ="true"
         data-show-refresh ="true"
         data-show-toggle ="true"
         data-show-columns ="true"
         data-show-export="true"
         data-toolbar="#remove"
         data-toolbar="#toolbar"
         data-id-field="teacherID"
         
         >
    <thead>
        <tr>
           <th data-field="state" data-checkbox="true"></th>
           <th data-formatter="runningFormatter" data-align="center">ลำดับที่</th>
           <th data-field="teacherID" data-align="center" data-sortable="true">รหัสบุคลากร</th>
           <th data-field="titleName" data-sortable="true">คำนำหน้า</th>
           <th data-field="name" data-sortable="true">ชื่อ</th>
           <th data-field="lastName" data-sortable="true">นามสกุล</th>
           <th data-field="type_name" data-sortable="true">สายงาน</th>
           <th data-field="sub_type_name" data-sortable="true">ประเภทงาน</th>
           <th data-field="typePersonnel" data-sortable="true">ประเภทบุคลากร</th>
           <th data-field="operate" data-align="center" data-events="operateEvents" data-formatter="operateFormatter">เครื่องมือ</th>
        </tr>
    </thead>
   
</table>
     
  
     

  </div><!-- /.box-body -->

</div><!-- /.box -->   
         

    </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="bootstrap/js/sweetalert.min.js"></script>
<script src="bootstrap/js/smoke.min.js"></script>
<script src="bootstraptable/bootstrap-table.min.js"></script>
<script src="bootstraptable/extensions/export/bootstrap-table-export.min.js"></script>
<script src="bootstraptable/extensions/export/tableExport.js"></script>
<script src="bootstraptable/locale/bootstrap-table-th-TH.min.js"></script>

<script>

            var $table = $('#table'),
                    $remove = $('#remove');


            $(function () {
                $table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
                    $remove.prop('disabled', !$table.bootstrapTable('getSelections').length);
                });
                $remove.click(function () {
                    $.smkConfirm({text: 'แน่ใจว่าต้องการลบข้อมูล ?', accept: 'ตกลง', cancel: 'ยกเลิก'}, function (e) {
                        if (e) {
                            var ids = $.map($table.bootstrapTable('getSelections'), function (row) {
                                return row.teacherID;
                            });
                            //alert(ids);

                            //ajax delete
                            $.get("del_teacher.php", {"teacherID[]": ids})
                                    .done(function (data) {
                                        if (data.status === "success") {
                                            $.smkAlert({text: data.message, type: data.status});
                                        } else {
                                            $.smkAlert({text: data.message, type: data.status});
                                        }
                                        $table.bootstrapTable('refresh');
                             });


                            $remove.prop('disabled', true);
                            //uncheck
                            $table.bootstrapTable('togglePagination').bootstrapTable('uncheckAll').bootstrapTable('togglePagination');
                        }
                    });
                });
            });

            function priceFormatter(value) {
                return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                ;
            }

            function operateFormatter(value, row, index) {
                return [
                    '<a class="btn btn-warning btn-xs view" href="javascript:void(0)" title="ดูรายละเอียด">',
                    '<i class="fa fa-eye"></i>',
                    '</a>  ',
                    '<a class="btn btn-success btn-xs edit" href="javascript:void(0)" title="แก้ไขข้อมูล">',
                    '<i class="glyphicon glyphicon-pencil"></i>',
                    '</a>  '
                ].join('');
            }

            window.operateEvents = {
                'click .edit': function (e, value, row, index) {            
                    var teacherID = [row.teacherID];
                    //alert('You click like action, row: ' + row.prodID);
                    $(location).attr('href', 'frm_teacher_edit.php?teacherID='+teacherID); //redirect to your url
                    
                },
                'click .view': function (e, value, row, index) {            
                    var teacherID = [row.teacherID];
                    //alert('You click like action, row: ' + row.prodID);
                    $(location).attr('href', 'show_teacher.php?teacherID='+teacherID); //redirect to your url
                    
                }
                
            };
            
          
       //ลำดับ1,2,3
       function runningFormatter(value, row, index) {
       return 1+index;
       }

        </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