[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: dashboard.php
<?php /** * Parent Dashboard * This page shows student performance reports for parents */ require_once '../config/config.php'; requireLogin('parent'); $database = new Database(); $conn = $database->getConnection(); $student_id = $_SESSION['student_id']; $group_id = $_SESSION['group_id']; // Get date range from URL or default to current month $date_from = $_GET['date_from'] ?? date('Y-m-01'); $date_to = $_GET['date_to'] ?? date('Y-m-t'); // Get student and group information $student_query = "SELECT s.*, g.name as group_name, CONCAT(st.name, ' - ', gr.name, ' - ', sub.name) as full_info, t.name as teacher_name FROM students s JOIN groups g ON s.group_id = g.id 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 JOIN teachers t ON g.teacher_id = t.id WHERE s.id = :student_id"; $student_stmt = $conn->prepare($student_query); $student_stmt->bindParam(':student_id', $student_id); $student_stmt->execute(); $student_info = $student_stmt->fetch(PDO::FETCH_ASSOC); // Get attendance statistics $attendance_query = "SELECT COUNT(*) as total_sessions, SUM(CASE WHEN is_present = 1 THEN 1 ELSE 0 END) as present_sessions, SUM(CASE WHEN is_present = 0 THEN 1 ELSE 0 END) as absent_sessions, AVG(CASE WHEN has_test = 1 AND test_total_score > 0 THEN (student_test_score / test_total_score * 100) END) as test_average FROM attendance WHERE student_id = :student_id AND session_date BETWEEN :date_from AND :date_to"; $attendance_stmt = $conn->prepare($attendance_query); $attendance_stmt->bindParam(':student_id', $student_id); $attendance_stmt->bindParam(':date_from', $date_from); $attendance_stmt->bindParam(':date_to', $date_to); $attendance_stmt->execute(); $attendance_stats = $attendance_stmt->fetch(PDO::FETCH_ASSOC); // Get homework level distribution $homework_query = "SELECT homework_level, COUNT(*) as count FROM attendance WHERE student_id = :student_id AND homework_level IS NOT NULL AND session_date BETWEEN :date_from AND :date_to GROUP BY homework_level ORDER BY FIELD(homework_level, 'ممتاز', 'جيد جداً', 'جيد', 'مقبول', 'ضعيف')"; $homework_stmt = $conn->prepare($homework_query); $homework_stmt->bindParam(':student_id', $student_id); $homework_stmt->bindParam(':date_from', $date_from); $homework_stmt->bindParam(':date_to', $date_to); $homework_stmt->execute(); $homework_stats = $homework_stmt->fetchAll(PDO::FETCH_ASSOC); // Get makeup sessions count $makeup_query = "SELECT COUNT(*) as makeup_count FROM makeup_sessions WHERE student_id = :student_id AND session_date BETWEEN :date_from AND :date_to"; $makeup_stmt = $conn->prepare($makeup_query); $makeup_stmt->bindParam(':student_id', $student_id); $makeup_stmt->bindParam(':date_from', $date_from); $makeup_stmt->bindParam(':date_to', $date_to); $makeup_stmt->execute(); $makeup_stats = $makeup_stmt->fetch(PDO::FETCH_ASSOC); // Get recent attendance details $details_query = "SELECT session_date, session_time, is_present, homework_level, has_test, test_total_score, student_test_score, teacher_notes FROM attendance WHERE student_id = :student_id AND session_date BETWEEN :date_from AND :date_to ORDER BY session_date DESC, session_time DESC LIMIT 20"; $details_stmt = $conn->prepare($details_query); $details_stmt->bindParam(':student_id', $student_id); $details_stmt->bindParam(':date_from', $date_from); $details_stmt->bindParam(':date_to', $date_to); $details_stmt->execute(); $attendance_details = $details_stmt->fetchAll(PDO::FETCH_ASSOC); // Get test results $tests_query = "SELECT session_date, test_total_score, student_test_score, (student_test_score / test_total_score * 100) as percentage FROM attendance WHERE student_id = :student_id AND has_test = 1 AND test_total_score > 0 AND session_date BETWEEN :date_from AND :date_to ORDER BY session_date DESC"; $tests_stmt = $conn->prepare($tests_query); $tests_stmt->bindParam(':student_id', $student_id); $tests_stmt->bindParam(':date_from', $date_from); $tests_stmt->bindParam(':date_to', $date_to); $tests_stmt->execute(); $test_results = $tests_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-users me-2"></i> بوابة ولي الأمر </h4> <small>مرحباً بك</small> </div> <nav class="nav nav-pills flex-column p-3"> <a class="nav-link active" href="dashboard.php"> <i class="fas fa-chart-line 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"> <!-- Header --> <div class="d-flex justify-content-between align-items-center mb-4"> <h2>تقرير أداء الطالب</h2> <button class="btn btn-outline-primary" onclick="window.print()"> <i class="fas fa-print me-2"></i>طباعة التقرير </button> </div> <!-- Date Filter --> <div class="card mb-4"> <div class="card-header"> <h5 class="mb-0">فترة التقرير</h5> </div> <div class="card-body"> <form method="GET" action="dashboard.php"> <div class="row"> <div class="col-md-4"> <label for="dateFrom" class="form-label">من تاريخ</label> <input type="date" class="form-control" id="dateFrom" name="date_from" value="<?php echo $date_from; ?>" required> </div> <div class="col-md-4"> <label for="dateTo" class="form-label">إلى تاريخ</label> <input type="date" class="form-control" id="dateTo" name="date_to" value="<?php echo $date_to; ?>" required> </div> <div class="col-md-4 d-flex align-items-end"> <button type="submit" class="btn btn-primary w-100"> <i class="fas fa-filter me-2"></i>تحديث التقرير </button> </div> </div> </form> </div> </div> <!-- Student Info --> <div class="card mb-4"> <div class="card-header"> <h5 class="mb-0">معلومات الطالب</h5> </div> <div class="card-body"> <div class="row"> <div class="col-md-6"> <p><strong>اسم الطالب:</strong> <?php echo htmlspecialchars($student_info['name']); ?></p> <p><strong>كود الطالب:</strong> <span class="badge bg-info"><?php echo $student_info['student_code']; ?></span></p> <p><strong>المجموعة:</strong> <?php echo htmlspecialchars($student_info['group_name']); ?></p> </div> <div class="col-md-6"> <p><strong>المادة والصف:</strong> <?php echo htmlspecialchars($student_info['full_info']); ?></p> <p><strong>المعلم:</strong> <?php echo htmlspecialchars($student_info['teacher_name']); ?></p> <p><strong>فترة التقرير:</strong> <?php echo date('Y/m/d', strtotime($date_from)); ?> - <?php echo date('Y/m/d', strtotime($date_to)); ?></p> </div> </div> </div> </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 text-center"> <i class="fas fa-calendar-alt fa-2x mb-2"></i> <h3><?php echo $attendance_stats['total_sessions'] ?: 0; ?></h3> <p class="mb-0">إجمالي الحصص</p> </div> </div> </div> <div class="col-lg-3 col-md-6 mb-3"> <div class="card bg-success text-white"> <div class="card-body text-center"> <i class="fas fa-check-circle fa-2x mb-2"></i> <h3><?php echo $attendance_stats['present_sessions'] ?: 0; ?></h3> <p class="mb-0">حصص الحضور</p> </div> </div> </div> <div class="col-lg-3 col-md-6 mb-3"> <div class="card bg-danger text-white"> <div class="card-body text-center"> <i class="fas fa-times-circle fa-2x mb-2"></i> <h3><?php echo $attendance_stats['absent_sessions'] ?: 0; ?></h3> <p class="mb-0">حصص الغياب</p> </div> </div> </div> <div class="col-lg-3 col-md-6 mb-3"> <div class="card bg-info text-white"> <div class="card-body text-center"> <i class="fas fa-redo fa-2x mb-2"></i> <h3><?php echo $makeup_stats['makeup_count'] ?: 0; ?></h3> <p class="mb-0">حصص التعويض</p> </div> </div> </div> </div> <!-- Performance Metrics --> <div class="row mb-4"> <div class="col-md-6"> <div class="card"> <div class="card-header"> <h6 class="mb-0">نسبة الحضور</h6> </div> <div class="card-body text-center"> <?php $attendance_percentage = $attendance_stats['total_sessions'] > 0 ? ($attendance_stats['present_sessions'] / $attendance_stats['total_sessions']) * 100 : 0; $attendance_color = $attendance_percentage >= 80 ? 'success' : ($attendance_percentage >= 60 ? 'warning' : 'danger'); ?> <div class="progress mb-3" style="height: 20px;"> <div class="progress-bar bg-<?php echo $attendance_color; ?>" role="progressbar" style="width: <?php echo $attendance_percentage; ?>%" aria-valuenow="<?php echo $attendance_percentage; ?>" aria-valuemin="0" aria-valuemax="100"> <?php echo number_format($attendance_percentage, 1); ?>% </div> </div> <h4 class="text-<?php echo $attendance_color; ?>"><?php echo number_format($attendance_percentage, 1); ?>%</h4> </div> </div> </div> <?php if ($attendance_stats['test_average']): ?> <div class="col-md-6"> <div class="card"> <div class="card-header"> <h6 class="mb-0">متوسط الدرجات</h6> </div> <div class="card-body text-center"> <?php $test_average = $attendance_stats['test_average']; $test_color = $test_average >= 80 ? 'success' : ($test_average >= 60 ? 'warning' : 'danger'); ?> <div class="progress mb-3" style="height: 20px;"> <div class="progress-bar bg-<?php echo $test_color; ?>" role="progressbar" style="width: <?php echo $test_average; ?>%" aria-valuenow="<?php echo $test_average; ?>" aria-valuemin="0" aria-valuemax="100"> <?php echo number_format($test_average, 1); ?>% </div> </div> <h4 class="text-<?php echo $test_color; ?>"><?php echo number_format($test_average, 1); ?>%</h4> </div> </div> </div> <?php endif; ?> </div> <!-- Homework Distribution --> <?php if (!empty($homework_stats)): ?> <div class="card mb-4"> <div class="card-header"> <h5 class="mb-0">توزيع مستويات الواجبات</h5> </div> <div class="card-body"> <div class="row text-center"> <?php $homework_colors = [ 'ممتاز' => 'success', 'جيد جداً' => 'info', 'جيد' => 'primary', 'مقبول' => 'warning', 'ضعيف' => 'danger' ]; foreach ($homework_stats as $homework): ?> <div class="col-md-2 mb-3"> <div class="card bg-<?php echo $homework_colors[$homework['homework_level']] ?? 'secondary'; ?> text-white"> <div class="card-body"> <h4><?php echo $homework['count']; ?></h4> <p class="mb-0 small"><?php echo $homework['homework_level']; ?></p> </div> </div> </div> <?php endforeach; ?> </div> </div> </div> <?php endif; ?> <!-- Test Results --> <?php if (!empty($test_results)): ?> <div class="card mb-4"> <div class="card-header"> <h5 class="mb-0">نتائج الاختبارات</h5> </div> <div class="card-body"> <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 ($test_results as $test): ?> <tr> <td><?php echo date('Y/m/d', strtotime($test['session_date'])); ?></td> <td><?php echo $test['student_test_score']; ?></td> <td><?php echo $test['test_total_score']; ?></td> <td> <?php $percentage = $test['percentage']; $badge_color = $percentage >= 80 ? 'success' : ($percentage >= 60 ? 'warning' : 'danger'); ?> <span class="badge bg-<?php echo $badge_color; ?>"> <?php echo number_format($percentage, 1); ?>% </span> </td> <td> <?php if ($percentage >= 90) echo '<span class="badge bg-success">ممتاز</span>'; elseif ($percentage >= 80) echo '<span class="badge bg-info">جيد جداً</span>'; elseif ($percentage >= 70) echo '<span class="badge bg-primary">جيد</span>'; elseif ($percentage >= 60) echo '<span class="badge bg-warning">مقبول</span>'; else echo '<span class="badge bg-danger">ضعيف</span>'; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> <?php endif; ?> <!-- Attendance Details --> <?php if (!empty($attendance_details)): ?> <div class="card"> <div class="card-header"> <h5 class="mb-0">تفاصيل الحضور والأداء</h5> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th>التاريخ</th> <th>الوقت</th> <th>الحضور</th> <th>مستوى الواجب</th> <th>نتيجة الاختبار</th> <th>ملاحظات المعلم</th> </tr> </thead> <tbody> <?php foreach ($attendance_details as $detail): ?> <tr> <td><?php echo date('Y/m/d', strtotime($detail['session_date'])); ?></td> <td><?php echo date('g:i A', strtotime($detail['session_time'])); ?></td> <td> <span class="badge bg-<?php echo $detail['is_present'] ? 'success' : 'danger'; ?>"> <?php echo $detail['is_present'] ? 'حاضر' : 'غائب'; ?> </span> </td> <td> <?php if ($detail['homework_level']): ?> <span class="badge bg-<?php echo $homework_colors[$detail['homework_level']] ?? 'secondary'; ?>"> <?php echo $detail['homework_level']; ?> </span> <?php else: ?> <span class="text-muted">-</span> <?php endif; ?> </td> <td> <?php if ($detail['has_test']): ?> <?php $test_percentage = ($detail['student_test_score'] / $detail['test_total_score']) * 100; $test_badge_color = $test_percentage >= 80 ? 'success' : ($test_percentage >= 60 ? 'warning' : 'danger'); ?> <span class="badge bg-<?php echo $test_badge_color; ?>"> <?php echo $detail['student_test_score']; ?>/<?php echo $detail['test_total_score']; ?> (<?php echo number_format($test_percentage, 1); ?>%) </span> <?php else: ?> <span class="text-muted">لا يوجد</span> <?php endif; ?> </td> <td> <?php if ($detail['teacher_notes']): ?> <small><?php echo htmlspecialchars($detail['teacher_notes']); ?></small> <?php else: ?> <span class="text-muted">-</span> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> <?php endif; ?> </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