You are here

function backup_migrate_destination::get_file_links in Backup and Migrate 8.2

Same name and namespace in other branches
  1. 8.3 includes/destinations.inc \backup_migrate_destination::get_file_links()
  2. 6.3 includes/destinations.inc \backup_migrate_destination::get_file_links()
  3. 6.2 includes/destinations.inc \backup_migrate_destination::get_file_links()
  4. 7.3 includes/destinations.inc \backup_migrate_destination::get_file_links()
  5. 7.2 includes/destinations.inc \backup_migrate_destination::get_file_links()

Get the action links for a file on a given destination.

File

includes/destinations.inc, line 826

Class

backup_migrate_destination
A base class for creating destinations.

Code

function get_file_links($file_id) {
  $out = array(
    'download' => '',
    'restore' => '',
    'delete' => '',
  );

  // Don't display the download/delete/restore ops if they are not available for this destination.
  $can_read = $this
    ->can_read_file($file_id);
  $can_delete = $this
    ->can_delete_file($file_id);
  $destination_id = $this
    ->get_id();
  if ($can_read && user_access("access backup files")) {
    $out['download'] = l(t("download"), BACKUP_MIGRATE_MENU_PATH . "/destination/downloadfile/" . $destination_id . '/' . $file_id);
  }
  if ($can_read && user_access("restore from backup")) {
    $out['restore'] = l(t("restore"), BACKUP_MIGRATE_MENU_PATH . "/destination/restorefile/" . $destination_id . '/' . $file_id);
  }
  if ($can_delete && user_access("delete backup files")) {
    $out['delete'] = l(t("delete"), BACKUP_MIGRATE_MENU_PATH . "/destination/deletefile/" . $destination_id . '/' . $file_id);
  }
  return $out;
}