namespace Combodo\iTop\Renderer\Console\FieldRenderer; use \Dict; use Combodo\iTop\Renderer\FieldRenderer; use Combodo\iTop\Renderer\RenderingOutput; use \Combodo\iTop\Form\Field\TextAreaField; use \InlineImage; use \UserRights; class ConsoleSimpleFieldRenderer extends FieldRenderer { public function Render() { $oOutput = new RenderingOutput(); $sFieldClass = get_class($this->oField); if ($sFieldClass == 'Combodo\\iTop\\Form\\Field\\HiddenField') { $oOutput->AddHtml(''); } else { $oOutput->AddHtml('
'); } switch ($sFieldClass) { case 'Combodo\\iTop\\Form\\Field\\StringField': $oOutput->AddHtml(' | '); if ($this->oField->GetReadOnly()) { $oOutput->AddHtml(''); $oOutput->AddHtml(''.htmlentities($this->oField->GetCurrentValue(), ENT_QUOTES, 'UTF-8').''); } else { $oOutput->AddHtml(''); } $oOutput->AddHtml(''); $oOutput->AddHtml(' | '); break; case 'Combodo\\iTop\\Form\\Field\\TextAreaField': $bRichEditor = ($this->oField->GetFormat() === TextAreaField::ENUM_FORMAT_HTML); $oOutput->AddHtml('');
if ($this->oField->GetReadOnly())
{
$oOutput->AddHtml('');
}
else
{
$oOutput->AddHtml('');
// Some additional stuff if we are displaying it with a rich editor
if ($bRichEditor)
{
$sEditorLanguage = strtolower(trim(UserRights::GetUserLanguage()));
$oOutput->AddJs(
<< | ');
break;
case 'Combodo\\iTop\\Form\\Field\\SelectField':
$oOutput->AddHtml(''); if ($this->oField->GetReadOnly()) { $aChoices = $this->oField->GetChoices(); $sCurrentLabel = isset($aChoices[$this->oField->GetCurrentValue()]) ? $aChoices[$this->oField->GetCurrentValue()] : '' ; $oOutput->AddHtml(''); $oOutput->AddHtml(''.htmlentities($sCurrentLabel, ENT_QUOTES, 'UTF-8').''); } else { $oOutput->AddHtml(''); } $oOutput->AddHtml(''); $oOutput->AddHtml(' | '); break; } $oOutput->AddHtml('