You are here

function backup_migrate_destination::get_file_links in Backup and Migrate 6.2

Same name and namespace in other branches
  1. 8.2 includes/destinations.inc \backup_migrate_destination::get_file_links()
  2. 8.3 includes/destinations.inc \backup_migrate_destination::get_file_links()
  3. 6.3 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 798

Class

backup_migrate_destination
A base class for creating destinations.

Code

function get_file_links($file_id) {
  $out = array();

  // 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[] = l(t("download"), BACKUP_MIGRATE_MENU_PATH . "/destination/downloadfile/" . $destination_id . '/' . $file_id);
  }
  if ($can_read && user_access("restore from backup")) {
    $out[] = l(t("restore"), BACKUP_MIGRATE_MENU_PATH . "/destination/list/restorefile/" . $destination_id . '/' . $file_id);
  }
  if ($can_delete && user_access("delete backup files")) {
    $out[] = l(t("delete"), BACKUP_MIGRATE_MENU_PATH . "/destination/list/deletefile/" . $destination_id . '/' . $file_id);
  }
  return $out;
}