BxDolTwigModule::_actionSearch PHP Method

_actionSearch() public method

public _actionSearch ( $sKeyword, $sCategory, $sTitle )
    function _actionSearch($sKeyword, $sCategory, $sTitle)
    {
        if (!$this->isAllowedSearch()) {
            $this->_oTemplate->displayAccessDenied();
            return;
        }
        $this->_oTemplate->pageStart();
        if ($sKeyword) {
            $_GET['Keyword'] = $sKeyword;
        }
        if ($sCategory) {
            $_GET['Category'] = explode(',', $sCategory);
        }
        if (is_array($_GET['Category']) && 1 == count($_GET['Category']) && !$_GET['Category'][0]) {
            unset($_GET['Category']);
            unset($sCategory);
        }
        if ($sCategory || $sKeyword) {
            $_GET['submit_form'] = 1;
        }
        bx_import('FormSearch', $this->_aModule);
        $sClass = $this->_aModule['class_prefix'] . 'FormSearch';
        $oForm = new $sClass();
        $oForm->initChecker();
        if ($oForm->isSubmittedAndValid()) {
            bx_import('SearchResult', $this->_aModule);
            $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
            $o = new $sClass('search', $oForm->getCleanValue('Keyword'), $oForm->getCleanValue('Category'));
            if ($o->isError) {
                $this->_oTemplate->displayPageNotFound();
                return;
            }
            if ($s = $o->processing()) {
                echo $s;
            } else {
                $this->_oTemplate->displayNoData();
                return;
            }
            $this->isAllowedSearch(true);
            // perform search action
            $this->_oTemplate->addCss(array('unit.css', 'main.css', 'twig.css'));
            $this->_oTemplate->pageCode($o->aCurrent['title'], false, false);
        } else {
            echo $oForm->getCode();
            $this->_oTemplate->addCss('main.css');
            $this->_oTemplate->pageCode($sTitle);
        }
    }

Usage Example

Ejemplo n.º 1
0
 function actionSearch($sKeyword = '', $sCategory = '')
 {
     parent::_actionSearch($sKeyword, $sCategory, _t('_bx_store_page_title_search'));
 }
All Usage Examples Of BxDolTwigModule::_actionSearch