Exemplo n.º 1
0
 public function getForm($iDesignBoxTemplate = BX_DB_PADDING_DEF, $sTitle = false)
 {
     if ($this->_sMetaType) {
         return '';
     }
     if (false === $sTitle) {
         $sTitle = _t("_Search");
     }
     $aValues = $this->getKeyTitlesPairs();
     $aValue = isset($_GET['type']) ? bx_process_input($_GET['type']) : array_keys($aValues);
     $sIdForm = $this->_sIdForm . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
     $sIdResults = $this->_sIdResults . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
     $sIdLoadingContainer = $this->_bLiveSearch ? $sIdResults : $sIdForm;
     $sJsParams = "5, '#{$sIdForm}', '#{$sIdResults}', '#{$sIdLoadingContainer}', '{$this->_bLiveSearch}'";
     $aForm = array('form_attrs' => array('id' => $sIdForm, 'action' => BX_DOL_URL_ROOT . 'searchKeyword.php', 'method' => 'post'), 'csrf' => array('disable' => true), 'inputs' => array('live_search' => array('type' => 'hidden', 'name' => 'live_search', 'value' => $this->_bLiveSearch ? 1 : 0), 'section' => array('type' => 'checkbox_set', 'name' => 'section', 'caption' => _t('_Section'), 'values' => $aValues, 'value' => $aValue), 'keyword' => array('type' => 'text', 'name' => 'keyword', 'caption' => _t('_Keyword'), 'value' => bx_get('keyword') ? bx_process_input(bx_get('keyword')) : ''), 'search' => array('type' => 'submit', 'name' => 'search', 'value' => _t('_Search'))));
     if ($this->_bLiveSearch) {
         unset($aForm['inputs']['section']);
         unset($aForm['inputs']['search']);
         unset($aForm['inputs']['keyword']['caption']);
         $aForm['inputs']['keyword']['attrs']['placeholder'] = _t('_sys_search_placeholder');
         $aForm['inputs']['keyword']['attrs']['onkeypress'] = "return bx_search_on_type(event, {$sJsParams});";
         $aForm['inputs']['keyword']['attrs']['onpaste'] = $aForm['inputs']['keyword']['attrs']['onkeypress'];
     }
     bx_import('BxTemplFormView');
     $oForm = new BxTemplFormView($aForm);
     $sForm = $oForm->getCode();
     if (!$this->_bLiveSearch) {
         bx_import('BxTemplPaginate');
         $o = new BxTemplPaginate(array());
         $o->addCssJs();
     }
     return DesignBoxContent($sTitle, $sForm, $iDesignBoxTemplate);
 }