mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
Add File Select widget
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input\FileSelect;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Dict;
|
||||
|
||||
class FileSelect extends UIBlock
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-input-file-select';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/input/file-select/layout';
|
||||
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/input/file-select/layout';
|
||||
|
||||
/** @var string */
|
||||
private $sName;
|
||||
/** @var string */
|
||||
private $sFileName;
|
||||
/** @var string */
|
||||
private $sButtonText;
|
||||
|
||||
public function __construct(string $sName, string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->sName = $sName;
|
||||
$this->sFileName = Dict::S('UI:InputFile:NoFileSelected');
|
||||
$this->sButtonText = Dict::S('UI:InputFile:SelectFile');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetFileName()
|
||||
{
|
||||
return $this->sFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $sFileName
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetFileName($sFileName)
|
||||
{
|
||||
$this->sFileName = $sFileName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetButtonText(): string
|
||||
{
|
||||
return $this->sButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sButtonText
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetButtonText(string $sButtonText)
|
||||
{
|
||||
$this->sButtonText = $sButtonText;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetName(): string
|
||||
{
|
||||
return $this->sName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input\FileSelect;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
class FileSelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
public const TWIG_TAG_NAME = 'UIFileSelect';
|
||||
public const UI_BLOCK_CLASS_NAME = FileSelect::class;
|
||||
|
||||
public static function MakeStandard(string $sName, string $sId = null): FileSelect
|
||||
{
|
||||
return new FileSelect($sName, $sId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user