'Tickets', 'icon' => 'fa-life-ring', 'total' => $total, 'rows' => $rows, 'all' => 'tickets.php?' . http_build_query(['tab' => 'all', 'q' => $q])]; // Documents shared with them - for those who see the company's IT if ($can_documents) { $where = "document_client_id = $session_client_id AND document_client_visible = 1 AND document_archived_at IS NULL AND (document_name LIKE '%$q_sql%' OR document_description LIKE '%$q_sql%' OR document_content_raw LIKE '%$q_sql%')"; $total = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM documents WHERE $where"))[0]); $rows = []; if ($total) { $sql = mysqli_query($mysqli, "SELECT document_id, document_name, document_description, document_created_at, document_updated_at, folder_name, (SELECT file_ext FROM document_files JOIN files ON files.file_id = document_files.file_id WHERE document_files.document_id = documents.document_id ORDER BY files.file_id LIMIT 1) AS file_ext FROM documents LEFT JOIN folders ON folder_id = document_folder_id AND folder_client_id = $session_client_id WHERE $where ORDER BY (document_name LIKE '%$q_sql%') DESC, COALESCE(document_updated_at, document_created_at) DESC LIMIT $limit"); while ($row = mysqli_fetch_assoc($sql)) { $rows[] = $row; } } $sections['documents'] = ['label' => 'Documents', 'icon' => 'fa-folder-open', 'total' => $total, 'rows' => $rows, 'all' => 'documents.php?' . http_build_query(['q' => $q])]; } // Help - the articles shared with them if ($can_help) { $where = kbClientSql($session_client_id) . " AND (kb_article_title LIKE '%$q_sql%' OR kb_article_summary LIKE '%$q_sql%' OR MATCH(kb_article_content_raw) AGAINST ('$q_sql'))"; $total = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM kb_articles WHERE $where"))[0]); $rows = []; if ($total) { $sql = mysqli_query($mysqli, "SELECT kb_article_id, kb_article_title, kb_article_summary, kb_article_content, kb_article_created_at, kb_article_updated_at, category_name, category_icon FROM kb_articles LEFT JOIN categories ON category_id = kb_article_category_id AND kb_article_category_id > 0 WHERE $where ORDER BY (kb_article_title LIKE '%$q_sql%') DESC, MATCH(kb_article_content_raw) AGAINST ('$q_sql') DESC, kb_article_title ASC LIMIT $limit"); while ($row = mysqli_fetch_assoc($sql)) { $rows[] = $row; } } elseif (!portalViewingAs()) { // Nothing in Help - on the Knowledge Base's Not found list, as a search in Help is kbSearchMissSave($q, 'portal', $session_client_id); } $sections['help'] = ['label' => 'Help', 'icon' => 'fa-book', 'total' => $total, 'rows' => $rows, 'all' => 'kb.php?' . http_build_query(['q' => $q])]; } } $found = array_sum(array_column($sections, 'total')); ?>

Search

'What are you looking for?', 'text' => 'Type a word or a ticket number - it looks through your tickets and what was said on them' . ($can_documents ? ', your documents' : '') . ($can_help ? ' and our Help articles' : '') . '.', 'icon' => 'fa-search', 'filtered' => false]) ?>
'Nothing found', 'text' => 'Nothing mentions “' . escapeHtml($q) . '”. Try another word - or ask us.', 'icon' => 'fa-search', 'filtered' => false, 'actions' => [['label' => 'Ask Us', 'href' => portalAskUrl($q), 'icon' => 'fa-plus']]]) ?>
$section) { if (!$section['total']) { continue; } ?>

count($section['rows'])) { ?> See all