You are here

function config_upload_edited in Lingotek Translation 7.7

1 call to config_upload_edited()
lingotek_grid_upload_edited in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 1332

Code

function config_upload_edited($comma_separated_ids, $entity_type) {
  if ($comma_separated_ids !== NULL) {
    $lids = explode(",", $comma_separated_ids);
    lingotek_config_upload_selected($lids);
  }
  elseif (isset($_SESSION['grid_filters'][$entity_type])) {
    empty_array_check($_SESSION['grid_filters'][$entity_type]['filtered_config_lids'], $entity_type, "There are no entities ready for upload for this filter");
    $selected_lids = $_SESSION['grid_filters'][$entity_type]['filtered_config_lids'];

    //check lid selection for dirty statuses
    $edited_lid_map = LingotekConfigSet::getLidsToUpdate(0, $selected_lids);
    $never_lid_map = LingotekConfigSet::findNeverUploadedLids($selected_lids);
    $lid_map = array();
    if (!empty($edited_lid_map) && !empty($never_lid_map)) {
      foreach ($edited_lid_map as $key => $textgroup) {
        if (isset($never_lid_map[$key])) {
          $lid_map[$key] = array_merge($never_lid_map[$key], $textgroup);
        }
      }
    }
    else {
      $lid_map = empty($edited_lid_map) ? $never_lid_map : $edited_lid_map;
    }
  }
  else {

    // Get all lids that are ready to upload
    $lid_map = LingotekConfigSet::getLidsToUpdate();
  }
  lingotek_config_upload_selected($lid_map);
}