commentsArticleDefaultEnabled() public method

Return TRUE if comments will default to enabled in the article edit screen.
示例#1
0
 if (!isset($articles[$articleNumber][$tmpLanguageId])) {
     continue;
 }
 // Grab the first article - it doesnt matter which one.
 $tmpArticle = $articles[$articleNumber][$tmpLanguageId];
 // Copy all the translations requested.
 $newArticles = $tmpArticle->copy($f_destination_publication_id, $f_destination_issue_number, $f_destination_section_number, $g_user->getUserId(), $languageArray);
 // Set properties for each new copy.
 foreach ($newArticles as $newArticle) {
     // Set the name of the new copy
     $newArticle->setTitle($articleNames[$articleNumber][$newArticle->getLanguageId()]);
     // Set the default "comment enabled" status based
     // on the publication config settings.
     if ($f_destination_publication_id > 0) {
         $tmpPub = new Publication($f_destination_publication_id);
         $commentDefault = $tmpPub->commentsArticleDefaultEnabled();
         $newArticle->setCommentsEnabled($commentDefault);
     }
     foreach ($events as $event) {
         //$repo->add($timeSet, $articleId, 'schedule');
         $newEvent = $ArticleDatetimeRepository->getEmpty();
         $newEvent->setArticleId($newArticle->getArticleNumber());
         $newEvent->setArticleType($event->getArticleType());
         $newEvent->setStartDate($event->getStartDate());
         $newEvent->setStartTime($event->getStartTime());
         $newEvent->setEndDate($event->getEndDate());
         $newEvent->setEndTime($event->getEndTime());
         $newEvent->setRecurring($event->getRecurring());
         $newEvent->setFieldName($event->getFieldName());
         $em->persist($newEvent);
     }
示例#2
0
} else {
    $articleObj->create($f_article_type, $f_article_name, $publication_id, $issue_number, $section_number);
}
if ($articleObj->exists()) {
    $author = $this->_helper->service('user')->getCurrentUser()->getAuthorId();
    if (empty($author)) {
        $articleObj->setCreatorId($g_user->getUserId());
        $authorObj = new Author($g_user->getRealName());
        if (!$authorObj->exists()) {
            $authorData = Author::ReadName($g_user->getRealName());
            $authorData['email'] = $g_user->getEmail();
            $authorObj->create($authorData);
        }
    } else {
        $authorObj = new Author($author);
    }
    if ($authorObj->exists()) {
        $articleObj->setAuthor($authorObj);
    }
    $articleObj->setIsPublic(true);
    if ($publication_id > 0) {
        $commentDefault = $publicationObj->commentsArticleDefaultEnabled();
        $articleObj->setCommentsEnabled($commentDefault);
    }
    camp_html_add_msg(getGS("Article created."), "ok");
    camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, "edit.php"), false);
    ArticleIndex::RunIndexer(3, 10, true);
    exit;
} else {
    camp_html_display_error("Could not create article.");
}