You are here

function backup_migrate_ui_schedule_display_schedules in Backup and Migrate 5.2

List the the available schedules in the UI.

1 string reference to 'backup_migrate_ui_schedule_display_schedules'
backup_migrate_menu in ./backup_migrate.module
Implementation of hook_menu().

File

includes/schedules.inc, line 128
All of the schedule handling code needed for Backup and Migrate.

Code

function backup_migrate_ui_schedule_display_schedules() {
  require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/destinations.inc';
  require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/profiles.inc';
  $out = array();
  foreach (backup_migrate_get_schedules() as $schedule) {
    $destination = backup_migrate_get_destination($schedule['destination_id']);
    $profile = backup_migrate_get_profile($schedule['profile_id']);
    $row = array(
      check_plain($schedule['name']),
      $destination ? l($destination['name'], 'admin/content/backup_migrate/destination/files/' . $destination['destination_id']) : t("Missing"),
      $profile ? $profile['name'] : t("Missing"),
      _backup_migrate_schedule_format_frequency($schedule['period']),
      $schedule['keep'] ? $schedule['keep'] : t('All'),
      $schedule['enabled'] ? t('Enabled') : t('Disabled'),
      $schedule['last_run'] ? format_date($schedule['last_run'], 'small') : t('Never'),
      implode(" | ", _backup_migrate_schedule_get_links($schedule['schedule_id'])),
    );
    if (!$schedule['enabled']) {
      foreach ($row as $key => $field) {
        $row[$key] = array(
          'data' => $field,
          'class' => 'schedule-list-disabled',
        );
      }
    }
    $out[] = $row;
  }
  $headers = array(
    t('Name'),
    t('Destination'),
    t('Profile'),
    t('Frequency'),
    t('Keep'),
    t('Enabled'),
    t('Last run'),
    t('Operations'),
  );
  drupal_add_css(drupal_get_path('module', 'backup_migrate') . '/backup_migrate.css');
  if ($out) {
    $out = theme("table", $headers, $out);
  }
  else {
    $out = t('There are no schedules to display.');
  }
  return $out . ' ' . l(t("Create new schedule..."), 'admin/content/backup_migrate/schedule/add');
}