$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();

// Are the articles published?