Example #1
0
 /**
  * @return array $limits
  */
 public function getLimits()
 {
     $l = array(Scalr_Limits::ACCOUNT_ENVIRONMENTS, Scalr_Limits::ACCOUNT_FARMS, Scalr_Limits::ACCOUNT_SERVERS, Scalr_Limits::ACCOUNT_USERS);
     $limits = array();
     foreach ($l as $limitName) {
         $limit = Scalr_Limits::init()->Load($limitName, $this->id);
         $limits[$limitName] = array('limit' => $limit->getLimitValue(), 'usage' => $limit->getCurrentUsage());
     }
     return $limits;
 }
Example #2
0
 public function getAccount()
 {
     $account = Scalr_Account::init()->loadById($this->getParam(self::CALL_PARAM_NAME));
     $result = array('id' => $account->id, 'name' => $account->name, 'comments' => $account->comments, 'limitEnv' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_ENVIRONMENTS, $account->id)->getLimitValue(), 'limitFarms' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_FARMS, $account->id)->getLimitValue(), 'limitServers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_SERVERS, $account->id)->getLimitValue(), 'limitUsers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_USERS, $account->id)->getLimitValue());
     if ($this->getContainer()->config->get('scalr.auth_mode') == 'ldap') {
         $result['ownerEmail'] = $account->getOwner()->getEmail();
     }
     $result['ccs'] = [];
     if ($this->getContainer()->analytics->enabled) {
         foreach (AccountCostCenterEntity::findByAccountId($account->id) as $accountCcsEntity) {
             $result['ccs'][] = $accountCcsEntity->ccId;
         }
     }
     return $result;
 }
Example #3
0
 public function detailsAction()
 {
     $f = Scalr_Limits::getFeatures();
     foreach ($f as $featureKey => $featureName) {
         $features[$featureName] = $this->user->getAccount()->isFeatureEnabled($featureKey);
     }
     $info = $this->billing->getInfo();
     $info['emergPending'] = $this->user->getAccount()->getSetting(Scalr_Account::SETTING_BILLING_EMERG_SUPPORT_PENDING);
     $dt = $this->user->getAccount()->getSetting(Scalr_Account::SETTING_BILLING_EMERG_SUPPORT_DATE);
     if ($dt + 86400 * 2 < time()) {
         $this->user->getAccount()->setSetting(Scalr_Account::SETTING_BILLING_EMERG_SUPPORT_PENDING, 0);
         $this->user->getAccount()->setSetting(Scalr_Account::SETTING_BILLING_EMERG_SUPPORT_DATE, null);
         $info['emergPending'] = 0;
     }
     if ($info['emergPending'] == 1) {
         $info['emergPhone'] = 'Registration pending, make take up to 2 business days';
     }
     $this->response->page('ui/billing/details.js', array('billing' => $info, 'limits' => $this->user->getAccount()->getLimits(), 'features' => $features));
 }
Example #4
0
 public function getAccount()
 {
     $account = Scalr_Account::init()->loadById($this->getParam(self::CALL_PARAM_NAME));
     $result = array('id' => $account->id, 'name' => $account->name, 'comments' => $account->comments, 'limitEnv' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_ENVIRONMENTS, $account->id)->getLimitValue(), 'limitFarms' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_FARMS, $account->id)->getLimitValue(), 'limitServers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_SERVERS, $account->id)->getLimitValue(), 'limitUsers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_USERS, $account->id)->getLimitValue());
     if ($this->getContainer()->config->get('scalr.auth_mode') == 'ldap') {
         $result['ownerEmail'] = $account->getOwner()->getEmail();
     }
     return $result;
 }
Example #5
0
 public function buyEnvironmentsAction()
 {
     $limit = Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_ENVIRONMENTS, $this->user->getAccountId());
     $this->response->page('ui/account2/billing/buyEnvironments.js', array('currentLimit' => $limit->getLimitValue()));
 }
Example #6
0
 public function getAccount()
 {
     $account = Scalr_Account::init()->loadById($this->getParam(self::CALL_PARAM_NAME));
     return array('id' => $account->id, 'name' => $account->name, 'comments' => $account->comments, 'limitEnv' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_ENVIRONMENTS, $account->id)->getLimitValue(), 'limitFarms' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_FARMS, $account->id)->getLimitValue(), 'limitServers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_SERVERS, $account->id)->getLimitValue(), 'limitUsers' => Scalr_Limits::init()->Load(Scalr_Limits::ACCOUNT_USERS, $account->id)->getLimitValue());
 }