N°3123 - Refactor Directories

This commit is contained in:
Eric
2020-12-02 13:18:01 +01:00
parent d1b12ee04b
commit 15aa9e508c
259 changed files with 862 additions and 869 deletions

View File

@@ -0,0 +1,90 @@
<?php
/**
* @copyright Copyright (C) 2010-2020 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;
/**
* Class Input
*
* @package Combodo\iTop\Application\UI\Base\Component\Input
*/
class Input extends UIBlock
{
// Overloaded constants
public const BLOCK_CODE = 'ibo-input';
public const HTML_TEMPLATE_REL_PATH = 'base/components/input/layout';
public const INPUT_HIDDEN = 'hidden';
/** @var string */
protected $sType;
/** @var string */
protected $sName;
/** @var string */
protected $sValue;
/**
* @return string
*/
public function GetType(): string
{
return $this->sType;
}
/**
* @param string $sType
*
* @return Input
*/
public function SetType(string $sType): Input
{
$this->sType = $sType;
return $this;
}
/**
* @return string
*/
public function GetName(): string
{
return $this->sName;
}
/**
* @param string $sName
*
* @return Input
*/
public function SetName(string $sName): Input
{
$this->sName = $sName;
return $this;
}
/**
* @return string
*/
public function GetValue(): string
{
return $this->sValue;
}
/**
* @param string $sValue
*
* @return Input
*/
public function SetValue(string $sValue): Input
{
$this->sValue = $sValue;
return $this;
}
}

View File

@@ -0,0 +1,56 @@
<?php
/**
* @copyright Copyright (C) 2010-2020 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input;
use Combodo\iTop\Application\UI\Base\Component\Input\Select\Select;
use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOption;
class InputFactory
{
public static function MakeForHidden(string $sName, string $sValue, ?string $sId = null): Input
{
$oInput = new Input($sId);
$oInput->SetType(Input::INPUT_HIDDEN)
->SetName($sName)
->SetValue($sValue);
return $oInput;
}
public static function MakeForSelectWithLabel(string $sName, string $sLabel, ?string $sId = null): InputWithLabel
{
$oInput = new Select();
$oInput->SetName($sName);
$oInputWithLabel = new InputWithLabel($sLabel, $oInput, $sId);
return $oInputWithLabel;
}
public static function MakeForSelect(string $sName, ?string $sId = null): Select
{
$oInput = new Select($sId);
$oInput->SetName($sName);
return $oInput;
}
public static function MakeForSelectOption(string $sValue, string $sLabel, bool $bSelected, ?string $sId = null): SelectOption
{
$oInput = new SelectOption($sId);
$oInput->SetValue($sValue)
->SetLabel($sLabel)
->SetSelected($bSelected);
return $oInput;
}
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* @copyright Copyright (C) 2010-2020 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;
class InputWithLabel extends UIBlock
{
public const HTML_TEMPLATE_REL_PATH = 'base/components/input/inputwithlabel';
/** @var string */
protected $sLabel;
/** @var \Combodo\iTop\Application\UI\Base\Component\Input\Input */
protected $oInput;
/**
* InputWithLabel constructor.
*
* @param string $sLabel
* @param \Combodo\iTop\Application\UI\Base\Component\Input\Input $oInput
*/
public function __construct(string $sLabel, \Combodo\iTop\Application\UI\Base\Component\Input\Input $oInput, ?string $sId)
{
parent::__construct($sId);
$this->sLabel = $sLabel;
$this->oInput = $oInput;
}
/**
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Input
*/
public function GetInput(): \Combodo\iTop\Application\UI\Base\Component\Input\Input
{
return $this->oInput;
}
/**
* @param \Combodo\iTop\Application\UI\Base\Component\Input\Input $oInput
*
* @return $this
*/
public function SetInput(\Combodo\iTop\Application\UI\Base\Component\Input\Input $oInput): InputWithLabel
{
$this->oInput = $oInput;
return $this;
}
/**
* @return string
*/
public function GetLabel(): string
{
return $this->sLabel;
}
/**
* @param string $sLabel
*
* @return InputWithLabel
*/
public function SetLabel(string $sLabel): InputWithLabel
{
$this->sLabel = $sLabel;
return $this;
}
}

View File

@@ -0,0 +1,20 @@
<?php
/**
* @copyright Copyright (C) 2010-2020 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input\RichText;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
* Class RichText
*
* @package Combodo\iTop\Application\UI\Base\Component\RichText
*/
class RichText extends UIBlock
{
// Overloaded constants
public const BLOCK_CODE = 'ibo-richtext';
public const HTML_TEMPLATE_REL_PATH = 'base/components/input/richtext/layout';
public const JS_TEMPLATE_REL_PATH = 'base/components/input/richtext/layout';
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* @copyright Copyright (C) 2010-2020 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input\Select;
use Combodo\iTop\Application\UI\Base\Component\Input\Input;
class Select extends Input
{
public const HTML_TEMPLATE_REL_PATH = 'base/components/input/select/select';
/** @var array */
protected $aOptions;
public function __construct(?string $sId = null)
{
parent::__construct($sId);
$this->aOptions = [];
}
public function AddOption(SelectOption $oOption)
{
$this->aOptions[$oOption->GetId()] = $oOption;
}
public function GetSubBlocks()
{
return $this->aOptions;
}
}

View File

@@ -0,0 +1,81 @@
<?php
/**
* @copyright Copyright (C) 2010-2020 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input\Select;
use Combodo\iTop\Application\UI\Base\UIBlock;
class SelectOption extends UIBlock
{
public const HTML_TEMPLATE_REL_PATH = 'base/components/input/select/selectoption';
/** @var string */
protected $sValue;
/** @var string */
protected $sLabel;
/** @var bool */
protected $bSelected;
/**
* @return string
*/
public function GetValue(): string
{
return $this->sValue;
}
/**
* @param string $sValue
*
* @return SelectOption
*/
public function SetValue(string $sValue): SelectOption
{
$this->sValue = $sValue;
return $this;
}
/**
* @return string
*/
public function GetLabel(): string
{
return $this->sLabel;
}
/**
* @param string $sLabel
*
* @return SelectOption
*/
public function SetLabel(string $sLabel): SelectOption
{
$this->sLabel = $sLabel;
return $this;
}
/**
* @return bool
*/
public function IsSelected(): bool
{
return $this->bSelected;
}
/**
* @param bool $bSelected
*
* @return SelectOption
*/
public function SetSelected(bool $bSelected): SelectOption
{
$this->bSelected = $bSelected;
return $this;
}
}