openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

SearchQuicksearchAction.class.php (964B)


      1 <?php
      2 namespace cms\action\search;
      3 use cms\action\Method;
      4 use cms\action\SearchAction;
      5 use cms\base\Configuration;
      6 
      7 class SearchQuicksearchAction extends SearchAction implements Method {
      8     public function view() {
      9 		$searchConfig = Configuration::subset('search')->subset('quicksearch');
     10 
     11 		$text = $this->request->getText('search');
     12 		
     13 		$flag = $searchConfig->subset('flag');
     14 
     15 		$searchFlags = 0;
     16 
     17 		// Always search for the id without a max length
     18 		if	( $flag->is('id'         ) ) $searchFlags |= self::FLAG_ID;
     19 
     20 		if   ( strlen($text) >= $searchConfig->get('maxlength',3 ) ) {
     21 
     22 			if	( $flag->is('name'       ) ) $searchFlags |= self::FLAG_NAME;
     23 			if	( $flag->is('filename'   ) ) $searchFlags |= self::FLAG_FILENAME;
     24 			if	( $flag->is('description') ) $searchFlags |= self::FLAG_DESCRIPTION;
     25 			if	( $flag->is('content'    ) ) $searchFlags |= self::FLAG_VALUE;
     26 		}
     27 
     28 		$this->performSearch($text, $searchFlags);
     29     }
     30 
     31 
     32     public function post() {
     33     }
     34 }