You are here

function lingotek_admin_account_status_form in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.admin.inc \lingotek_admin_account_status_form()
  2. 7.3 lingotek.admin.inc \lingotek_admin_account_status_form()
  3. 7.4 lingotek.admin.inc \lingotek_admin_account_status_form()
  4. 7.5 lingotek.admin.inc \lingotek_admin_account_status_form()

Form constructor for the administration form.

Return value

array A FAPI form array.

1 string reference to 'lingotek_admin_account_status_form'
lingotek_admin_configuration_view in ./lingotek.admin.inc

File

./lingotek.admin.inc, line 16

Code

function lingotek_admin_account_status_form($form, &$form_state, $show_fieldset = FALSE) {
  lingotek_is_module_setup();
  $account = LingotekAccount::instance();
  $show_advanced = $account
    ->showAdvanced();

  // Account Status
  $account_status = $account
    ->getStatusText();
  $form['status'] = array(
    '#type' => $show_fieldset ? 'fieldset' : 'item',
    '#title' => t('Account'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'administrative_settings',
  );
  $form['status']['account_summary'] = array(
    '#type' => 'hidden',
    '#value' => $account_status,
    '#attributes' => array(
      'id' => array(
        'account_summary',
      ),
    ),
  );

  // Account Information
  $activation_details = variable_get('lingotek_activation_first_name', '') . ' ' . variable_get('lingotek_activation_last_name', '');
  $activation_email = variable_get('lingotek_activation_email', '');
  $activation_details .= strlen($activation_email) ? ' (' . $activation_email . ')' : '';
  $activation_details = strlen(trim($activation_details)) ? $activation_details : 'NA';
  $form['status'][] = array(
    '#type' => 'item',
    '#markup' => theme('table', array(
      'header' => array(),
      'rows' => array(
        array(
          t('Status:'),
          $account_status,
        ),
        array(
          t('Enterprise:'),
          $show_advanced ? '<span style="color: green;">' . t('Yes') . '</span>' : '<span>' . t('No') . '</span>',
        ),
        array(
          t('Activation Name:'),
          $activation_details,
        ),
        array(
          t('Community Identifier:'),
          variable_get('lingotek_community_identifier', ''),
        ),
        array(
          t('OAuth Credentials:') . ' <a id="lingotek-oauth-secret-btn"><i class="fa fa-lock fa-lg' . '" alt="' . t('lock/unlock') . '" style="cursor: pointer;"></i></a>',
          '<input type="text" value="' . variable_get('lingotek_oauth_consumer_id', '') . '" readonly="readonly" style="background: none; width: 80%;"/><span class="description">' . t('Key') . '</span>' . '<br/></span><span id="lingotek-oauth-secret" style="display:none;">' . '<input type="text" value="' . variable_get('lingotek_oauth_consumer_secret', '') . '" readonly="readonly" style="background: none; width: 80%;"/>' . '</span>' . '<span id="lingotek-oauth-secret-placeholder">' . '<input type="password" value="' . variable_get('lingotek_oauth_consumer_secret', '') . '" readonly="readonly" style="background: none; width: 80%;"/></span><span class="description">' . t('Secret') . '</span>',
        ),
        array(
          t('Workflow ID:'),
          variable_get('lingotek_workflow', ''),
        ),
        array(
          t('Integration Method ID:'),
          variable_get('lingotek_integration_method', ''),
        ),
        array(
          t('External ID:'),
          variable_get('lingotek_login_id', ''),
        ),
        array(
          t('Project ID:'),
          variable_get('lingotek_project', ''),
        ),
        array(
          t('Vault ID:'),
          variable_get('lingotek_vault', ''),
        ),
        array(
          t('Notify URL:'),
          '<span title="' . variable_get('lingotek_notify_url', '') . '">' . truncate_utf8(variable_get('lingotek_notify_url', ''), 45, FALSE, TRUE) . '</span>',
        ),
      ),
    )),
  );
  return $form;
}