src/FilterSetting/Text.php
private function doRegexpSearch($objFilter, $arrFilterUrl)
    {
        $objMetaModel  = $this->getMetaModel();
        $objAttribute  = $objMetaModel->getAttributeById($this->get('attr_id'));
        $strParamName  = $this->getParamName();
        $strParamValue = $arrFilterUrl[$strParamName];
        $strPattern    = $this->get('pattern');

        if ($objAttribute && $strParamName && $strParamValue !== null) {
            if (empty($strPattern) || substr_count($strPattern, '%s') != 1) {
                $strPattern = '%s';
            }

            $strRegex = sprintf($strPattern, $strParamValue);

            $strQuery = sprintf(
                'SELECT id FROM %s WHERE %s REGEXP \'%s\'',
                $objMetaModel->getTableName(),
                $objAttribute->getColName(),
                $strRegex
            );

            $objFilter->addFilterRule(new SimpleQuery($strQuery));

            return;
        }

        $objFilter->addFilterRule(new StaticIdList(null));
    }
private function doRegexpSearch($objFilter, $arrFilterUrl)
    {
        $objMetaModel  = $this->getMetaModel();
        $objAttribute  = $objMetaModel->getAttributeById($this->get('attr_id'));
        $strParamName  = $this->getParamName();
        $strParamValue = $arrFilterUrl[$strParamName];
        $strPattern    = $this->get('pattern');

        if ($objAttribute && $strParamName && $strParamValue !== null) {
            if (empty($strPattern) || substr_count($strPattern, '%s') != 1) {
                $strPattern = '%s';
            }

            $strRegex = sprintf($strPattern, $strParamValue);

            $strQuery = sprintf(
                'SELECT id FROM %s WHERE %s REGEXP \'%s\'',
                $objMetaModel->getTableName(),
                $objAttribute->getColName(),
                $strRegex
            );

            $objFilter->addFilterRule(new SimpleQuery($strQuery));

            return;
        }

        $objFilter->addFilterRule(new StaticIdList(null));
    }
private function doRegexpSearch ( $ objFilter , $ arrFilterUrl ) { $ objMetaModel = $ this -> getMetaModel ( ) ; $ objAttribute = $ objMetaModel -> getAttributeById ( $ this -> get ( 'attr_id' ) ) ; $ strParamName = $ this -> getParamName ( ) ; $ strParamValue = $ arrFilterUrl [ $ strParamName ] ; $ strPattern = $ this -> get ( 'pattern' ) ; if ( $ objAttribute && $ strParamName && $ strParamValue !== null ) { if ( empty ( $ strPattern ) || substr_count ( $ strPattern , '%s' ) != 1 ) { $ strPattern = '%s' ; } $ strRegex = sprintf ( $ strPattern , $ strParamValue ) ; $ strQuery = sprintf ( 'SELECT id FROM %s WHERE %s REGEXP \'%s\'' , $ objMetaModel -> getTableName ( ) , $ objAttribute -> getColName ( ) , $ strRegex ) ; $ objFilter -> addFilterRule ( new SimpleQuery ( $ strQuery ) ) ; return ; } $ objFilter -> addFilterRule ( new StaticIdList ( null ) ) ; }
Make a simple search with a regexp.

@param IFilter  $objFilter     The filter to append the rules to.

@param string[] $arrFilterUrl  The parameters to evaluate.

@return void
Make a simple search with a regexp .