ArticleAuthor::OnArticleLanguageDelete PHP Method

OnArticleLanguageDelete() public static method

public static OnArticleLanguageDelete ( $p_articleNumber, $p_languageId ) : void
return void
    public static function OnArticleLanguageDelete($p_articleNumber, $p_languageId)
    {
        global $g_ado_db;
        $queryStr = 'DELETE FROM ' . self::TABLE . '
            WHERE fk_article_number = ' . (int) $p_articleNumber . '
            AND fk_language_id = ' . (int) $p_languageId;
        $g_ado_db->Execute($queryStr);
    }

Usage Example

Ejemplo n.º 1
0
    $diffSeconds -= $hours * 3600;
    $minutes = floor($diffSeconds / 60);
    $lockUser = new User($articleObj->getLockedByUser());
    camp_html_add_msg($translator->trans('Could not save the article. It has been locked by $1 $2 hours and $3 minutes ago.', array('$1' => $lockUser->getRealName(), '$2' => $hours, '$3' => $minutes), 'articles'));
    camp_html_goto_page($BackLink);
    exit;
}
// Update the article author
$blogService = Zend_Registry::get('container')->getService('blog');
$blogInfo = $blogService->getBlogInfo($g_user);
if (!empty($f_article_author)) {
    $em = Zend_Registry::get('container')->getService('em');
    $dispatcher = Zend_Registry::get('container')->getService('dispatcher');
    $language = $em->getRepository('Newscoop\\Entity\\Language')->findOneById($articleObj->getLanguageId());
    $authors = $em->getRepository('Newscoop\\Entity\\ArticleAuthor')->getArticleAuthors($articleObj->getArticleNumber(), $language->getCode())->getArrayResult();
    ArticleAuthor::OnArticleLanguageDelete($articleObj->getArticleNumber(), $articleObj->getLanguageId());
    foreach ($authors as $author) {
        $dispatcher->dispatch("user.set_points", new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('authorId' => $author['fk_author_id'])));
    }
    $i = 0;
    foreach ($f_article_author as $author) {
        $authorObj = new Author($author);
        $author = trim($author);
        if (!$authorObj->exists() && isset($author[0])) {
            if ($blogService->isBlogger($g_user)) {
                // blogger can't create authors
                continue;
            }
            $authorData = Author::ReadName($author);
            $authorObj->create($authorData);
        } elseif ($blogService->isBlogger($g_user)) {