mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
N°2847 Add new entry form for activity panel (static atm)
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2020 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityNewEntryForm;
|
||||
use Combodo\iTop\Application\UI\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\UIBlock;
|
||||
/**
|
||||
* Class ActivityNewEntryForm
|
||||
*
|
||||
* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityNewEntryForm
|
||||
*/
|
||||
class ActivityNewEntryForm extends UIContentBlock
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-activitynewentryform';
|
||||
public const HTML_TEMPLATE_REL_PATH = 'layouts/activity-panel/activitynewentryform/layout';
|
||||
public const JS_TEMPLATE_REL_PATH = 'layouts/activity-panel/activitynewentryform/layout';
|
||||
|
||||
/** @var \Combodo\iTop\Application\UI\Component\Input\RichText\RichText $oFormTextInput */
|
||||
protected $oFormTextInput;
|
||||
/** @var array $aTextInputActionButtons */
|
||||
protected $aTextInputActionButtons;
|
||||
/** @var array $aFormActionButtons */
|
||||
protected $aFormActionButtons;
|
||||
|
||||
/**
|
||||
* ActivityNewEntryForm constructor.
|
||||
*
|
||||
* @param null $sName
|
||||
*/
|
||||
public function __construct($sName = null)
|
||||
{
|
||||
parent::__construct($sName);
|
||||
$this->aFormActionButtons = [];
|
||||
$this->aTextInputActionButtons = [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \Combodo\iTop\Application\UI\Component\Input\RichText\RichText
|
||||
*/
|
||||
public function GetFormTextInput(): \Combodo\iTop\Application\UI\Component\Input\RichText\RichText
|
||||
{
|
||||
return $this->oFormTextInput;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Combodo\iTop\Application\UI\Component\Input\RichText\RichText $oFormTextInput
|
||||
* @return $this
|
||||
*/
|
||||
public function SetFormTextInput(\Combodo\iTop\Application\UI\Component\Input\RichText\RichText $oFormTextInput): ActivityNewEntryForm
|
||||
{
|
||||
$this->oFormTextInput = $oFormTextInput;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function GetTextInputActionButtons(): array
|
||||
{
|
||||
return $this->aTextInputActionButtons;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aTextInputActionButtons
|
||||
* @return $this
|
||||
*/
|
||||
public function SetTextInputActionButtons(array $aTextInputActionButtons): ActivityNewEntryForm
|
||||
{
|
||||
$this->aTextInputActionButtons = $aTextInputActionButtons;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Combodo\iTop\Application\UI\UIBlock $oTextInputActionButtons
|
||||
*/
|
||||
public function AddTextInputActionButtons(UIBlock $oTextInputActionButtons): void
|
||||
{
|
||||
$this->aTextInputActionButtons[] = $oTextInputActionButtons;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function GetFormActionButtons()
|
||||
{
|
||||
return $this->aFormActionButtons;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aFormActionButtons
|
||||
* @return $this
|
||||
*/
|
||||
public function SetFormActionButtons(array $aFormActionButtons): ActivityNewEntryForm
|
||||
{
|
||||
$this->aFormActionButtons = $aFormActionButtons;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UIBlock $oFormActionButtons
|
||||
*/
|
||||
public function AddFormActionButtons(UIBlock $oFormActionButtons): void
|
||||
{
|
||||
$this->aFormActionButtons[] = $oFormActionButtons;
|
||||
}
|
||||
|
||||
|
||||
public function GetSubBlocks() : array
|
||||
{
|
||||
$aSubBlocks = [];
|
||||
$aSubBlocks[$this->GetFormTextInput()->GetId()] = $this->GetFormTextInput();
|
||||
foreach ($this->GetTextInputActionButtons() as $oTextInputActionButton)
|
||||
{
|
||||
$aSubBlocks[$oTextInputActionButton->GetId()] = $oTextInputActionButton;
|
||||
}
|
||||
foreach ($this->GetFormActionButtons() as $oFormActionButton)
|
||||
{
|
||||
$aSubBlocks[$oFormActionButton->GetId()] = $oFormActionButton;
|
||||
}
|
||||
return $aSubBlocks;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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\Layout\ActivityPanel\ActivityNewEntryFormFactory;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Component\Button\ButtonFactory;
|
||||
use Combodo\iTop\Application\UI\Component\Input\RichText\RichText;
|
||||
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityNewEntryForm\ActivityNewEntryForm;
|
||||
|
||||
/**
|
||||
* Class ActivityNewEntryFormFactory
|
||||
*
|
||||
* @internal
|
||||
* @author Stephen Abello <stephen.abello@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityNewEntryFormFactory
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class ActivityNewEntryFormFactory
|
||||
{
|
||||
public static function MakeForObjectDetailsActivityPanel(): ActivityNewEntryForm
|
||||
{
|
||||
$oActivityNewEntryForm = new ActivityNewEntryForm();
|
||||
$oActivityNewEntryForm->SetFormTextInput(new RichText());
|
||||
$oActivityNewEntryForm->AddFormActionButtons(ButtonFactory::MakeForSecondaryAction('Cancel'));
|
||||
$oActivityNewEntryForm->AddFormActionButtons(ButtonFactory::MakeForValidationAction('Send'));
|
||||
$oActivityNewEntryForm->AddFormActionButtons(ButtonFactory::MakeForValidationAction('Send....'));
|
||||
$oActivityNewEntryForm->AddTextInputActionButtons(ButtonFactory::MakeForSecondaryAction('Templates')->SetColor('blue'));
|
||||
return $oActivityNewEntryForm;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user