You are here

function bynder_upload_file_batch_finished in Bynder 7

1 string reference to 'bynder_upload_file_batch_finished'
bynder_upload_submit in includes/bynder_upload.inc

File

includes/bynder_upload.inc, line 231

Code

function bynder_upload_file_batch_finished($success, $results, $operations) {
  if ($success) {

    // Here we do something meaningful with the results.
    $message = t('@count items successfully processed:', array(
      '@count' => count($results['files_done']),
    ));
    $message .= theme('item_list', array(
      'items' => $results['files_done'],
    ));
    drupal_set_message($message);
  }
  else {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $message = t('An error occurred while processing %error_operation with arguments: @arguments', array(
      '%error_operation' => $error_operation[0],
      '@arguments' => print_r($error_operation[1], true),
    ));
    drupal_set_message($message, 'error');
  }
  if (!isset($_SESSION['bynder_upload_browser'])) {
    drupal_goto('/media/browser', array(
      'query' => array(
        'render' => 'media-popup',
        'fid' => isset($results['fids_done']) ? $results['fids_done'] : array(),
      ),
    ));
  }
  else {
    drupal_set_message(t("Successfully added the selected assets."), 'status');
    drupal_goto('admin/content/file');

    // page to return to after complete
  }
}