Example #1
0
        $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');
$cacheService->clearNamespace('authors');
$cacheService->clearNamespace('article');
$cacheService->clearNamespace('article_type');
$cacheService->clearNamespace('boxarticles');
echo json_encode($data);
Example #2
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 #3
0
        }
        $authorObj = new Author($authorName);
        if (!$authorObj->exists()) {
            $authorData = Author::ReadName($authorName);
            if ($isAuthorFromCreator) {
                $authorData['email'] = $g_user->getEmail();
            }
            $authorObj->create($authorData);
        }
        if ($authorObj->exists()) {
            $articleObj->setAuthor($authorObj);
            $articleFields['author'] = true;
        }
        // Updates the publish date
        $articlePublishDate = (string) $article->publish_date;
        $articleObj->setPublishDate($articlePublishDate);
        // Updates the article
        if (isset($article->keywords) && !empty($article->keywords)) {
            $articleObj->setKeywords((string) $article->keywords);
        }
        $articleFields['keywords'] = true;
        foreach ($xmlArticle as $articleFieldName => $articleFieldValue) {
            if (!array_key_exists($articleFieldName, $articleFields)) {
                $errorMessages[$articleCount][] = '"' . $articleFieldName . '" field in XML file ' . 'was not loaded into database as there is not any ' . 'article type field matching it.<br />';
            }
        }
    }
    camp_html_add_msg($translator->trans("\$1 articles successfully imported.", array('$1' => $articleCount), 'articles'), "ok");
}
// Gets all issues
$allIssues = array();
Example #4
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));
 }