Example #1
0
 // Submit all the articles requested.
 $tmpArticles = array();
 foreach ($doAction as $articleNumber => $languageArray) {
     foreach ($languageArray as $languageId => $action) {
         $tmpArticle = new Article($languageId, $articleNumber);
         $tmpArticle->setTitle($articleNames[$articleNumber][$languageId]);
         // Check if the name already exists in the destination section.
         $conflictingArticles = Article::GetByName($tmpArticle->getTitle(), $f_destination_publication_id, $f_destination_issue_number, $f_destination_section_number, null, true);
         if (count($conflictingArticles) > 0) {
             $conflictingArticle = array_pop($conflictingArticles);
             $conflictingArticleLink = camp_html_article_url($conflictingArticle, $conflictingArticle->getLanguageId(), "edit.php");
             camp_html_add_msg($translator->trans("The article could not be submitted.", array(), 'articles') . " " . $translator->trans("You cannot have two articles in the same section with the same name.  The article name you specified is already in use by the article '\$1'.", array('$1' => "<a href='{$conflictingArticleLink}'>" . $conflictingArticle->getName() . "</a>"), 'articles'));
             $args = $_REQUEST;
             unset($args["action_button"]);
             unset($args["f_article_code"]);
             $argsStr = camp_implode_keys_and_values($args, "=", "&");
             foreach ($_REQUEST["f_article_code"] as $code) {
                 $argsStr .= "&f_article_code[]={$code}";
             }
             $backLink = "/{$ADMIN}/articles/duplicate.php?{$argsStr}";
             camp_html_goto_page($backLink);
         } else {
             $tmpArticle->move($f_destination_publication_id, $f_destination_issue_number, $f_destination_section_number);
             $tmpArticle->setWorkflowStatus('S');
             \Zend_Registry::get('container')->getService('dispatcher')->dispatch('article.submit', new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('article' => $tmpArticle)));
             $tmpArticles[] = $tmpArticle;
         }
     }
 }
 $tmpArticle = camp_array_peek($tmpArticles);
 if ($f_mode == "single") {
        }
        if (!$access) {
            camp_html_add_msg($translator->trans("You do not have the right to change this article status. Once submitted an article can only be changed by authorized users.", array(), 'articles'));
            camp_html_goto_page(camp_html_article_url($articleObj, $f_language_id, "edit.php"));
        }
        // If the article is not yet categorized, force it to be before publication.
        if (($f_action_workflow == "Y" || $f_action_workflow == 'M') && ($articleObj->getPublicationId() == 0 || $articleObj->getIssueNumber() == 0 || $articleObj->getSectionNumber() == 0)) {
            $args = $_REQUEST;
            $argsStr = camp_implode_keys_and_values($_REQUEST, "=", "&");
            $argsStr .= "&f_article_code[]=" . $f_article_number . "_" . $f_language_selected;
            $argsStr .= "&f_mode=single&f_action=publish";
            camp_html_goto_page("/{$ADMIN}/articles/duplicate.php?" . $argsStr);
        } else {
            if ($f_action_workflow == "S" && ($articleObj->getPublicationId() == 0 || $articleObj->getIssueNumber() == 0 || $articleObj->getSectionNumber() == 0)) {
                $args = $_REQUEST;
                $argsStr = camp_implode_keys_and_values($_REQUEST, "=", "&");
                $argsStr .= "&f_article_code[]=" . $f_article_number . "_" . $f_language_selected;
                $argsStr .= "&f_mode=single&f_action=submit";
                camp_html_goto_page("/{$ADMIN}/articles/duplicate.php?" . $argsStr);
            }
        }
        $articleObj->setWorkflowStatus($f_action_workflow);
        // Make sure that the time stamp is updated.
        $articleObj->setProperty('time_updated', 'NOW()', true, true);
        $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
        $cacheService->clearNamespace('article');
        camp_html_add_msg($translator->trans("Article status set to \$1", array('$1' => $articleObj->getWorkflowDisplayString()), 'articles'), "ok");
    }
    $url = camp_html_article_url($articleObj, $f_language_id, "edit.php");
    camp_html_goto_page($url);
}