namespace Combodo\iTop\Application\Dashlet\Core; use Combodo\iTop\Application\Dashlet\Dashlet; use Combodo\iTop\Application\UI\Base\Component\Dashlet\DashletFactory; use DesignerForm; use DesignerLongTextField; use Dict; use utils; class DashletPlainText extends Dashlet { /** * @inheritdoc */ public function __construct($oModelReflection, $sId) { parent::__construct($oModelReflection, $sId); $this->aProperties['text'] = Dict::S('UI:DashletPlainText:Prop-Text:Default'); } /** * @inheritdoc */ public function Render($oPage, $bEditMode = false, $aExtraParams = []) { $sText = $this->aProperties['text']; $sText = utils::EscapeHtml(Dict::S($sText)); $sText = str_replace(["\r\n", "\n", "\r"], "
", $sText); $sId = 'plaintext_'.($bEditMode ? 'edit_' : '').$this->sId; return DashletFactory::MakeForDashletPlainText($sText, $sId); } /** * @inheritdoc */ public function GetPropertiesFields(DesignerForm $oForm) { $oField = new DesignerLongTextField('text', Dict::S('UI:DashletPlainText:Prop-Text'), $this->aProperties['text']); $oField->SetMandatory(); $oForm->AddField($oField); } }