mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 10:08:45 +02:00
N°2841 - Error when trying to delete a user with a no admin
This commit is contained in:
46
sources/application/UI/Base/Component/Text/Text.php
Normal file
46
sources/application/UI/Base/Component/Text/Text.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Text;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
* Class Text
|
||||
*
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Text
|
||||
*/
|
||||
class Text extends UIBlock
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-text';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/text/layout';
|
||||
|
||||
/**@var string */
|
||||
protected $sText;
|
||||
|
||||
/**
|
||||
* Text constructor.
|
||||
*
|
||||
* @param string $sText
|
||||
*/
|
||||
public function __construct(string $sText, ?string $sId = null)
|
||||
{
|
||||
$this->sText = $sText;
|
||||
parent::__construct($sId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetText(): string
|
||||
{
|
||||
return $this->sText;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
@@ -7,6 +7,7 @@
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Title;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -14,7 +15,7 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
*
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Title
|
||||
*/
|
||||
class Title extends UIBlock
|
||||
class Title extends UIContentBlock
|
||||
{
|
||||
// Overloaded constants
|
||||
/** @inheritDoc */
|
||||
@@ -31,8 +32,6 @@ class Title extends UIBlock
|
||||
/** @var string */
|
||||
public const DEFAULT_ICON_COVER_METHOD = self::ENUM_ICON_COVER_METHOD_CONTAIN;
|
||||
|
||||
/** @var string */
|
||||
protected $sTitle;
|
||||
/** @var int */
|
||||
protected $iLevel;
|
||||
/** @var string */
|
||||
@@ -44,22 +43,14 @@ class Title extends UIBlock
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function __construct(string $sTitle = '', int $iLevel = 1, ?string $sId = null)
|
||||
public function __construct(UIBlock $oTitle, int $iLevel = 1, ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->sTitle = $sTitle;
|
||||
$this->iLevel = $iLevel;
|
||||
$this->sIconUrl = null;
|
||||
$this->sIconCoverMethod = static::DEFAULT_ICON_COVER_METHOD;
|
||||
$this->bIsMedallion = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetTitle(): string
|
||||
{
|
||||
return $this->sTitle;
|
||||
$this->AddSubBlock($oTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
@@ -9,6 +9,8 @@ namespace Combodo\iTop\Application\UI\Base\Component\Title;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Text\Text;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
@@ -17,7 +19,7 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
|
||||
public static function MakeForPage(string $sTitle, ?string $sId = null)
|
||||
{
|
||||
return new Title($sTitle, 1, $sId);
|
||||
return new Title(new Text($sTitle), 1, $sId);
|
||||
}
|
||||
|
||||
public static function MakeForPageWithIcon(
|
||||
@@ -25,7 +27,7 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
?string $sId = null
|
||||
)
|
||||
{
|
||||
$oTitle = new Title($sTitle, 1, $sId);
|
||||
$oTitle = new Title(new Text($sTitle), 1, $sId);
|
||||
$oTitle->SetIcon($sIconUrl, $sIconCoverMethod, $bIsMedallion);
|
||||
|
||||
return $oTitle;
|
||||
@@ -33,6 +35,11 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
|
||||
public static function MakeNeutral(string $sTitle, int $iLevel = 1, ?string $sId = null)
|
||||
{
|
||||
return new Title($sTitle, $iLevel, $sId);
|
||||
return new Title(new Text($sTitle), $iLevel, $sId);
|
||||
}
|
||||
|
||||
public static function MakeStandard(UIBlock $oTitle, int $iLevel = 1, ?string $sId = null)
|
||||
{
|
||||
return new Title($oTitle, $iLevel, $sId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user