IssuePublish::setPublishArticlesAction PHP Method

setPublishArticlesAction() public method

Set the front page state to switch to when the "publish time" arrives: 'Y' for Yes, or 'N' for No.
public setPublishArticlesAction ( string $p_value ) : mixed
$p_value string
return mixed
    public function setPublishArticlesAction($p_value)
    {
        $p_value = strtoupper($p_value);
        if ($p_value == 'Y' || $p_value == 'N') {
            $this->setProperty('do_publish_articles', $p_value);
        }
    }

Usage Example

$issue = new Issue(1, 1, $issueId);
$issue->create($issueId);
$issue->fetch();
$issue->dumpToHtml();
$article1 = new Article(1, 1, $issueId, 1);
$article1->create('fastnews', 'issue schueduled publish test '.rand());
$article2 = new Article(1, 1, $issueId, 1);
$article2->create('fastnews', 'issue schueduled publish test '.rand());

// Create issue publish event
echo "Creating issue publish event...<br>";
$datetime = strftime("%Y-%m-%d %H:%M:00");
$issuePublishEvent = new IssuePublish(1, $issueId, 1, $datetime);
$issuePublishEvent->create();
$issuePublishEvent->setPublishAction('P');
$issuePublishEvent->setPublishArticlesAction('Y');
$issuePublishEvent->fetch();
$issuePublishEvent->dumpToHtml();

echo "Executing pending events:<br>";
$events = IssuePublish::GetPendingActions();
foreach ($events as $event) {
    $event->doAction();
    $event->dumpToHtml();
}

// Check if issues are published
echo "Is the issue published?<br>";
$issue->fetch();
$issue->dumpToHtml();
All Usage Examples Of IssuePublish::setPublishArticlesAction