You are here

function config_download_ready in Lingotek Translation 7.7

1 call to config_download_ready()
lingotek_grid_download_ready in ./lingotek.bulk_grid.inc
1 string reference to 'config_download_ready'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.bulk_grid.inc, line 1262

Code

function config_download_ready($force_download, $comma_separated_ids = NULL, $entity_type = NULL) {
  if ($entity_type === NULL) {
    $entity_type = 'node';
  }
  if ($force_download != NULL) {
    $ready_lids = LingotekConfigSet::getSetIdsByStatus(LingotekSync::STATUS_READY);
    $current_lids = LingotekConfigSet::getSetIdsByStatus(LingotekSync::STATUS_CURRENT);
    $interim_current_lids = LingotekConfigSet::getSetIdsByStatus(LingotekSync::STATUS_INTERIM);
    $interim_ready_lids = LingotekConfigSet::getSetIdsByStatus(LingotekSync::STATUS_READY_INTERIM);
    $edited_lids = LingotekConfigSet::getSetIdsByStatus(LingotekSync::STATUS_EDITED);
    $set_ids = array_merge($ready_lids, $current_lids, $edited_lids, $interim_current_lids, $interim_ready_lids);
  }
  elseif (isset($_SESSION['grid_filters'][$entity_type]) || $comma_separated_ids !== NULL) {
    if (isset($_SESSION['grid_filters'][$entity_type])) {
      empty_array_check($_SESSION['grid_filters'][$entity_type]['filtered_config_lids'], $entity_type, "There are no translations ready for download for this filter.");
    }
    $selected_lids = $comma_separated_ids !== NULL ? explode(",", $comma_separated_ids) : $_SESSION['grid_filters'][$entity_type]['filtered_config_lids'];
    $set_ids = LingotekConfigSet::getSetIdsByStatus(LingotekSync::STATUS_READY, $selected_lids);
  }
  else {
    $set_ids = LingotekConfigSet::getSetIdsByStatus(LingotekSync::STATUS_READY);
  }
  lingotek_config_download_selected('download_all', $set_ids, TRUE);
}