namespace Combodo\iTop\Form\Field; use Dict; use utils; /** * Description of BlobField * * @author Guillaume Lajarige */ class BlobField extends AbstractSimpleField { /** @var string */ protected $sDownloadUrl; /** @var string */ protected $sDisplayUrl; public function GetDownloadUrl() { return $this->sDownloadUrl; } public function GetDisplayUrl() { return $this->sDisplayUrl; } public function SetDownloadUrl(string $sDownloadUrl) { $this->sDownloadUrl = $sDownloadUrl; return $this; } public function SetDisplayUrl(string $sDisplayUrl) { $this->sDisplayUrl = $sDisplayUrl; return $this; } public function GetCurrentValue() { return $this->currentValue->GetFileName(); } public function GetDisplayValue() { if ($this->currentValue->IsEmpty()) { $sValue = Dict::S('Portal:File:None'); } else { $sFilename = $this->currentValue->GetFileName(); $iSize = utils::BytesToFriendlyFormat(utils::Strlen($this->currentValue->GetData())); $sOpenLink = $this->GetDisplayUrl(); $sDownloadLink = $this->GetDownloadUrl(); $sValue = Dict::Format('Portal:File:DisplayInfo+', $sFilename, $iSize, $sOpenLink, $sDownloadLink); } return $sValue; } }