You are here

function globallink_dashboard_active_submissions_page in GlobalLink Connect for Drupal 7.7

Same name in this branch
  1. 7.7 globallink_workbench_all_active_submissions.inc \globallink_dashboard_active_submissions_page()
  2. 7.7 globallink_workbench_all_submissions.inc \globallink_dashboard_active_submissions_page()
Same name and namespace in other branches
  1. 7.5 globallink_active_submissions.inc \globallink_dashboard_active_submissions_page()
  2. 7.6 globallink_active_submissions.inc \globallink_dashboard_active_submissions_page()
11 string references to 'globallink_dashboard_active_submissions_page'
globallink_beans_menu in globallink_beans/globallink_beans.module
Implements hook_menu().
globallink_block_menu in globallink_block/globallink_block.module
Implements hook_menu().
globallink_commerce_menu in globallink_commerce/globallink_commerce.module
Implements hook_menu().
globallink_entity_menu in globallink_entity/globallink_entity.module
Implements hook_menu().
globallink_fieldable_panels_menu in globallink_fieldable_panels/globallink_fieldable_panels.module
Implements hook_menu().

... See full list

File

./globallink_workbench_all_active_submissions.inc, line 3

Code

function globallink_dashboard_active_submissions_page($type = GLOBALLINK_ENTITY_TYPE_NODE) {
  $_SESSION['transpefect_dashboard_active_type'] = $type;
  $_SESSION['transpefect_dashboard_receive_type'] = $type;
  $array = array();
  if (arg(6) == 'sync') {
    $sub_rid_sync = arg(4);
    $doc_id_sync = arg(7);
    $uri = request_uri();
    $ex_uri = explode(arg(6), $uri);
    $curr_uri = explode('admin', $ex_uri[0]);
    $doc_ids_sync = array(
      $doc_id_sync,
    );
    if ($sub_rid_sync != '') {
      module_load_include('inc', 'globallink', 'globallink_settings');
      $pd4 = globallink_get_project_director_details();
      if (module_exists('background_process') && module_exists('background_batch')) {
        $operations = array();
        $operations[] = array(
          'globallink_background_pull',
          array(
            $pd4,
            $sub_rid_sync,
            $doc_ids_sync,
            1,
          ),
        );
        $batch = array(
          'title' => t('Pulling Status'),
          'operations' => $operations,
          'error_message' => t('Sync has encountered an error.'),
          'file' => drupal_get_path('module', 'globallink') . '/globallink_background_jobs.inc',
        );
        batch_set($batch);
        $batch['progressive'] = FALSE;
        background_batch_process_batch('admin/globallink-translations/workbench');
        drupal_set_message('The submission(s) are being synced in the background. Please refresh the page for the progress.');
      }
      else {
        module_load_include('inc', 'globallink', 'globallink_background_jobs');
        globallink_background_pull($pd4, $sub_rid_sync, $doc_ids_sync, 1);
        drupal_set_message('The document has been synced with latest available status');
      }
      drupal_goto('admin' . $curr_uri[1]);
    }
  }
  if (arg(6) == 'import') {
    $sub_rid_import = arg(4);
    $doc_id_import = arg(7);
    $uri = request_uri();
    $ex_uri = explode(arg(6), $uri);
    $curr_uri = explode('admin', $ex_uri[0]);
    $doc_ids_import = array(
      $doc_id_import,
    );
    if ($sub_rid_import != '') {
      module_load_include('inc', 'globallink', 'globallink_settings');
      $pd4 = globallink_get_project_director_details();
      if (module_exists('background_process') && module_exists('background_bacth')) {
        $operations = array();
        $operations[] = array(
          'globallink_background_import',
          array(
            $pd4,
            $sub_rid_import,
            $doc_ids_import,
          ),
        );
        $batch = array(
          'title' => t('Importing'),
          'operations' => $operations,
          'error_message' => t('Import has encountered an error.'),
          'file' => drupal_get_path('module', 'globallink') . '/globallink_background_jobs.inc',
        );
        batch_set($batch);
        $batch['progressive'] = FALSE;
        background_batch_process_batch('admin/globallink-translations/workbench');
        drupal_set_message('The submission(s) are being imported in the background. Please refresh the page for the progress.');
      }
      else {
        module_load_include('inc', 'globallink', 'globallink_background_jobs');
        globallink_background_import($pd4, $sub_rid_import, $doc_ids_import);
        drupal_set_message('Document has been imported');
      }
      drupal_goto('admin' . $curr_uri[1]);
    }
  }
  $f1 = drupal_get_form('globallink_all_active_filter_form');
  $f2 = drupal_get_form('globallink_all_active_pager_form');
  $f3 = drupal_get_form('globallink_all_active_form');
  $html = drupal_render($f1);
  $html .= drupal_render($f2);
  $html .= drupal_render($f3);
  return $html;
}