mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
N°4791 - Expand usage of ObjectFormHandlerHelper::ENUM_MODE_XXX constants for better robustness / comprehension
This commit is contained in:
@@ -50,12 +50,17 @@ use UserRights;
|
|||||||
*/
|
*/
|
||||||
class ObjectFormHandlerHelper
|
class ObjectFormHandlerHelper
|
||||||
{
|
{
|
||||||
/** @var string ENUM_MODE_VIEW */
|
/** @var string */
|
||||||
const ENUM_MODE_VIEW = 'view';
|
const ENUM_MODE_VIEW = 'view';
|
||||||
/** @var string ENUM_MODE_EDIT */
|
/** @var string */
|
||||||
const ENUM_MODE_EDIT = 'edit';
|
const ENUM_MODE_EDIT = 'edit';
|
||||||
/** @var string ENUM_MODE_CREATE */
|
/** @var string */
|
||||||
const ENUM_MODE_CREATE = 'create';
|
const ENUM_MODE_CREATE = 'create';
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @since 2.7.7 3.0.1 3.1.0
|
||||||
|
*/
|
||||||
|
const ENUM_MODE_APPLY_STIMULUS = 'apply_stimulus';
|
||||||
|
|
||||||
/** @var \Combodo\iTop\Portal\Helper\RequestManipulatorHelper $oRequestManipulator */
|
/** @var \Combodo\iTop\Portal\Helper\RequestManipulatorHelper $oRequestManipulator */
|
||||||
private $oRequestManipulator;
|
private $oRequestManipulator;
|
||||||
@@ -172,7 +177,7 @@ class ObjectFormHandlerHelper
|
|||||||
'label' => Dict::S('Portal:Button:Submit'),
|
'label' => Dict::S('Portal:Button:Submit'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if ($sMode !== 'apply_stimulus')
|
if ($sMode !== static::ENUM_MODE_APPLY_STIMULUS)
|
||||||
{
|
{
|
||||||
// Add transition buttons
|
// Add transition buttons
|
||||||
$oSetToCheckRights = DBObjectSet::FromObject($oObject);
|
$oSetToCheckRights = DBObjectSet::FromObject($oObject);
|
||||||
@@ -237,9 +242,9 @@ class ObjectFormHandlerHelper
|
|||||||
// Note : We might need to distinguish form & renderer endpoints
|
// Note : We might need to distinguish form & renderer endpoints
|
||||||
switch($sMode)
|
switch($sMode)
|
||||||
{
|
{
|
||||||
case 'create':
|
case static::ENUM_MODE_CREATE:
|
||||||
case 'edit':
|
case static::ENUM_MODE_EDIT:
|
||||||
case 'view':
|
case static::ENUM_MODE_VIEW:
|
||||||
$sFormEndpoint = $this->oUrlGenerator->generate(
|
$sFormEndpoint = $this->oUrlGenerator->generate(
|
||||||
'p_object_'.$sMode,
|
'p_object_'.$sMode,
|
||||||
array(
|
array(
|
||||||
@@ -249,7 +254,7 @@ class ObjectFormHandlerHelper
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'apply_stimulus':
|
case static::ENUM_MODE_APPLY_STIMULUS:
|
||||||
$sFormEndpoint = $this->oUrlGenerator->generate(
|
$sFormEndpoint = $this->oUrlGenerator->generate(
|
||||||
'p_object_apply_stimulus',
|
'p_object_apply_stimulus',
|
||||||
array(
|
array(
|
||||||
|
|||||||
Reference in New Issue
Block a user