Sindbad~EG File Manager

Current Path : /home/copmadinaarea/thecopmadinaarea.org/reports/includes/
Upload File :
Current File : /home/copmadinaarea/thecopmadinaarea.org/reports/includes/header.php

<?php
if (!isset($_SESSION['user_id'])) {
    header('Location: ../login.php');
    exit();
}

if (!checkSessionTimeout()) {
    header('Location: ../login.php');
    exit();
}

$site_title = getSetting('site_title', 'COP Madina Area Reports');
$user_notifications = getNotifications($_SESSION['user_id'], true);
$notification_count = count($user_notifications);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo isset($page_title) ? htmlspecialchars($page_title) . ' - ' : ''; ?><?php echo htmlspecialchars($site_title); ?></title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        'cop-blue': '#1e40af',
                        'cop-light-blue': '#3b82f6',
                        'cop-gray': '#6b7280',
                        'cop-dark-blue': '#1e3a8a',
                    }
                }
            }
        }
    </script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .sidebar-gradient {
            background: linear-gradient(180deg, #1e40af 0%, #1e3a8a 100%);
        }
        .glass-effect {
            backdrop-filter: blur(16px) saturate(180%);
            -webkit-backdrop-filter: blur(16px) saturate(180%);
            background-color: rgba(255, 255, 255, 0.95);
            border: 1px solid rgba(209, 213, 219, 0.3);
        }
        .notification-badge {
            animation: pulse 2s infinite;
        }
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }
    </style>
</head>
<body class="bg-gray-100">
    <div id="app" class="flex h-screen">
        <!-- Sidebar -->
        <div class="sidebar-gradient w-64 shadow-lg flex flex-col">
            <div class="flex-shrink-0 p-6 pb-4">
                <!-- Logo and Title -->
                <div class="flex items-center mb-8">
                    <div class="w-10 h-10 bg-white rounded-lg flex items-center justify-center mr-3">
                        <i class="fas fa-church text-cop-blue text-lg"></i>
                    </div>
                    <div>
                        <h1 class="text-white font-bold text-lg">COP Madina</h1>
                        <p class="text-blue-200 text-xs">Reports System</p>
                    </div>
                </div>

                <!-- User Info -->
                <div class="bg-white/10 rounded-lg p-3 mb-4">
                    <div class="flex items-center">
                        <div class="w-10 h-10 bg-white/20 rounded-full flex items-center justify-center mr-3">
                            <i class="fas fa-user text-white text-sm"></i>
                        </div>
                        <div>
                            <p class="text-white font-medium text-sm"><?php echo htmlspecialchars($_SESSION['first_name'] . ' ' . $_SESSION['last_name']); ?></p>
                            <p class="text-blue-200 text-xs capitalize"><?php echo htmlspecialchars($_SESSION['user_level'] . ' - ' . $_SESSION['user_role']); ?></p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Scrollable Navigation Menu -->
            <div class="flex-1 overflow-y-auto px-6 pb-6">
                <nav class="space-y-1">
                    <a href="<?php echo $_SESSION['user_level']; ?>.php" 
                       class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == $_SESSION['user_level'] . '.php') ? 'bg-white/20' : ''; ?>">
                        <i class="fas fa-tachometer-alt mr-3 text-sm"></i>
                        <span class="text-sm">Dashboard</span>
                    </a>
                    
                    <a href="profile.php" 
                       class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'profile.php') ? 'bg-white/20' : ''; ?>">
                        <i class="fas fa-user-circle mr-3 text-sm"></i>
                        <span class="text-sm">Profile</span>
                    </a>
                    
                    <a href="notifications.php" 
                       class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'notifications.php') ? 'bg-white/20' : ''; ?>">
                        <i class="fas fa-bell mr-3 text-sm"></i>
                        <span class="text-sm">Notifications</span>
                        <?php if ($notification_count > 0): ?>
                        <span class="ml-auto bg-red-500 text-white text-xs rounded-full w-4 h-4 flex items-center justify-center">
                            <?php echo $notification_count > 9 ? '9+' : $notification_count; ?>
                        </span>
                        <?php endif; ?>
                    </a>

                    <!-- Data Entry Section -->
                    <div class="pt-3">
                        <p class="text-blue-200 text-xs uppercase tracking-wider font-semibold mb-1 px-3">Data Entry</p>
                        <a href="demography-entry.php" 
                           class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'demography-entry.php') ? 'bg-white/20' : ''; ?>">
                            <i class="fas fa-users mr-3 text-sm"></i>
                            <span class="text-sm">Demography 1</span>
                        </a>
                    </div>

                    <!-- Data Edit Section -->
                    <div class="pt-3">
                        <p class="text-blue-200 text-xs uppercase tracking-wider font-semibold mb-1 px-3">Data Edit</p>
                        <a href="demography-edit.php" 
                           class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'demography-edit.php') ? 'bg-white/20' : ''; ?>">
                            <i class="fas fa-users-cog mr-3 text-sm"></i>
                            <span class="text-sm">Demography 1</span>
                        </a>
                    </div>

                    <!-- Reports Section -->
                    <div class="pt-3">
                        <p class="text-blue-200 text-xs uppercase tracking-wider font-semibold mb-1 px-3">Reports</p>
                        <a href="demography-reports.php" 
                           class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'demography-reports.php') ? 'bg-white/20' : ''; ?>">
                            <i class="fas fa-chart-pie mr-3 text-sm"></i>
                            <span class="text-sm">Demography 1 Reports</span>
                        </a>
                    </div>

                    <!-- Admin Sections -->
                    <?php if ($_SESSION['user_role'] == 'admin' || $_SESSION['user_level'] == 'superuser'): ?>
                    <div class="pt-3">
                        <p class="text-blue-200 text-xs uppercase tracking-wider font-semibold mb-1 px-3">Admin</p>
                        <a href="settings.php" 
                           class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'settings.php') ? 'bg-white/20' : ''; ?>">
                            <i class="fas fa-cog mr-3 text-sm"></i>
                            <span class="text-sm">Settings</span>
                        </a>
                        
                        <a href="location-management.php" 
                           class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'location-management.php') ? 'bg-white/20' : ''; ?>">
                            <i class="fas fa-map-marker-alt mr-3 text-sm"></i>
                            <span class="text-sm">Location Management</span>
                        </a>
                        
                        <a href="audit.php" 
                           class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'audit.php') ? 'bg-white/20' : ''; ?>">
                            <i class="fas fa-history mr-3 text-sm"></i>
                            <span class="text-sm">Audit</span>
                        </a>
                        
                        <a href="maintenance.php" 
                           class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'maintenance.php') ? 'bg-white/20' : ''; ?>">
                            <i class="fas fa-tools mr-3 text-sm"></i>
                            <span class="text-sm">Maintenance</span>
                        </a>
                        
                        <?php if ($_SESSION['user_level'] == 'superuser'): ?>
                        <a href="user-management.php" 
                           class="flex items-center px-3 py-2 text-white hover:bg-white/10 rounded-lg transition duration-200 <?php echo (basename($_SERVER['PHP_SELF']) == 'user-management.php') ? 'bg-white/20' : ''; ?>">
                            <i class="fas fa-users-cog mr-3 text-sm"></i>
                            <span class="text-sm">User Management</span>
                        </a>
                        <?php endif; ?>
                    </div>
                    <?php endif; ?>

                    <!-- Logout -->
                    <div class="pt-4 mt-auto">
                        <a href="../logout.php" 
                           class="flex items-center px-3 py-2 text-red-200 hover:bg-red-500/20 rounded-lg transition duration-200">
                            <i class="fas fa-sign-out-alt mr-3 text-sm"></i>
                            <span class="text-sm">Logout</span>
                        </a>
                    </div>
                </nav>
            </div>
        </div>

        <!-- Main Content -->
        <div class="flex-1 flex flex-col overflow-hidden">
            <!-- Top Header -->
            <header class="bg-white shadow-sm border-b border-gray-200">
                <div class="flex items-center justify-between px-6 py-4">
                    <div>
                        <h2 class="text-2xl font-semibold text-gray-800"><?php echo isset($page_title) ? htmlspecialchars($page_title) : 'Dashboard'; ?></h2>
                        <p class="text-gray-600 text-sm"><?php echo isset($page_description) ? htmlspecialchars($page_description) : 'Welcome to your dashboard'; ?></p>
                    </div>
                    
                    <div class="flex items-center space-x-4">
                        <!-- Notifications -->
                        <div class="relative">
                            <button @click="showNotifications = !showNotifications" 
                                    class="relative p-2 text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-lg transition duration-200">
                                <i class="fas fa-bell text-lg"></i>
                                <?php if ($notification_count > 0): ?>
                                <span class="absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center notification-badge">
                                    <?php echo $notification_count > 9 ? '9+' : $notification_count; ?>
                                </span>
                                <?php endif; ?>
                            </button>
                            
                            <!-- Notifications Dropdown -->
                            <div v-show="showNotifications" 
                                 class="absolute right-0 mt-2 w-80 bg-white rounded-lg shadow-lg border border-gray-200 z-50">
                                <div class="p-4 border-b border-gray-200">
                                    <h3 class="font-semibold text-gray-800">Notifications</h3>
                                </div>
                                <div class="max-h-64 overflow-y-auto">
                                    <?php if (empty($user_notifications)): ?>
                                    <div class="p-4 text-center text-gray-500">
                                        <i class="fas fa-bell-slash text-2xl mb-2"></i>
                                        <p>No new notifications</p>
                                    </div>
                                    <?php else: ?>
                                        <?php foreach ($user_notifications as $notification): ?>
                                        <div class="p-4 border-b border-gray-100 hover:bg-gray-50">
                                            <div class="flex items-start">
                                                <div class="flex-shrink-0 mr-3">
                                                    <i class="fas fa-info-circle text-<?php echo $notification['type'] == 'error' ? 'red' : ($notification['type'] == 'warning' ? 'yellow' : ($notification['type'] == 'success' ? 'green' : 'blue')); ?>-500"></i>
                                                </div>
                                                <div class="flex-1">
                                                    <p class="font-medium text-gray-800"><?php echo htmlspecialchars($notification['title']); ?></p>
                                                    <p class="text-sm text-gray-600"><?php echo htmlspecialchars($notification['message']); ?></p>
                                                    <p class="text-xs text-gray-400 mt-1"><?php echo getRelativeTime($notification['created_at']); ?></p>
                                                </div>
                                            </div>
                                        </div>
                                        <?php endforeach; ?>
                                    <?php endif; ?>
                                </div>
                                <?php if (!empty($user_notifications)): ?>
                                <div class="p-4 border-t border-gray-200">
                                    <a href="notifications.php" class="text-sm text-cop-blue hover:text-cop-light-blue">View all notifications</a>
                                </div>
                                <?php endif; ?>
                            </div>
                        </div>

                        <!-- User Menu -->
                        <div class="relative">
                            <button @click="showUserMenu = !showUserMenu" 
                                    class="flex items-center space-x-2 p-2 text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-lg transition duration-200">
                                <div class="w-8 h-8 bg-cop-blue rounded-full flex items-center justify-center">
                                    <span class="text-white text-sm font-medium">
                                        <?php echo strtoupper(substr($_SESSION['first_name'], 0, 1) . substr($_SESSION['last_name'], 0, 1)); ?>
                                    </span>
                                </div>
                                <i class="fas fa-chevron-down text-xs"></i>
                            </button>
                            
                            <!-- User Dropdown -->
                            <div v-show="showUserMenu" 
                                 class="absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 z-50">
                                <div class="p-4 border-b border-gray-200">
                                    <p class="font-medium text-gray-800"><?php echo htmlspecialchars($_SESSION['first_name'] . ' ' . $_SESSION['last_name']); ?></p>
                                    <p class="text-sm text-gray-600"><?php echo htmlspecialchars($_SESSION['email']); ?></p>
                                </div>
                                <div class="py-2">
                                    <a href="profile.php" class="block px-4 py-2 text-gray-700 hover:bg-gray-100">
                                        <i class="fas fa-user mr-2"></i>Profile
                                    </a>
                                    <a href="../logout.php" class="block px-4 py-2 text-red-600 hover:bg-red-50">
                                        <i class="fas fa-sign-out-alt mr-2"></i>Logout
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </header>

            <!-- Main Content Area -->
            <main class="flex-1 overflow-y-auto p-6">
                <div class="max-w-7xl mx-auto">

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists