You are here

function lingotek_dashboard in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lingotek.dashboard.inc \lingotek_dashboard()
  2. 7.2 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() {
  lingotek_is_module_setup();
  $account = LingotekAccount::instance();

  //remove?
  if (lingotek_is_config_missing()) {
    $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'), 'admin/config/lingotek/setup'), 'warning');
    }
    $output[] = lingotek_support_footer();
    return $output;
  }

  // As a backup fail safe, the dashboard loading should clear the sync flag if its still set.
  if (isset($_SESSION['lingotek_sync_in_progress'])) {
    unset($_SESSION['lingotek_sync_in_progress']);
  }
  return array(
    'dashboard' => array(
      '#type' => 'markup',
      '#markup' => '<div id="dashboard"></div>',
    ),
    'script' => array(
      '#type' => 'markup',
      '#markup' => lingotek_get_dashboard_code(),
    ),
  );
}