You are here

function lingotek_get_sync_upload_batch_elements in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.batch.inc \lingotek_get_sync_upload_batch_elements()
  2. 7.2 lingotek.batch.inc \lingotek_get_sync_upload_batch_elements()
  3. 7.3 lingotek.batch.inc \lingotek_get_sync_upload_batch_elements()
  4. 7.5 lingotek.batch.inc \lingotek_get_sync_upload_batch_elements()
  5. 7.6 lingotek.batch.inc \lingotek_get_sync_upload_batch_elements()

Sync - Upload Batch Elements: Creates the batch elements for nodes/documents that need to be uploaded.

2 calls to lingotek_get_sync_upload_batch_elements()
lingotek_grid_action_submit in ./lingotek.bulk_grid.inc
Submit function for The Grid's actions The action corresponds to the key of the option selected Often redirects to batch operations or to other pages entirely
lingotek_sync_batch_create in ./lingotek.batch.inc
Batch Create - Sync: Uploads new and changed documents for translation and Downloads translated documents.

File

./lingotek.batch.inc, line 134
Central location for batch create functions, before control is handed off to individual batch command files.

Code

function lingotek_get_sync_upload_batch_elements($upload_nids = array()) {
  $operations = array();
  if (is_null($upload_nids)) {

    //deprecated

    // Grab nodes that are currently marked 'EDITED'
    $query = db_select('lingotek', 'l')
      ->fields('l');
    $query
      ->condition('lingokey', 'node_sync_status');
    $query
      ->condition('lingovalue', LingotekSync::STATUS_EDITED);
    $result = $query
      ->execute();
    while ($record = $result
      ->fetchAssoc()) {
      $operations[] = array(
        'lingotek_sync_upload_node',
        array(
          $record['nid'],
        ),
      );
    }
  }
  elseif (is_array($upload_nids)) {
    foreach ($upload_nids as $nid) {
      $operations[] = array(
        'lingotek_sync_upload_node',
        array(
          $nid,
        ),
      );
    }
  }
  return $operations;
}