namespace Combodo\iTop\Application\Dashlet\Base; use Combodo\iTop\Application\Dashlet\Dashlet; use Combodo\iTop\Application\UI\Base\Component\Dashlet\DashletContainer; use DBObjectSearch; use DesignerForm; use DesignerIconSelectionField; use Dict; use DisplayBlock; use utils; class DashletBadge extends Dashlet { /** * @inheritdoc */ public function __construct($oModelReflection, $sId) { parent::__construct($oModelReflection, $sId); $this->aProperties['class'] = 'Contact'; $this->aCSSClasses[] = 'ibo-dashlet--is-inline'; $this->aCSSClasses[] = 'ibo-dashlet-badge'; } /** * @inheritdoc * * @throws \Exception */ public function Render($oPage, $bEditMode = false, $aExtraParams = []) { $oDashletContainer = new DashletContainer($this->sId, ['dashlet-content']); $sClass = $this->aProperties['class']; $oFilter = new DBObjectSearch($sClass); $oBlock = new DisplayBlock($oFilter, 'actions'); $aExtraParams['context_filter'] = 1; $aExtraParams['withJSRefreshCallBack'] = true; $sBlockId = 'block_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occurring in the same DOM) $oBlock->DisplayIntoContentBlock($oDashletContainer, $oPage, $sBlockId, $aExtraParams); return $oDashletContainer; } }