mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 14:38:47 +02:00
N°4621 Fix naming inconsistencies in sources/*
This commit is contained in:
201
sources/Application/UI/Base/Component/Dashlet/DashletBadge.php
Normal file
201
sources/Application/UI/Base/Component/Dashlet/DashletBadge.php
Normal file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\tJSRefreshCallback;
|
||||
|
||||
class DashletBadge extends DashletContainer
|
||||
{
|
||||
use tJSRefreshCallback;
|
||||
|
||||
public const BLOCK_CODE = 'ibo-dashlet-badge';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/dashlet/dashlet-badge';
|
||||
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/components/dashlet/dashlet-badge';
|
||||
public const DEFAULT_JS_FILES_REL_PATH = [
|
||||
'js/components/dashlet/dashlet-badge.js',
|
||||
];
|
||||
|
||||
/** @var string */
|
||||
protected $sClassIconUrl;
|
||||
/** @var string */
|
||||
protected $sHyperlink;
|
||||
/** @var string */
|
||||
protected $iCount;
|
||||
/** @var string */
|
||||
protected $sClassLabel;
|
||||
|
||||
/** @var string */
|
||||
protected $sCreateActionUrl;
|
||||
/** @var string */
|
||||
protected $sCreateActionLabel;
|
||||
/** @var array */
|
||||
protected $aRefreshParams;
|
||||
|
||||
/**
|
||||
* DashletBadge constructor.
|
||||
*
|
||||
* @param string $sClassIconUrl
|
||||
* @param string $sHyperlink
|
||||
* @param string $iCount
|
||||
* @param string $sClassLabel
|
||||
* @param string|null $sCreateActionUrl
|
||||
* @param string|null $sCreateActionLabel
|
||||
* @param array $aRefreshParams
|
||||
*/
|
||||
public function __construct(
|
||||
string $sClassIconUrl, string $sHyperlink, string $iCount, string $sClassLabel, ?string $sCreateActionUrl = '',
|
||||
?string $sCreateActionLabel = '', array $aRefreshParams = []
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->sClassIconUrl = $sClassIconUrl;
|
||||
$this->sHyperlink = $sHyperlink;
|
||||
$this->iCount = $iCount;
|
||||
$this->sClassLabel = $sClassLabel;
|
||||
$this->sCreateActionUrl = $sCreateActionUrl;
|
||||
$this->sCreateActionLabel = $sCreateActionLabel;
|
||||
$this->aRefreshParams = $aRefreshParams;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetCreateActionUrl(): ?string
|
||||
{
|
||||
return $this->sCreateActionUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $sCreateActionUrl
|
||||
*
|
||||
* @return DashletBadge
|
||||
*/
|
||||
public function SetCreateActionUrl(?string $sCreateActionUrl)
|
||||
{
|
||||
$this->sCreateActionUrl = $sCreateActionUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetCreateActionLabel(): ?string
|
||||
{
|
||||
return $this->sCreateActionLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $sCreateActionLabel
|
||||
*
|
||||
* @return DashletBadge
|
||||
*/
|
||||
public function SetCreateActionLabel(?string $sCreateActionLabel)
|
||||
{
|
||||
$this->sCreateActionLabel = $sCreateActionLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetClassIconUrl(): string
|
||||
{
|
||||
return $this->sClassIconUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClassIconUrl
|
||||
*
|
||||
* @return DashletBadge
|
||||
*/
|
||||
public function SetClassIconUrl(string $sClassIconUrl)
|
||||
{
|
||||
$this->sClassIconUrl = $sClassIconUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetHyperlink(): string
|
||||
{
|
||||
return $this->sHyperlink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sHyperlink
|
||||
*
|
||||
* @return DashletBadge
|
||||
*/
|
||||
public function SetHyperlink(string $sHyperlink)
|
||||
{
|
||||
$this->sHyperlink = $sHyperlink;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetCount(): string
|
||||
{
|
||||
return $this->iCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $iCount
|
||||
*
|
||||
* @return DashletBadge
|
||||
*/
|
||||
public function SetCount(string $iCount)
|
||||
{
|
||||
$this->iCount = $iCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetClassLabel(): string
|
||||
{
|
||||
return $this->sClassLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClassLabel
|
||||
*
|
||||
* @return DashletBadge
|
||||
*/
|
||||
public function SetClassLabel(string $sClassLabel)
|
||||
{
|
||||
$this->sClassLabel = $sClassLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function GetJSRefresh(): string
|
||||
{
|
||||
return "$('#".$this->sId."').block();
|
||||
$.post('ajax.render.php?operation=refreshDashletCount&style=count',
|
||||
".json_encode($this->aRefreshParams).",
|
||||
function(data){
|
||||
$('#".$this->sId."').find('.ibo-dashlet-badge--action-list-count').html(data.count);
|
||||
$('#".$this->sId."').unblock();
|
||||
});
|
||||
|
||||
$('#".$this->sId."').unblock();";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
class DashletContainer extends UIContentBlock
|
||||
{
|
||||
public const BLOCK_CODE = 'ibo-dashlet';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/content-block/layout';
|
||||
|
||||
public function __construct(string $sId = null, array $aContainerClasses = [])
|
||||
{
|
||||
parent::__construct($sId, $aContainerClasses);
|
||||
|
||||
$this->AddDataAttribute('role', static::BLOCK_CODE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
/**
|
||||
* Class DashletFactory
|
||||
*
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Dashlet
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class DashletFactory
|
||||
{
|
||||
public static function MakeForDashletBadge(string $sClassIconUrl, string $sHyperlink, string $iCount, string $sClassLabel, ?string $sCreateActionUrl = '', ?string $sCreateActionLabel = '', array $aRefreshParams = []): DashletBadge
|
||||
{
|
||||
return new DashletBadge($sClassIconUrl, $sHyperlink, $iCount, $sClassLabel, $sCreateActionUrl, $sCreateActionLabel, $aRefreshParams);
|
||||
}
|
||||
|
||||
public static function MakeForDashletHeaderStatic(string $sTitle, string $sIconUrl, string $sId = null): DashletHeaderStatic
|
||||
{
|
||||
return new DashletHeaderStatic($sTitle, $sIconUrl, $sId);
|
||||
}
|
||||
|
||||
public static function MakeForDashletPlainText(string $sText, string $sId = null): DashletPlainText
|
||||
{
|
||||
return new DashletPlainText($sText, $sId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
/**
|
||||
* Class DashletHeaderStatic
|
||||
*
|
||||
* @internal
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @since 3.0.0
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Dashlet
|
||||
*/
|
||||
class DashletHeaderStatic extends DashletContainer
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-dashlet-header-static';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/dashlet/dashlet-header-static';
|
||||
|
||||
/** @var string */
|
||||
protected $sTitle;
|
||||
/** @var string */
|
||||
protected $sIconUrl;
|
||||
|
||||
/**
|
||||
* DashletHeaderStatic constructor.
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param string $sIconUrl
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct(string $sTitle, string $sIconUrl, string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
|
||||
$this->sTitle = $sTitle;
|
||||
$this->sIconUrl = $sIconUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetTitle(): string
|
||||
{
|
||||
return $this->sTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sTitle
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetTitle(string $sTitle)
|
||||
{
|
||||
$this->sTitle = $sTitle;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetIconUrl(): string
|
||||
{
|
||||
return $this->sIconUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sIconUrl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetIconUrl(string $sIconUrl)
|
||||
{
|
||||
$this->sIconUrl = $sIconUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
/**
|
||||
* Class DashletPlainText
|
||||
*
|
||||
* @internal
|
||||
* @author Eric Espie <eric.espie@combodo.com>
|
||||
* @since 3.0.0
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Dashlet
|
||||
*/
|
||||
class DashletPlainText extends DashletContainer
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-dashlet-plain-text';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/dashlet/dashlet-plain-text';
|
||||
|
||||
/** @var string */
|
||||
protected $sText;
|
||||
|
||||
/**
|
||||
* DashletPlainText constructor.
|
||||
*
|
||||
* @param string $sText
|
||||
*/
|
||||
public function __construct(string $sText, string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
|
||||
$this->sText = $sText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetText(): string
|
||||
{
|
||||
return $this->sText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sText
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetText(string $sText)
|
||||
{
|
||||
$this->sText = $sText;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user