You are here

function drupalchat_app_settings in DrupalChat 7.2

Same name and namespace in other branches
  1. 6.2 drupalchat.admin.inc \drupalchat_app_settings()

@file Administrative functions to configure DrupalChat.

1 string reference to 'drupalchat_app_settings'
drupalchat_menu in ./drupalchat.module
Implements hook_menu().

File

./drupalchat.admin.inc, line 8
Administrative functions to configure DrupalChat.

Code

function drupalchat_app_settings() {
  global $user;
  if (isset($_SESSION['token']) && !empty($_SESSION['token'])) {
    $token = $_SESSION['token'];
  }
  else {
    $json = _drupalchat_get_auth(array());
    $token = $json['key'];
  }
  $drupalchat_host = DRUPALCHAT_EXTERNAL_A_HOST;
  $host = explode("/", $drupalchat_host);
  $host_name = $host[2];
  $dashboardUrl = "https://" . DRUPALCHAT_EXTERNAL_CDN_HOST . "/apps/dashboard/#/settings/app?sessid=" . $token . "&hostName=" . $host_name . "&hostPort=" . DRUPALCHAT_EXTERNAL_A_PORT;

  //return '<iframe id = "app_settings" style = "width:100%; height:600px; border:none;" src = "'.$dashboardUrl.'"></iframe>';
  $form = array();
  $form['drupalchat_app_dashboard'] = array(
    '#type' => 'button',
    '#attributes' => array(
      'onClick' => 'window.open("' . $dashboardUrl . '","_blank")',
    ),
    '#value' => t('Click here to open App Dashboard'),
  );
  return $form;
}