mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 14:38:47 +02:00
N°330 Attachments display as table : console
This commit is contained in:
@@ -75,6 +75,29 @@ class ormDocument
|
||||
return $this->m_sMimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int size in bits
|
||||
* @uses strlen which returns the no of bits used
|
||||
* @since 2.7.0
|
||||
*/
|
||||
public function GetSize()
|
||||
{
|
||||
return strlen($this->m_data);
|
||||
}
|
||||
|
||||
public function GetFormatedSize($precision = 2)
|
||||
{
|
||||
$bytes = $this->GetSize();
|
||||
$units = array('B', 'KB', 'MB', 'GB', 'TB');
|
||||
|
||||
$bytes = max($bytes, 0);
|
||||
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
|
||||
$pow = min($pow, count($units) - 1);
|
||||
|
||||
$bytes /= pow(1024, $pow);
|
||||
|
||||
return round($bytes, $precision).' '.$units[$pow];
|
||||
}
|
||||
public function GetData()
|
||||
{
|
||||
return $this->m_data;
|
||||
|
||||
Reference in New Issue
Block a user