コード例 #1
0
ファイル: QuickSearch_0.php プロジェクト: 62BRAINS/EPESI
 public function applet($conf, &$opts)
 {
     $recordset = "quick_search";
     $theme = $this->init_module('Base/Theme');
     $form = $this->init_module('Libs/QuickForm');
     $txtQuery = 'query_text';
     $txtLabel = 'query_label';
     $btnQuery = 'query_button';
     $id = $conf['criteria'];
     $searchPrompt = Applets_QuickSearchCommon::getSearchPromptById($id);
     $conf['a_title'] = $conf['a_title'] == "Quick Search" ? Applets_QuickSearchCommon::getPresetNameById($id) : $conf['a_title'];
     $placeholder = $searchPrompt == "" ? "" : $searchPrompt;
     $opts['title'] = $conf['a_title'];
     $opts['go'] = false;
     load_css('modules/Applets/QuickSearch/theme/quick_form.css');
     load_js('modules/Applets/QuickSearch/js/quicksearch.js');
     //$js ='setDelayOnSearch()';
     //eval_js($js);
     $txt = $form->addElement('text', $txtQuery, __('Search'));
     $txt->setAttribute('id', $txtQuery . "_" . $id);
     $txt->setAttribute('class', 'QuickSearch_text');
     $txt->setAttribute('onkeypress', 'setDelayOnSearch(\'' . $id . '\')');
     $txt->setAttribute('placeholder', _V($placeholder));
     $theme->assign($txtLabel, __('Search'));
     $theme->assign($txtQuery, $txt->toHtml());
     $theme->assign('search_id', $conf['criteria']);
     $theme->display('quick_form');
     return true;
 }
コード例 #2
0
ファイル: getresult.php プロジェクト: 62BRAINS/EPESI
if (!Base_AclCommon::is_user()) {
    return;
}
if (isset($_GET['crit']) && $_GET['crit'] != "" && isset($_GET['q']) && $_GET['q'] != "") {
    $arrResult = array();
    $id = $_GET['crit'];
    $txt = trim(urldecode($_GET['q']));
    $arrTxt = explode(" ", $txt);
    $arrayQuick = Applets_QuickSearchCommon::getRecordsetAndFields($id);
    $format = Applets_QuickSearchCommon::getResultFormat();
    $formatString = Applets_QuickSearchCommon::parseFormatString($format);
    $arrayKey = array();
    $array_keys = array_keys($arrayQuick);
    foreach ($array_keys as $key) {
        $fieldsArray = Applets_QuickSearchCommon::parse_array($arrayQuick[$key]);
        $sql = substr("select * from " . $key . "_data_1 where " . Applets_QuickSearchCommon::constructLikeSQL($arrTxt, $fieldsArray), 0, -3);
        $qry = DB::SelectLimit($sql, 20, 0);
        if ($qry) {
            $arrRow = array();
            $result = "";
            while ($rowValue = $qry->FetchRow()) {
                $rowValue["RECORD_SET"] = $key;
                $arrayKey[] = $rowValue;
            }
        }
    }
    if (is_array($arrayKey) && !empty($arrayKey)) {
        foreach ($arrayKey as $rows) {
            $result = "";
            $keyRecordset = $rows["RECORD_SET"];
            foreach ($formatString[$keyRecordset] as $keyIdx) {
コード例 #3
0
 public static function getRecordsetAndFields($id)
 {
     $qry = Utils_RecordBrowserCommon::get_record("quick_search", $id, false);
     if ($qry) {
         self::$resultFormat = $qry["result_format"];
         return self::parse_recordset($qry["recordsets"], $qry["select_field_to_search"]);
     } else {
         return false;
     }
 }