ok
Direktori : /home2/selectio/www/thedentalpark.com/admin/ |
Current File : /home2/selectio/www/thedentalpark.com/admin/college-list.php |
<?php include "header.php"; if(isset($_GET['del_id']) && $_GET['del_id']!=''){ $id = isset($_GET['del_id']) ? $_GET['del_id'] : ''; $statement = $pdo->prepare("SELECT * FROM tbl_college WHERE id=?"); $statement->execute(array($id)); $edit_result = $statement->fetchAll(PDO::FETCH_ASSOC); $edit_count = $statement->rowCount(); if($edit_count > 0){ $college_image = $edit_result[0]['college_image']; if(!empty($college_image)){ if (file_exists('../assets/img/college/'. $college_image)) { unlink('../assets/img/college/'. $college_image); } } $statement = $pdo->prepare("DELETE FROM tbl_college WHERE id=?"); $result=$statement->execute(array($id)); if($result) { $_SESSION['success_message'] = 'College Details Delete Successfully' ; header("Location: college-list.php"); exit; } else { $_SESSION['error_message'] = 'Error Occured Not Delete'; header("Location: college-list.php"); exit; } } } ?> <div class="content-wrapper"> <section class="content-header"> <h1>College List</h1> <ol class="breadcrumb"> <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li> <li class="active"> College List</li> </ol> </section> <div class="clearfix"></div> <section class="content"> <div class="row"> <div class="col-xs-12"> <?php if(!empty($_SESSION['error_message'])) { ?> <div class="callout callout-danger"> <p> <i class="icon fa fa-warning"></i> <?php echo $_SESSION['error_message']; ?></p> </div> <?php unset($_SESSION['error_message']); }?> <?php if(!empty($_SESSION['success_message'])){ ?> <div class="callout callout-success"> <p> <i class="icon fa fa-check"></i> <?php echo $_SESSION['success_message']; ?></p> </div> <?php unset($_SESSION['success_message']); } ?> </div> </div> <div class="row"> <div class="col-xs-12"> <div class="box box-primary"> <div class="box-header"> <a href="college-add.php" class="btn btn-success btn-sm pull-right"><i class="fa fa-plus-circle"></i> Add College</a> <span class="btn btn-default btn-sm pull-right filter" style="margin-right: 5px;"> Show/Hide Filter</span> <h3 class="box-title">College List</h3> </div> <div class="box-body"> <div class="row" id="filter"> <div class="col-sm-3"> <div class="form-group"> <label class="control-label" for="status">Status</label> <select name="status" class="form-control select2" style="width:100%" id="status"> <option value="1">Active</option> <option value="0">In-Active</option> <option value="">All Status</option> </select> </div> </div> </div> <div class="clearfix"></div> <div class="table-responsive"> <table id="StData" class="table table-striped table-bordered table-condensed table-hover" style="margin-bottom:5px;"> <thead> <tr> <td colspan="10" class="p0"><input type="text" class="form-control b0" name="search_table" id="search_table" placeholder="Search Here" style="width:100%;background-color: darkblue;color: white;"></td> </tr> <tr class="active"> <th style="width:100px;">Actions</th> <th>S.No</th> <th>College Name</th> <th>College Image</th> <th>Status</th> </tr> </thead> <tbody> <tr> <td colspan="10" class="dataTables_empty"><center> Loading Pls Wait Data</center></td> </tr> </tbody> </table> </div> <div class="clearfix"></div> </div> </div> </div> </div> </section> <?php include "footer.php";?> <script> $(document).ready(function(){ $('#filter').hide(); $('.filter').click(function(){ $("#filter").slideToggle(); return false; }); }); </script> <script type="text/javascript"> <?php $columns = "0, 1, 2, 3, 4, 5, 6, 7, 8"; $data_table = "var search_table = $('#search_table').val(); var status = $('#status').val(); var table = $('#StData').DataTable({ 'ajax' : { url: 'data-tables/college-data-table.php', data:{search:search_table, status:status}, type: 'POST'}, bFilter: true, bDestroy: true, searching: true,pageLength: 10, 'buttons': [ { extend: 'copyHtml5', 'footer': false, exportOptions: { columns: [ $columns ] } }, { extend: 'excelHtml5', 'footer': false, exportOptions: { columns: [ $columns ] } }, { extend: 'csvHtml5', 'footer': false, exportOptions: { columns: [ $columns ] } }, { extend: 'pdfHtml5', orientation: 'landscape', pageSize: 'A4', 'footer': false, exportOptions: { columns: [ $columns ] } }, { extend: 'colvis', text: 'Columns'}, ] });"; ?> $(document).ready(function() { get_data(); function get_data(){ <?=$data_table?> } $('#search_table').keyup(function() { get_data(); document.getElementById("search_table").focus(); }); $('#status').change(function() { get_data(); }); $("#StData").on('click', '.college_delete', function() { if (!confirm("Confirm Want to Delete This College?")) { return false; } }); }); function DynamicInActive(id){ var result = confirm("Confirm Want to In-Active This College?"); if (result) { $.ajax({ type: 'POST', url: 'api/delete.php', data: {type:'dynamic_in_active',delete_id:id, table: 'tbl_college'}, success: function(response) { console.log(response); get_data(); } }); } } function DynamicActive(id){ var result = confirm("Confirm Want to Active This College?"); if (result) { $.ajax({ type: 'POST', url: 'api/delete.php', data: {type:'dynamic_active',delete_id:id, table:'tbl_college'}, success: function(response) { console.log(response); get_data(); } }); } } function get_data(){ <?=$data_table?> } </script>