You are here

public function LingotekAccount::__construct in Lingotek Translation 7.2

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekAccount.php \LingotekAccount::__construct()
  2. 7.3 lib/Drupal/lingotek/LingotekAccount.php \LingotekAccount::__construct()
  3. 7.4 lib/Drupal/lingotek/LingotekAccount.php \LingotekAccount::__construct()
  4. 7.5 lib/Drupal/lingotek/LingotekAccount.php \LingotekAccount::__construct()
  5. 7.6 lib/Drupal/lingotek/LingotekAccount.php \LingotekAccount::__construct()

Constructor.

Sets default values

File

lib/Drupal/lingotek/LingotekAccount.php, line 41
Defines LingotekAccount.

Class

LingotekAccount
A class representing a Lingotek Account

Code

public function __construct() {

  // Set the Defaults
  $this->status = self::LINGOTEK_ACCOUNT_STATUS_UNKNOWN;
  $this->plan = self::LINGOTEK_ACCOUNT_PLAN_UNKNOWN;
  $this->enterprise = FALSE;

  // Load the Current Account Status from Cached local Drupal information.
  $current_status = variable_get('lingotek_account_status', NULL);
  $current_plan = variable_get('lingotek_account_plan', NULL);
  $current_enterprise = variable_get('lingotek_account_enterprise', NULL);

  // Stored as 0/1
  if (isset($current_status) && isset($current_plan) && isset($current_enterprise)) {
    $this
      ->setStatus($current_status);
    $this
      ->setPlan($current_plan);
    $this
      ->setEnterpriseStatus($current_enterprise);
  }
  else {

    // If the Account data isn't cached locally pull it down.
    $this
      ->getAccountStatus();
  }
}