Exemplo n.º 1
0
 /**
  * Set the ID of the author who wrote this article.
  *
  * @param int $p_value
  * @return boolean
  */
 public function setAuthor(Author $p_author)
 {
     $defaultAuthorType = $p_author->setType();
     // Links the author to the article
     $articleAuthorObj = new ArticleAuthor($this->getArticleNumber(),
                                           $this->getLanguageId(),
                                           $p_author->getId(), $defaultAuthorType);
     if (!$articleAuthorObj->exists()) {
         $articleAuthorObj->create();
     }
 } // fn setAuthor
Exemplo n.º 2
0
            $authorData = Author::ReadName($author);
            $authorObj->create($authorData);
        } elseif ($blogService->isBlogger($g_user)) {
            // test if using authors from blog
            if (!$blogService->isBlogAuthor($authorObj, $blogInfo)) {
                continue;
            }
        }
        // Sets the author type selected
        $author_type = $f_article_author_type[$i];
        $authorObj->setType($author_type);
        // Links the author to the article
        if ($authorObj->getId() != 0) {
            $articleAuthorObj = new ArticleAuthor($articleObj->getArticleNumber(), $articleObj->getLanguageId(), $authorObj->getId(), $author_type, $i + 1);
        }
        if (isset($articleAuthorObj) && !$articleAuthorObj->exists()) {
            $articleAuthorObj->create();
            $dispatcher->dispatch("user.set_points", new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('authorId' => $articleAuthorObj->getAuthorId())));
        }
        $i++;
    }
}
// Update the article.
$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;
    }
Exemplo n.º 3
0
 /**
  * Copy all the pointers for the given article.
  *
  * @param int $p_srcArticleNumber
  * @param int $p_destArticleNumber
  * @return void
  */
 public static function OnArticleCopy($p_srcArticleNumber, $p_destArticleNumber)
 {
     global $g_ado_db;
     $queryStr = 'SELECT fk_language_id, fk_author_id, fk_type_id
                  FROM ' . self::TABLE . '
                  WHERE fk_article_number = ' . (int) $p_srcArticleNumber;
     $rows = $g_ado_db->GetAll($queryStr);
     foreach ($rows as $row) {
         $tmpArticleAuthorObj = new ArticleAuthor($p_destArticleNumber, $row['fk_language_id'], $row['fk_author_id'], $row['fk_type_id']);
         if (!$tmpArticleAuthorObj->exists()) {
             $tmpArticleAuthorObj->create();
         }
     }
 }
Exemplo n.º 4
0
    ArticleAuthor::OnArticleLanguageDelete($articleObj->getArticleNumber(), $articleObj->getLanguageId());
    $i = 0;
    foreach ($f_article_author as $author) {
        $authorObj = new Author($author);
        if (!$authorObj->exists()  && strlen(trim($author)) > 0) {
            $authorData = Author::ReadName($author);
            $authorObj->create($authorData);
        }
        // Sets the author type selected
        $author_type = $f_article_author_type[$i];
        $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") {