Example #1
0
 /**
  * Support method for initSearch() -- handle advanced settings.  Advanced
  * searches have numeric subscripts on the lookfor and type parameters --
  * this is how they are distinguished from basic searches.
  *
  * @param \Zend\StdLib\Parameters $request Parameter object representing user
  * request.
  *
  * @return void
  */
 protected function initAdvancedSearch($request)
 {
     $this->query = QueryAdapter::fromRequest($request, $this->getOptions()->getDefaultHandler());
     $this->searchType = $this->query instanceof Query ? 'basic' : 'advanced';
     // If we ended up with a basic search, set the default handler if necessary:
     if ($this->searchType == 'basic' && $this->query->getHandler() === null) {
         $this->query->setHandler($this->getOptions()->getDefaultHandler());
     }
 }
Example #2
0
 /**
  * Support method for initSearch() -- handle advanced settings.  Advanced
  * searches have numeric subscripts on the lookfor and type parameters --
  * this is how they are distinguished from basic searches.
  *
  * @param \Zend\StdLib\Parameters $request Parameter object representing user
  * request.
  *
  * @return void
  */
 protected function initAdvancedSearch($request)
 {
     $this->query = QueryAdapter::fromRequest($request, $this->getOptions()->getDefaultHandler());
     $this->searchType = $this->query instanceof Query ? 'basic' : 'advanced';
     // If we ended up with a basic search, it's probably the result of
     // submitting an empty form, and more processing may be needed:
     if ($this->searchType == 'basic') {
         // Set a default handler if necessary:
         if ($this->query->getHandler() === null) {
             $this->query->setHandler($this->getOptions()->getDefaultHandler());
         }
         // If the user submitted the advanced search form, we want to treat
         // the search as advanced even if it evaluated to a basic search.
         if ($request->offsetExists('lookfor0')) {
             $this->convertToAdvancedSearch();
         }
     }
 }
Example #3
0
 /**
  * Test setHandler() method
  *
  * @return void
  */
 public function testSetHandler()
 {
     $q = new Query('foo', 'bar');
     $q->setHandler('baz');
     $this->assertEquals('baz', $q->getHandler());
 }