📁 File Manager
🏠 /
/
home
/
u857492117
/
domains
/
mangaldailawcollege.in
/
public_html
/
law-admin
Dosya Düzenle: students.php
<?php session_start(); if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; } require 'config/db.php'; $adminName = $_SESSION['admin_name'] ?? "Administrator"; /* =============================== Dashboard Statistics ================================ */ $totalStudents = $conn->query("SELECT COUNT(*) FROM student_reg")->fetchColumn(); $approvedStudents = $conn->query("SELECT COUNT(*) FROM student_reg WHERE admission_status='Approved'")->fetchColumn(); $draftStudents = $conn->query("SELECT COUNT(*) FROM student_reg WHERE admission_status='Draft'")->fetchColumn(); $rejectedStudents = $conn->query("SELECT COUNT(*) FROM student_reg WHERE admission_status='Rejected'")->fetchColumn(); $PendingStudents = $totalStudents - $approvedStudents; $admissionFee = 20700; // Total admission fee per student $totalCollection = $approvedStudents * $admissionFee; /* =============================== Search ================================ */ $search = $_GET['search'] ?? ''; $course = $_GET['course'] ?? ''; $semester = $_GET['semester'] ?? ''; $status = $_GET['status'] ?? ''; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Students | Mangaldai Law College</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.8/css/dataTables.bootstrap5.min.css"> <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.datatables.net/1.13.8/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.13.8/js/dataTables.bootstrap5.min.js"></script> <style> *{ margin:0; padding:0; box-sizing:border-box; font-family:'Poppins',sans-serif; } body{ background:#f4f7fb; } /*====================== PAGE HEADER =======================*/ .page-header{ background:linear-gradient(135deg,#0A2647,#144272); padding:30px; border-radius:18px; color:#fff; display:flex; justify-content:space-between; align-items:center; margin-bottom:25px; box-shadow:0 10px 25px rgba(0,0,0,.12); } .page-header h2{ font-size:30px; font-weight:700; margin-bottom:5px; } .page-header p{ opacity:.9; } .add-btn{ background:#FFD54F; padding:12px 25px; border-radius:10px; text-decoration:none; font-weight:600; color:#000; transition:.3s; } .add-btn:hover{ background:#ffc107; color:#000; } /*====================== STATISTICS =======================*/ .cards{ display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:20px; margin-bottom:30px; } .card{ background:#fff; padding:25px; border-radius:15px; box-shadow:0 8px 25px rgba(0,0,0,.08); display:flex; justify-content:space-between; align-items:center; transition:.3s; } .card:hover{ transform:translateY(-5px); } .card h3{ font-size:32px; margin-top:8px; } .card p{ color:#777; } .card i{ font-size:45px; opacity:.2; } .total{ border-left:6px solid #0d6efd; } .approved{ border-left:6px solid #198754; } .draft{ border-left:6px solid #ffc107; } .rejected{ border-left:6px solid #dc3545; } .section{ background:#fff; padding:25px; border-radius:15px; box-shadow:0 10px 25px rgba(0,0,0,.08); margin-bottom:25px; } @media(max-width:768px){ .page-header{ flex-direction:column; text-align:center; gap:20px; } } .form-control, .form-select{ width:100%; height:48px; padding:10px 15px; font-size:15px; border:1px solid #dcdfe5; border-radius:10px; background:#fff; transition:.3s; } .form-control:focus, .form-select:focus{ border-color:#0A2647; box-shadow:0 0 0 3px rgba(10,38,71,.15); outline:none; } .table{ margin:0; } .table thead th{ background:#0A2647; color:#fff; padding:16px; font-weight:600; border:none; } .table tbody td{ padding:15px; vertical-align:middle; } .table tbody tr:hover{ background:#f5f8fc; } .dataTables_wrapper .dataTables_filter{ float:right; margin-bottom:20px; } .dataTables_wrapper .dataTables_filter input{ height:42px; width:250px; border-radius:8px; border:1px solid #ccc; padding:8px 12px; } .dataTables_wrapper .dataTables_length select{ height:42px; border-radius:8px; } .dataTables_wrapper .dataTables_paginate .paginate_button{ padding:6px 12px !important; margin:0 3px; border-radius:6px !important; } .student-photo{ width:60px; height:60px; border-radius:50%; object-fit:cover; border:3px solid #e5e5e5; } .action-btn{ width:36px; height:36px; display:inline-flex; align-items:center; justify-content:center; border-radius:50%; margin-right:5px; } </style> </head> <body> <?php include 'sidebar.php'; ?> <?php if(isset($_SESSION['success'])){ echo " <script> document.addEventListener('DOMContentLoaded',function(){ Swal.fire({ icon:'success', title:'Success!', text:'".$_SESSION['success']."', confirmButtonColor:'#198754' }); }); </script>"; unset($_SESSION['success']); } if(isset($_SESSION['error'])){ echo " <script> document.addEventListener('DOMContentLoaded',function(){ Swal.fire({ icon:'error', title:'Error!', text:'".$_SESSION['error']."', confirmButtonColor:'#dc3545' }); }); </script>"; unset($_SESSION['error']); } ?> <div class="content"> <div class="page-header"> <div> <h2> <i class="fa-solid fa-user-graduate"></i> Students Management </h2> <p> Manage all student admission records. </p> </div> <a href="promote_student.php" class="add-btn"> <i class="fa-solid fa-plus"></i> Promote Student </a> </div> <div class="cards"> <div class="card total"> <div> <p>Total Students</p> <h3><?= $totalStudents ?></h3> </div> <i class="fa-solid fa-users text-primary"></i> </div> <div class="card approved"> <div> <p>Admitted students</p> <h3><?= $approvedStudents ?></h3> </div> <i class="fa-solid fa-circle-check text-success"></i> </div> <div class="card draft"> <div> <p>Pending</p> <h3><?= $PendingStudents ?></h3> </div> <i class="fa-solid fa-file text-warning"></i> </div> <div class="card rejected"> <div> <p>Total Collection</p> <h3 class="amount"> ₹<?= number_format($totalCollection); ?> </h3> </div> <i class="fa-solid fa-indian-rupee-sign text-danger"></i> </div> </div> <!-- ========================================== SEARCH & FILTER SECTION ========================================== --> <div class="section"> <form method="GET"> <div style="display:grid;grid-template-columns:2fr 1fr 1fr 1fr auto auto;gap:15px;align-items:end;"> <div> <label style="font-weight:600;margin-bottom:8px;display:block;"> Search Student </label> <input type="text" name="search" class="form-control" placeholder="Form No, Application No, Roll No, Name or Mobile" value="<?= htmlspecialchars($search); ?>"> </div> <div> <label style="font-weight:600;margin-bottom:8px;display:block;"> Course </label> <select name="course" class="form-control"> <option value="">All Courses</option> <option value="LL.B." <?= ($course=="LL.B.")?'selected':'';?>> LL.B. </option> <option value="LL.M." <?= ($course=="LL.M.")?'selected':'';?>> LL.M. </option> </select> </div> <div> <label style="font-weight:600;margin-bottom:8px;display:block;"> Semester </label> <select name="semester" class="form-control"> <option value="">All</option> <?php for($i=1;$i<=10;$i++): ?> <option value="<?= $i ?>" <?= ($semester==$i)?'selected':'';?>> Semester <?= $i ?> </option> <?php endfor; ?> </select> </div> <div> <label style="font-weight:600;margin-bottom:8px;display:block;"> Status </label> <select name="status" class="form-control"> <option value="">All Status</option> <option value="Approved" <?= ($status=="Approved")?'selected':''; ?>> Approved </option> <option value="Draft" <?= ($status=="Draft")?'selected':''; ?>> Draft </option> <option value="Submitted" <?= ($status=="Submitted")?'selected':''; ?>> Submitted </option> <option value="Verified" <?= ($status=="Verified")?'selected':''; ?>> Verified </option> <option value="Rejected" <?= ($status=="Rejected")?'selected':''; ?>> Rejected </option> </select> </div> <div> <button type="submit" style="background:#0A2647;color:#fff;border:none;padding:12px 22px;border-radius:8px;cursor:pointer;"> <i class="fa-solid fa-search"></i> Search </button> </div> <div> <a href="students.php" style="background:#6c757d;color:#fff;text-decoration:none;padding:12px 22px;border-radius:8px;display:inline-block;"> <i class="fa-solid fa-rotate-right"></i> Reset </a> </div> </div> </form> </div> <?php /*========================================= STUDENT LIST QUERY ==========================================*/ $where = []; $params = []; if($search!=''){ $where[]="( form_no LIKE ? OR enrollment_no LIKE ? OR roll_no LIKE ? OR full_name LIKE ? OR phone_no LIKE ? )"; for($i=0;$i<5;$i++){ $params[]="%{$search}%"; } } if($course!=''){ $where[]="course=?"; $params[]=$course; } if($semester!=''){ $where[]="semester=?"; $params[]=$semester; } if($status!=''){ $where[]="admission_status=?"; $params[]=$status; } $sql = "SELECT * FROM admitted_students"; if(count($where)>0){ $sql.=" WHERE ".implode(" AND ",$where); } $sql.=" ORDER BY form_no DESC"; $stmt=$conn->prepare($sql); $stmt->execute($params); $students=$stmt->fetchAll(); ?> <!-- ========================================== STUDENT LIST ========================================== --> <div class="section"> <h2 style="margin-bottom:20px;color:#0A2647;"> <i class="fa-solid fa-users"></i> Student Records </h2> <div class="table-responsive"> <table class="table" id="studentTable"> <thead> <tr> <th>Form No</th> <th>Enrollment No</th> <th>Name</th> <th>Mobile</th> <th>Course</th> <th>Status</th> <th width="180">Action</th> </tr> </thead> <tbody> <?php if(count($students)>0){ foreach($students as $row){ $statusColor="secondary"; switch($row['admission_status']){ case "Approved": $statusColor="success"; break; case "Verified": $statusColor="info"; break; case "Submitted": $statusColor="warning"; break; case "Rejected": $statusColor="danger"; break; case "Draft": $statusColor="secondary"; break; } $photo="assets/images/default-user.png"; if(!empty($row['photo']) && file_exists("uploads/students/".$row['photo'])){ $photo="uploads/students/".$row['photo']; } ?> <tr> <td> <strong> <?= htmlspecialchars($row['form_no']); ?> </strong> </td> <td> <?= htmlspecialchars($row['enrollment_no']); ?> </td> <td> <strong> <?= htmlspecialchars($row['full_name']); ?> </strong> <br> <small style="color:#777;"> <small> <?= htmlspecialchars($row['roll_no']); ?> </small> </small> </td> <td> <?= htmlspecialchars($row['phone_no']); ?> </td> <td> <?= htmlspecialchars($row['course']); ?> <br> <small> Semester <?= htmlspecialchars($row['semester']); ?> </small> </td> <td> <span class="badge bg-success"> Approved </span> </td> <td> <div style="display:flex;gap:8px;"> <a href="student_details.php?id=<?= $row['id']; ?>" class="btn btn-sm btn-primary" title="View"> <i class="fa-solid fa-eye"></i> </a> <a href="edit_student.php?id=<?= $row['id']; ?>" class="btn btn-sm btn-warning" title="Edit"> <i class="fa-solid fa-pen"></i> </a> <a href="delete_student.php?id=<?= $row['id']; ?>" class="btn btn-danger btn-sm deleteBtn"> <i class="fa-solid fa-trash"></i> </a> </div> </td> </tr> <?php } }else{ ?> <tr> <td colspan="8" style="text-align:center;padding:40px;"> <i class="fa-solid fa-circle-info"></i> No student records found. </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> <script> $(function () { if ($.fn.DataTable.isDataTable('#studentTable')) { $('#studentTable').DataTable().destroy(); } $('#studentTable').DataTable({ responsive:true, pageLength:10, autoWidth:false, searching:true, ordering:true, lengthMenu:[[10,25,50,100],[10,25,50,100]], language:{ search:"", searchPlaceholder:"Search students..." } }); }); /* SweetAlert Delete */ document.querySelectorAll('.btn-danger').forEach(function(btn){ btn.addEventListener('click',function(e){ e.preventDefault(); let url=this.getAttribute('href'); Swal.fire({ title:'Delete Student?', text:'This action cannot be undone.', icon:'warning', showCancelButton:true, confirmButtonColor:'#dc3545', cancelButtonColor:'#6c757d', confirmButtonText:'Yes, Delete' }).then((result)=>{ if(result.isConfirmed){ window.location=url; } }); }); }); </script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> </body> </html>
💾 Kaydet
İptal