Example #1
0
 /**
  * Publish text item
  *
  * @param Newscoop\News\NewsItem $item
  * @return Article
  */
 private function publishText(NewsItem $item)
 {
     $issueNumber = $this->settings->getPublicationId() ? \Issue::GetCurrentIssue($this->settings->getPublicationId())->getIssueNumber() : null;
     $type = $this->getArticleType($this->settings->getArticleTypeName());
     $article = new \Article($this->findLanguageId($item->getContentMeta()->getLanguage()));
     $article->create($type->getTypeName(), $item->getContentMeta()->getHeadline(), $this->settings->getPublicationId(), $issueNumber, $this->settings->getSectionNumber());
     $article->setKeywords($item->getContentMeta()->getSlugline());
     $article->setCreationDate($item->getItemMeta()->getFirstCreated()->format(self::DATE_FORMAT));
     $article->setPublishDate(null);
     $article->setProperty('time_updated', date_create('now')->format(self::DATE_FORMAT));
     $this->setArticleData($article, $item);
     $article->commit();
     return $article;
 }
Example #2
0
    // as appropriate.
    if ($articleObj->commentsEnabled() != $commentsEnabled) {
        $articleObj->setCommentsEnabled($commentsEnabled);
        global $controller;
        $repository = $controller->getHelper('entity')->getRepository('Newscoop\\Entity\\Comment');
        $repository->setArticleStatus($f_article_number, $f_language_selected, $commentsEnabled ? STATUS_APPROVED : STATUS_HIDDEN);
        $repository->flush();
    }
    $articleObj->setCommentsLocked($f_comment_status == "locked");
}
// Make sure that the time stamp is updated.
$articleObj->setProperty('time_updated', 'NOW()', true, true);
// Verify creation date is in the correct format.
// If not, dont change it.
if (preg_match("/\\d{4}-\\d{2}-\\d{2}/", $f_creation_date)) {
    $articleObj->setCreationDate($f_creation_date);
}
// Verify publish date is in the correct format.
// If not, dont change it.
if (preg_match("/\\d{4}-\\d{2}-\\d{2}/", $f_publish_date)) {
    $articleObj->setPublishDate($f_publish_date);
}
foreach ($articleFields as $dbColumnName => $text) {
    $articleTypeObj->setProperty($dbColumnName, $text);
}
Log::ArticleMessage($articleObj, $translator->trans('Content edited', array(), 'articles'), $g_user->getUserId(), 37);
ArticleIndex::RunIndexer(3, 10, true);
if (CampTemplateCache::factory()) {
    CampTemplateCache::factory()->update(array('language' => $articleObj->getLanguageId(), 'publication' => $articleObj->getPublicationId(), 'issue' => $articleObj->getIssueNumber(), 'section' => $articleObj->getSectionNumber(), 'article' => $articleObj->getArticleNumber()), !($articleObj->isPublished() || $articleObj->m_published));
}
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
Example #3
0
 /**
  * Set article dates
  *
  * @param Article $article
  * @param Newscoop\Entity\Ingest\Feed\Entry $entry
  * @return void
  */
 private function setArticleDates(\Article $article, Entry $entry)
 {
     $entry->setPublished(new \DateTime());
     $article->setCreationDate($entry->getCreated()->format(self::DATETIME_FORMAT));
     $article->setPublishDate($entry->getPublished()->format(self::DATETIME_FORMAT));
     $article->setProperty('time_updated', $entry->getUpdated()->format(self::DATETIME_FORMAT));
 }