forked from boonex/dolphin.pro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchKeyword.php
123 lines (105 loc) · 3.32 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
* Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
* CC-BY License - http://creativecommons.org/licenses/by/3.0/
*/
require_once('inc/header.inc.php');
require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php');
require_once(BX_DIRECTORY_PATH_INC . 'languages.inc.php');
bx_import('BxDolSearch');
bx_import('BxTemplFormView');
check_logged();
$member['ID'] = getLoggedId();
$_page['name_index'] = 81;
$_page['css_name'] = array('searchKeyword.css');
$_page['header'] = _t( "_Search" );
$_page['header_text'] = _t("_Search");
ob_start();
?>
<script language="javascript">
$(document).ready( function() {
$('#searchForm').bind( 'submit', function() {
bx_loading('searchForm', true);
var sQuery = $('input', '#searchForm').serialize();
$.post('searchKeywordContent.php', sQuery, function(data) {
$('#searchArea').html(data);
bx_loading('searchForm', false);
}
);
return false;
}
);
}
);
</script>
<?php
$sCode = '';
$_page['extra_js'] = ob_get_clean();
$_ni = $_page['name_index'];
$oZ = new BxDolSearch();
if (bx_get('keyword')) {
$sCode = $oZ->response();
if (mb_strlen($sCode) == 0)
$sCode = $oZ->getEmptyResult();
}
$sForm = getSearchForm();
$sSearchArea = '<div id="searchArea">'.$sCode.'</div>';
$_page_cont[$_ni]['page_main_code'] = $sForm . $sSearchArea;
$aVars = array ();
$GLOBALS['oTopMenu']->setCustomSubActions($aVars, '');
PageCode();
function getSearchForm ()
{
$aList = $GLOBALS['MySQL']->fromCache('sys_objects_search', 'getAllWithKey',
'SELECT `ID` as `id`,
`Title` as `title`,
`ClassName` as `class`,
`ClassPath` as `file`,
`ObjectName`
FROM `sys_objects_search`', 'ObjectName'
);
$aValues = array();
foreach ($aList as $sKey => $aValue) {
$aValues[$sKey] = _t($aValue['title']);
if (!class_exists($aValue['class'])) {
$sPath = BX_DIRECTORY_PATH_ROOT . str_replace('{tmpl}', $GLOBALS['tmpl'], $aValue['file']);
require_once($sPath);
}
$oClass = new $aValue['class']();
$oClass->addCustomParts();
}
if (isset($_GET['type'])) {
$aValue = strip_tags($_GET['type']);
} else
$aValue = array_keys($aValues);
$aForm = array(
'form_attrs' => array(
'id' => 'searchForm',
'action' => '',
'method' => 'post',
'onsubmit' => '',
),
'inputs' => array(
'section' => array(
'type' => 'checkbox_set',
'name' => 'section',
'caption' => _t('_Section'),
'values' => $aValues,
'value' => $aValue,
),
'keyword' => array(
'type' => 'text',
'name' => 'keyword',
'caption' => _t('_Keyword')
),
'search' => array(
'type' => 'submit',
'name' => 'search',
'value' => _t('_Search')
)
)
);
$oForm = new BxTemplFormView($aForm);
$sFormVal = $oForm->getCode();
return DesignBoxContent(_t( "_Search" ), $sFormVal, 11);
}