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()

Builds forms on GlobalLink active submissions dashboard.

Parameters

string $type: The type of task we are working on.

Return value

array Array of forms for the GlobalLink active submissions dashboard.

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_submissions.inc, line 12

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(3) == 'sync') {
    $sub_rid = arg(4);
    $uri = request_uri();
    $ex_uri = explode(arg(3), $uri);
    $curr_uri = explode('admin', $ex_uri[0]);
    if ($sub_rid != '') {
      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,
            NULL,
            0,
          ),
        );
        $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, NULL, 0);
        drupal_set_message('The submission has been synced with the latest available status');
      }
    }
    drupal_goto('admin' . $curr_uri[1]);
  }
  if (arg(3) == 'import') {
    $sub_rid = arg(4);
    $uri = request_uri();
    $ex_uri = explode(arg(3), $uri);
    $curr_uri = explode('admin', $ex_uri[0]);
    if ($sub_rid != '') {
      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_import',
          array(
            $pd4,
            $sub_rid,
            NULL,
          ),
        );
        $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, NULL);
        drupal_set_message('The submission has been imported');
      }
    }
    drupal_goto('admin' . $curr_uri[1]);
  }
  if (arg(3) == 'completed' && arg(4) == 'import') {
    $sub_rid = arg(5);
    $uri = request_uri();
    $ex_uri = explode(arg(4), $uri);
    $curr_uri = explode('admin', $ex_uri[0]);
    if ($sub_rid != '') {
      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_import',
          array(
            $pd4,
            $sub_rid,
            NULL,
          ),
        );
        $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, NULL);
        drupal_set_message('The submission has been imported');
      }
    }
    drupal_goto('admin' . $curr_uri[1]);
  }
  $f1 = drupal_get_form('globallink_all_active_filter_form');
  $f2 = drupal_get_form('globallink_node_active_pager_form');
  $f3 = drupal_get_form('globallink_dashboard_active');
  $html = drupal_render($f1);
  $html .= drupal_render($f2);
  $html .= drupal_render($f3);
  return $html;
}