Ejemplo n.º 1
0
 /**
  * Main action terms will be sorted
  * by the currentCharacter
  *
  * @param string $character
  *
  * @throws Exception
  *
  * @return void
  */
 public function indexAction($character = '')
 {
     if (TRUE === empty($character)) {
         $this->query->setLimit(1)->setOrderings(array($this->field => QueryInterface::ORDER_ASCENDING));
         $firstObject = $this->query->execute()->toArray();
         $this->query = $this->objects->getQuery();
         if (TRUE === empty($firstObject)) {
             $this->view->assign('noObjects', TRUE);
         } else {
             $getter = 'get' . GeneralUtility::underscoredToUpperCamelCase($this->field);
             if (TRUE === method_exists($firstObject[0], $getter)) {
                 $this->currentCharacter = strtoupper(substr($firstObject[0]->{$getter}(), 0, 1));
             } else {
                 throw new Exception('Getter for "' . $this->field . '" in "' . get_class($firstObject[0]) . '" does not exist', 1433257601);
             }
         }
     } else {
         $this->currentCharacter = $character;
     }
     $this->currentCharacter = str_replace(array('AE', 'OE', 'UE'), array('Ä', 'Ö', 'Ü'), $this->currentCharacter);
     $objects = $this->getMatchings()->execute()->toArray();
     $this->view->assign('configuration', $this->configuration);
     $this->view->assign('pagination', $this->buildPagination());
     $this->view->assign('contentArguments', array($this->widgetConfiguration['as'] => $objects));
 }
Ejemplo n.º 2
0
 /**
  * sets query limits from given values
  *
  * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface &$query
  * @param int $offset
  * @param int $limit
  * @return void
  */
 protected function setQueryLimits(QueryInterface &$query, $offset = NULL, $limit = NULL)
 {
     if (is_numeric($offset)) {
         $query->setOffset($offset);
     }
     if (is_numeric($limit)) {
         $query->setLimit($limit);
     }
 }
Ejemplo n.º 3
0
 /**
  * Sets the query limit
  *
  * @param integer $limit The limit of elements to show
  * @return void
  */
 public function setLimit($limit)
 {
     $this->query->setLimit($limit);
 }
Ejemplo n.º 4
0
 /**
  * Sets a query limit to the given query for the given demand
  *
  * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query Query
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Dto\EventDemand $eventDemand EventDemand
  *
  * @return void
  */
 protected function setQueryLimitFromDemand($query, EventDemand $eventDemand)
 {
     if ($eventDemand->getQueryLimit() != NULL && MathUtility::canBeInterpretedAsInteger($eventDemand->getQueryLimit()) && (int) $eventDemand->getQueryLimit() > 0) {
         $query->setLimit((int) $eventDemand->getQueryLimit());
     }
 }