forked from unacms/una
-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchKeyword.php
42 lines (34 loc) · 1.21 KB
/
searchKeyword.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Copyright (c) UNA, Inc - https://una.io
* MIT License - https://opensource.org/licenses/MIT
*
* @defgroup UnaCore UNA Core
* @{
*/
require_once('./inc/header.inc.php');
require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
$sClass = 'BxTemplSearch';
$sElsName = 'bx_elasticsearch';
$sElsMethod = 'is_configured';
if(BxDolRequest::serviceExists($sElsName, $sElsMethod) && BxDolService::call($sElsName, $sElsMethod)) {
$oModule = BxDolModule::getInstance($sElsName);
bx_import('Search', $oModule->_aModule);
$sClass = 'BxElsSearch';
}
$oSearch = new $sClass(bx_get('section'));
$oSearch->setLiveSearch(bx_get('live_search') ? 1 : 0);
$oSearch->setMetaType(bx_process_input(bx_get('type')));
$oSearch->setCategoryObject(bx_process_input(bx_get('cat')));
$sCode = '';
if (bx_get('keyword') !== false) {
$sCode = $oSearch->response();
if (!$sCode)
$sCode = $oSearch->getEmptyResult();
}
$oTemplate = BxDolTemplate::getInstance();
$oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
$oTemplate->setPageHeader (_t("_Search"));
$oTemplate->setPageContent ('page_main_code', $oSearch->getForm() . ($sCode ? $oSearch->getResultsContainer($sCode) : ''));
$oTemplate->getPageCode();
/** @} */