/** * @see \Hofff\Contao\Selectri\Model\Data::browseFrom() * * @param null $chunks * * @return array * * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ public function browseFrom($chunks = null) { $listData = new SQLListData($this->getWidget(), $this->getDatabase(), $this->prepareListDataConfig($chunks)); list($eventMonthLevels, $key) = $listData->browseFrom(null); $levels = new \ArrayIterator(); while ($newsArchive = $eventMonthLevels->current()) { $node = $newsArchive->getData(); $node['_isSelectable'] = false; $node['_key'] = implode('::', array_merge($chunks, array('month', $node['month']))); $listNode = new SQLListSelectAbleNode($listData, $node); $levels->append($listNode); $eventMonthLevels->next(); } return array($levels, implode('::', $chunks)); }
/** * @see \Hofff\Contao\Selectri\Model\Data::browseFrom() * * @param null $key * * @return array * * @throws SelectriException */ public function browseFrom($key = null) { $listData = new SQLListData($this->getWidget(), $this->getDatabase(), $this->prepareListDataConfig()); list($eventCalendarLevels, $key) = $listData->browseFrom($key); $levels = new \ArrayIterator(); while ($eventCalendar = $eventCalendarLevels->current()) { $node = $eventCalendar->getData(); if ($this->isEmptyCalendar($node)) { $eventCalendarLevels->next(); continue; } $node['_isSelectable'] = false; $node['_key'] = 'tl_calendar::' . $node['_key']; $listNode = new SQLListSelectAbleNode($listData, $node); $levels->append($listNode); $eventCalendarLevels->next(); } return array($levels, $key); }
/** * Filters the given primary keys for values identifing only existing * records. * * @param array <string> $keys An array of primary key values in their * string representation * * @return array<string> The input array with all invalid values removed */ public function filter(array $keys) { $listData = new SQLListData($this->getWidget(), $this->getDatabase(), $this->prepareListDataConfig()); $filterKeys = array(); if (count($keys) > 0) { foreach ($keys as $key) { array_push($filterKeys, explode('::', $key)[1]); } } return $listData->filter($filterKeys); }
/** * EventController constructor. * * @param Widget $widget * @param Database $database */ public function __construct(Widget $widget, Database $database) { parent::__construct($widget, $database, $this->prepareConfig()); }
/** * Remove the provider index from key, to save the id only. * * @param array $keys * * @return array */ public function filter(array $keys) { $listData = new SQLListData($this->getData()->getWidget(), Database::getInstance(), $this->getListDataConfig()); $filterKeys = array(); foreach ($keys as $key) { array_push($filterKeys, explode('::', $key)[1]); } return $listData->filter($filterKeys); }