mayankjoin3

Untitled

Jun 26th, 2026
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.81 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Administrative UI Functions
  4.  *
  5.  * This file contains UI components that should only be accessible to administrators.
  6.  * It is isolated from the common functions file to prevent information leakage
  7.  * to student/faculty modules.
  8.  */
  9.  
  10. require_once __DIR__ . '/functions.php';
  11.  
  12. /**
  13.  * Renders the main Admin Sidebar
  14.  */
  15. function renderAdminSidebar()
  16. {
  17.     $currentPage = basename($_SERVER['PHP_SELF']);
  18.     echo '
  19.    <style>
  20.        .sidebar {
  21.            width: 280px;
  22.            height: 100vh;
  23.            background: linear-gradient(135deg, #232526, #414345);
  24.            display: flex;
  25.            flex-direction: column;
  26.            align-items: center;
  27.            padding-top: 20px;
  28.            position: fixed;
  29.            box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);
  30.            overflow-y: auto;
  31.            z-index: 1000;
  32.        }
  33.        .sidebar h4 {
  34.            font-size: 22px;
  35.            color: #f8f9fa;
  36.            margin-bottom: 20px;
  37.            text-transform: uppercase;
  38.            font-weight: 600;
  39.            letter-spacing: 1px;
  40.            text-align: center;
  41.            border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  42.            padding-bottom: 10px;
  43.            width: 80%;
  44.        }
  45.        .nav-section {
  46.            width: 100%;
  47.            margin-bottom: 15px;
  48.        }
  49.        .nav-section-title {
  50.            font-size: 14px;
  51.            color: rgba(255, 255, 255, 0.7);
  52.            text-transform: uppercase;
  53.            font-weight: 600;
  54.            letter-spacing: 1px;
  55.            text-align: center;
  56.            margin: 15px 0 10px 0;
  57.            padding: 5px 0;
  58.            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  59.            width: 80%;
  60.            margin-left: auto;
  61.            margin-right: auto;
  62.        }
  63.        .sidebar a {
  64.            color: #ffffff;
  65.            padding: 12px 20px;
  66.            margin: 4px 0;
  67.            width: 80%;
  68.            text-align: center;
  69.            display: block;
  70.            text-decoration: none;
  71.            font-size: 16px;
  72.            font-weight: 500;
  73.            border-radius: 6px;
  74.            transition: all 0.3s ease-in-out;
  75.            position: relative;
  76.        }
  77.        .sidebar a:hover {
  78.            background: rgba(255, 255, 255, 0.2);
  79.            transform: scale(1.05);
  80.        }
  81.        .sidebar a.active {
  82.            background: rgba(255, 255, 255, 0.25);
  83.            color: #fff;
  84.            font-weight: 600;
  85.        }
  86.        .sidebar a.active::before {
  87.            content: "";
  88.            position: absolute;
  89.            left: 0;
  90.            top: 0;
  91.            bottom: 0;
  92.            width: 4px;
  93.            background: #0d6efd;
  94.            border-radius: 0 4px 4px 0;
  95.        }
  96.        .sidebar::-webkit-scrollbar { width: 6px; }
  97.        .sidebar::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); }
  98.        .sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 3px; }
  99.        
  100.        @media screen and (max-width: 768px) {
  101.            .sidebar { width: 220px; }
  102.        }
  103.        @media screen and (max-width: 576px) {
  104.            .sidebar { width: 100%; height: auto; position: relative; }
  105.            .sidebar a { display: inline-block; width: auto; }
  106.        }
  107.    </style>
  108.    <div class="sidebar">
  109.        <h4>Admin Portal</h4>
  110.        <div class="nav-section">
  111.            <div class="nav-section-title">Dashboard</div>
  112.            <a href="admin_home.php" class="' . ($currentPage == 'admin_home.php' ? 'active' : '') . '">Home</a>
  113.        </div>
  114.        <div class="nav-section">
  115.            <div class="nav-section-title">Database</div>
  116.            <a href="admin_full_table_edit_dropdown_unique.php" class="' . ($currentPage == 'admin_full_table_edit_dropdown_unique.php' ? 'active' : '') . '">Database Explorer</a>
  117.            <a href="admin_full_table_edit_textbox.php" class="' . ($currentPage == 'admin_full_table_edit_textbox.php' ? 'active' : '') . '">Explorer Textbox</a>
  118.            <a href="admin_full_table_edit.php" class="' . ($currentPage == 'admin_full_table_edit.php' ? 'active' : '') . '">Explorer Edit</a>
  119.            <a href="admin_full_table_raw_query.php" class="' . ($currentPage == 'admin_full_table_raw_query.php' ? 'active' : '') . '">Raw Query</a>
  120.            <a href="admin_change_password.php" class="' . ($currentPage == 'admin_change_password.php' ? 'active' : '') . '">Change Password</a>
  121.            <a href="admin_add_faculty.php" class="' . ($currentPage == 'admin_add_faculty.php' ? 'active' : '') . '">Add Faculty</a>
  122.            <a href="admin_imports.php" class="' . ($currentPage == 'admin_imports.php' ? 'active' : '') . '">Import Data</a>
  123.        </div>
  124.        <div class="nav-section">
  125.            <div class="nav-section-title">Feedback</div>
  126.            <a href="feedback_view_admin_old.php" class="' . ($currentPage == 'feedback_view_admin_old.php' ? 'active' : '') . '">Feedback Viewer</a>
  127.        </div>
  128.        <div class="nav-section">
  129.            <div class="nav-section-title">Transcripts</div>
  130.            <a href="job.php" class="' . ($currentPage == 'job.php' ? 'active' : '') . '">Job Management</a>
  131.            <a href="generate_transcripts_old.php" class="' . ($currentPage == 'generate_transcripts_old.php' ? 'active' : '') . '">Transcript Generator</a>
  132.        </div>
  133.        <div class="nav-section" style="margin-top: auto; padding-bottom: 20px;">
  134.            <a href="../../logout.php" style="background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3);">Logout</a>
  135.        </div>
  136.    </div>
  137.    ';
  138. }
  139.  
  140. /**
  141.  * Renders the Admin Hostel Sidebar (Moved for isolation)
  142.  */
  143. function renderAdminHostelSidebar()
  144. {
  145.     $currentPage = basename($_SERVER['PHP_SELF']);
  146.     echo '
  147.    <style>
  148.        .sidebar {
  149.            width: 290px;
  150.            background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  151.            color: #0d1117;
  152.            min-height: 100vh;
  153.            height: 100vh;
  154.            position: fixed;
  155.            left: 0;
  156.            top: 0;
  157.            overflow-y: auto;
  158.            border-right: 1px solid #e1e4e8;
  159.            z-index: 1000;
  160.        }
  161.        .sidebar-header {
  162.            padding: 24px;
  163.            background: #ffffff;
  164.            border-bottom: 1px solid #e1e4e8;
  165.            margin-bottom: 16px;
  166.        }
  167.        .sidebar-header h4 {
  168.            margin: 0;
  169.            font-size: 1.25rem;
  170.            font-weight: 700;
  171.            color: #0d6efd;
  172.            letter-spacing: -0.5px;
  173.        }
  174.        .nav-link {
  175.            display: flex;
  176.            align-items: center;
  177.            padding: 12px 24px;
  178.            color: #444d56;
  179.            text-decoration: none;
  180.            font-weight: 500;
  181.            font-size: 0.95rem;
  182.            transition: all 0.2s ease;
  183.            border-left: 4px solid transparent;
  184.        }
  185.        .nav-link:hover {
  186.            background-color: #f1f8ff;
  187.            color: #0366d6;
  188.        }
  189.        .nav-link.active {
  190.            background-color: #f1f8ff;
  191.            color: #0366d6;
  192.            border-left-color: #0366d6;
  193.            font-weight: 600;
  194.        }
  195.        .nav-section-label {
  196.            padding: 16px 24px 8px;
  197.            font-size: 0.75rem;
  198.            font-weight: 600;
  199.            color: #959da5;
  200.            text-transform: uppercase;
  201.            letter-spacing: 1px;
  202.        }
  203.    </style>
  204.    <div class="sidebar">
  205.        <div class="sidebar-header">
  206.            <h4>Hostel Admin</h4>
  207.        </div>
  208.        <div class="nav-section-label">Management</div>
  209.        <a href="admin_hostel_students.php" class="nav-link ' . ($currentPage == 'admin_hostel_students.php' ? 'active' : '') . '">Student Records</a>
  210.        <a href="admin_hostel_rooms.php" class="nav-link ' . ($currentPage == 'admin_hostel_rooms.php' ? 'active' : '') . '">Room Allocation</a>
  211.        <a href="admin_complaints.php" class="nav-link ' . ($currentPage == 'admin_complaints.php' ? 'active' : '') . '">Complaints</a>
  212.        
  213.        <div class="nav-section-label">Mess & Leaves</div>
  214.        <a href="admin_mess_leaves_view.php" class="nav-link ' . ($currentPage == 'admin_mess_leaves_view.php' ? 'active' : '') . '">Mess Leaves</a>
  215.        <a href="admin_consolidated_mess_leaves_view.php" class="nav-link ' . ($currentPage == 'admin_consolidated_mess_leaves_view.php' ? 'active' : '') . '">Consolidated Leaves</a>
  216.        
  217.        <div class="nav-section-label">Finance</div>
  218.        <a href="admin_check_fines.php" class="nav-link ' . ($currentPage == 'admin_check_fines.php' ? 'active' : '') . '">Fines & Penalties</a>
  219.        
  220.        <div style="margin-top: auto; padding: 24px; border-top: 1px solid #e1e4e8;">
  221.            <a href="../../logout.php" class="nav-link" style="color: #d73a49;">Sign Out</a>
  222.        </div>
  223.    </div>';
  224. }
  225.  
Advertisement
Add Comment
Please, Sign In to add comment