Beispiel #1
0
 public function getFilterInstance(Sitengine_Controller_Request_Http $request, array $params, Zend_Session_Namespace $namespace, $usersTable)
 {
     require_once 'Sitengine/Grid/Search.php';
     $filter = new Sitengine_Grid_Search();
     $reset = $request->get($params['reset']);
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal($params['find'], $namespace);
     }
     $filter->registerSessionVal($namespace, $request, $params['find'], self::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal($params['find'])) {
         $value = $this->_database->quote($filter->getVal($params['find']));
         $value = preg_replace('/\\s+/', ' ', $value);
         $value = preg_replace('/.(.*)./', "\$1", trim($value));
         # remove quote delimiters
         $clause = "(";
         $clause .= " LOWER({$this->_name}.comment) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$usersTable}.name) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$usersTable}.firstname) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$usersTable}.lastname) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$usersTable}.nickname) LIKE LOWER('%{$value}%')";
         $clause .= ")";
         $filter->setClause($params['find'], $clause);
     }
     return $filter;
 }
Beispiel #2
0
 public function getFilterInstance(Sitengine_Controller_Request_Http $request, array $params, Zend_Session_Namespace $namespace)
 {
     $transcripts = $this->getTranscripts();
     $transcripts->setLanguage($this->_transcript);
     $index = $transcripts->getIndex();
     $default = $transcripts->getDefaultIndex();
     require_once 'Sitengine/Grid/Search.php';
     $filter = new Sitengine_Grid_Search();
     $reset = $request->get($params['reset']);
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal($params['find'], $namespace);
     }
     $filter->registerSessionVal($namespace, $request, $params['find'], self::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal($params['find'])) {
         $value = $this->getAdapter()->quote($filter->getVal($params['find']));
         $value = preg_replace('/\\s+/', ' ', $value);
         $value = preg_replace('/.(.*)./', "\$1", trim($value));
         # remove quote delimiters
         $clause = "(";
         $clause .= "LOWER({$this->_name}.titleLang{$index}) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.slug) LIKE LOWER('%{$value}%')";
         $clause .= ")";
         $filter->setClause($params['find'], $clause);
     }
     return $filter;
 }
Beispiel #3
0
 public function getFilterInstance(Sitengine_Controller_Request_Http $request, array $params, Zend_Session_Namespace $namespace)
 {
     require_once 'Sitengine/Grid/Search.php';
     $filter = new Sitengine_Grid_Search();
     $reset = $request->get($params['reset']);
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal($params['type'], $namespace);
     }
     $filter->registerSessionVal($namespace, $request, $params['type'], self::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal($params['type'])) {
         $value = $this->getAdapter()->quote($filter->getVal($params['type']));
         $clause = "{$this->_name}.type = {$value}";
         $filter->setClause($params['type'], $clause);
     }
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal($params['find'], $namespace);
     }
     $filter->registerSessionVal($namespace, $request, $params['find'], self::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal($params['find'])) {
         $value = $this->getAdapter()->quote($filter->getVal($params['find']));
         $value = preg_replace('/\\s+/', ' ', $value);
         $value = preg_replace('/.(.*)./', "\$1", trim($value));
         # remove quote delimiters
         $clause = "(";
         $clause .= "LOWER({$this->_name}.titleLang0) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.markupLang0) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.titleLang1) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.markupLang1) LIKE LOWER('%{$value}%')";
         $clause .= " OR LOWER({$this->_name}.file1OriginalSource) LIKE LOWER('%{$value}%')";
         $clause .= ")";
         $filter->setClause($params['find'], $clause);
     }
     return $filter;
 }
Beispiel #4
0
 public function getSearchFilterInstance()
 {
     require_once 'Sitengine/Grid/Search.php';
     $filter = new Sitengine_Grid_Search();
     $reset = $this->_controller->getRequest()->get(Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_RESET);
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal(Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_TYPE, $this->_controller->getNamespace());
     }
     $filter->registerSessionVal($this->_controller->getNamespace(), $this->_controller->getRequest(), Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_TYPE, Sitengine_Sitemap_Backend_Controller::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal(Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_TYPE)) {
         $value = $this->_controller->getDatabase()->quote($filter->getVal(Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_TYPE));
         $clause = 'type = ' . $value;
         $filter->setClause(Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_TYPE, $clause);
     }
     ### filter element ###
     if ($reset) {
         $filter->resetSessionVal(Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_FIND, $this->_controller->getNamespace());
     }
     $filter->registerSessionVal($this->_controller->getNamespace(), $this->_controller->getRequest(), Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_FIND, Sitengine_Sitemap_Backend_Controller::VALUE_NONESELECTED);
     # set clause
     if ($filter->getVal(Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_FIND)) {
         $value = $this->_controller->getDatabase()->quote($filter->getVal(Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_FIND));
         $value = preg_replace('/\\s+/', ' ', $value);
         $value = preg_replace('/.(.*)./', "\$1", trim($value));
         # remove quote delimiters
         $clause = '(';
         $clause .= ' LOWER(keyword) LIKE LOWER("%' . $value . '%")';
         $clause .= ' OR LOWER(file1OriginalSource) LIKE LOWER("%' . $value . '%")';
         foreach ($this->_controller->getTranscripts()->get() as $index => $symbol) {
             #$clause .= ' OR LOWER(titleLang'.$index.') LIKE LOWER("%'.$value.'%")';
             $clause .= ' OR LOWER(htmlLang' . $index . ') LIKE LOWER("%' . $value . '%")';
             $clause .= ' OR LOWER(metaKeywordsLang' . $index . ') LIKE LOWER("%' . $value . '%")';
             $clause .= ' OR LOWER(metaDescriptionLang' . $index . ') LIKE LOWER("%' . $value . '%")';
         }
         $clause .= ')';
         $filter->setClause(Sitengine_Sitemap_Backend_Controller::PARAM_SEARCH_BY_FIND, $clause);
     }
     return $filter;
 }