/** * 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); }
/** * @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 = []; } }
/** * 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); }