/** * This method gets the total storage used by user. * * @author Orangescrum * @method ajax_getStorage * @param * @return string */ function ajax_getStorage() { App::import('Model', 'CaseFile'); $CaseFile = new CaseFile(); $usedspace = $CaseFile->getStorage(); echo $usedspace; exit; }
function betauser_limitation() { App::import('Model', 'UserSubscription'); $usersubscription = new UserSubscription(); $limitation = $usersubscription->find('first', array('conditions' => array('company_id' => SES_COMP), 'order' => 'id DESC')); $GLOBALS['Userlimitation'] = $limitation['UserSubscription']; $GLOBALS['user_subscription'] = $limitation['UserSubscription']; $this->set("user_subscription", $limitation['UserSubscription']); if ($limitation['UserSubscription']['subscription_id'] == 1 || $limitation['UserSubscription']['subscription_id'] == 9) { $GLOBALS['FREE_SUBSCRIPTION'] = 1; } //$this->set('sub_limitation',$limitation['UserSubscription']); //echo $this->projcetcount(SES_COMP,$limitation)."====".$this->milestonecount(SES_COMP,$limitation)."--".$this->usercount(SES_COMP,$limitation); $this->set('rem_projects', $this->projcetcount(SES_COMP, $limitation)); $this->set('rem_milestone', $this->milestonecount(SES_COMP, $limitation)); $this->set('rem_users', $this->usercount(SES_COMP, $limitation)); App::import('Model', 'CaseFile'); $cmpusr = new CaseFile(); $usedspace = $cmpusr->getStorage(); $this->set('used_storage', $usedspace); $GLOBALS['usedspace'] = $usedspace; if (isset($limitation['UserSubscriptions']['storage_limit']) && (strtolower($limitation['UserSubscriptions']['storage_limit']) == 'unlimited' || $limitation['UserSubscription']['is_free'])) { $this->set('remspace', 'Unlimited'); $GLOBALS['remspace'] = 'Unlimited'; } elseif (isset($limitation['UserSubscriptions']['storage_limit']) && $usedspace <= $limitation['UserSubscriptions']['storage_limit']) { $this->set('remspace', $limitation['UserSubscriptions']['storage_limit'] - $usedspace); $GLOBALS['remspace'] = $limitation['UserSubscriptions']['storage_limit'] - $usedspace; } else { $GLOBALS['remspace'] = 0; $this->set('remspace', 0); } //echo "Deal count=".$rem_deal_count."--Contact = ".$rem_contact_count."--User = "******"-Total Used Space:-".$totalused;exit; }