source: trunk/searchKeyword.php

Last change on this file was 2, checked in by george, 14 years ago
  • Přidáno: Trunk revize 13719.
File size: 4.0 KB
Line 
1<?php
2
3/***************************************************************************
4* Dolphin Smart Community Builder
5* -----------------
6* begin : Mon Mar 23 2006
7* copyright : (C) 2006 BoonEx Group
8* website : http://www.boonex.com/
9* This file is part of Dolphin - Smart Community Builder
10*
11* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
12* http://creativecommons.org/licenses/by/3.0/
13*
14* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16* See the Creative Commons Attribution 3.0 License for more details.
17* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
18* see license.txt file; if not, write to marketing@boonex.com
19***************************************************************************/
20
21require_once('inc/header.inc.php');
22require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php');
23require_once(BX_DIRECTORY_PATH_INC . 'languages.inc.php');
24
25bx_import('BxDolSearch');
26bx_import('BxTemplFormView');
27
28check_logged();
29$member['ID'] = (int)$_COOKIE['memberID'];
30
31$_page['name_index'] = 81;
32$_page['css_name'] = array('searchKeyword.css');
33
34$_page['header'] = _t( "_Search" );
35$_page['header_text'] = _t("_Search");
36
37ob_start();
38?>
39<script language="javascript">
40 $(document).ready( function() {
41 $('#searchForm').bind( 'submit', function() {
42 bx_loading('searchForm', true);
43 var sQuery = $('input', '#searchForm').serialize();
44 $.post('searchKeywordContent.php', sQuery, function(data) {
45 $('#searchArea').html(data);
46 bx_loading('searchForm', false);
47 }
48 );
49 return false;
50 }
51 );
52 }
53 );
54</script>
55<?
56
57$_page['extra_js'] = ob_get_clean();
58
59$_ni = $_page['name_index'];
60
61$oZ = new BxDolSearch();
62if ($_REQUEST['keyword']) {
63 $sCode = $oZ->response();
64 if (mb_strlen($sCode) == 0)
65 $sCode = $oZ->getEmptyResult();
66}
67
68$sForm = getSearchForm();
69$sSearchArea = '<div id="searchArea">'.$sCode.'</div>';
70
71$_page_cont[$_ni]['page_main_code'] = $sForm . $sSearchArea;
72
73$aVars = array ();
74$GLOBALS['oTopMenu']->setCustomSubActions($aVars, '');
75
76PageCode();
77
78function getSearchForm () {
79 $aList = $GLOBALS['MySQL']->fromCache('sys_objects_search', '');
80 $aValues = array();
81 foreach ($aList as $sKey => $aValue) {
82 $aValues[$sKey] = _t($aValue['title']);
83 if (!class_exists($aValue['class'])) {
84 $sPath = BX_DIRECTORY_PATH_ROOT . str_replace('{tmpl}', $GLOBALS['tmpl'], $aValue['file']);
85 require_once($sPath);
86 }
87 $oClass = new $aValue['class']();
88 $oClass->addCustomParts();
89 }
90
91 if (isset($_GET['type'])) {
92 $aValue = strip_tags($_GET['type']);
93 }
94 else
95 $aValue = array_keys($aValues);
96
97 $aForm = array(
98 'form_attrs' => array(
99 'id' => 'searchForm',
100 'action' => '',
101 'method' => 'post',
102 'onsubmit' => '',
103 ),
104 'inputs' => array(
105 'section' => array(
106 'type' => 'checkbox_set',
107 'name' => 'section',
108 'caption' => _t('_Section'),
109 'values' => $aValues,
110 'value' => $aValue,
111 ),
112 'keyword' => array(
113 'type' => 'text',
114 'name' => 'keyword',
115 'caption' => _t('_Keyword')
116 ),
117 'search' => array(
118 'type' => 'submit',
119 'name' => 'search',
120 'value' => _t('_Search')
121 )
122 )
123 );
124
125 $oForm = new BxTemplFormView($aForm);
126 $sFormVal = $oForm->getCode();
127
128 return DesignBoxContent(_t( "_Search" ), $sFormVal, 1);
129}
130
131?>
Note: See TracBrowser for help on using the repository browser.