mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
# Conflicts: # application/displayblock.class.inc.php # core/config.class.inc.php # datamodels/2.x/authent-cas/module.authent-cas.php # datamodels/2.x/authent-external/module.authent-external.php # datamodels/2.x/authent-ldap/module.authent-ldap.php # datamodels/2.x/authent-local/module.authent-local.php # datamodels/2.x/combodo-backoffice-darkmoon-theme/module.combodo-backoffice-darkmoon-theme.php # datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php # datamodels/2.x/itop-attachments/module.itop-attachments.php # datamodels/2.x/itop-backup/module.itop-backup.php # datamodels/2.x/itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php # datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php # datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php # datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php # datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php # datamodels/2.x/itop-config/module.itop-config.php # datamodels/2.x/itop-core-update/module.itop-core-update.php # datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php # datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php # datamodels/2.x/itop-faq-light/module.itop-faq-light.php # datamodels/2.x/itop-files-information/module.itop-files-information.php # datamodels/2.x/itop-full-itil/module.itop-full-itil.php # datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php # datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php # datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php # datamodels/2.x/itop-portal-base/module.itop-portal-base.php # datamodels/2.x/itop-portal/module.itop-portal.php # datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php # datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php # datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php # datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php # datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php # datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php # datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php # datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php # datamodels/2.x/itop-structure/module.itop-structure.php # datamodels/2.x/itop-tickets/module.itop-tickets.php # datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php # datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php # datamodels/2.x/version.xml
140 lines
2.5 KiB
PHP
140 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
|
* @license http://opensource.org/licenses/AGPL-3.0
|
|
*/
|
|
|
|
|
|
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
|
|
|
|
|
use Combodo\iTop\Application\UI\Base\UIBlock;
|
|
|
|
/**
|
|
* You might want to use a {@link \Combodo\iTop\Application\UI\Base\Component\Field\Field} component instead...
|
|
*
|
|
* @package Combodo\iTop\Application\UI\Base\Component\Input
|
|
*/
|
|
class InputWithLabel extends UIBlock
|
|
{
|
|
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/input/inputwithlabel';
|
|
|
|
/** @var string */
|
|
protected $sLabel;
|
|
/** @var \Combodo\iTop\Application\UI\Base\UIBlock */
|
|
protected $oInput;
|
|
/** @var bool Label before input ? */
|
|
protected $bBeforeInput;
|
|
/**
|
|
* @var string|null $sDescription for tooltip
|
|
* @since 3.0.1
|
|
*/
|
|
protected $sDescription;
|
|
|
|
/**
|
|
* @param string $sLabel
|
|
* @param \Combodo\iTop\Application\UI\Base\UIBlock $oInput
|
|
* @param string|null $sId
|
|
*/
|
|
public function __construct(string $sLabel, UIBlock $oInput, ?string $sId)
|
|
{
|
|
parent::__construct($sId);
|
|
$this->sLabel = $sLabel;
|
|
$this->oInput = $oInput;
|
|
$this->bBeforeInput = true;
|
|
}
|
|
|
|
/**
|
|
* @return UIBlock
|
|
*/
|
|
public function GetInput()
|
|
{
|
|
return $this->oInput;
|
|
}
|
|
|
|
/**
|
|
* @param \Combodo\iTop\Application\UI\Base\UIBlock $oInput
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function SetInput(UIBlock $oInput)
|
|
{
|
|
$this->oInput = $oInput;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @param bool $bBeforeInput
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function SetBeforeInput(bool $bBeforeInput)
|
|
{
|
|
$this->bBeforeInput = $bBeforeInput;
|
|
if ($bBeforeInput) {
|
|
$this->oInput->AddCSSClass('ibo-input--label-left');
|
|
} else {
|
|
$this->oInput->AddCSSClass('ibo-input--label-right');
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function IsLabelBefore(): bool
|
|
{
|
|
return $this->bBeforeInput;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function GetLabel(): string
|
|
{
|
|
return $this->sLabel;
|
|
}
|
|
|
|
/**
|
|
* @param string $sLabel
|
|
*
|
|
* @return InputWithLabel
|
|
*/
|
|
public function SetLabel(string $sLabel)
|
|
{
|
|
$this->sLabel = $sLabel;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string|null
|
|
* @since 3.0.1
|
|
*/
|
|
public function GetDescription(): ?string
|
|
{
|
|
return $this->sDescription;
|
|
}
|
|
|
|
/**
|
|
* @param string|null $sDescription
|
|
* @return $this
|
|
* @since 3.0.1
|
|
*/
|
|
public function SetDescription(?string $sDescription)
|
|
{
|
|
$this->sDescription = $sDescription;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
* @since 3.0.1
|
|
*/
|
|
public function HasDescription(): bool
|
|
{
|
|
return strlen($this->sDescription) > 0;
|
|
}
|
|
|
|
} |