public function fetchSitemapUrls() { $this->addUrl('news/index/index'); foreach ($this->newsRepository->getAll($this->date->getCurrentDateTime()) as $result) { $this->addUrl(sprintf(Helpers::URL_KEY_PATTERN, $result['id']), $this->date->format($result['updated_at'], 'Y-m-d')); } }
/** * @param int $categoryId * @param array $settings * @return array */ private function fetchNews($categoryId, array $settings) { if (!empty($categoryId)) { $news = $this->newsRepository->getAllByCategoryId((int) $categoryId, $this->date->getCurrentDateTime(), $settings['sidebar']); } else { $news = $this->newsRepository->getAll($this->date->getCurrentDateTime(), $settings['sidebar']); } return $news; }
/** * @return array */ public function fetchFeedItems() { $items = []; $results = $this->newsRepository->getAll($this->date->getCurrentDateTime(), 10); $cResults = count($results); for ($i = 0; $i < $cResults; ++$i) { $items[] = ['title' => $results[$i]['title'], 'date' => $this->date->timestamp($results[$i]['start']), 'description' => $this->formatter->shortenEntry($results[$i]['text'], 300, 0), 'link' => $this->router->route('news/index/details/id_' . $results[$i]['id'], true)]; } return $items; }
/** * @param int $categoryId * @param string $time * * @return array */ private function fetchNews($categoryId, $time) { if (!empty($categoryId)) { $news = $this->newsRepository->getAllByCategoryId($categoryId, $time, $this->pagination->getResultsStartOffset(), $this->resultsPerPage->getResultsPerPage(News\Installer\Schema::MODULE_NAME)); } else { $news = $this->newsRepository->getAll($time, $this->pagination->getResultsStartOffset(), $this->resultsPerPage->getResultsPerPage(News\Installer\Schema::MODULE_NAME)); } return $news; }