예제 #1
0
 /**
  * return extbase query result
  *
  * @param string|bool $orderby
  * @param string|bool $direction
  * @return resource
  */
 public function getResults($orderby = FALSE, $direction = 'ASC')
 {
     foreach ($this->elements as $element) {
         if ($element->isSearchable()) {
             if ($element->getValue() == '') {
                 unset($this->clauses[$element->getName()]);
             }
             if (($clause = $element->getClause()) !== false) {
                 $this->clauses[$clause['elementname']] = $clause;
             }
         }
     }
     if ($this->storeSearchInSession === true) {
         if (UserUtility::isLogged()) {
             $GLOBALS['TSFE']->fe_user->setKey('user', 'form-' . $this->getIdentifier() . '-clauses', $this->clauses);
         } else {
             $GLOBALS['TSFE']->fe_user->setKey('ses', 'form-' . $this->getIdentifier() . '-clauses', $this->clauses);
         }
         $GLOBALS['TSFE']->storeSessionData();
     }
     $clauses = '';
     foreach ($this->clauses as $clause) {
         $clauses .= ' AND ' . $this->makeWhereClause($clause);
     }
     if ($orderby) {
         $order = ' ORDER BY ' . $orderby . ' ' . $direction;
     } else {
         $order = '';
     }
     return $GLOBALS['TYPO3_DB']->sql_query($this->query . $clauses . $order . $this->querylimit);
 }
예제 #2
0
파일: Search.php 프로젝트: ameos/ameos_form
 /**
  * @constuctor
  *
  * @param	string $identifier form identifier
  */
 public function __construct($identifier)
 {
     parent::__construct($identifier);
     if (TYPO3_MODE == 'FE') {
         if (UserUtility::isLogged()) {
             $GLOBALS['TSFE']->fe_user->setKey('user', 'form-' . $this->getIdentifier() . '-clauses', $this->clauses);
         } else {
             $GLOBALS['TSFE']->fe_user->setKey('ses', 'form-' . $this->getIdentifier() . '-clauses', $this->clauses);
         }
         $GLOBALS['TSFE']->storeSessionData();
     } elseif (TYPO3_MODE == 'BE') {
         session_start();
         $_SESSION['form-' . $this->getIdentifier() . '-clauses'] = $this->clauses;
     }
     if (!is_array($this->clauses)) {
         $this->clauses = [];
     }
 }
예제 #3
0
 /**
  * return extbase query result
  *
  * @param string|bool $orderby
  * @param string|bool $direction
  * @return Object
  */
 public function getResults($orderby = false, $direction = 'ASC')
 {
     foreach ($this->elements as $element) {
         if ($element->isSearchable()) {
             if ($element->getValue() == '') {
                 unset($this->clauses[$element->getName()]);
             }
             if (($clause = $element->getClause()) !== false) {
                 $this->clauses[$clause['elementname']] = $clause;
             }
         }
     }
     if ($this->storeSearchInSession === true) {
         if (UserUtility::isLogged()) {
             $GLOBALS['TSFE']->fe_user->setKey('user', 'form-' . $this->getIdentifier() . '-clauses', $this->clauses);
         } else {
             $GLOBALS['TSFE']->fe_user->setKey('ses', 'form-' . $this->getIdentifier() . '-clauses', $this->clauses);
         }
         $GLOBALS['TSFE']->storeSessionData();
     }
     $clauses = array_merge($this->clauses, $this->defaultClause);
     return $this->repository->findByClausesArray($clauses, $orderby, $direction);
 }