mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 01:58:47 +02:00
64 lines
2.0 KiB
PHP
64 lines
2.0 KiB
PHP
<?php
|
|
|
|
// Copyright (C) 2012-2024 Combodo SAS
|
|
//
|
|
// This file is part of iTop.
|
|
//
|
|
// iTop is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// iTop is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
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;
|
|
}
|
|
}
|