mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-29 05:28:44 +02:00
Add features to Spinner block
This commit is contained in:
@@ -19,9 +19,71 @@ class Spinner extends UIBlock
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-spinner';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/spinner/layout';
|
||||
|
||||
/* @var string Display size for inline element, rather small */
|
||||
public const ENUM_SPINNER_SIZE_INLINE = 'inline';
|
||||
/* @var string Display size for small element, displayed in a column */
|
||||
public const ENUM_SPINNER_SIZE_SMALL = 'small';
|
||||
/* @var string Display size for medium element, displayed in a column */
|
||||
public const ENUM_SPINNER_SIZE_MEDIUM = 'medium';
|
||||
|
||||
public function __construct(?string $sId = null)
|
||||
/* @var string Display size for large element, displayed in a column */
|
||||
public const ENUM_SPINNER_SIZE_LARGE = 'large';
|
||||
/* @var string Default display size */
|
||||
public const ENUM_SPINNER_SIZE_DEFAULT = self::ENUM_SPINNER_SIZE_INLINE;
|
||||
|
||||
/* @var string */
|
||||
private $sDescription = '';
|
||||
/* @var string */
|
||||
private $sSize = self::ENUM_SPINNER_SIZE_DEFAULT;
|
||||
|
||||
public function __construct(?string $sId = null, $sDescription = '')
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->sDescription = $sDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetDescription(): string
|
||||
{
|
||||
return $this->sDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDescription
|
||||
* @return $this
|
||||
*/
|
||||
public function SetDescription($sDescription)
|
||||
{
|
||||
$this->sDescription = $sDescription;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function HasDescription(): bool
|
||||
{
|
||||
return $this->sDescription !== '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetSize(): string
|
||||
{
|
||||
return $this->sSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSize
|
||||
* @return $this
|
||||
*/
|
||||
public function SetSize(string $sSize)
|
||||
{
|
||||
$this->sSize = $sSize;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -35,4 +35,49 @@ class SpinnerUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new Spinner($sId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
*
|
||||
* @param string|null $sId
|
||||
* @param string $sDescription
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Spinner\Spinner
|
||||
*/
|
||||
public static function MakeSmall(?string $sId = null, string $sDescription = '')
|
||||
{
|
||||
$oSpinner = new Spinner($sId, $sDescription);
|
||||
$oSpinner->SetSize(Spinner::ENUM_SPINNER_SIZE_SMALL);
|
||||
return $oSpinner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
*
|
||||
* @param string|null $sId
|
||||
* @param string $sDescription
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Spinner\Spinner
|
||||
*/
|
||||
public static function MakeMedium(?string $sId = null, string $sDescription = '')
|
||||
{
|
||||
$oSpinner = new Spinner($sId, $sDescription);
|
||||
$oSpinner->SetSize(Spinner::ENUM_SPINNER_SIZE_MEDIUM);
|
||||
return $oSpinner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
*
|
||||
* @param string|null $sId
|
||||
* @param string $sDescription
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Spinner\Spinner
|
||||
*/
|
||||
public static function MakeLarge(?string $sId = null, string $sDescription = '')
|
||||
{
|
||||
$oSpinner = new Spinner($sId, $sDescription);
|
||||
$oSpinner->SetSize(Spinner::ENUM_SPINNER_SIZE_LARGE);
|
||||
return $oSpinner;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user