Custom Links - your own links in ITFlow's menus: your RMM, your * documentation, a booking page for clients. Tabs for each menu - the agent * menu, the top bar, the client portal, the admin menu and the reports menu - * with how many each holds, and the archived ones, which are kept but not * shown. Each row shows the link as its menu draws it, what it is for, where * it goes and whether it opens in a new tab. On a menu's tab they are in that * menu's order and can be dragged into another (or moved up and down from * the row's menu). The work is in functions/custom_link.php; the handlers * are admin/post/custom_link.php. */ // Default Column Sortby Filter - the order the menus show them in $sort = "custom_link_order"; $order = "ASC"; require_once "includes/inc_all_admin.php"; $locations = customLinkLocations(); // The tabs: every menu, each menu, and the archived ones $views = ['' => ['label' => 'All menus', 'icon' => 'fa-th-list', 'where' => 'custom_link_archived_at IS NULL', 'title' => 'Every link that shows in a menu']]; foreach ($locations as $location => $location_config) { $views[(string) $location] = ['label' => $location_config['label'], 'icon' => $location_config['icon'], 'where' => "custom_link_archived_at IS NULL AND custom_link_location = $location", 'title' => $location_config['about']]; } $views['archived'] = ['label' => 'Archived', 'icon' => 'fa-archive', 'where' => 'custom_link_archived_at IS NOT NULL', 'title' => 'Kept, but not shown in any menu']; $show = (string) ($_GET['show'] ?? ''); $show = isset($views[$show]) ? $show : ''; $show_location = $show !== '' && $show !== 'archived' ? intval($show) : 0; // Only these sort - an unknown column would take the page down $sortable_columns = [ 'custom_link_order' => "custom_link_location ASC, custom_link_order $order, custom_link_name ASC", 'custom_link_name' => "custom_link_name $order", 'custom_link_location' => "custom_link_location $order, custom_link_order ASC, custom_link_name ASC", 'custom_link_uri' => "custom_link_uri $order", ]; if (!isset($sortable_columns[$sort])) { $sort = 'custom_link_order'; } $filters = "(custom_link_name LIKE '%$q%' OR custom_link_uri LIKE '%$q%' OR custom_link_description LIKE '%$q%')"; $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS custom_link_id, custom_link_name, custom_link_description, custom_link_uri, custom_link_new_tab, custom_link_icon, custom_link_location, custom_link_order, custom_link_archived_at FROM custom_links WHERE $filters AND {$views[$show]['where']} ORDER BY {$sortable_columns[$sort]}, custom_link_id ASC LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT " . implode(', ', array_map(function ($view) { return "COALESCE(SUM({$view['where']}), 0)"; }, $views)) . " FROM custom_links WHERE $filters")); $view_counts = array_combine(array_keys($views), $counts); // Dragging into order: one menu's links, in its order, with nothing searched $can_reorder = $show_location && $sort === 'custom_link_order' && $order === 'ASC' && $q === '' && $num_rows[0] > 1; $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { return '' . $label . ($sort === $column ? " $order_icon" : '') . ''; }; $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; $add_url = 'modals/custom_link/custom_link_add.php' . ($show_location ? "?location=$show_location" : ''); $csrf = $_SESSION['csrf_token']; ?>
| Order | = $sort_link('custom_link_name', 'Link') ?> | = $sort_link('custom_link_location', 'Shows in') ?> | = $sort_link('custom_link_uri', 'Goes to') ?> | |
|---|---|---|---|---|
|
= $name ?>
= escapeHtml($description) ?>
Goes nowhere in its menu - edit its address
Archived = date('M j, Y', strtotime($row['custom_link_archived_at'])) ?>
= $where_html ?>
= $goes_html ?>
|
= $where_html ?> | = $goes_html ?> |
|