Ejemplo n.º 1
0
 /**
  * @param int $categoryId
  * @param array $settings
  * @return array
  */
 private function fetchFiles($categoryId, array $settings)
 {
     if (!empty($categoryId)) {
         $files = $this->filesRepository->getAllByCategoryId((int) $categoryId, $this->date->getCurrentDateTime(), $settings['sidebar']);
     } else {
         $files = $this->filesRepository->getAll($this->date->getCurrentDateTime(), $settings['sidebar']);
     }
     return $files;
 }
 public function fetchSitemapUrls()
 {
     $this->addUrl('files/index/index');
     foreach ($this->categoryRepository->getAllByModuleName(Schema::MODULE_NAME) as $category) {
         $this->addUrl('files/index/files/cat_' . $category['id']);
     }
     foreach ($this->filesRepository->getAll($this->date->getCurrentDateTime()) as $result) {
         $this->addUrl(sprintf(Helpers::URL_KEY_PATTERN, $result['id']), $this->date->format($result['updated_at'], 'Y-m-d'));
     }
 }
 /**
  * @return array
  */
 public function fetchFeedItems()
 {
     $items = [];
     $results = $this->filesRepository->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('files/index/details/id_' . $results[$i]['id'], true)];
     }
     return $items;
 }