⚝
One Hat Cyber Team
⚝
Your IP:
216.73.217.70
Server IP:
209.74.65.82
Server:
Linux 209-74-65-82.cprapid.com 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
PHP Version:
8.1.34
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
ivsoxidh
/
system.ivsoftdesign.mk
/
Edit File: admin_dashboard.php
<?php require_once __DIR__ . '/auth.php'; require_once __DIR__ . '/functions.php'; if (!is_admin()) { header('Location: user_dashboard.php'); exit; } $year = (int)($_GET['year'] ?? date('Y')); $month = (int)($_GET['month'] ?? date('n')); $employee_id = (int)($_GET['employee_id'] ?? 0); $employees = all_employees(); if ($employee_id === 0 && !empty($employees)) $employee_id = $employees[0]['id']; if (isset($_GET['export']) && $_GET['export'] === 'csv') { header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename=leaves_'.$year.'.csv'); $out = fopen('php://output', 'w'); fputcsv($out, ['User','Email','Team','Date','Reason']); $stmt = $pdo->prepare("SELECT u.name,u.email,u.team_id, l.date,l.reason FROM leave_days l JOIN users u ON u.id=l.user_id WHERE YEAR(l.date)=? ORDER BY u.name,l.date"); $stmt->execute([$year]); while ($r = $stmt->fetch()) fputcsv($out, [$r['name'], $r['email'], team_name($r['team_id']), $r['date'], $r['reason']]); exit; } include __DIR__ . '/partials/header.php'; ?> <div class="d-flex justify-content-between align-items-center mb-3"> <h1 class="h4 mb-0">Админ</h1> <a class="btn btn-outline-secondary btn-sm" href="?year=<?= (int)$year ?>&export=csv">Export CSV</a> </div> <div class="row g-4"> <div class="col-lg-4"> <div class="card shadow-sm"> <div class="card-body"> <h2 class="h6">Преглед по вработени (<?= (int)$year ?>)</h2> <table class="table table-sm"> <thead><tr><th>Име</th><th class="text-center">Земени</th><th class="text-center">Преостан.</th><th>Тим</th></tr></thead> <tbody> <?php foreach ($employees as $e): $taken = leave_count_in_year($e['id'], $year); $remain = max(0, MAX_LEAVE_DAYS_PER_YEAR - $taken); ?> <tr> <td><?= htmlspecialchars($e['name']) ?></td> <td class="text-center"><?= (int)$taken ?></td> <td class="text-center"><?= (int)$remain ?></td> <td><?= htmlspecialchars(team_name($e['team_id'])) ?></td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> <div class="col-lg-8"> <div class="card shadow-sm mb-3"> <div class="card-body"> <form class="row g-2 align-items-end" method="get"> <div class="col-auto"> <label class="form-label">Вработен</label> <select name="employee_id" class="form-select"> <?php foreach ($employees as $e): ?> <option value="<?= (int)$e['id'] ?>" <?= $e['id']==$employee_id?'selected':'' ?>><?= htmlspecialchars($e['name']) ?></option> <?php endforeach; ?> </select> </div> <div class="col-auto"> <label class="form-label">Месец</label> <select name="month" class="form-select"> <?php for($m=1;$m<=12;$m++): ?> <option value="<?= $m ?>" <?= $m==$month?'selected':'' ?>><?= $m ?></option> <?php endfor; ?> </select> </div> <div class="col-auto"> <label class="form-label">Година</label> <input type="number" name="year" class="form-control" value="<?= (int)$year ?>"> </div> <div class="col-auto"> <button class="btn btn-outline-primary">Прикажи</button> </div> </form> </div> </div> <div class="card shadow-sm"> <div class="card-body"> <h2 class="h6 mb-3">Календар — <?= htmlspecialchars(find_user($employee_id)['name'] ?? '') ?></h2> <?php render_calendar($month, $year, $employee_id); ?> </div> </div> </div> </div> <?php include __DIR__ . '/partials/footer.php'; ?>
Simpan