|
@@ -132,24 +132,9 @@ class Profile implements TenancyIdTraitInterface
|
|
return $this->download;
|
|
return $this->download;
|
|
}
|
|
}
|
|
|
|
|
|
- function units($value, $prefered=false, $mode = 'short', $decimals = 2, $prefix_grows=1000){
|
|
|
|
- $units = array('long' => array('', 'kilo', 'mega','giga', 'tera', 'peta',' exa','zetta', 'yotta'),
|
|
|
|
- 'short' => array('', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y',)
|
|
|
|
- );
|
|
|
|
- $unit = '';
|
|
|
|
- for($i = 0; $i < count($units[$mode]); $i++) {
|
|
|
|
- $unit = $units[$mode][$i];
|
|
|
|
- if($unit === $prefered) break;
|
|
|
|
- if($value > $prefix_grows) {
|
|
|
|
- $value /= $prefix_grows;
|
|
|
|
- } else {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return round($value, $decimals) . $unit;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- function getDownloadAsK(){return $this->units($this->getDownload(), "k"); }
|
|
|
|
- function getUploadAsK() {return $this->units($this->getUpload() , "k"); }
|
|
|
|
|
|
+ function getDownloadAsK(){return round($this->getDownload()/1000,2)."k"; }
|
|
|
|
+ function getUploadAsK() {return round($this->getUpload()/1000,2)."k"; }
|
|
|
|
+
|
|
function getRadiusName() {return preg_replace("|[^A-Za-z0-9]|", "-", $this->name); }
|
|
function getRadiusName() {return preg_replace("|[^A-Za-z0-9]|", "-", $this->name); }
|
|
}
|
|
}
|