Viewing file: view-department.php (5.31 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
error_reporting(0);
include 'conn.php';
require_once "auth.php";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php include('title.php') ?></title>
<link rel="shortcut icon" type="image/png" href="images/fav.png">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="css/themify-icons.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/red.css" id="style_theme">
<link rel="stylesheet" href="css/responsive.css">
<link rel="stylesheet" href="charts/css/morris.css">
<link rel="stylesheet" href="css/jquery-jvectormap.css">
<link rel="stylesheet" href="datatable/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="plugins/summernote/summernote-bs4.css">
<script src="js/modernizr.min.js"></script>
<link rel="stylesheet" href="dist/css/user_css.css">
</head>
<body>
<!-- Pre Loader -->
<div class="loading">
<div class="spinner">
<div class="double-bounce1"></div>
<div class="double-bounce2"></div>
</div>
</div>
<!--/Pre Loader -->
<!-- Color Changer -->
<!-- /Color Changer -->
<div class="wrapper">
<!-- Sidebar -->
<?php include('sidebar.php') ?>
<!-- /Sidebar -->
<!-- Page Content -->
<div id="content">
<div>
<?php include('topbar.php') ?>
</div>
<div class="row no-margin-padding">
<div class="col-md-6">
<h3 class="block-title">View Departments</h3>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="index.html">
<span class="ti-home"></span>
</a>
</li>
<li class="breadcrumb-item">Departments</li>
</ol>
</div>
</div>
<!-- /Page Title -->
<?php
if(isset($_GET['delete_id']))
{
$query_select1 = "SELECT img, main_image FROM department WHERE id='" . $_GET['delete_id'] . "'";
$result1 = mysqli_query($con, $query_select1);
$row = mysqli_fetch_assoc($result1);
$query_delete="DELETE FROM department WHERE id='".$_GET['delete_id']."'";
$doc_image_path = "images/department/" . $row['img'];
if (file_exists($doc_image_path)) {
unlink($doc_image_path);
}
if ($row['main_image'] != 'default.jpg') {
$doc_image_path = "images/department/" . $row['main_image'];
unlink($doc_image_path);
}
$p = mysqli_query($con, $query_delete);
echo "<script>alert('Deleted Successfully');</script>
<script>window.location.href = 'add-department.php'</script>";
}
$location = mysqli_query($con,"SELECT * FROM department");
?>
<!-- /Breadcrumb -->
<!-- Main Content -->
<div class="container-fluid">
<section class="content" >
<table class="table">
<thead>
<tr>
<th>Department Name</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
while ($location_ft = mysqli_fetch_array($location)) {
?>
<tr>
<td><?php echo $location_ft["d_name"]; ?></td>
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<a href="edit-department.php?edit=<?php echo $location_ft["id"]; ?>" onclick="return confirm('Are you sure?')" class="btn btn-info"><i class="fas fa-edit"></i></a>
<a href="view-department.php?delete_id=<?php echo $location_ft["id"]; ?>" onclick="return confirm('Are you sure?')" class="btn btn-danger"><i class="fas fa-trash"></i></a>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</section>
</div>
<!-- /Main Content -->
</div>
<!-- /Page Content -->
</div>
<!-- Back to Top -->
<a id="back-to-top" href="#" class="back-to-top">
<span class="ti-angle-up"></span>
</a>
<script src="plugins/jquery/jquery.min.js"></script>
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="dist/js/adminlte.min.js"></script>
<script src="dist/js/demo.js"></script>
<script src="plugins/summernote/summernote-bs4.min.js"></script>
<script>
$(function () {
$('.textarea').summernote()
})
</script>
<!-- Popper Library-->
<script src="js/popper.min.js"></script>
<!-- Bootstrap Library-->
<script src="js/bootstrap.min.js"></script>
<!-- Datatable -->
<script src="datatable/jquery.dataTables.min.js"></script>
<script src="datatable/dataTables.bootstrap4.min.js"></script>
<!-- Custom Script-->
<script src="js/custom.js"></script>
</body>
</html>
|