You are here

function revisioning_scheduler_revisionapi in Revisioning 7

Same name and namespace in other branches
  1. 8 revisioning_scheduler/revisioning_scheduler.module \revisioning_scheduler_revisionapi()
  2. 6.3 revisioning_scheduler/revisioning_scheduler.module \revisioning_scheduler_revisionapi()

Implements hook_revisionapi().

See also

revisioning/revisioning_api.inc

File

revisioning_scheduler/revisioning_scheduler.module, line 230
Allows revisions to be published at specified dates and times.

Code

function revisioning_scheduler_revisionapi($op, $node) {
  switch ($op) {
    case 'pre publish':
    case 'post revert':
      if (empty($_POST['revisioning_scheduler_date'])) {
        break;
      }
      $date = check_plain($_POST['revisioning_scheduler_date']);
      $time = check_plain($_POST['revisioning_scheduler_time']);
      $result = _revisioning_scheduler_schedule_publication($date, $time, $node);
      if (isset($result)) {

        // This will abort the current publication operation.
        return FALSE;
      }
      break;

    // The revision is being deleted. If it is scheduled for publishing, i.e.
    // vid exists in {revisioning_scheduler} table, remove the scheduler entry.
    case 'pre delete':
      _revisioning_scheduler_unschedule($node->vid);
      break;
  }
}