You are here

function lingotek_get_dashboard_code in Lingotek Translation 7.6

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

Generates the code for the embedded Javascript dashboard.

1 call to lingotek_get_dashboard_code()
lingotek_dashboard in ./lingotek.dashboard.inc
Tab: Dashboard - The main Lingotek dashboard page.

File

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

Code

function lingotek_get_dashboard_code() {
  global $base_url, $language;
  $output = '';
  $guid = lingotek_get_guid();

  // 16 char string
  $script = '
      <script>
        var cms_data = {
          // lingotek
          "community": "%s",
          "external_id": "%s",
          "tm_vault_id": "%s",
          "workflow_id": "%s",
          "project_id": "%s",
          "first_name": "%s",
          "last_name": "%s",
          "email": "%s",
          // cms
          "cms_site_id": "%s",
          "cms_site_key": "%s",
          "cms_site_name": "%s",
          "cms_type": "%s",
          "cms_version": "%s",
          "cms_tag": "%s",
          "locale": "%s",
          "module_version": %s,
          "endpoint_url": "%s"
        };
      </script>
      <link rel="stylesheet" href="' . LINGOTEK_GMC_SERVER . '/v2/styles/ltk.css">
      <script src="' . LINGOTEK_GMC_SERVER . '/v2/ltk.min.js"></script>
      <div ltk-dashboard ng-app="LingotekApp"></div>
    ';
  $endpoint = $base_url . '/lingotek/language';

  //(variable_get('clean_url', 0) ? '' : '?q=') . '/lingotek/target';
  $sync_url = $base_url . '/' . LINGOTEK_MENU_MAIN_BASE_URL . '/manage/node';

  //(variable_get('clean_url', 0) ? '' : '?q=') . '/' . LINGOTEK_MENU_LANG_BASE_URL . '/sync';
  $output .= sprintf($script, variable_get('lingotek_community_identifier', ''), variable_get('lingotek_login_id', ''), variable_get('lingotek_vault', ''), variable_get('lingotek_workflow', ''), variable_get('lingotek_project', ''), variable_get('lingotek_activation_first_name', ''), variable_get('lingotek_activation_last_name', ''), variable_get('lingotek_activation_email', ''), $guid, url('<front>', array(
    'absolute' => TRUE,
  )), variable_get('site_name', 'Unidentified Drupal Site'), 'Drupal', VERSION, variable_get('install_profile', ''), isset($language->lingotek_locale) ? $language->lingotek_locale : Lingotek::convertDrupal2Lingotek($language->language, FALSE), json_encode(lingotek_get_module_info('version')), $endpoint);
  return $output;
}