Agent Banners - every banner along the top of agents' pages (functions/agent_banner.php): * those for every client, made here, and those for one client, made here or from the client's * ⋮ menu. Each row shows how loud it is, where it stands (showing, scheduled, ended), who it is * for and when it shows. Current holds what isn't archived; Archived what is. Search looks in * the title and message; the client filter picks every client's or one client's. The handlers * are agent/post/agent_banner.php and the windows agent/modals/agent_banner/, shared with the * client's menu. */ // Default Column Sortby Filter $sort = "starts"; $order = "DESC"; require_once "includes/inc_all_admin.php"; $views = [ '' => ['label' => 'Current', 'icon' => 'fa-bullhorn', 'where' => 'announcement_archived_at IS NULL', 'title' => 'Showing, still to come, or ended and not archived'], 'archived' => ['label' => 'Archived', 'icon' => 'fa-archive', 'where' => 'announcement_archived_at IS NOT NULL', 'title' => 'Nobody sees them'], ]; $show = (string) ($_GET['show'] ?? ''); $show = isset($views[$show]) ? $show : ''; $show_archived = $show === 'archived'; // Who it is for: any, every client (0), or one client $client_filter = (string) ($_GET['client'] ?? ''); $client_filter = $client_filter === 'every' ? 'every' : (intval($client_filter) > 0 ? (string) intval($client_filter) : ''); // Only these sort - an unknown column would take the page down $sortable_columns = [ 'announcement_title' => "announcement_title $order", 'client_name' => "announcement_client_id > 0 $order, client_name $order", 'starts' => "COALESCE(announcement_starts_at, announcement_created_at) $order", 'ends' => "announcement_ends_at IS NULL $order, announcement_ends_at $order", ]; if (!isset($sortable_columns[$sort])) { $sort = 'starts'; } $filters = "announcement_audience = 'agents' AND (announcement_title LIKE '%$q%' OR announcement_body LIKE '%$q%')"; if ($client_filter === 'every') { $filters .= " AND announcement_client_id = 0"; } elseif ($client_filter !== '') { $filters .= " AND announcement_client_id = " . intval($client_filter); } $ready = agentBannersReady(); $num_rows = [0]; $banners = []; $view_counts = ['' => 0, 'archived' => 0]; if ($ready) { $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS announcement_id, announcement_title, announcement_body, announcement_tone, announcement_client_id, announcement_starts_at, announcement_ends_at, announcement_created_at, announcement_archived_at, client_name, user_name FROM portal_announcements LEFT JOIN clients ON client_id = announcement_client_id LEFT JOIN users ON user_id = announcement_created_by WHERE $filters AND {$views[$show]['where']} ORDER BY {$sortable_columns[$sort]}, announcement_id DESC LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); while ($row = mysqli_fetch_assoc($sql)) { $banners[] = $row; } $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(announcement_archived_at IS NULL), 0), COALESCE(SUM(announcement_archived_at IS NOT NULL), 0) FROM portal_announcements LEFT JOIN clients ON client_id = announcement_client_id WHERE $filters")); $view_counts = ['' => intval($counts[0]), 'archived' => intval($counts[1])]; } $state_badges = ['showing' => 'text-bg-success', 'scheduled' => 'text-bg-info', 'ended' => 'text-bg-secondary', 'archived' => 'text-bg-secondary']; $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { return '' . $label . ($sort === $column ? " $order_icon" : '') . ''; }; $pill_url = function ($view) use ($client_filter) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'client' => $client_filter, 'show' => $view])); }; $add_url = '/agent/modals/agent_banner/agent_banner_add.php'; $csrf = $_SESSION['csrf_token']; ?>

Agent Banners

Banners come with the 3.7.2 database update - run it in Update.

Along the top of agents' pages - for every client on every page, or for one client on its pages and its tickets, invoices, quotes and projects. Agents who can edit a client add its banners from its ⋮ menu. Clients don't see them; for a note on the client portal, use announcements.

"> ' . escapeHtml($row['client_name']) . '' : 'A client no longer here') : 'Every client'; $from = $row['announcement_starts_at'] ? date('M j, Y g:i A', strtotime($row['announcement_starts_at'])) : date('M j, Y', strtotime($row['announcement_created_at'])); $until = $row['announcement_ends_at'] ? date('M j, Y g:i A', strtotime($row['announcement_ends_at'])) : 'Until archived'; ?>
Posted by
'banners', 'icon' => 'fa-bullhorn', 'filtered' => $q !== '' || $client_filter !== '', 'archived' => $show_archived, 'views' => ['show'], 'text' => 'A note your team sees along the top of their pages - "On credit hold, no work without approval", "Call before going onsite", an outage everyone should know about.', 'actions' => $ready ? [['label' => 'New Banner', 'modal' => $add_url, 'size' => 'lg']] : [], ]; require_once "../includes/filter_footer.php"; ?>