IssuePublish::GetPendingActions PHP Method

GetPendingActions() public static method

Get all the actions that currently need to be performed.
public static GetPendingActions ( ) : array
return array
    public static function GetPendingActions()
    {
        $datetime = strftime("%Y-%m-%d %H:%M:00");
        $queryStr = "SELECT * FROM IssuePublish " . " WHERE time_action <= '{$datetime}'" . " AND is_completed != 'Y'" . " ORDER BY time_action ASC";
        $result = DbObjectArray::Create('IssuePublish', $queryStr);
        return $result;
    }

Usage Example

$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?
echo "Are the articles published?<br>";
$article1->fetch();
$article1->dumpToHtml();
$article2->fetch();
$article2->dumpToHtml();

echo "Number of remaining events (should be zero): ".count(IssuePublish::GetPendingActions())."<br>";

echo "Deleting objects.<br>";
$issue->delete();
$article1->delete();
$article2->delete();
$issuePublishEvent->delete();

echo "done.<br>";
?>
All Usage Examples Of IssuePublish::GetPendingActions