GetArticleEvents() public static method

Returns an array of ArticlePublish objects.
public static GetArticleEvents ( integer $p_articleNumber, integer $p_languageId = null, boolean $p_onlyFutureEvents = false ) : array
$p_articleNumber integer
$p_languageId integer
$p_onlyFutureEvents boolean
return array
Esempio n. 1
0
}
if ($f_publish_hour == "" || $f_publish_minute == "") {
    camp_html_add_msg(getGS('You must fill in the $1 field.', '<B>' . getGS('Time') . '</B>'));
}
if ($f_publish_action != "P" && $f_publish_action != "U" && $f_front_page_action != "S" && $f_front_page_action != "R" && $f_section_page_action != "S" && $f_section_page_action != "R") {
    camp_html_add_msg(getGS('You must select an action.'));
}
if (count($articles) == 0 && count($errorArticles) > 0) {
    camp_html_add_msg(getGS("The article is new; it is not possible to schedule it for automatic publishing."));
}
if (camp_html_has_msgs()) {
    camp_html_goto_page($backLink);
}
$publishTime = $f_publish_date . " " . $f_publish_hour . ":" . $f_publish_minute . ":00";
foreach ($articles as $tmpArticle) {
    $articleEvents = ArticlePublish::GetArticleEvents($tmpArticle->getArticleNumber(), $f_language_selected, TRUE);
    foreach ($articleEvents as $event) {
        if ($event->getActionTime() == $publishTime) {
            if ($f_publish_action != $event->getPublishAction()) {
                ?>
			    <script type="text/javascript">
			    try {
			        parent.$.fancybox.reload = true;
			        parent.$.fancybox.message = '<?php 
                putGS('You can not schedule opposing events at the same time');
                ?>
';
			        parent.$.fancybox.close();
			    } catch (e) {
			    }
			    </script>
        ArticleIndex::RunIndexer(3, 10, true);
        exit;
}
if (!is_null($f_action_workflow)) {
    $f_action_workflow = strtoupper($f_action_workflow);
    if (in_array($f_action_workflow, array('Y', 'M', 'S', 'N'))) {
        $access = false;
        // A publisher can change the status in any way he sees fit.
        // Someone who can change an article can submit/unsubmit articles.
        // A user who owns the article may submit it.
        if ($g_user->hasPermission('Publish') || $g_user->hasPermission('ChangeArticle') && $f_action_workflow != 'Y' || $articleObj->userCanModify($g_user) && $f_action_workflow == 'S') {
            $access = true;
        }
        // If the article is set to New, remove all the autopublish events
        if ($f_action_workflow == 'N') {
            $articleEvents = ArticlePublish::GetArticleEvents($f_article_number, $f_language_selected, TRUE);
            foreach ($articleEvents as $event) {
                $eventId = $event->getArticlePublishId();
                $articlePublishObj = new ArticlePublish($eventId);
                if ($articlePublishObj->exists()) {
                    $articlePublishObj->delete();
                }
            }
        }
        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;