$authorObj->setType($author_type); // Links the author to the article $articleAuthorObj = new ArticleAuthor($articleObj->getArticleNumber(), $articleObj->getLanguageId(), $authorObj->getId(), $author_type); if (!$articleAuthorObj->exists()) { $articleAuthorObj->create(); } $i++; } } // Update the article. $articleObj->setOnFrontPage(!empty($f_on_front_page)); $articleObj->setOnSectionPage(!empty($f_on_section_page)); $articleObj->setIsPublic(!empty($f_is_public)); $articleObj->setKeywords($f_keywords); $articleObj->setTitle($f_article_title); $articleObj->setIsIndexed(false); if (!empty($f_comment_status)) { if ($f_comment_status == "enabled" || $f_comment_status == "locked") { $commentsEnabled = true; } else { $commentsEnabled = false; } // If status has changed, then you need to show/hide all the comments // as appropriate. if ($articleObj->commentsEnabled() != $commentsEnabled) { $articleObj->setCommentsEnabled($commentsEnabled); $comments = ArticleComment::GetArticleComments($f_article_number, $f_language_selected); if ($comments) {
} 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."); }