[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: dashboard.php
<?php /** * Teacher Dashboard * Main dashboard page for teachers showing their groups and quick actions */ require_once '../config/config.php'; requireLogin('teacher'); $database = new Database(); $conn = $database->getConnection(); $teacher_id = $_SESSION['teacher_id']; // Get teacher's statistics $stats = []; // Count active groups $query = "SELECT COUNT(*) as count FROM groups WHERE teacher_id = :teacher_id AND is_active = 1"; $stmt = $conn->prepare($query); $stmt->bindParam(':teacher_id', $teacher_id); $stmt->execute(); $stats['groups'] = $stmt->fetch(PDO::FETCH_ASSOC)['count']; // Count total students $query = "SELECT COUNT(DISTINCT s.id) as count FROM students s JOIN groups g ON s.group_id = g.id WHERE g.teacher_id = :teacher_id AND s.is_active = 1"; $stmt = $conn->prepare($query); $stmt->bindParam(':teacher_id', $teacher_id); $stmt->execute(); $stats['students'] = $stmt->fetch(PDO::FETCH_ASSOC)['count']; // Count today's sessions $today = date('Y-m-d'); $query = "SELECT COUNT(*) as count FROM groups g WHERE g.teacher_id = :teacher_id AND g.is_active = 1 AND ( (g.day1 = :today_name) OR (g.day2 = :today_name AND g.sessions_per_week = 2) )"; $stmt = $conn->prepare($query); $stmt->bindParam(':teacher_id', $teacher_id); $stmt->bindParam(':today_name', date('l')); // Day name in English $stmt->execute(); $stats['today_sessions'] = $stmt->fetch(PDO::FETCH_ASSOC)['count']; // Count students with high absence rate (>3 absences) $query = "SELECT COUNT(DISTINCT s.id) as count FROM students s JOIN groups g ON s.group_id = g.id WHERE g.teacher_id = :teacher_id AND s.is_active = 1 AND ( SELECT COUNT(*) FROM attendance a WHERE a.student_id = s.id AND a.is_present = 0 ) > 3"; $stmt = $conn->prepare($query); $stmt->bindParam(':teacher_id', $teacher_id); $stmt->execute(); $stats['absent_students'] = $stmt->fetch(PDO::FETCH_ASSOC)['count']; // Get recent groups $query = "SELECT g.*, CONCAT(st.name, ' - ', gr.name, ' - ', sub.name) as full_info, COUNT(s.id) as students_count FROM groups g JOIN grades gr ON g.grade_id = gr.id JOIN stages st ON gr.stage_id = st.id JOIN subjects sub ON g.subject_id = sub.id LEFT JOIN students s ON g.id = s.group_id AND s.is_active = 1 WHERE g.teacher_id = :teacher_id AND g.is_active = 1 GROUP BY g.id ORDER BY g.created_at DESC LIMIT 5"; $stmt = $conn->prepare($query); $stmt->bindParam(':teacher_id', $teacher_id); $stmt->execute(); $recent_groups = $stmt->fetchAll(PDO::FETCH_ASSOC); $page_title = 'لوحة تحكم المعلم'; include '../includes/header.php'; ?> <div class="container-fluid"> <div class="row"> <!-- Sidebar --> <div class="col-lg-3 col-md-4 sidebar p-0"> <div class="d-flex flex-column h-100"> <div class="p-3 text-white"> <h4 class="mb-0"> <i class="fas fa-chalkboard-teacher me-2"></i> لوحة المعلم </h4> <small>مرحباً <?php echo $_SESSION['teacher_name']; ?></small> </div> <nav class="nav nav-pills flex-column p-3"> <a class="nav-link active" href="dashboard.php"> <i class="fas fa-tachometer-alt me-2"></i>الرئيسية </a> <a class="nav-link" href="subjects_grades.php"> <i class="fas fa-book me-2"></i>المواد والصفوف </a> <a class="nav-link" href="groups.php"> <i class="fas fa-users me-2"></i>المجموعات </a> <a class="nav-link" href="students.php"> <i class="fas fa-user-graduate me-2"></i>الطلاب </a> <a class="nav-link" href="attendance.php"> <i class="fas fa-clipboard-check me-2"></i>تسجيل الحضور </a> <a class="nav-link" href="makeup_sessions.php"> <i class="fas fa-redo me-2"></i>حصص التعويض </a> <a class="nav-link" href="reports.php"> <i class="fas fa-chart-bar me-2"></i>التقارير </a> <div class="mt-auto"> <a class="nav-link text-light" href="../logout.php"> <i class="fas fa-sign-out-alt me-2"></i>تسجيل الخروج </a> </div> </nav> </div> </div> <!-- Main Content --> <div class="col-lg-9 col-md-8 main-content p-4"> <div class="d-flex justify-content-between align-items-center mb-4"> <h2>مرحباً <?php echo $_SESSION['teacher_name']; ?></h2> <span class="text-muted"> <i class="fas fa-calendar me-1"></i> <?php echo date('Y/m/d'); ?> </span> </div> <!-- Statistics Cards --> <div class="row mb-4"> <div class="col-lg-3 col-md-6 mb-3"> <div class="card bg-primary text-white"> <div class="card-body"> <div class="d-flex justify-content-between"> <div> <h3 class="mb-1"><?php echo $stats['groups']; ?></h3> <p class="mb-0">المجموعات النشطة</p> </div> <div class="align-self-center"> <i class="fas fa-users fa-2x"></i> </div> </div> </div> </div> </div> <div class="col-lg-3 col-md-6 mb-3"> <div class="card bg-success text-white"> <div class="card-body"> <div class="d-flex justify-content-between"> <div> <h3 class="mb-1"><?php echo $stats['students']; ?></h3> <p class="mb-0">إجمالي الطلاب</p> </div> <div class="align-self-center"> <i class="fas fa-user-graduate fa-2x"></i> </div> </div> </div> </div> </div> <div class="col-lg-3 col-md-6 mb-3"> <div class="card bg-info text-white"> <div class="card-body"> <div class="d-flex justify-content-between"> <div> <h3 class="mb-1"><?php echo $stats['today_sessions']; ?></h3> <p class="mb-0">حصص اليوم</p> </div> <div class="align-self-center"> <i class="fas fa-clock fa-2x"></i> </div> </div> </div> </div> </div> <div class="col-lg-3 col-md-6 mb-3"> <div class="card bg-warning text-white"> <div class="card-body"> <div class="d-flex justify-content-between"> <div> <h3 class="mb-1"><?php echo $stats['absent_students']; ?></h3> <p class="mb-0">طلاب بحاجة متابعة</p> </div> <div class="align-self-center"> <i class="fas fa-exclamation-triangle fa-2x"></i> </div> </div> </div> </div> </div> </div> <!-- Quick Actions --> <div class="row mb-4"> <div class="col-12"> <div class="card"> <div class="card-header"> <h5 class="mb-0">الإجراءات السريعة</h5> </div> <div class="card-body"> <div class="row"> <div class="col-lg-3 col-md-6 mb-3"> <a href="groups.php" class="btn btn-outline-primary w-100 h-100 d-flex flex-column justify-content-center"> <i class="fas fa-plus fa-2x mb-2"></i> إنشاء مجموعة جديدة </a> </div> <div class="col-lg-3 col-md-6 mb-3"> <a href="students.php" class="btn btn-outline-success w-100 h-100 d-flex flex-column justify-content-center"> <i class="fas fa-user-plus fa-2x mb-2"></i> إضافة طالب </a> </div> <div class="col-lg-3 col-md-6 mb-3"> <a href="attendance.php" class="btn btn-outline-info w-100 h-100 d-flex flex-column justify-content-center"> <i class="fas fa-clipboard-check fa-2x mb-2"></i> تسجيل الحضور </a> </div> <div class="col-lg-3 col-md-6 mb-3"> <a href="reports.php" class="btn btn-outline-warning w-100 h-100 d-flex flex-column justify-content-center"> <i class="fas fa-chart-bar fa-2x mb-2"></i> عرض التقارير </a> </div> </div> </div> </div> </div> </div> <!-- Recent Groups --> <div class="card"> <div class="card-header"> <h5 class="mb-0">المجموعات الحديثة</h5> </div> <div class="card-body"> <?php if (empty($recent_groups)): ?> <div class="text-center py-4"> <i class="fas fa-users fa-3x text-muted mb-3"></i> <h5>لا توجد مجموعات بعد</h5> <p class="text-muted">ابدأ بإنشاء مجموعة جديدة</p> <a href="groups.php" class="btn btn-primary"> <i class="fas fa-plus me-2"></i>إنشاء مجموعة </a> </div> <?php else: ?> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th>اسم المجموعة</th> <th>التفاصيل</th> <th>عدد الطلاب</th> <th>مواعيد الحصص</th> <th>الإجراءات</th> </tr> </thead> <tbody> <?php foreach ($recent_groups as $group): ?> <tr> <td> <strong><?php echo htmlspecialchars($group['name']); ?></strong> </td> <td> <small class="text-muted"><?php echo htmlspecialchars($group['full_info']); ?></small> </td> <td> <span class="badge bg-info"><?php echo $group['students_count']; ?> طالب</span> </td> <td> <small> <?php echo $group['day1'] . ' ' . date('g:i A', strtotime($group['time1'])); ?> <?php if ($group['sessions_per_week'] == 2): ?> <br><?php echo $group['day2'] . ' ' . date('g:i A', strtotime($group['time2'])); ?> <?php endif; ?> </small> </td> <td> <a href="students.php?group_id=<?php echo $group['id']; ?>" class="btn btn-sm btn-outline-primary"> <i class="fas fa-users"></i> </a> <a href="attendance.php?group_id=<?php echo $group['id']; ?>" class="btn btn-sm btn-outline-success"> <i class="fas fa-clipboard-check"></i> </a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <div class="text-center mt-3"> <a href="groups.php" class="btn btn-outline-primary"> عرض جميع المجموعات <i class="fas fa-arrow-left me-2"></i> </a> </div> <?php endif; ?> </div> </div> </div> </div> </div> <?php include '../includes/footer.php'; ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.87 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285