Ejemplo n.º 1
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();
         }
     }
 }
Ejemplo n.º 2
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
Ejemplo n.º 3
0
            $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;
    }
    // If status has changed, then you need to show/hide all the comments