public function let(TraceableEventDispatcher $dispatcher, EntityManager $em, Article $article, Language $language) { $article->getNumber()->willReturn(10); $article->getName()->willReturn("test article"); $article->getPublicationId()->willReturn(2); $article->getLanguageId()->willReturn(1); $article->getIssueId()->willReturn(20); $article->getSectionId()->willReturn(30); $em->getReference('Newscoop\\Entity\\Language', 1)->willReturn($language); $language->getCode()->willReturn('en'); $this->beConstructedWith($dispatcher, $em); }
private function createArticleLegacyPreviewUrl(Article $article) { $params = array('f_publication_id' => $article->getPublicationId(), 'f_issue_number' => $article->getIssueId(), 'f_section_number' => $article->getSectionId(), 'f_article_number' => $article->getNumber(), 'f_language_id' => $article->getLanguageId(), 'f_language_selected' => $article->getLanguageId()); return '/admin/articles/get.php?' . http_build_query($params); }
/** * Render actions * * @param array $actions * @return void */ public function linkArticle(Article $p_article) { $params = array('f_publication_id' => $p_article->getPublicationId(), 'f_issue_number' => $p_article->getIssueId(), 'f_section_number' => $p_article->getSectionId(), 'f_article_number' => $p_article->getId(), 'f_language_id' => $p_article->getLanguageId(), 'f_language_selected' => $p_article->getLanguageId()); return http_build_query($params); }
private function getLogArray(Topic $topic, Article $article) { return array('title' => $topic->getTitle(), 'id' => array('Title' => $article->getName(), 'Number' => $article->getNumber(), 'IdLanguage' => $article->getLanguageId()), 'diff' => array('id' => $topic->getId(), 'title' => $topic->getTitle())); }
/** * Get section short name * * @param Newscoop\Entity\Article $article * @return string */ public function getSectionShortName(Article $article) { $issue = $this->em->getRepository('Newscoop\\Entity\\Issue')->findOneBy(array('number' => $article->getIssueId(), 'publication' => $article->getPublicationId(), 'language' => $article->getLanguageId())); if (!$issue) { return null; } $section = $this->em->getRepository('Newscoop\\Entity\\Section')->findOneBy(array('number' => $article->getSectionId(), 'publication' => $article->getPublicationId(), 'language' => $article->getLanguageId(), 'issue' => $issue ? $issue->getId() : null)); return $section ? $section->getShortName() : null; }
/** * Send comment notification * * @param Newscoop\Entity\Comment $comment * @param Newscoop\Entity\Article $article * @param array $authors * @param Newscoop\Entity\User $user * * @return void */ public function sendCommentNotification(Comment $comment, Article $article, array $authors, User $user = null) { $publicationService = $this->container->get('newscoop_newscoop.publication_service'); $templatesService = $this->container->get('newscoop.templates.service'); $placeholdersService = $this->container->get('newscoop.placeholders.service'); $preferencesService = $this->container->get('preferences'); $translator = $this->container->get('translator'); $emails = array_unique(array_filter(array_map(function ($author) { return $author->getEmail(); }, $authors))); $publication = $publicationService->getPublication(); $moderatorTo = $this->getModeratorEmailIfModerationEnabled($publication, $user); $moderatorTo ? $emails['moderator'] = $moderatorTo : null; $moderatorFrom = $publication->getModeratorFrom(); if (empty($emails)) { return; } $smarty = $templatesService->getSmarty(); $uri = \CampSite::GetURIInstance(); if ($user) { $smarty->assign('username', $user->getUsername()); } else { $smarty->assign('username', $translator->trans('anonymous')); } $smarty->assign('comment', $comment); $smarty->assign('article', new \MetaArticle($article->getLanguageId(), $article->getNumber())); $smarty->assign('publication', $uri->getBase()); $smarty->assign('site', $uri->getBase()); $smarty->assign('articleLink', \ShortURL::GetURI($article->getPublicationId(), $article->getLanguageId(), $article->getIssueId(), $article->getSectionId(), $article->getNumber())); $message = $templatesService->fetchTemplate("email_comment-notify.tpl"); $this->send($placeholdersService->get('subject'), $message, $emails, $moderatorFrom ?: $preferencesService->EmailFromAddress); }
public function getLanguageId() { $this->__load(); return parent::getLanguageId(); }