Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Administrative UI Functions
- *
- * This file contains UI components that should only be accessible to administrators.
- * It is isolated from the common functions file to prevent information leakage
- * to student/faculty modules.
- */
- require_once __DIR__ . '/functions.php';
- /**
- * Renders the main Admin Sidebar
- */
- function renderAdminSidebar()
- {
- $currentPage = basename($_SERVER['PHP_SELF']);
- echo '
- <style>
- .sidebar {
- width: 280px;
- height: 100vh;
- background: linear-gradient(135deg, #232526, #414345);
- display: flex;
- flex-direction: column;
- align-items: center;
- padding-top: 20px;
- position: fixed;
- box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);
- overflow-y: auto;
- z-index: 1000;
- }
- .sidebar h4 {
- font-size: 22px;
- color: #f8f9fa;
- margin-bottom: 20px;
- text-transform: uppercase;
- font-weight: 600;
- letter-spacing: 1px;
- text-align: center;
- border-bottom: 2px solid rgba(255, 255, 255, 0.3);
- padding-bottom: 10px;
- width: 80%;
- }
- .nav-section {
- width: 100%;
- margin-bottom: 15px;
- }
- .nav-section-title {
- font-size: 14px;
- color: rgba(255, 255, 255, 0.7);
- text-transform: uppercase;
- font-weight: 600;
- letter-spacing: 1px;
- text-align: center;
- margin: 15px 0 10px 0;
- padding: 5px 0;
- border-bottom: 1px solid rgba(255, 255, 255, 0.2);
- width: 80%;
- margin-left: auto;
- margin-right: auto;
- }
- .sidebar a {
- color: #ffffff;
- padding: 12px 20px;
- margin: 4px 0;
- width: 80%;
- text-align: center;
- display: block;
- text-decoration: none;
- font-size: 16px;
- font-weight: 500;
- border-radius: 6px;
- transition: all 0.3s ease-in-out;
- position: relative;
- }
- .sidebar a:hover {
- background: rgba(255, 255, 255, 0.2);
- transform: scale(1.05);
- }
- .sidebar a.active {
- background: rgba(255, 255, 255, 0.25);
- color: #fff;
- font-weight: 600;
- }
- .sidebar a.active::before {
- content: "";
- position: absolute;
- left: 0;
- top: 0;
- bottom: 0;
- width: 4px;
- background: #0d6efd;
- border-radius: 0 4px 4px 0;
- }
- .sidebar::-webkit-scrollbar { width: 6px; }
- .sidebar::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); }
- .sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 3px; }
- @media screen and (max-width: 768px) {
- .sidebar { width: 220px; }
- }
- @media screen and (max-width: 576px) {
- .sidebar { width: 100%; height: auto; position: relative; }
- .sidebar a { display: inline-block; width: auto; }
- }
- </style>
- <div class="sidebar">
- <h4>Admin Portal</h4>
- <div class="nav-section">
- <div class="nav-section-title">Dashboard</div>
- <a href="admin_home.php" class="' . ($currentPage == 'admin_home.php' ? 'active' : '') . '">Home</a>
- </div>
- <div class="nav-section">
- <div class="nav-section-title">Database</div>
- <a href="admin_full_table_edit_dropdown_unique.php" class="' . ($currentPage == 'admin_full_table_edit_dropdown_unique.php' ? 'active' : '') . '">Database Explorer</a>
- <a href="admin_full_table_edit_textbox.php" class="' . ($currentPage == 'admin_full_table_edit_textbox.php' ? 'active' : '') . '">Explorer Textbox</a>
- <a href="admin_full_table_edit.php" class="' . ($currentPage == 'admin_full_table_edit.php' ? 'active' : '') . '">Explorer Edit</a>
- <a href="admin_full_table_raw_query.php" class="' . ($currentPage == 'admin_full_table_raw_query.php' ? 'active' : '') . '">Raw Query</a>
- <a href="admin_change_password.php" class="' . ($currentPage == 'admin_change_password.php' ? 'active' : '') . '">Change Password</a>
- <a href="admin_add_faculty.php" class="' . ($currentPage == 'admin_add_faculty.php' ? 'active' : '') . '">Add Faculty</a>
- <a href="admin_imports.php" class="' . ($currentPage == 'admin_imports.php' ? 'active' : '') . '">Import Data</a>
- </div>
- <div class="nav-section">
- <div class="nav-section-title">Feedback</div>
- <a href="feedback_view_admin_old.php" class="' . ($currentPage == 'feedback_view_admin_old.php' ? 'active' : '') . '">Feedback Viewer</a>
- </div>
- <div class="nav-section">
- <div class="nav-section-title">Transcripts</div>
- <a href="job.php" class="' . ($currentPage == 'job.php' ? 'active' : '') . '">Job Management</a>
- <a href="generate_transcripts_old.php" class="' . ($currentPage == 'generate_transcripts_old.php' ? 'active' : '') . '">Transcript Generator</a>
- </div>
- <div class="nav-section" style="margin-top: auto; padding-bottom: 20px;">
- <a href="../../logout.php" style="background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.3);">Logout</a>
- </div>
- </div>
- ';
- }
- /**
- * Renders the Admin Hostel Sidebar (Moved for isolation)
- */
- function renderAdminHostelSidebar()
- {
- $currentPage = basename($_SERVER['PHP_SELF']);
- echo '
- <style>
- .sidebar {
- width: 290px;
- background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
- color: #0d1117;
- min-height: 100vh;
- height: 100vh;
- position: fixed;
- left: 0;
- top: 0;
- overflow-y: auto;
- border-right: 1px solid #e1e4e8;
- z-index: 1000;
- }
- .sidebar-header {
- padding: 24px;
- background: #ffffff;
- border-bottom: 1px solid #e1e4e8;
- margin-bottom: 16px;
- }
- .sidebar-header h4 {
- margin: 0;
- font-size: 1.25rem;
- font-weight: 700;
- color: #0d6efd;
- letter-spacing: -0.5px;
- }
- .nav-link {
- display: flex;
- align-items: center;
- padding: 12px 24px;
- color: #444d56;
- text-decoration: none;
- font-weight: 500;
- font-size: 0.95rem;
- transition: all 0.2s ease;
- border-left: 4px solid transparent;
- }
- .nav-link:hover {
- background-color: #f1f8ff;
- color: #0366d6;
- }
- .nav-link.active {
- background-color: #f1f8ff;
- color: #0366d6;
- border-left-color: #0366d6;
- font-weight: 600;
- }
- .nav-section-label {
- padding: 16px 24px 8px;
- font-size: 0.75rem;
- font-weight: 600;
- color: #959da5;
- text-transform: uppercase;
- letter-spacing: 1px;
- }
- </style>
- <div class="sidebar">
- <div class="sidebar-header">
- <h4>Hostel Admin</h4>
- </div>
- <div class="nav-section-label">Management</div>
- <a href="admin_hostel_students.php" class="nav-link ' . ($currentPage == 'admin_hostel_students.php' ? 'active' : '') . '">Student Records</a>
- <a href="admin_hostel_rooms.php" class="nav-link ' . ($currentPage == 'admin_hostel_rooms.php' ? 'active' : '') . '">Room Allocation</a>
- <a href="admin_complaints.php" class="nav-link ' . ($currentPage == 'admin_complaints.php' ? 'active' : '') . '">Complaints</a>
- <div class="nav-section-label">Mess & Leaves</div>
- <a href="admin_mess_leaves_view.php" class="nav-link ' . ($currentPage == 'admin_mess_leaves_view.php' ? 'active' : '') . '">Mess Leaves</a>
- <a href="admin_consolidated_mess_leaves_view.php" class="nav-link ' . ($currentPage == 'admin_consolidated_mess_leaves_view.php' ? 'active' : '') . '">Consolidated Leaves</a>
- <div class="nav-section-label">Finance</div>
- <a href="admin_check_fines.php" class="nav-link ' . ($currentPage == 'admin_check_fines.php' ? 'active' : '') . '">Fines & Penalties</a>
- <div style="margin-top: auto; padding: 24px; border-top: 1px solid #e1e4e8;">
- <a href="../../logout.php" class="nav-link" style="color: #d73a49;">Sign Out</a>
- </div>
- </div>';
- }
Advertisement
Add Comment
Please, Sign In to add comment