setFlashdata('success', 'Evento apagado — fica na lixeira 30 dias.'); header('Location: ' . base_url('views/admin/events/index.php')); exit; } $items = db_events_list($pdo, true); // include soft-deleted so they can be restored if (isset($_GET['csv'])) { $rows = []; foreach ($items as $item) { $rows[] = [$item['title'], $item['summary'] ?? '', format_date_pt((string) $item['publish_from']), format_date_pt((string) $item['publish_until']), events_status($item), db_event_leads_count($pdo, (int) $item['e_id'])]; } csv_export('event', 'eventos', 'Exportação CSV de eventos', ['Evento', 'Resumo', 'Início', 'Fim', 'Estado', 'Leads'], $rows); } // Status badge styling + label (PT). $badge = [ 'active' => ['bg-success', 'Ativo'], 'scheduled' => ['bg-info text-dark', 'Agendado'], 'expired' => ['bg-secondary', 'Expirado'], 'inactive' => ['bg-warning text-dark', 'Inativo'], 'deleted' => ['bg-dark', 'Apagado'], ]; $page_title = 'Eventos'; include __DIR__ . '/../../../includes/header.php'; ?>
| Evento | Estado | Janela de publicação | Leads | Ações |
|---|---|---|---|---|
| Nenhum evento. Criar o primeiro. | ||||
|
= htmlspecialchars($item['title']) ?>
= htmlspecialchars($item['summary']) ?>
/evento/= htmlspecialchars($item['slug']) ?>
|
= $lbl ?> | = htmlspecialchars(format_date_pt((string) $item['publish_from'])) ?> → = htmlspecialchars(format_date_pt((string) $item['publish_until'])) ?> | = $leads > 0 ? '' . $leads . '' : '0' ?> | |