You are here

function lingotek_dashboard in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.2 lingotek.dashboard.inc \lingotek_dashboard()
  2. 7.3 lingotek.dashboard.inc \lingotek_dashboard()
  3. 7.4 lingotek.dashboard.inc \lingotek_dashboard()
  4. 7.5 lingotek.dashboard.inc \lingotek_dashboard()
  5. 7.6 lingotek.dashboard.inc \lingotek_dashboard()

Tab: Dashboard - The main Lingotek dashboard page.

1 string reference to 'lingotek_dashboard'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.dashboard.inc, line 11
Lingotek Dashboard.

Code

function lingotek_dashboard() {
  if (variable_get('lingotek_use_stage_servers', FALSE)) {
    $server_url = 'cms.lingotek.com';
    drupal_set_message(t('Warning: Lingotek\'s sandbox TMS environment (@server) will be discontinued soon. Please plan accordingly.', array(
      '@server' => $server_url,
    )), 'warning');
  }
  lingotek_is_module_setup();
  $account = LingotekAccount::instance();

  //remove?
  if (lingotek_is_config_missing() === TRUE) {
    $output = array();

    // Check the login ID to see if this is a Lingopoint user, if so, provide information about setting up their oauth keys.
    $login_id = variable_get('lingotek_login_id', 'community_admin');
    if ($login_id != 'community_admin') {
      drupal_set_message(t('The Lingotek Translation module is not fully configured.'), 'warning');
      $output['instructions'] = array(
        '#type' => 'markup',
        '#markup' => theme('item_list', array(
          'title' => 'Complete configuration by performing the following:',
          'type' => 'ol',
          'items' => array(
            array(
              'data' => t('Login to the') . ' ' . l(t('Lingotek account dashboard'), LINGOTEK_API_SERVER, array(
                'attributes' => array(
                  'target' => '_blank',
                ),
              )),
            ),
            array(
              'data' => t('Select the <i>Community &gt; Integrations</i> menu item'),
            ),
            array(
              'data' => t('Setup an <i>Inbound OAuth integration</i> method to create an <i>OAuth Key</i> and <i>OAuth Secret</i>'),
            ),
            array(
              'data' => t('Copy and paste the <i>OAuth Key</i> and <i>OAuth Secret</i> that were created into the') . ' ' . l(t('Lingotek Drupal module settings'), LINGOTEK_MENU_LANG_BASE_URL . '/settings', array(
                'query' => array(
                  'edit_connection' => 1,
                ),
              )),
            ),
          ),
        )),
      );
    }
    else {

      // Show the standard misconfiguration message.
      drupal_set_message(t('The Lingotek Translation module is not fully configured. To complete setup, run the') . ' ' . l(t('Lingotek Configuration Wizard'), LINGOTEK_MENU_LANG_BASE_URL . '/setup'), 'warning');
    }
    $output[] = lingotek_support_footer();
    return $output;
  }
  lingotek_notify_if_no_languages_added();
  return array(
    'script' => array(
      '#type' => 'markup',
      '#markup' => lingotek_get_dashboard_code(),
    ),
  );
  return array(
    'script' => array(
      '#type' => 'markup',
      '#markup' => lingotek_get_dashboard_code(),
    ),
  );
}