Exemplo n.º 1
0
 private static function enreachPaginator($articlesPaginator)
 {
     if (isset($articlesPaginator) && count($articlesPaginator->items()) > 0) {
         $articlesPaginator->items(ArticleService::getEnrichedArticles($articlesPaginator->items()));
         return $articlesPaginator;
     }
     return null;
 }
Exemplo n.º 2
0
 public function pdf($page)
 {
     $articleInfos = ArticleWithJournalInfoService::find(($page - 1) * self::SITEMAP_SIZE, self::SITEMAP_SIZE);
     foreach ($articleInfos as $articleInfo) {
         $fileName = ArticleService::getArticleFileName($articleInfo->prefix, $articleInfo->issue_year, $articleInfo->number_in_year, $articleInfo->sort_order);
         $articleInfo->fileName = $fileName;
     }
     return Response::view('sitemap.pdf', compact('articleInfos'))->header('Content-Type', 'application/xml');
 }
Exemplo n.º 3
0
 public function byYear($selectedYear)
 {
     $articles = ArticleDao::findContentByYear($selectedYear);
     foreach ($articles as $article) {
         $fileName = ArticleService::getArticleFileName($article->prefix, $article->issue_year, $article->number_in_year, $article->sort_order);
         $article->fileName = $fileName;
     }
     return view('year.details')->with(array('selectedYear' => $selectedYear, 'articles' => $articles));
 }
Exemplo n.º 4
0
 /**
  * メールで連絡ページ
  * @Post("/mail_send/{id}", as="articles.postMailSend", where={"id": "[0-9]+"})
  * @param DirectMailPost $directMailPost
  * @param string $id
  * @return \Illuminate\Http\Response
  */
 public function postMailSend(DirectMailPost $directMailPost, $id)
 {
     $article = $this->article->find($id);
     if (empty($article)) {
         abort(404);
     }
     $data = $directMailPost->all();
     $this->articleService->directMailSend($article, $data);
     return view('article.mail_send', ['article' => $article, 'flg' => true]);
 }
Exemplo n.º 5
0
 public function show($authorId)
 {
     try {
         $author = AuthorDao::findById($authorId);
     } catch (NoElementException $e) {
         App::abort(404, 'Author not found');
     }
     $articles = ArticleDao::findByAuthor($authorId);
     $articles = ArticleService::getEnrichedArticles($articles);
     return view('author.details')->with(array('author' => $author, 'articles' => $articles));
 }
Exemplo n.º 6
0
 public function raw($prefix, $selectedYear, $number)
 {
     try {
         $journal = JournalDao::findByPrefix($prefix);
         $edition = EditionDao::findByJournalIdAndYearNumber($journal->journal_id, $selectedYear, $number);
     } catch (NoElementException $e) {
         App::abort(404, 'Edition not found');
     }
     $articles = ArticleDao::findByEdition($edition->journal_edition_id);
     foreach ($articles as $article) {
         $fileName = ArticleService::getArticleFileName($prefix, $selectedYear, $number, $article->sort_order);
         $article->fileName = $fileName;
     }
     return Response::view('edition.raw', compact('articles'))->header('Content-Type', 'text/plain');
 }
Exemplo n.º 7
0
 private function enrichArticle($article)
 {
     $alternatives = AlternativeDao::findByArticleId($article->article_id);
     $article->alternatives = $alternatives;
     self::setShortLanguage($article);
     self::assignMainAuthorNames($article);
     self::convertArticleUpdateDate($article);
     $article->fileName = ArticleService::getArticleFileName($article->journal_prefix, $article->edition_issue_year, $article->edition_number_in_year, $article->sort_order);
     foreach ($article->alternatives as $alternative) {
         self::setShortLanguage($alternative);
         self::assignAlternativeAuthorNames($alternative, $alternative->authors);
         self::xmlEscape($alternative);
     }
     self::xmlEscape($article);
 }
Exemplo n.º 8
0
 public function showTag($tag, $page = 1)
 {
     $articles = $this->service->getByTag($tag, $page, self::ARTICLE_LIMIT);
     $max_pages = ceil($articles->count() / self::ARTICLE_LIMIT);
     return view('article.index', ['articles' => $articles, 'max_pages' => $max_pages, 'current_page' => $page]);
 }