Merge remote-tracking branch 'origin/develop' into feature/8772_form_dependencies_manager

This commit is contained in:
Eric Espie
2025-11-14 16:08:37 +01:00
2221 changed files with 56572 additions and 61991 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Alert;
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
@@ -254,10 +254,9 @@ class Alert extends UIContentBlock
*/
public function IsOpenedByDefault(): bool
{
if($this->IsCollapsible()) {
if ($this->IsCollapsible()) {
return $this->bIsOpenedByDefault;
}
else {
} else {
return true;
}
}
@@ -292,4 +291,4 @@ class Alert extends UIContentBlock
return $this->sSectionStateStorageKey;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -158,4 +159,4 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_SECONDARY, $sId);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Breadcrumbs;
use Combodo\iTop\Application\UI\Base\UIBlock;
use MetaModel;
use utils;
@@ -90,8 +90,7 @@ class Breadcrumbs extends UIBlock
$aJsWidgetOptions = [];
$iBreadCrumbMaxCount = utils::GetConfig()->Get('breadcrumb.max_count');
if ($iBreadCrumbMaxCount > 1)
{
if ($iBreadCrumbMaxCount > 1) {
$oConfig = MetaModel::GetConfig();
$siTopInstanceId = $oConfig->GetItopInstanceid();
@@ -104,4 +103,4 @@ class Breadcrumbs extends UIBlock
return $aJsWidgetOptions;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Button;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -39,7 +39,7 @@ class Button extends UIBlock
'js/components/button.js',
];
public const REQUIRES_ANCESTORS_DEFAULT_JS_FILES = true;
// Specific constants
/** @var string ENUM_ACTION_TYPE_REGULAR */
public const ENUM_ACTION_TYPE_REGULAR = 'regular';
@@ -271,4 +271,4 @@ class Button extends UIBlock
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Button;
/**
* Class Button
*
@@ -66,19 +66,34 @@ class ButtonJS extends Button
* @param string $sOnClickJsCode
*/
public function __construct(
string $sLabel, string $sId = null, string $sName = '', string $sValue = '', string $sType = self::DEFAULT_TYPE,
string $sTooltip = '', string $sIconClass = '',
string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColor = self::DEFAULT_COLOR_SCHEME, string $sJsCode = '',
string $sLabel,
string $sId = null,
string $sName = '',
string $sValue = '',
string $sType = self::DEFAULT_TYPE,
string $sTooltip = '',
string $sIconClass = '',
string $sActionType = self::DEFAULT_ACTION_TYPE,
string $sColor = self::DEFAULT_COLOR_SCHEME,
string $sJsCode = '',
string $sOnClickJsCode = ''
) {
parent::__construct( $sLabel,$sId, $sTooltip, $sIconClass,
$sActionType, $sColor, $sJsCode, $sOnClickJsCode);
parent::__construct(
$sLabel,
$sId,
$sTooltip,
$sIconClass,
$sActionType,
$sColor,
$sJsCode,
$sOnClickJsCode
);
$this->sName = $sName;
$this->sValue = $sValue;
$this->sType = $sType;
}
/**
* @return string
*/
@@ -135,4 +150,4 @@ class ButtonJS extends Button
$this->sValue = $sValue;
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -149,8 +150,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
) {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName,
$bIsSubmit, $sId);
return static::MakeForAction(
$sLabel,
Button::ENUM_COLOR_SCHEME_DESTRUCTIVE,
Button::ENUM_ACTION_TYPE_REGULAR,
$sValue,
$sName,
$bIsSubmit,
$sId
);
}
//-------------------------------------------------
@@ -175,8 +183,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
) {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
return static::MakeForAction(
$sLabel,
Button::ENUM_COLOR_SCHEME_NEUTRAL,
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
$sValue,
$sName,
$bIsSubmit,
$sId
);
}
/**
@@ -198,8 +213,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
) {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_PRIMARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
return static::MakeForAction(
$sLabel,
Button::ENUM_COLOR_SCHEME_PRIMARY,
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
$sValue,
$sName,
$bIsSubmit,
$sId
);
}
/**
@@ -220,8 +242,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
) {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_SECONDARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
return static::MakeForAction(
$sLabel,
Button::ENUM_COLOR_SCHEME_SECONDARY,
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
$sValue,
$sName,
$bIsSubmit,
$sId
);
}
/**
@@ -242,8 +271,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
) {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_VALIDATION, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
return static::MakeForAction(
$sLabel,
Button::ENUM_COLOR_SCHEME_VALIDATION,
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
$sValue,
$sName,
$bIsSubmit,
$sId
);
}
/**
@@ -264,8 +300,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
) {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
return static::MakeForAction(
$sLabel,
Button::ENUM_COLOR_SCHEME_DESTRUCTIVE,
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
$sValue,
$sName,
$bIsSubmit,
$sId
);
}
/**
@@ -289,8 +332,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
$sLabel = $sLabel ?? Dict::S('UI:Button:Cancel');
$sName = $sName ?? 'cancel';
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
return static::MakeForAction(
$sLabel,
Button::ENUM_COLOR_SCHEME_NEUTRAL,
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
$sValue,
$sName,
$bIsSubmit,
$sId
);
}
/**
@@ -311,8 +361,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
) {
$oButton = static::MakeForAction('', Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
$oButton = static::MakeForAction(
'',
Button::ENUM_COLOR_SCHEME_NEUTRAL,
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
$sValue,
$sName,
$bIsSubmit,
$sId
);
$oButton->SetIconClass($sIconClasses);
$oButton->SetTooltip($sTooltipText);
@@ -335,14 +392,17 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
* @return \Combodo\iTop\Application\UI\Base\Component\Button\Button
*/
public static function MakeLinkNeutral(
string $sURL, ?string $sLabel = '', ?string $sIconClasses = null, ?string $sTarget = null,
string $sURL,
?string $sLabel = '',
?string $sIconClasses = null,
?string $sTarget = null,
?string $sId = null
) {
if (empty($sTarget)) {
$sTarget = ButtonURL::DEFAULT_TARGET;
}
$sType = empty($sIconClasses) ? Button::ENUM_ACTION_TYPE_REGULAR : Button::ENUM_ACTION_TYPE_ALTERNATIVE;
$oButton = static::MakeForLink($sLabel, $sURL,Button::ENUM_COLOR_SCHEME_NEUTRAL, $sType, $sTarget, $sId);
$oButton = static::MakeForLink($sLabel, $sURL, Button::ENUM_COLOR_SCHEME_NEUTRAL, $sType, $sTarget, $sId);
if (!empty($sIconClasses)) {
$oButton->SetIconClass($sIconClasses);
@@ -361,19 +421,22 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
* @return \Combodo\iTop\Application\UI\Base\Component\Button\ButtonURL
*/
public static function MakeIconLink(
string $sIconClasses, string $sTooltipText, ?string $sURL = '', ?string $sTarget = null,
string $sIconClasses,
string $sTooltipText,
?string $sURL = '',
?string $sTarget = null,
?string $sId = null
) {
if (empty($sTarget)) {
$sTarget = ButtonURL::DEFAULT_TARGET;
}
$oButton = static::MakeForLink('', $sURL,Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sTarget, $sId);
$oButton = static::MakeForLink('', $sURL, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sTarget, $sId);
$oButton->SetIconClass($sIconClasses);
$oButton->SetTooltip($sTooltipText);
return $oButton;
}
/**
* @param string $sIconClasses
* @param string $sTooltipText
@@ -385,10 +448,14 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
* @return \Combodo\iTop\Application\UI\Base\Component\Button\Button
*/
public static function MakeDestructiveIconLink(
string $sIconClasses, string $sTooltipText, ?string $sURL = null, ?string $sName = null, ?string $sTarget = null,
string $sIconClasses,
string $sTooltipText,
?string $sURL = null,
?string $sName = null,
?string $sTarget = null,
?string $sId = null
) {
$oButton = static::MakeIconLink($sIconClasses, $sTooltipText, $sURL, $sTarget, $sId);
$oButton = static::MakeIconLink($sIconClasses, $sTooltipText, $sURL, $sTarget, $sId);
$oButton->SetColor(Button::ENUM_COLOR_SCHEME_DESTRUCTIVE);
$oButton->SetTooltip($sTooltipText);
return $oButton;
@@ -467,7 +534,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
$oButton = new ButtonURL($sLabel, $sURL, $sId, $sTarget);
$oButton->SetActionType($sActionType)
->SetColor($sColor);
return $oButton;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Button;
/**
* Class Button
*
@@ -37,15 +37,14 @@ class ButtonURL extends Button
/** @var string ENUM_TARGET_BLANK */
public const ENUM_TARGET_BLANK = '_blank';
/** @var string ENUM_TARGET_SELF */
public const ENUM_TARGET_SELF= '_self';
public const ENUM_TARGET_SELF = '_self';
/** @var string ENUM_TARGET_PARENT */
public const ENUM_TARGET_PARENT= '_parent';
public const ENUM_TARGET_PARENT = '_parent';
/** @var string ENUM_TARGET_TOP */
public const ENUM_TARGET_TOP= '_top';
public const ENUM_TARGET_TOP = '_top';
/** @var string DEFAULT_TARGET */
public const DEFAULT_TARGET = self::ENUM_TARGET_SELF;
/** @var string */
protected $sURL;
/** @var string */
@@ -66,12 +65,27 @@ class ButtonURL extends Button
* @param string $sOnClickJsCode
*/
public function __construct(
string $sLabel, string $sURL, string $sId = null, string $sTarget = self::DEFAULT_TARGET, string $sTooltip = '', string $sIconClass = '',
string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColor = self::DEFAULT_COLOR_SCHEME, string $sJsCode = '',
string $sOnClickJsCode = '')
{
parent::__construct($sLabel, $sId, $sTooltip, $sIconClass,
$sActionType, $sColor, $sJsCode, $sOnClickJsCode);
string $sLabel,
string $sURL,
string $sId = null,
string $sTarget = self::DEFAULT_TARGET,
string $sTooltip = '',
string $sIconClass = '',
string $sActionType = self::DEFAULT_ACTION_TYPE,
string $sColor = self::DEFAULT_COLOR_SCHEME,
string $sJsCode = '',
string $sOnClickJsCode = ''
) {
parent::__construct(
$sLabel,
$sId,
$sTooltip,
$sIconClass,
$sActionType,
$sColor,
$sJsCode,
$sOnClickJsCode
);
$this->sURL = $sURL;
$this->sTarget = $sTarget;
}
@@ -86,7 +100,7 @@ class ButtonURL extends Button
/**
* @param string $sURL
*
*
* @return $this
*/
public function SetURL(string $sURL)
@@ -105,7 +119,7 @@ class ButtonURL extends Button
/**
* @param string $sTarget
*
*
* @return $this
*/
public function SetTarget(string $sTarget)
@@ -113,4 +127,4 @@ class ButtonURL extends Button
$this->sTarget = $sTarget;
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\ButtonGroup;
use Combodo\iTop\Application\UI\Base\Component\Button\Button;
use Combodo\iTop\Application\UI\Base\iUIBlock;
use Combodo\iTop\Application\UI\Base\UIBlock;
@@ -150,4 +150,4 @@ class ButtonGroup extends UIBlock
{
return array_merge($this->GetButtons(), $this->GetExtraBlocks());
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -55,4 +56,4 @@ class ButtonGroupUIBlockFactory extends AbstractUIBlockFactory
return $oButtonGroup;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\CollapsibleSection;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Combodo\iTop\Application\UI\Base\tUIContentAreas;
@@ -99,4 +99,4 @@ class CollapsibleSection extends UIContentBlock
{
return $this->sSectionStateStorageKey;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\CollapsibleSection;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
@@ -36,4 +35,4 @@ class CollapsibleSectionUIBlockFactory extends AbstractUIBlockFactory
{
return new CollapsibleSection($sTitle, [], $sId);
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
use Combodo\iTop\Application\UI\Base\tJSRefreshCallback;
use utils;
@@ -55,10 +54,14 @@ class DashletBadge extends DashletContainer
* @param array $aRefreshParams
*/
public function __construct(
string $sClassIconUrl, string $sHyperlink, string $iCount, string $sClassLabel, ?string $sCreateActionUrl = '',
?string $sCreateActionLabel = '', array $aRefreshParams = []
)
{
string $sClassIconUrl,
string $sHyperlink,
string $iCount,
string $sClassLabel,
?string $sCreateActionUrl = '',
?string $sCreateActionLabel = '',
array $aRefreshParams = []
) {
parent::__construct();
$this->sClassIconUrl = $sClassIconUrl;
@@ -71,7 +74,6 @@ class DashletBadge extends DashletContainer
$this->sClassDescription = '';
}
/**
* @return string
*/
@@ -210,7 +212,7 @@ class DashletBadge extends DashletContainer
public function SetClassDescription(string $sClassDescription)
{
$this->sClassDescription = $sClassDescription;
return $this;
}
@@ -236,4 +238,4 @@ class DashletBadge extends DashletContainer
$('#".$this->sId."').unblock();";
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
class DashletContainer extends UIContentBlock
@@ -21,4 +20,4 @@ class DashletContainer extends UIContentBlock
$this->AddDataAttribute('role', static::BLOCK_CODE);
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
/**
* Class DashletFactory
*
@@ -33,4 +32,4 @@ class DashletFactory
return new DashletPlainText($sText, $sId);
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
/**
* Class DashletHeaderStatic
*
@@ -42,7 +41,6 @@ class DashletHeaderStatic extends DashletContainer
$this->sIconUrl = $sIconUrl;
}
/**
* @return string
*/
@@ -82,4 +80,4 @@ class DashletHeaderStatic extends DashletContainer
return $this;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
/**
* Class DashletPlainText
*
@@ -56,4 +55,4 @@ class DashletPlainText extends DashletContainer
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\DataTable;
use ApplicationContext;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Combodo\iTop\Application\UI\Base\tJSRefreshCallback;
@@ -63,7 +63,6 @@ class DataTable extends UIContentBlock
public const DEFAULT_ACTION_ROW_CONFIRMATION = true;
/**
* Panel constructor.
*
@@ -95,17 +94,14 @@ class DataTable extends UIContentBlock
*/
public function SetAjaxUrl(string $sAjaxUrl)
{
if (strlen($sAjaxUrl) > 0)
{
if (strlen($sAjaxUrl) > 0) {
$oAppContext = new ApplicationContext();
if(strpos ($sAjaxUrl,'?')) {
if (strpos($sAjaxUrl, '?')) {
$this->sAjaxUrl = $sAjaxUrl.$oAppContext->GetForLink(true);
} else {
$this->sAjaxUrl = $sAjaxUrl."?".$oAppContext->GetForLink();
}
}
else
{
} else {
$this->sAjaxUrl = $sAjaxUrl;
}

View File

@@ -42,4 +42,4 @@ class DataTableConfig extends UIContentBlock
return $this->GetDataTable()->GetId();
}
}
}

View File

@@ -23,49 +23,49 @@ class DataTableSettings
/**
* @var array
*/
public $aClassAliases;
public $aClassAliases;
/**
* @var null|string
*/
public $sTableId;
public $sTableId;
/**
* @var int
*/
public $iDefaultPageSize;
public $iDefaultPageSize;
/**
* @var array
*/
public $aColumns;
public $aColumns;
/**
* @var array
*/
public $aSortOrder;
/**
* DataTableSettings constructor.
*
* @param $aClassAliases
* @param null $sTableId
*/
public function __construct($aClassAliases, $sTableId = null)
{
$this->aClassAliases = $aClassAliases;
$this->sTableId = $sTableId;
$this->iDefaultPageSize = 10;
$this->aColumns = array();
}
/**
* DataTableSettings constructor.
*
* @param $aClassAliases
* @param null $sTableId
*/
public function __construct($aClassAliases, $sTableId = null)
{
$this->aClassAliases = $aClassAliases;
$this->sTableId = $sTableId;
$this->iDefaultPageSize = 10;
$this->aColumns = [];
}
/**
* @return string
* @since 3.1.0
*/
public function __serialize() {
public function __serialize()
{
return serialize([
$this->aClassAliases,
$this->sTableId,
$this->iDefaultPageSize,
$this->aColumns
$this->aColumns,
]);
}
@@ -73,335 +73,343 @@ class DataTableSettings
* @param $data
* @since 3.1.0
*/
public function __unserialize($data) {
public function __unserialize($data)
{
list(
$this->aClassAliases,
$this->sTableId,
$this->iDefaultPageSize,
$this->aColumns
) = unserialize($data);
) = unserialize($data);
}
/**
* @param $iDefaultPageSize
* @param $aSortOrder
* @param $aColumns
*/
protected function Init($iDefaultPageSize, $aSortOrder, $aColumns)
{
$this->iDefaultPageSize = $iDefaultPageSize;
$this->aColumns = $aColumns;
$this->FixVisibleColumns();
}
/**
* @param $iDefaultPageSize
* @param $aSortOrder
* @param $aColumns
*/
protected function Init($iDefaultPageSize, $aSortOrder, $aColumns)
{
$this->iDefaultPageSize = $iDefaultPageSize;
$this->aColumns = $aColumns;
$this->FixVisibleColumns();
}
/**
* @return string
*/
public function serialize()
{
// Save only the 'visible' columns
$aColumns = array();
foreach ($this->aClassAliases as $sAlias => $sClass) {
$aColumns[$sAlias] = array();
if (isset($this->aColumns[$sAlias])) {
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
unset($aData['label']); // Don't save the display name
unset($aData['alias']); // Don't save the alias (redundant)
unset($aData['code']); // Don't save the code (redundant)
if ($aData['checked']) {
$aColumns[$sAlias][$sAttCode] = $aData;
}
}
}
}
return serialize(
array(
'iDefaultPageSize' => $this->iDefaultPageSize,
'aColumns' => $aColumns,
)
);
}
/**
* @return string
*/
public function serialize()
{
// Save only the 'visible' columns
$aColumns = [];
foreach ($this->aClassAliases as $sAlias => $sClass) {
$aColumns[$sAlias] = [];
if (isset($this->aColumns[$sAlias])) {
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
unset($aData['label']); // Don't save the display name
unset($aData['alias']); // Don't save the alias (redundant)
unset($aData['code']); // Don't save the code (redundant)
if ($aData['checked']) {
$aColumns[$sAlias][$sAttCode] = $aData;
}
}
}
}
return serialize(
[
'iDefaultPageSize' => $this->iDefaultPageSize,
'aColumns' => $aColumns,
]
);
}
/**
* @param string $sData
*
* @throws \Exception
*/
public function unserialize($sData)
{
$aData = unserialize($sData);
$this->iDefaultPageSize = $aData['iDefaultPageSize'];
$this->aColumns = $aData['aColumns'];
foreach ($this->aClassAliases as $sAlias => $sClass) {
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
$aFieldData = false;
if ($sAttCode == '_key_') {
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, null, true /* bChecked */, $aData['sort']);
} else if (MetaModel::isValidAttCode($sClass, $sAttCode)) {
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, true /* bChecked */, $aData['sort']);
}
/**
* @param string $sData
*
* @throws \Exception
*/
public function unserialize($sData)
{
$aData = unserialize($sData);
$this->iDefaultPageSize = $aData['iDefaultPageSize'];
$this->aColumns = $aData['aColumns'];
foreach ($this->aClassAliases as $sAlias => $sClass) {
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
$aFieldData = false;
if ($sAttCode == '_key_') {
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, null, true /* bChecked */, $aData['sort']);
} elseif (MetaModel::isValidAttCode($sClass, $sAttCode)) {
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, true /* bChecked */, $aData['sort']);
}
if ($aFieldData) {
$this->aColumns[$sAlias][$sAttCode] = $aFieldData;
} else {
unset($this->aColumns[$sAlias][$sAttCode]);
}
}
}
$this->FixVisibleColumns();
}
if ($aFieldData) {
$this->aColumns[$sAlias][$sAttCode] = $aFieldData;
} else {
unset($this->aColumns[$sAlias][$sAttCode]);
}
}
}
$this->FixVisibleColumns();
}
/**
* @param $aClassAliases
* @param $bViewLink
* @param $aDefaultLists
*
* @return DataTableSettings
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
public static function GetDataModelSettings($aClassAliases, $bViewLink, $aDefaultLists)
{
$oSettings = new DataTableSettings($aClassAliases);
// Retrieve the class specific settings for each class/alias based on the 'list' ZList
//TODO let the caller pass some other default settings (another Zlist, extre fields...)
$aColumns = [];
$aSortOrder = [];
foreach ($aClassAliases as $sAlias => $sClass) {
if ($aDefaultLists == null) {
$aList = cmdbAbstractObject::FlattenZList(MetaModel::GetZListItems($sClass, 'list'));
} else {
$aList = $aDefaultLists[$sAlias];
}
/**
* @param $aClassAliases
* @param $bViewLink
* @param $aDefaultLists
*
* @return DataTableSettings
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
public static function GetDataModelSettings($aClassAliases, $bViewLink, $aDefaultLists)
{
$oSettings = new DataTableSettings($aClassAliases);
// Retrieve the class specific settings for each class/alias based on the 'list' ZList
//TODO let the caller pass some other default settings (another Zlist, extre fields...)
$aColumns = [];
$aSortOrder = [];
foreach ($aClassAliases as $sAlias => $sClass) {
if ($aDefaultLists == null) {
$aList = cmdbAbstractObject::FlattenZList(MetaModel::GetZListItems($sClass, 'list'));
} else {
$aList = $aDefaultLists[$sAlias];
}
$aSortOrder = MetaModel::GetOrderByDefault($sClass);
if ($bViewLink) {
$sSort = 'none';
if (array_key_exists('friendlyname', $aSortOrder)) {
$sSort = $aSortOrder['friendlyname'] ? 'asc' : 'desc';
}
$sNormalizedFName = MetaModel::NormalizeFieldSpec($sClass, 'friendlyname');
if (array_key_exists($sNormalizedFName, $aSortOrder)) {
$sSort = $aSortOrder[$sNormalizedFName] ? 'asc' : 'desc';
}
$aColumns[$sAlias]['_key_'] = $oSettings->GetFieldData($sAlias, '_key_', null, true /* bChecked */, $sSort);
}
$aSortOrder = MetaModel::GetOrderByDefault($sClass);
if ($bViewLink) {
$sSort = 'none';
if (array_key_exists('friendlyname', $aSortOrder)) {
$sSort = $aSortOrder['friendlyname'] ? 'asc' : 'desc';
}
$sNormalizedFName = MetaModel::NormalizeFieldSpec($sClass, 'friendlyname');
if (array_key_exists($sNormalizedFName, $aSortOrder)) {
$sSort = $aSortOrder[$sNormalizedFName] ? 'asc' : 'desc';
}
$aColumns[$sAlias]['_key_'] = $oSettings->GetFieldData($sAlias, '_key_', null, true /* bChecked */, $sSort);
}
foreach ($aList as $sAttCode) {
$sSort = 'none';
if (array_key_exists($sAttCode, $aSortOrder)) {
$sSort = $aSortOrder[$sAttCode] ? 'asc' : 'desc';
}
$oAttDef = Metamodel::GetAttributeDef($sClass, $sAttCode);
$aFieldData = $oSettings->GetFieldData($sAlias, $sAttCode, $oAttDef, true /* bChecked */, $sSort);
if ($aFieldData) $aColumns[$sAlias][$sAttCode] = $aFieldData;
}
}
$iDefaultPageSize = appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit());
$oSettings->Init($iDefaultPageSize, $aSortOrder, $aColumns);
return $oSettings;
}
foreach ($aList as $sAttCode) {
$sSort = 'none';
if (array_key_exists($sAttCode, $aSortOrder)) {
$sSort = $aSortOrder[$sAttCode] ? 'asc' : 'desc';
}
$oAttDef = Metamodel::GetAttributeDef($sClass, $sAttCode);
$aFieldData = $oSettings->GetFieldData($sAlias, $sAttCode, $oAttDef, true /* bChecked */, $sSort);
if ($aFieldData) {
$aColumns[$sAlias][$sAttCode] = $aFieldData;
}
}
}
$iDefaultPageSize = appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit());
$oSettings->Init($iDefaultPageSize, $aSortOrder, $aColumns);
return $oSettings;
}
/**
* @throws \CoreException
*/
protected function FixVisibleColumns()
{
foreach ($this->aClassAliases as $sAlias => $sClass) {
if (!isset($this->aColumns[$sAlias])) {
continue;
}
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
// Remove non-existent columns
// TODO: check if the existing ones are still valid (in case their type changed)
if (($sAttCode != '_key_') && (!MetaModel::IsValidAttCode($sClass, $sAttCode))) {
unset($this->aColumns[$sAlias][$sAttCode]);
}
}
$aList = MetaModel::ListAttributeDefs($sClass);
/**
* @throws \CoreException
*/
protected function FixVisibleColumns()
{
foreach ($this->aClassAliases as $sAlias => $sClass) {
if (!isset($this->aColumns[$sAlias])) {
continue;
}
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
// Remove non-existent columns
// TODO: check if the existing ones are still valid (in case their type changed)
if (($sAttCode != '_key_') && (!MetaModel::IsValidAttCode($sClass, $sAttCode))) {
unset($this->aColumns[$sAlias][$sAttCode]);
}
}
$aList = MetaModel::ListAttributeDefs($sClass);
// Add the other (non visible ones), sorted in alphabetical order
$aTempData = array();
foreach ($aList as $sAttCode => $oAttDef) {
if ((!array_key_exists($sAttCode, $this->aColumns[$sAlias])) && (!($oAttDef instanceof AttributeLinkedSet || $oAttDef instanceof AttributeDashboard))) {
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, false /* bChecked */, 'none');
if ($aFieldData) $aTempData[$aFieldData['label']] = $aFieldData;
}
}
ksort($aTempData);
foreach ($aTempData as $sLabel => $aFieldData) {
$this->aColumns[$sAlias][$aFieldData['code']] = $aFieldData;
}
}
}
// Add the other (non visible ones), sorted in alphabetical order
$aTempData = [];
foreach ($aList as $sAttCode => $oAttDef) {
if ((!array_key_exists($sAttCode, $this->aColumns[$sAlias])) && (!($oAttDef instanceof AttributeLinkedSet || $oAttDef instanceof AttributeDashboard))) {
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, false /* bChecked */, 'none');
if ($aFieldData) {
$aTempData[$aFieldData['label']] = $aFieldData;
}
}
}
ksort($aTempData);
foreach ($aTempData as $sLabel => $aFieldData) {
$this->aColumns[$sAlias][$aFieldData['code']] = $aFieldData;
}
}
}
/**
* @param $aClassAliases
* @param null $sTableId
* @param bool $bOnlyOnTable
*
* @return DataTableSettings|null
* @throws \Exception
*/
static public function GetTableSettings($aClassAliases, $sTableId = null, $bOnlyOnTable = false)
{
$pref = null;
$oSettings = new DataTableSettings($aClassAliases, $sTableId);
/**
* @param $aClassAliases
* @param null $sTableId
* @param bool $bOnlyOnTable
*
* @return DataTableSettings|null
* @throws \Exception
*/
public static function GetTableSettings($aClassAliases, $sTableId = null, $bOnlyOnTable = false)
{
$pref = null;
$oSettings = new DataTableSettings($aClassAliases, $sTableId);
if ($sTableId != null) {
// An identified table, let's fetch its own settings (if any)
$pref = appUserPreferences::GetPref($oSettings->GetPrefsKey($sTableId), null);
}
if ($sTableId != null) {
// An identified table, let's fetch its own settings (if any)
$pref = appUserPreferences::GetPref($oSettings->GetPrefsKey($sTableId), null);
}
if ($pref == null) {
if (!$bOnlyOnTable) {
// Try the global preferred values for this class / set of classes
$pref = appUserPreferences::GetPref($oSettings->GetPrefsKey(null), null);
}
if ($pref == null) {
// no such settings, use the default values provided by the data model
return null;
}
}
$oSettings->unserialize($pref);
if ($pref == null) {
if (!$bOnlyOnTable) {
// Try the global preferred values for this class / set of classes
$pref = appUserPreferences::GetPref($oSettings->GetPrefsKey(null), null);
}
if ($pref == null) {
// no such settings, use the default values provided by the data model
return null;
}
}
$oSettings->unserialize($pref);
return $oSettings;
}
return $oSettings;
}
/**
* @return array
*/
public function GetSortOrder()
{
$aSortOrder = array();
foreach ($this->aColumns as $sAlias => $aColumns) {
foreach ($aColumns as $aColumn) {
if ($aColumn['sort'] != 'none') {
$sCode = ($aColumn['code'] == '_key_') ? 'friendlyname' : $aColumn['code'];
$aSortOrder[$sCode] = ($aColumn['sort'] == 'asc'); // true for ascending, false for descending
}
}
break; // TODO: For now the Set object supports only sorting on the first class of the set
}
return $aSortOrder;
}
/**
* @return array
*/
public function GetSortOrder()
{
$aSortOrder = [];
foreach ($this->aColumns as $sAlias => $aColumns) {
foreach ($aColumns as $aColumn) {
if ($aColumn['sort'] != 'none') {
$sCode = ($aColumn['code'] == '_key_') ? 'friendlyname' : $aColumn['code'];
$aSortOrder[$sCode] = ($aColumn['sort'] == 'asc'); // true for ascending, false for descending
}
}
break; // TODO: For now the Set object supports only sorting on the first class of the set
}
return $aSortOrder;
}
/**
* @param null $sTargetTableId
*
* @return bool
*/
public function Save($sTargetTableId = null)
{
$sSaveId = is_null($sTargetTableId) ? $this->sTableId : $sTargetTableId;
if ($sSaveId == null) return false; // Cannot save, the table is not identified, use SaveAsDefault instead
/**
* @param null $sTargetTableId
*
* @return bool
*/
public function Save($sTargetTableId = null)
{
$sSaveId = is_null($sTargetTableId) ? $this->sTableId : $sTargetTableId;
if ($sSaveId == null) {
return false;
} // Cannot save, the table is not identified, use SaveAsDefault instead
$sSettings = $this->serialize();
appUserPreferences::SetPref($this->GetPrefsKey($sSaveId), $sSettings);
return true;
}
$sSettings = $this->serialize();
appUserPreferences::SetPref($this->GetPrefsKey($sSaveId), $sSettings);
return true;
}
/**
* @return bool
*/
public function SaveAsDefault()
{
$sSettings = $this->serialize();
appUserPreferences::SetPref($this->GetPrefsKey(null), $sSettings);
return true;
}
/**
* @return bool
*/
public function SaveAsDefault()
{
$sSettings = $this->serialize();
appUserPreferences::SetPref($this->GetPrefsKey(null), $sSettings);
return true;
}
/**
* Clear the preferences for this particular table
* @param $bResetAll boolean If true,the settings for all tables of the same class(es)/alias(es) are reset
*/
public function ResetToDefault($bResetAll)
{
if (($this->sTableId == null) && (!$bResetAll)) {
return false;
} // Cannot reset, the table is not identified, use force $bResetAll instead
if ($bResetAll) {
// Turn the key into a suitable PCRE pattern
$sKey = $this->GetPrefsKey(null);
$sPattern = str_replace(['|'], ['\\|'], $sKey); // escape the | character
$sPattern = '#^'.str_replace(['*'], ['.*'], $sPattern).'$#'; // Don't use slash as the delimiter since it's used in our key to delimit aliases
appUserPreferences::UnsetPref($sPattern, true);
} else {
appUserPreferences::UnsetPref($this->GetPrefsKey($this->sTableId), false);
}
return true;
}
/**
* Clear the preferences for this particular table
* @param $bResetAll boolean If true,the settings for all tables of the same class(es)/alias(es) are reset
*/
public function ResetToDefault($bResetAll)
{
if (($this->sTableId == null) && (!$bResetAll)) return false; // Cannot reset, the table is not identified, use force $bResetAll instead
if ($bResetAll) {
// Turn the key into a suitable PCRE pattern
$sKey = $this->GetPrefsKey(null);
$sPattern = str_replace(array('|'), array('\\|'), $sKey); // escape the | character
$sPattern = '#^' . str_replace(array('*'), array('.*'), $sPattern) . '$#'; // Don't use slash as the delimiter since it's used in our key to delimit aliases
appUserPreferences::UnsetPref($sPattern, true);
} else {
appUserPreferences::UnsetPref($this->GetPrefsKey($this->sTableId), false);
}
return true;
}
/**
* @param null $sTableId
*
* @return string
*/
protected function GetPrefsKey($sTableId = null)
{
return static::GetAppUserPreferenceKey($this->aClassAliases, $sTableId);
}
/**
* @param null $sTableId
*
* @return string
*/
protected function GetPrefsKey($sTableId = null)
{
return static::GetAppUserPreferenceKey($this->aClassAliases, $sTableId);
}
public static function GetAppUserPreferenceKey($aClassAliases, $sTableId)
{
if ($sTableId === null) {
$sTableId = '*';
}
public static function GetAppUserPreferenceKey($aClassAliases, $sTableId)
{
if ($sTableId === null) {
$sTableId = '*';
}
$aKeys = [];
foreach ($aClassAliases as $sAlias => $sClass) {
$aKeys[] = $sAlias.'-'.$sClass;
}
return implode('/', $aKeys).'|'.$sTableId;
}
$aKeys = array();
foreach ($aClassAliases as $sAlias => $sClass) {
$aKeys[] = $sAlias . '-' . $sClass;
}
return implode('/', $aKeys) . '|' . $sTableId;
}
/**
* @param $sAlias
* @param $sAttCode
* @param $oAttDef
* @param $bChecked
* @param $sSort
*
* @return array|bool
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
protected function GetFieldData($sAlias, $sAttCode, $oAttDef, $bChecked, $sSort)
{
$ret = false;
if ($sAttCode == '_key_') {
$sLabel = Dict::Format('UI:ExtKey_AsLink', MetaModel::GetName($this->aClassAliases[$sAlias]));
$ret = array(
'label' => $sLabel,
'checked' => $bChecked,
'disabled' => true,
'alias' => $sAlias,
'code' => $sAttCode,
'sort' => $sSort,
);
} else if (!$oAttDef->IsLinkSet()) {
$sLabel = $oAttDef->GetLabel();
if ($oAttDef->IsExternalKey()) {
$sLabel = Dict::Format('UI:ExtKey_AsLink', $oAttDef->GetLabel());
} else if ($oAttDef->IsExternalField()) {
if ($oAttDef->IsFriendlyName()) {
$sLabel = Dict::Format('UI:ExtKey_AsFriendlyName', $oAttDef->GetLabel());
} else {
$oExtAttDef = $oAttDef->GetExtAttDef();
$sLabel = Dict::Format('UI:ExtField_AsRemoteField', $oAttDef->GetLabel(), $oExtAttDef->GetLabel());
}
} elseif ($oAttDef instanceof AttributeFriendlyName) {
$sLabel = Dict::Format('UI:ExtKey_AsFriendlyName', $oAttDef->GetLabel());
}
$ret = array(
'label' => $sLabel,
'checked' => $bChecked,
'disabled' => false,
'alias' => $sAlias,
'code' => $sAttCode,
'sort' => $sSort,
);
}
return $ret;
}
}
/**
* @param $sAlias
* @param $sAttCode
* @param $oAttDef
* @param $bChecked
* @param $sSort
*
* @return array|bool
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
protected function GetFieldData($sAlias, $sAttCode, $oAttDef, $bChecked, $sSort)
{
$ret = false;
if ($sAttCode == '_key_') {
$sLabel = Dict::Format('UI:ExtKey_AsLink', MetaModel::GetName($this->aClassAliases[$sAlias]));
$ret = [
'label' => $sLabel,
'checked' => $bChecked,
'disabled' => true,
'alias' => $sAlias,
'code' => $sAttCode,
'sort' => $sSort,
];
} elseif (!$oAttDef->IsLinkSet()) {
$sLabel = $oAttDef->GetLabel();
if ($oAttDef->IsExternalKey()) {
$sLabel = Dict::Format('UI:ExtKey_AsLink', $oAttDef->GetLabel());
} elseif ($oAttDef->IsExternalField()) {
if ($oAttDef->IsFriendlyName()) {
$sLabel = Dict::Format('UI:ExtKey_AsFriendlyName', $oAttDef->GetLabel());
} else {
$oExtAttDef = $oAttDef->GetExtAttDef();
$sLabel = Dict::Format('UI:ExtField_AsRemoteField', $oAttDef->GetLabel(), $oExtAttDef->GetLabel());
}
} elseif ($oAttDef instanceof AttributeFriendlyName) {
$sLabel = Dict::Format('UI:ExtKey_AsFriendlyName', $oAttDef->GetLabel());
}
$ret = [
'label' => $sLabel,
'checked' => $bChecked,
'disabled' => false,
'alias' => $sAlias,
'code' => $sAttCode,
'sort' => $sSort,
];
}
return $ret;
}
}

View File

@@ -1,4 +1,5 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -75,7 +76,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
* @throws \OQLException
* @throws \ReflectionException
*/
public static function MakeForResult(WebPage $oPage, string $sListId, DBObjectSet $oSet, $aExtraParams = array())
public static function MakeForResult(WebPage $oPage, string $sListId, DBObjectSet $oSet, $aExtraParams = [])
{
$oDataTable = DataTableUIBlockFactory::MakeForRendering($sListId, $oSet, $aExtraParams);
if ($oPage->IsPrintableVersion()) {
@@ -105,7 +106,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
* @throws \OQLException
* @throws \ReflectionException
*/
public static function MakeForObject(WebPage $oPage, string $sListId, DBObjectSet $oSet, $aExtraParams = array())
public static function MakeForObject(WebPage $oPage, string $sListId, DBObjectSet $oSet, $aExtraParams = [])
{
$oDataTable = DataTableUIBlockFactory::MakeForRendering($sListId, $oSet, $aExtraParams);
if ($oPage->IsPrintableVersion()) {
@@ -190,7 +191,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
}
// Panel subtitle
if(!empty($oDataTable->GetInitDisplayData()) && isset($oDataTable->GetInitDisplayData()['recordsTotal'])){
if (!empty($oDataTable->GetInitDisplayData()) && isset($oDataTable->GetInitDisplayData()['recordsTotal'])) {
$iCount = $oDataTable->GetInitDisplayData()['recordsTotal'];
} else {
$iCount = $oSet->Count();
@@ -200,7 +201,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
$sSubTitle = Dict::Format('UI:Pagination:HeaderSelection', $sCountHtml, '<span class="ibo-datatable--selected-count">0</span>');
} else {
$sSubTitle = Dict::Format('UI:Pagination:HeaderNoSelection', $sCountHtml);
}
}
if (utils::IsNotNullOrEmptyString($sFilterListUrl)) {
$sSubTitle = '<a href="'.$sFilterListUrl.'" title="'.Dict::S('UI:Menu:FilterList').'">'.$sSubTitle.'</a>';
@@ -292,15 +293,15 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
* @throws \DictExceptionMissingString
* @throws \MySQLException
*/
public static function MakeForRendering(string $sListId, DBObjectSet $oSet, $aExtraParams = array())
public static function MakeForRendering(string $sListId, DBObjectSet $oSet, $aExtraParams = [])
{
$oDataTable = new DataTable('datatable_'.$sListId);
$aLists = array();
$aLists = [];
// Initialize and check the parameters
$bViewLink = isset($aExtraParams['view_link']) ? $aExtraParams['view_link'] : true;
// Check if there is a list of aliases to limit the display to...
$aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',', $aExtraParams['display_aliases']) : array();
$aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',', $aExtraParams['display_aliases']) : [];
$sZListName = isset($aExtraParams['zlist']) ? ($aExtraParams['zlist']) : 'list';
$sLinkageAttribute = isset($aExtraParams['link_attr']) ? $aExtraParams['link_attr'] : '';
@@ -317,9 +318,11 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
}
}
$aExtraFieldsRaw = isset($aExtraParams['extra_fields']) ? explode(',',
trim($aExtraParams['extra_fields'])) : array();
$aExtraFields = array();
$aExtraFieldsRaw = isset($aExtraParams['extra_fields']) ? explode(
',',
trim($aExtraParams['extra_fields'])
) : [];
$aExtraFields = [];
$sAttCode = '';
foreach ($aExtraFieldsRaw as $sFieldName) {
// Ignore attributes not of the main queried class
@@ -332,10 +335,10 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
} else {
$aExtraFields['*'][] = $sFieldName;
}
}
}
$aClassAliases = $oSet->GetFilter()->GetSelectedClasses();
$aAuthorizedClasses = array();
$aAuthorizedClasses = [];
foreach ($aClassAliases as $sAlias => $sClassName) {
if ((UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) &&
((count($aDisplayAliases) == 0) || (in_array($sAlias, $aDisplayAliases)))) {
@@ -345,65 +348,65 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
foreach ($aAuthorizedClasses as $sAlias => $sClassName) {
// In case there is only 1 "alias" for the extra fields and it is the fallback ("*"), then consider that all fields are for the current alias.
// This is for the particular use case when the zlist is set to false and extra fields are specified.
if ( (count($aExtraFields) === 1) && (array_keys($aExtraFields)[0] === '*') ) {
if ((count($aExtraFields) === 1) && (array_keys($aExtraFields)[0] === '*')) {
$aLists[$sAlias] = $aExtraFields['*'];
}
// Regular use case, dispatch fields to their corresponding aliases
else if (array_key_exists($sAlias, $aExtraFields)) {
elseif (array_key_exists($sAlias, $aExtraFields)) {
$aLists[$sAlias] = $aExtraFields[$sAlias];
}
}
// Finally, if unknown alias, ignore fields
else {
$aLists[$sAlias] = array();
$aLists[$sAlias] = [];
}
// If zlist specified, merge its fields with the currently present
if ($sZListName !== false) {
if ($sZListName !== false) {
$aDefaultList = MetaModel::FlattenZList(MetaModel::GetZListItems($sClassName, $sZListName));
$aLists[$sAlias] = array_merge($aDefaultList, $aLists[$sAlias]);
}
}
// Filter the list to removed linked set since we are not able to display them here
// Filter the list to removed linked set since we are not able to display them here
foreach ($aLists[$sAlias] as $index => $sAttCode) {
$oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
if ($oAttDef instanceof AttributeLinkedSet) {
// Removed from the display list
$oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
if ($oAttDef instanceof AttributeLinkedSet) {
// Removed from the display list
unset($aLists[$sAlias][$index]);
}
}
if (empty($aLists[$sAlias])) {
unset($aLists[$sAlias], $aAuthorizedClasses[$sAlias]);
}
}
// Only for main class
if (!empty($sLinkageAttribute) && $sClassName === $oSet->GetFilter()->GetClass()) {
// The set to display is in fact a set of links between the object specified in the $sLinkageAttribute
// and other objects...
// The display will then group all the attributes related to the link itself:
// | Link_attr1 | link_attr2 | ... || Object_attr1 | Object_attr2 | Object_attr3 | .. | Object_attr_n |
$aDisplayList = array();
$aAttDefs = MetaModel::ListAttributeDefs($sClassName);
assert(isset($aAttDefs[$sLinkageAttribute]));
$oAttDef = $aAttDefs[$sLinkageAttribute];
assert($oAttDef->IsExternalKey());
// First display all the attributes specific to the link record
// The set to display is in fact a set of links between the object specified in the $sLinkageAttribute
// and other objects...
// The display will then group all the attributes related to the link itself:
// | Link_attr1 | link_attr2 | ... || Object_attr1 | Object_attr2 | Object_attr3 | .. | Object_attr_n |
$aDisplayList = [];
$aAttDefs = MetaModel::ListAttributeDefs($sClassName);
assert(isset($aAttDefs[$sLinkageAttribute]));
$oAttDef = $aAttDefs[$sLinkageAttribute];
assert($oAttDef->IsExternalKey());
// First display all the attributes specific to the link record
foreach ($aLists[$sAlias] as $sLinkAttCode) {
$oLinkAttDef = $aAttDefs[$sLinkAttCode];
if ((!$oLinkAttDef->IsExternalKey()) && (!$oLinkAttDef->IsExternalField())) {
$aDisplayList[] = $sLinkAttCode;
$oLinkAttDef = $aAttDefs[$sLinkAttCode];
if ((!$oLinkAttDef->IsExternalKey()) && (!$oLinkAttDef->IsExternalField())) {
$aDisplayList[] = $sLinkAttCode;
}
}
}
// Then display all the attributes neither specific to the link record nor to the 'linkage' object (because the latter are constant)
// Then display all the attributes neither specific to the link record nor to the 'linkage' object (because the latter are constant)
foreach ($aLists[$sAlias] as $sLinkAttCode) {
$oLinkAttDef = $aAttDefs[$sLinkAttCode];
if (($oLinkAttDef->IsExternalKey() && ($sLinkAttCode != $sLinkageAttribute))
|| ($oLinkAttDef->IsExternalField() && ($oLinkAttDef->GetKeyAttCode() != $sLinkageAttribute))) {
$aDisplayList[] = $sLinkAttCode;
$oLinkAttDef = $aAttDefs[$sLinkAttCode];
if (($oLinkAttDef->IsExternalKey() && ($sLinkAttCode != $sLinkageAttribute))
|| ($oLinkAttDef->IsExternalField() && ($oLinkAttDef->GetKeyAttCode() != $sLinkageAttribute))) {
$aDisplayList[] = $sLinkAttCode;
}
}
}
// First display all the attributes specific to the link
// Then display all the attributes linked to the other end of the relationship
// First display all the attributes specific to the link
// Then display all the attributes linked to the other end of the relationship
$aLists[$sAlias] = $aDisplayList;
}
}
@@ -460,7 +463,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
$sIdName = isset($aExtraParams["id_for_select"]) ? $aExtraParams["id_for_select"] : "";
// Load only the requested columns
$aColumnsToLoad = array();
$aColumnsToLoad = [];
foreach ($oCustomSettings->aColumns as $sAlias => $aColumnsInfo) {
foreach ($aColumnsInfo as $sAttCode => $aData) {
$bForceLoad = false;
@@ -488,7 +491,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
$oSet->OptimizeColumnLoad($aColumnsToLoad);
$aColumnDefinition = [];
$iIndexColumn=0;
$iIndexColumn = 0;
$bSelectMode = isset($aExtraParams['selection_mode']) ? $aExtraParams['selection_mode'] == true : false;
$bSingleSelectMode = isset($aExtraParams['selection_type']) ? ($aExtraParams['selection_type'] == 'single') : false;
@@ -509,12 +512,11 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
$sCode = ($aData['code'] == '_key_') ? 'friendlyname' : $aData['code'];
if ($aData['sort'] != 'none') {
$aSortOrder[$sClassAlias.'.'.$sCode] = ($aData['sort'] == 'asc'); // true for ascending, false for descending
$aSortDatable=[$iIndexColumn,$aData['sort']];
}
elseif (isset($oCustomSettings->aSortOrder[$sAttCode])){
$aSortDatable = [$iIndexColumn,$aData['sort']];
} elseif (isset($oCustomSettings->aSortOrder[$sAttCode])) {
$aSortOrder[$sClassAlias.'.'.$sCode] = $oCustomSettings->aSortOrder[$sAttCode]; // true for ascending, false for descending
}
if ($aData['checked']) {
if ($sAttCode == '_key_') {
if ($bViewLink) {
@@ -557,7 +559,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
$aOptions = [];
if ($oDefaultSettings != null) {
$aOptions['oDefaultSettings'] = json_encode(array('iDefaultPageSize' => $oDefaultSettings->iDefaultPageSize, 'oColumns' => $oDefaultSettings->aColumns));
$aOptions['oDefaultSettings'] = json_encode(['iDefaultPageSize' => $oDefaultSettings->iDefaultPageSize, 'oColumns' => $oDefaultSettings->aColumns]);
}
// Selection mode
@@ -568,7 +570,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
$aOptions['select_mode'] = "single";
}
}
$aOptions['selectionMode'] = $aExtraParams['selectionMode']?? 'positive';
$aOptions['selectionMode'] = $aExtraParams['selectionMode'] ?? 'positive';
// Sort
$aOptions['sort'] = $aSortDatable;
@@ -600,9 +602,8 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
} else {
$aOptions['sSelectedRows'] = '[]';
}
$aExtraParams['table_id']=$sTableId;
$aExtraParams['list_id']=$sListId;
$aExtraParams['table_id'] = $sTableId;
$aExtraParams['list_id'] = $sListId;
$oDataTable->SetOptions($aOptions);
$oDataTable->SetAjaxUrl(utils::GetAbsoluteUrlAppRoot()."pages/ajax.render.php");
@@ -623,7 +624,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
$oDataTable->SetRowActions($aExtraParams['row_actions']);
}
if (isset($aExtraParams['creation_in_modal_js_handler'])){
if (isset($aExtraParams['creation_in_modal_js_handler'])) {
$oDataTable->SetModalCreationHandler($aExtraParams['creation_in_modal_js_handler']);
}
@@ -671,18 +672,17 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory
$aColumnDefinition["data"] = "";
$aColumnDefinition["render"]["display"] = "";
if ($sSelectMode != "single") {
$aColumnDefinition["render"]["display"] = $aColumnDefinition["render"]["display"] . " var oCheckboxElem = $('<span class=\"row_input\"><input type=\"checkbox\" class=\"selectList".$sTableId."\" name=\"selectObject[]\" value='+row.id+' /></span>');";
$aColumnDefinition["render"]["display"] = $aColumnDefinition["render"]["display"]." var oCheckboxElem = $('<span class=\"row_input\"><input type=\"checkbox\" class=\"selectList".$sTableId."\" name=\"selectObject[]\" value='+row.id+' /></span>');";
} else {
$aColumnDefinition["render"]["display"] = $aColumnDefinition["render"]["display"]." var oCheckboxElem = $('<span class=\"row_input\"><input type=\"radio\" class=\"selectList".$sTableId."\" name=\"selectObject[]\" value='+ row.id +' /></span>');";
}
else {
$aColumnDefinition["render"]["display"] = $aColumnDefinition["render"]["display"] . " var oCheckboxElem = $('<span class=\"row_input\"><input type=\"radio\" class=\"selectList".$sTableId."\" name=\"selectObject[]\" value='+ row.id +' /></span>');";
}
$aColumnDefinition["render"]["display"] = $aColumnDefinition["render"]["display"] . " if (row.limited_access) { oCheckboxElem.html('-'); } else { oCheckboxElem.find(':input').attr('data-object-id', row.id).attr('data-target-object-id', row.target_id); }";
$aColumnDefinition["render"]["display"] = $aColumnDefinition["render"]["display"]. " return oCheckboxElem.prop('outerHTML'); ";
$aColumnDefinition["render"]["display"] = $aColumnDefinition["render"]["display"]." if (row.limited_access) { oCheckboxElem.html('-'); } else { oCheckboxElem.find(':input').attr('data-object-id', row.id).attr('data-target-object-id', row.target_id); }";
$aColumnDefinition["render"]["display"] = $aColumnDefinition["render"]["display"]." return oCheckboxElem.prop('outerHTML'); ";
array_push($aColumnsDefinitions, $aColumnDefinition);
}
foreach ($aColumns as $sClassAlias => $aClassColumns) {
$sClassName=$aClassAliases[$sClassAlias];
$sClassName = $aClassAliases[$sClassAlias];
foreach ($aClassColumns as $sAttCode => $aData) {
if ($aData['checked'] == "true") {
$aColumnDefinition["width"] = "auto";
@@ -803,7 +803,7 @@ JS;
"data": '.$sAjaxData.',
"method": "post",
"pages": 5 // number of pages to cache
} )'
} )',
]);
if (count($aJsFiles) > 0) {
foreach ($aJsFiles as $sJsFile) {
@@ -954,4 +954,4 @@ JS;
/** Don't provide the standard object creation feature */
];
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTable;
use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTableRow\FormTableRow;
use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\StaticTable;
use Combodo\iTop\Application\UI\Base\Component\DataTable\tTableRowActions;
@@ -67,4 +67,4 @@ class FormTable extends StaticTable
$this->aRows[] = $oRow;
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTableRow;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -136,4 +136,4 @@ class FormTableRow extends UIBlock
return $this;
}
}
}

View File

@@ -201,4 +201,4 @@ class StaticTable extends UIContentBlock
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -20,7 +21,7 @@ use Combodo\iTop\Application\UI\Base\Component\Dialog\DialogUIBlockFactory;
trait tTableRowActions
{
/** @var bool static dialog initialized flag to avoid multiple html markups */
static public bool $bDialogInitialized = false;
public static bool $bDialogInitialized = false;
/**
* @var $aRowActions array array of row actions
@@ -81,4 +82,4 @@ trait tTableRowActions
{
return DataTableUIBlockFactory::MakeActionRowToolbarTemplate($this);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Field;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Combodo\iTop\Application\UI\Base\UIBlock;
use utils;
@@ -390,4 +390,4 @@ class Field extends UIContentBlock
{
return utils::IsNotNullOrEmptyString($this->GetDescription());
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Field;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
use Combodo\iTop\Application\UI\Base\UIBlock;
@@ -150,4 +150,4 @@ class FieldUIBlockFactory extends AbstractUIBlockFactory
return $oField;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\FieldBadge;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
/**
@@ -23,4 +23,4 @@ class FieldBadge extends UIContentBlock
{
parent::__construct($sId, $aContainerClasses);
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\FieldBadge;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use ormStyle;
use utils;
@@ -62,4 +61,4 @@ class FieldBadgeUIBlockFactory extends AbstractUIBlockFactory
$oBadge->AddHtml($sHtml);
return $oBadge;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\FieldSet;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
/**
@@ -42,5 +42,5 @@ class FieldSet extends UIContentBlock
{
return $this->sLegend;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\FieldSet;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
@@ -36,4 +35,4 @@ class FieldSetUIBlockFactory extends AbstractUIBlockFactory
{
return new FieldSet($sLegend, $sId);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Form;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
/**
@@ -65,4 +65,4 @@ class Form extends UIContentBlock
return $this;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Form;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
@@ -35,4 +34,4 @@ class FormUIBlockFactory extends AbstractUIBlockFactory
{
return new Form($sId);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\GlobalSearch;
use Combodo\iTop\Application\UI\Base\UIBlock;
use Combodo\iTop\Application\UI\Hook\iKeyboardShortcut;
use MetaModel;
@@ -183,4 +183,4 @@ class GlobalSearch extends UIBlock implements iKeyboardShortcut
{
return "[data-role='".static::BLOCK_CODE."']";
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\GlobalSearch;
/**
* Class GlobalSearchFactory
*
@@ -45,4 +45,4 @@ class GlobalSearchFactory
return new GlobalSearch($aLastClasses, GlobalSearch::BLOCK_CODE);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\GlobalSearch;
use appUserPreferences;
use MetaModel;
use utils;
@@ -59,15 +59,13 @@ class GlobalSearchHelper
];
// Set icon only when necessary
if (!empty($sIconRelUrl))
{
if (!empty($sIconRelUrl)) {
//Ensure URL is relative to limit space in the preferences and avoid broken links in case app_root_url changes
$aNewEntry['icon_url'] = str_replace(utils::GetAbsoluteUrlAppRoot(), '', $sIconRelUrl);
}
// Set label only when necessary to avoid unnecessary space filling of the preferences in the DB
if(!empty($sLabelAsHtml))
{
if (!empty($sLabelAsHtml)) {
$aNewEntry['label_html'] = $sLabelAsHtml;
}
@@ -75,10 +73,8 @@ class GlobalSearchHelper
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
// Remove same query from history to avoid duplicates
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
{
if($aHistoryEntries[$iIdx]['query'] === $sQuery)
{
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++) {
if ($aHistoryEntries[$iIdx]['query'] === $sQuery) {
unset($aHistoryEntries[$iIdx]);
}
}
@@ -107,21 +103,21 @@ class GlobalSearchHelper
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
static::TruncateHistory($aHistoryEntries);
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++){
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++) {
$sRawQuery = $aHistoryEntries[$iIdx]['query'];
// Make icon URL absolute
if(isset($aHistoryEntries[$iIdx]['icon_url'])){
if (isset($aHistoryEntries[$iIdx]['icon_url'])) {
$aHistoryEntries[$iIdx]['icon_url'] = utils::GetAbsoluteUrlAppRoot().$aHistoryEntries[$iIdx]['icon_url'];
}
// Add HTML label if missing
if(!isset($aHistoryEntries[$iIdx]['label_html'])) {
if (!isset($aHistoryEntries[$iIdx]['label_html'])) {
$aHistoryEntries[$iIdx]['label_html'] = utils::EscapeHtml($sRawQuery);
}
// Add URL
if(!isset($aHistoryEntries[$iIdx]['target_url'])){
if (!isset($aHistoryEntries[$iIdx]['target_url'])) {
$aHistoryEntries[$iIdx]['target_url'] = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=full_text&text='.urlencode($sRawQuery);
}
}
@@ -137,9 +133,8 @@ class GlobalSearchHelper
protected static function TruncateHistory(array &$aHistoryEntries): void
{
$iMaxHistoryResults = (int) MetaModel::GetConfig()->Get('global_search.max_history_results');
if(count($aHistoryEntries) > $iMaxHistoryResults)
{
if (count($aHistoryEntries) > $iMaxHistoryResults) {
$aHistoryEntries = array_slice($aHistoryEntries, 0, $iMaxHistoryResults);
}
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Html;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -87,4 +87,4 @@ class Html extends UIBlock
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Html;
/**
* @package Combodo\iTop\Application\UI\Base\Component\Html
* @since 3.0.0
@@ -62,4 +62,4 @@ class HtmlFactory
{
return new Html('<div class="ibo-is-html-content">'.$sContent.'</div>');
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Input;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -22,7 +22,7 @@ abstract class AbstractInput extends UIBlock
/**@var string */
protected $sPlaceholder;
public function GetName(): ?string
public function GetName(): string
{
return $this->sName;
}
@@ -76,4 +76,4 @@ abstract class AbstractInput extends UIBlock
return $this;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @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;
@@ -103,5 +102,5 @@ class FileSelect extends UIBlock
{
return $this->bShowFilename;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input\FileSelect;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
@@ -36,4 +35,4 @@ class FileSelectUIBlockFactory extends AbstractUIBlockFactory
{
return new FileSelect($sName, $sId);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Input;
/**
* Class Input
*
@@ -21,7 +21,7 @@ class Input extends AbstractInput
public const INPUT_HIDDEN = 'hidden';
protected $bIsChecked = false;
protected $bIsDisabled = false;
protected $bIsReadonly = false;
@@ -128,4 +128,4 @@ class Input extends AbstractInput
{
return !is_null($this->sLabel);
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Field\Field;
@@ -78,10 +77,12 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
* @return \Combodo\iTop\Application\UI\Base\Component\Input\InputWithLabel
*/
public static function MakeForInputWithLabel(
string $sLabel, string $sInputName, ?string $sInputValue = null,
?string $sInputId = null, string $sInputType = 'type'
)
{
string $sLabel,
string $sInputName,
?string $sInputValue = null,
?string $sInputId = null,
string $sInputType = 'type'
) {
$oInput = new Input($sInputId);
$oInput->SetType($sInputType);
$oInput->SetValue($sInputValue);
@@ -109,4 +110,4 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
return new InputWithLabel($sLabel, $oInput, $sId);
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input;
use Combodo\iTop\Application\UI\Base\UIBlock;
use utils;
@@ -142,4 +141,4 @@ class InputWithLabel extends UIBlock
{
return [$this->oInput->GetId() => $this->oInput];
}
}
}

View File

@@ -1,9 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input\RichText;
use Combodo\iTop\Application\Helper\CKEditorHelper;
use Combodo\iTop\Application\Helper\WebResourcesHelper;
use Combodo\iTop\Application\UI\Base\UIBlock;
@@ -83,7 +86,7 @@ class RichText extends UIBlock
public function SetValue(?string $sValue)
{
$this->sValue = $sValue;
if(is_array($this->aConfig)) {
if (is_array($this->aConfig)) {
$this->aConfig['detectChanges'] = ['initialValue' => $sValue];
}
@@ -111,4 +114,4 @@ class RichText extends UIBlock
{
return $this->aConfig;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @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\tInputLabel;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
@@ -26,7 +25,6 @@ class Select extends UIContentBlock
/** @var bool Allow multiple selection */
protected $bIsMultiple = false;
public function __construct(?string $sId = null)
{
parent::__construct($sId);
@@ -95,4 +93,4 @@ class Select extends UIContentBlock
return $this;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @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
@@ -80,8 +79,8 @@ class SelectOption extends UIBlock
{
$this->bSelected = $bSelected;
return $this;
}
}
/**
* @return bool
*/
@@ -101,4 +100,4 @@ class SelectOption extends UIBlock
return $this;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input\Select;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
@@ -45,4 +44,4 @@ class SelectOptionUIBlockFactory extends AbstractUIBlockFactory
return $oInput;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input\Select;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Input\Select\Select;
@@ -64,4 +63,4 @@ class SelectUIBlockFactory extends AbstractUIBlockFactory
return $oInput;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -156,5 +157,4 @@ abstract class AbstractDataProvider implements iDataProvider
return $this->GetType() === iDataProvider::TYPE_SIMPLE_PROVIDER;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -28,7 +29,7 @@ namespace Combodo\iTop\Application\UI\Base\Component\Input\Set\DataProvider;
class AjaxDataProvider extends SimpleDataProvider
{
/** @var int DEFAULT_MAX_RESULTS maximum results fetched */
const DEFAULT_MAX_RESULTS = 25;
public const DEFAULT_MAX_RESULTS = 25;
/**
* @see \Combodo\iTop\Service\Router\Router
@@ -45,7 +46,6 @@ class AjaxDataProvider extends SimpleDataProvider
/** @var int $iMaxResults Maximum entries */
private int $iMaxResults = AjaxDataProvider::DEFAULT_MAX_RESULTS;
/**
* Constructor.
*
@@ -166,4 +166,4 @@ class AjaxDataProvider extends SimpleDataProvider
return $this->iMaxResults;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -27,7 +28,6 @@ namespace Combodo\iTop\Application\UI\Base\Component\Input\Set\DataProvider;
*/
class AjaxDataProviderForOQL extends AjaxDataProvider
{
/**
* Constructor.
*
@@ -62,4 +62,4 @@ class AjaxDataProviderForOQL extends AjaxDataProvider
->SetDataSearchFields(['friendlyname', 'additional_field']);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -92,4 +93,4 @@ class SimpleDataProvider extends AbstractDataProvider
return array_values($aGroups);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -142,4 +143,4 @@ interface iDataProvider
* @return $this
*/
public function SetTooltipField(string $sField): iDataProvider;
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -54,7 +55,6 @@ class Set extends AbstractInput
private ?int $iMinItems;
/** @var int|null $iMaxItem Maximum number of displayed options */
private ?int $iMaxOptions;
@@ -608,4 +608,4 @@ class Set extends AbstractInput
$this->bIsDisabled = $bIsDisabled;
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -53,13 +54,15 @@ class SetUIBlockFactory extends AbstractUIBlockFactory
* @param string $sValueField Field used for option value
* @param array $aSearchFields Fields used for searching
* @param string|null $sGroupField Field used for grouping
* @param string $sName Field name
*
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Set\Set
*/
public static function MakeForSimple(string $sId, array $aOptions, string $sLabelFields, string $sValueField, array $aSearchFields, ?string $sGroupField = null, ?string $sTooltipField = null): Set
public static function MakeForSimple(string $sId, array $aOptions, string $sLabelFields, string $sValueField, array $aSearchFields, ?string $sGroupField = null, ?string $sTooltipField = null, string $sName = ''): Set
{
// Create set ui block
$oSetUIBlock = new Set($sId);
$oSetUIBlock->SetName($sName);
// Simple data provider
$oDataProvider = new SimpleDataProvider($aOptions);
@@ -91,13 +94,15 @@ class SetUIBlockFactory extends AbstractUIBlockFactory
* @param string $sValueField Field used for value
* @param array $aSearchFields Fields used for search
* @param string|null $sGroupField Field used for grouping
* @param string $sName Field name
*
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Set\Set
*/
public static function MakeForAjax(string $sId, string $sAjaxRoute, array $aAjaxRouteParams, string $sLabelFields, string $sValueField, array $aSearchFields, ?string $sGroupField = null): Set
public static function MakeForAjax(string $sId, string $sAjaxRoute, array $aAjaxRouteParams, string $sLabelFields, string $sValueField, array $aSearchFields, ?string $sGroupField = null, string $sName = ''): Set
{
// Create set ui block
$oSetUIBlock = new Set($sId);
$oSetUIBlock->SetName($sName);
// Ajax data provider
$oDataProvider = new AjaxDataProvider($sAjaxRoute, $aAjaxRouteParams);
@@ -129,13 +134,15 @@ class SetUIBlockFactory extends AbstractUIBlockFactory
* @param string|null $sWizardHelperJsVarName Wizard helper name
* @param array $aFieldsToLoad Additional fields to load on objects
* @param string|null $sGroupField Field used for grouping
* @param string $sName Field name
*
* @return \Combodo\iTop\Application\UI\Base\Component\Input\Set\Set
*/
public static function MakeForOQL(string $sId, string $sObjectClass, string $sOql, string $sWizardHelperJsVarName = null, array $aFieldsToLoad = [], ?string $sGroupField = null): Set
public static function MakeForOQL(string $sId, string $sObjectClass, string $sOql, string $sWizardHelperJsVarName = null, array $aFieldsToLoad = [], ?string $sGroupField = null, string $sName = ''): Set
{
// Create set ui block
$oSetUIBlock = new Set($sId);
$oSetUIBlock->SetName($sName);
// Renderers
$oSetUIBlock->SetOptionsTemplate('application/object/set/option_renderer.html.twig');
@@ -151,4 +158,4 @@ class SetUIBlockFactory extends AbstractUIBlockFactory
return $oSetUIBlock;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Input;
/**
* @package Combodo\iTop\Application\UI\Base\Component\Input
*/
@@ -88,5 +88,4 @@ class TextArea extends AbstractInput
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,25 +7,23 @@
namespace Combodo\iTop\Application\UI\Base\Component\Input;
/**
* @package Combodo\iTop\Application\UI\Base\Component\Input
* @since 3.2.0
*/
class Toggler extends Input {
class Toggler extends Input
{
// Overloaded constants
public const BLOCK_CODE = 'ibo-toggler';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/input/input-toggler';
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/components/input/input-toggler';
public function __construct(?string $sId = null)
{
parent::__construct($sId);
$this->SetType('checkbox');
}
public function SetIsToggled(bool $bIsToggled): static
{
return $this->SetIsChecked($bIsToggled);
@@ -34,4 +33,4 @@ class Toggler extends Input {
{
return $this->IsChecked();
}
}
}

View File

@@ -1,10 +1,10 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Input;
use utils;
@@ -122,4 +122,4 @@ trait tInputLabel
{
return utils::StrLen($this->sDescription) > 0;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\MedallionIcon;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -38,7 +38,7 @@ class MedallionIcon extends UIBlock
{
parent::__construct($sId);
$this->sImageUrl = $sImageUrl;
$this->sIconClass= $sIconClass;
$this->sIconClass = $sIconClass;
}
/**
@@ -78,7 +78,7 @@ class MedallionIcon extends UIBlock
$this->sIconClass = $sIconClass;
return $this;
}
/**
* @return string
*/
@@ -97,5 +97,5 @@ class MedallionIcon extends UIBlock
$this->sDescription = $sDescription;
return $this;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -56,4 +57,4 @@ class DoNotShowAgainOptionBlock extends UIContentBlock
$oCheckBox->SetLabel(Dict::S('UI:UserPref:DoNotShowAgain'));
$this->AddSubBlock($oCheckBox);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Panel;
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
use Combodo\iTop\Application\UI\Base\iUIBlock;
use Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock;
@@ -518,7 +518,8 @@ class Panel extends UIContentBlock
*
* @return $this
*/
public function SetMainBlocks(array $aBlocks) {
public function SetMainBlocks(array $aBlocks)
{
$this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_MAIN, $aBlocks);
return $this;
@@ -530,7 +531,8 @@ class Panel extends UIContentBlock
* @return \Combodo\iTop\Application\UI\Base\iUIBlock[]
* @throws \Exception
*/
public function GetMainBlocks(): array {
public function GetMainBlocks(): array
{
return $this->GetContentAreaBlocks(static::ENUM_CONTENT_AREA_MAIN);
}
@@ -586,7 +588,8 @@ class Panel extends UIContentBlock
*
* @return $this
*/
public function SetToolBlocks(array $aBlocks) {
public function SetToolBlocks(array $aBlocks)
{
$this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_TOOLBAR, $aBlocks);
return $this;
@@ -598,7 +601,8 @@ class Panel extends UIContentBlock
* @return \Combodo\iTop\Application\UI\Base\iUIBlock[]
* @throws \Exception
*/
public function GetToolbarBlocks(): array {
public function GetToolbarBlocks(): array
{
return $this->GetContentAreaBlocks(static::ENUM_CONTENT_AREA_TOOLBAR);
}
@@ -654,7 +658,8 @@ class Panel extends UIContentBlock
/**
* @inheritDoc
*/
public function AddHtml(string $sHtml) {
public function AddHtml(string $sHtml)
{
$oBlock = new Html($sHtml);
$this->AddMainBlock($oBlock);
@@ -666,7 +671,8 @@ class Panel extends UIContentBlock
*
* @inheritDoc
*/
public function AddSubBlock(?iUIBlock $oSubBlock) {
public function AddSubBlock(?iUIBlock $oSubBlock)
{
if ($oSubBlock) {
$this->AddMainBlock($oSubBlock);
}
@@ -680,7 +686,8 @@ class Panel extends UIContentBlock
*
* @return $this
*/
public function RemoveSubBlock(string $sId) {
public function RemoveSubBlock(string $sId)
{
foreach ($this->GetContentAreas() as $oContentArea) {
$oContentArea->RemoveSubBlock($sId);
}
@@ -695,7 +702,8 @@ class Panel extends UIContentBlock
*
* @return bool
*/
public function HasSubBlock(string $sId): bool {
public function HasSubBlock(string $sId): bool
{
foreach ($this->GetContentAreas() as $oContentArea) {
if ($oContentArea->HasSubBlock($sId)) {
return true;
@@ -710,7 +718,8 @@ class Panel extends UIContentBlock
*
* @inheritDoc
*/
public function GetSubBlock(string $sId): ?iUIBlock {
public function GetSubBlock(string $sId): ?iUIBlock
{
foreach ($this->GetContentAreas() as $oContentArea) {
$oSubBlock = $oContentArea->GetSubBlock($sId);
if (!is_null($oSubBlock)) {
@@ -727,7 +736,8 @@ class Panel extends UIContentBlock
* @inheritDoc
* @return $this|\Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock
*/
public function SetSubBlocks(array $aSubBlocks): iUIContentBlock {
public function SetSubBlocks(array $aSubBlocks): iUIContentBlock
{
$this->SetMainBlocks($aSubBlocks);
return $this;

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -218,4 +219,4 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
return $oPanel;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Pill;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
/**
@@ -142,4 +141,4 @@ class Pill extends UIContentBlock
{
return !empty($this->sTooltip);
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Pill;
use Combodo\iTop\Application\UI\Helper\UIHelper;
use MetaModel;
@@ -42,4 +41,4 @@ class PillFactory
return $oPill;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\NewsroomMenu;
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu;
/**
@@ -65,4 +65,4 @@ class NewsroomMenu extends PopoverMenu
{
return json_encode($this->aParams);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -62,17 +63,17 @@ class NewsroomMenuFactory
*/
protected static function PrepareParametersForNewsroomMenu()
{
$aProviderParams=[];
$aProviderParams = [];
$oUser = UserRights::GetUserObject();
/** @var iNewsroomProvider[] $aProviders */
$aProviders = InterfaceDiscovery::GetInstance()->FindItopClasses(iNewsroomProvider::class);
foreach($aProviders as $cProvider) {
foreach ($aProviders as $cProvider) {
$oProvider = new $cProvider();
$oConfig = MetaModel::GetConfig();
$oProvider->SetConfig($oConfig);
$bProviderEnabled = appUserPreferences::GetPref('newsroom_provider_'.get_class($oProvider), true);
if ($bProviderEnabled && $oProvider->IsApplicable($oUser)) {
$aProviderParams[] = array(
$aProviderParams[] = [
'label' => $oProvider->GetLabel(),
'fetch_url' => $oProvider->GetFetchURL(),
'target' => utils::StartsWith($oProvider->GetFetchURL(), $oConfig->Get('app_root_url')) ? '_self' : '_blank',
@@ -80,25 +81,25 @@ class NewsroomMenuFactory
'mark_all_as_read_url' => $oProvider->GetMarkAllAsReadURL(),
'placeholders' => $oProvider->GetPlaceholders(),
'ttl' => $oProvider->GetTTL(),
);
];
}
}
$sImageUrl= 'fas fa-comment-dots';
$sPlaceholderImageUrl= 'far fa-envelope';
$aParams = array(
$sImageUrl = 'fas fa-comment-dots';
$sPlaceholderImageUrl = 'far fa-envelope';
$aParams = [
'image_icon' => $sImageUrl,
'no_message_icon' => file_get_contents(APPROOT.'images/illustrations/undraw_social_serenity.svg'),
'placeholder_image_icon' => $sPlaceholderImageUrl,
'cache_uuid' => 'itop-newsroom-'.UserRights::GetUserId().'-'.md5(APPROOT),
'providers' => $aProviderParams,
'display_limit' => (int)appUserPreferences::GetPref('newsroom_display_size', 7),
'labels' => array(
'labels' => [
'no_notification' => 'UI:Newsroom:NoNewMessage',
'x_notifications' => 'UI:Newsroom:XNewMessage',
'mark_all_as_read' => 'UI:Newsroom:MarkAllAsRead',
'view_all' => 'UI:Newsroom:ViewAllMessages'
),
);
'view_all' => 'UI:Newsroom:ViewAllMessages',
],
];
return $aParams;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu;
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem\PopoverMenuItem;
use Combodo\iTop\Application\UI\Base\iUIBlock;
use Combodo\iTop\Application\UI\Base\UIBlock;
@@ -336,8 +336,7 @@ class PopoverMenu extends UIBlock
*/
public function AddSection(string $sId)
{
if (false === $this->HasSection($sId))
{
if (false === $this->HasSection($sId)) {
$this->aSections[$sId] = [
'aItems' => [],
];
@@ -357,8 +356,7 @@ class PopoverMenu extends UIBlock
*/
public function RemoveSection(string $sId)
{
if (true === $this->HasSection($sId))
{
if (true === $this->HasSection($sId)) {
unset($this->aSections[$sId]);
}
@@ -387,8 +385,7 @@ class PopoverMenu extends UIBlock
*/
public function ClearSection(string $sId)
{
if (false === $this->HasSection($sId))
{
if (false === $this->HasSection($sId)) {
throw new Exception('Could not clear section "'.$sId.'" as it does not exist in the "'.$this->GetId().'" menu');
}
@@ -448,13 +445,11 @@ class PopoverMenu extends UIBlock
*/
public function RemoveItem(string $sSectionId, string $sItemId)
{
if (false === $this->HasSection($sSectionId))
{
if (false === $this->HasSection($sSectionId)) {
throw new Exception('Could not remove en item from the "'.$sSectionId.'" as it does not seem to exist in the "'.$this->GetId().'" menu.');
}
if (array_key_exists($sItemId, $this->aSections[$sSectionId]['aItems']))
{
if (array_key_exists($sItemId, $this->aSections[$sSectionId]['aItems'])) {
unset($this->aSections[$sSectionId]['aItems'][$sItemId]);
}
@@ -472,7 +467,7 @@ class PopoverMenu extends UIBlock
*/
public function AddItems(string $sSectionId, array $aItems)
{
foreach($aItems as $oItem){
foreach ($aItems as $oItem) {
$this->AddItem($sSectionId, $oItem);
}
@@ -525,12 +520,11 @@ class PopoverMenu extends UIBlock
$aSubBlocks = [];
foreach ($this->aSections as $sSectionId => $aSectionData) {
foreach($aSectionData['aItems'] as $sItemId => $oItem)
{
foreach ($aSectionData['aItems'] as $sItemId => $oItem) {
$aSubBlocks[$sItemId] = $oItem;
}
}
return $aSubBlocks;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,8 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu;
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem\PopoverMenuItemFactory;
use Dict;
use JSPopupMenuItem;
@@ -80,7 +79,7 @@ class PopoverMenuFactory
return $oMenu;
}
/**
* Return the allowed portals items for the current user
*
@@ -89,10 +88,8 @@ class PopoverMenuFactory
protected static function PrepareAllowedPortalsItemsForUserMenu()
{
$aItems = [];
foreach (UserRights::GetAllowedPortals() as $aAllowedPortal)
{
if ($aAllowedPortal['id'] !== 'backoffice')
{
foreach (UserRights::GetAllowedPortals() as $aAllowedPortal) {
if ($aAllowedPortal['id'] !== 'backoffice') {
$oPopupMenuItem = new URLPopupMenuItem(
'portal:'.$aAllowedPortal['id'],
Dict::S($aAllowedPortal['label']),
@@ -127,8 +124,7 @@ class PopoverMenuFactory
);
// Archive mode
if(true === utils::IsArchiveMode())
{
if (true === utils::IsArchiveMode()) {
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
new JSPopupMenuItem(
'UI:ArchiveModeOff',
@@ -136,9 +132,7 @@ class PopoverMenuFactory
'return ArchiveMode(false);'
)
);
}
elseif(UserRights::CanBrowseArchive())
{
} elseif (UserRights::CanBrowseArchive()) {
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
new JSPopupMenuItem(
'UI:ArchiveModeOn',
@@ -149,8 +143,7 @@ class PopoverMenuFactory
}
// Logoff
if(utils::CanLogOff())
{
if (utils::CanLogOff()) {
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
new URLPopupMenuItem(
'UI:LogOffMenu',
@@ -161,8 +154,7 @@ class PopoverMenuFactory
}
// Change password
if (UserRights::CanChangePassword())
{
if (UserRights::CanChangePassword()) {
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
new URLPopupMenuItem(
'UI:ChangePwdMenu',
@@ -189,7 +181,7 @@ class PopoverMenuFactory
utils::GetPopupMenuItemsBlock($oMenu, iPopupMenuExtension::MENU_USER_ACTIONS, null, $aOriginalItems);
$aTransformedItems = [];
foreach($aOriginalItems as $sItemID => $aItemData) {
foreach ($aOriginalItems as $sItemID => $aItemData) {
$aTransformedItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItemData($sItemID, $aItemData);
}
@@ -273,4 +265,4 @@ class PopoverMenuFactory
return $oMenu;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
use JSPopupMenuItem;
/**
@@ -27,7 +27,7 @@ use JSPopupMenuItem;
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @package Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem
* @property \JSPopupMenuItem $oPopupMenuItem
* @property \JSPopupMenuItem $oPopupMenuItem
* @since 3.0.0
*/
class JsPopoverMenuItem extends PopoverMenuItem
@@ -63,4 +63,4 @@ class JsPopoverMenuItem extends PopoverMenuItem
return $aJsFiles;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
use ApplicationPopupMenuItem;
use Combodo\iTop\Application\UI\Base\UIBlock;
use utils;
@@ -106,7 +106,7 @@ class PopoverMenuItem extends UIBlock
{
return $this->oPopupMenuItem->GetCssClasses();
}
/**
* @return string
* @uses oPopupMenuItem
@@ -137,7 +137,7 @@ class PopoverMenuItem extends UIBlock
{
return $this->oPopupMenuItem->GetTooltip();
}
/**
* @return $this
* @uses oPopupMenuItem
@@ -149,7 +149,6 @@ class PopoverMenuItem extends UIBlock
return $this;
}
/**
* @return string
* @uses oPopupMenuItem
@@ -160,5 +159,4 @@ class PopoverMenuItem extends UIBlock
return $this->oPopupMenuItem->GetUID();
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,8 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
use ApplicationPopupMenuItem;
use JSPopupMenuItem;
use SeparatorPopupMenuItem;
@@ -46,14 +45,13 @@ class PopoverMenuItemFactory
public static function MakeFromApplicationPopupMenuItem(ApplicationPopupMenuItem $oItem)
{
$sNamespace = 'Combodo\\iTop\\Application\\UI\\Base\\Component\\PopoverMenu\\PopoverMenuItem\\';
switch(true)
{
switch (true) {
case $oItem instanceof URLPopupMenuItem:
$sTargetClass = 'UrlPopoverMenuItem';
break;
case $oItem instanceof JSPopupMenuItem:
$sTargetClass = 'JsPopoverMenuItem';
break;
break;
case $oItem instanceof SeparatorPopupMenuItem:
$sTargetClass = 'SeparatorPopoverMenuItem';
break;
@@ -99,7 +97,8 @@ class PopoverMenuItemFactory
new JSPopupMenuItem(
$aRefactoredItem['uid'],
$aRefactoredItem['label'],
$aRefactoredItem['on_click'])
$aRefactoredItem['on_click']
)
);
} elseif (!empty($aRefactoredItem['url'])) {
// URL
@@ -108,7 +107,8 @@ class PopoverMenuItemFactory
$aRefactoredItem['uid'],
$aRefactoredItem['label'],
$aRefactoredItem['url'],
$aRefactoredItem['target'])
$aRefactoredItem['target']
)
);
} else {
// Separator
@@ -140,4 +140,4 @@ class PopoverMenuItemFactory
{
return new SeparatorPopoverMenuItem(new SeparatorPopupMenuItem());
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
/**
* Class SeparatorPopoverMenuItem
*
@@ -33,4 +33,4 @@ class SeparatorPopoverMenuItem extends PopoverMenuItem
// Overloaded constants
public const BLOCK_CODE = 'ibo-popover-menu--item-separator';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/popover-menu/item/mode_separator';
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
/**
* Class UrlPopoverMenuItem
*
@@ -41,7 +41,7 @@ class UrlPopoverMenuItem extends PopoverMenuItem
{
return $this->oPopupMenuItem->GetUrl();
}
/**
* @see \URLPopupMenuItem::GetTarget()
* @return string
@@ -50,4 +50,4 @@ class UrlPopoverMenuItem extends PopoverMenuItem
{
return $this->oPopupMenuItem->GetTarget();
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\QuickCreate;
use Combodo\iTop\Application\UI\Base\UIBlock;
use Combodo\iTop\Application\UI\Hook\iKeyboardShortcut;
use MetaModel;
@@ -81,7 +81,7 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
{
parent::__construct($sId);
$this->SetEndpoint(static::DEFAULT_ENDPOINT_REL_URL);
$this->aAvailableClasses = $this->FilterAvailableClasses(UserRights::GetAllowedClasses(UR_ACTION_CREATE, array('bizmodel'), true));
$this->aAvailableClasses = $this->FilterAvailableClasses(UserRights::GetAllowedClasses(UR_ACTION_CREATE, ['bizmodel'], true));
$this->aLastClasses = $aLastClasses;
$this->iMaxAutocompleteResults = (int) MetaModel::GetConfig()->Get('quick_create.max_autocomplete_results');
$this->bShowHistory = (bool) MetaModel::GetConfig()->Get('quick_create.show_history');
@@ -141,14 +141,14 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
{
$aFilteredClasses = [];
foreach ($aClasses as $sClassName => $sClassLabel){
foreach ($aClasses as $sClassName => $sClassLabel) {
// Skip not derivating from cmdbAbstractObject
if(false === is_a($sClassName, '\cmdbAbstractObject', true)) {
if (false === is_a($sClassName, '\cmdbAbstractObject', true)) {
continue;
}
// Skip n:n classes
if(MetaModel::IsLinkClass($sClassName)) {
if (MetaModel::IsLinkClass($sClassName)) {
continue;
}
@@ -236,4 +236,4 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
{
return "[data-role='".static::BLOCK_CODE."']";
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\QuickCreate;
/**
* Class QuickCreateFactory
*
@@ -44,4 +44,4 @@ class QuickCreateFactory
return new QuickCreate($aLastClasses, QuickCreate::BLOCK_CODE);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -19,7 +20,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\QuickCreate;
use appUserPreferences;
use DBObject;
use MetaModel;
@@ -60,10 +60,8 @@ class QuickCreateHelper
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
// Remove same entry from history to avoid duplicates
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
{
if ($aHistoryEntries[$iIdx]['class'] === $sClass)
{
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++) {
if ($aHistoryEntries[$iIdx]['class'] === $sClass) {
unset($aHistoryEntries[$iIdx]);
}
}
@@ -92,33 +90,28 @@ class QuickCreateHelper
static::Truncate($aHistoryEntries, 'quick_create.max_history_results');
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
{
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++) {
$sClass = $aHistoryEntries[$iIdx]['class'];
if (!MetaModel::IsValidClass($sClass)) {
continue;
}
// Add class icon
if(!isset($aHistoryEntries[$iIdx]['icon_url']))
{
if (!isset($aHistoryEntries[$iIdx]['icon_url'])) {
$sClassIconUrl = MetaModel::GetClassIcon($sClass, false);
// Mind that some classes don't have an icon
if(!empty($sClassIconUrl))
{
if (!empty($sClassIconUrl)) {
$aHistoryEntries[$iIdx]['icon_url'] = $sClassIconUrl;
}
}
// Add class label
if(!isset($aHistoryEntries[$iIdx]['label_html']))
{
if (!isset($aHistoryEntries[$iIdx]['label_html'])) {
$aHistoryEntries[$iIdx]['label_html'] = utils::EscapeHtml(MetaModel::GetName($sClass));
}
// Add URL
if(!isset($aHistoryEntries[$iIdx]['target_url']))
{
if (!isset($aHistoryEntries[$iIdx]['target_url'])) {
$aHistoryEntries[$iIdx]['target_url'] = DBObject::ComputeStandardUIPage($sClass).'?operation=new&class='.$sClass;
}
}
@@ -138,20 +131,18 @@ class QuickCreateHelper
{
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
static::Truncate($aHistoryEntries, 'quick_create.max_history_results');
$aPopularClassesNames = UserRights::GetAllowedClasses(UR_ACTION_CREATE, array('popular'), false);
$aPopularClassesNames = UserRights::GetAllowedClasses(UR_ACTION_CREATE, ['popular'], false);
// Prevent classes in both Popular and Recent to appear twice
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
{
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++) {
if (($key = array_search($aHistoryEntries[$iIdx]['class'], $aPopularClassesNames)) !== false) {
unset($aPopularClassesNames[$key]);
}
}
//die(var_dump($aPopularClassesNames));
static::Truncate($aPopularClassesNames, 'quick_create.max_popular_results');
$aPopularClasses = array();
foreach($aPopularClassesNames as $sClass)
{
$aPopularClasses = [];
foreach ($aPopularClassesNames as $sClass) {
if (!MetaModel::IsValidClass($sClass)) {
continue;
}
@@ -167,12 +158,12 @@ class QuickCreateHelper
// Add URL
$sTargetUrl = DBObject::ComputeStandardUIPage($sClass).'?operation=new&class='.$sClass;
$aPopularClasses[] = array(
$aPopularClasses[] = [
'class' => $sClass,
'icon_url' => $sClassIconUrl,
'label_html' => $sLabelHtml,
'target_url' => $sTargetUrl
);
'target_url' => $sTargetUrl,
];
}
return $aPopularClasses;
}
@@ -186,11 +177,9 @@ class QuickCreateHelper
protected static function Truncate(array &$aEntries, string $sMaxEntriesParam = 'global_search.max_history_results'): void
{
$iMaxResults = (int) MetaModel::GetConfig()->Get($sMaxEntriesParam);
if(count($aEntries) > $iMaxResults)
{
if (count($aEntries) > $iMaxResults) {
$aEntries = array_slice($aEntries, 0, $iMaxResults);
}
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Spinner;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -19,7 +19,7 @@ class Spinner extends UIBlock
// Overloaded constants
public const BLOCK_CODE = 'ibo-spinner';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/spinner/layout';
/* @var string Display size for inline element, rather small */
public const ENUM_SPINNER_SIZE_INLINE = 'inline';
/* @var string Display size for small element, displayed in a column */
@@ -60,7 +60,7 @@ class Spinner extends UIBlock
$this->sDescription = $sDescription;
return $this;
}
/**
* @return bool
*/
@@ -68,7 +68,7 @@ class Spinner extends UIBlock
{
return $this->sDescription !== '';
}
/**
* @return string
*/
@@ -86,4 +86,4 @@ class Spinner extends UIBlock
$this->sSize = $sSize;
return $this;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Spinner;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
@@ -50,7 +49,7 @@ class SpinnerUIBlockFactory extends AbstractUIBlockFactory
$oSpinner->SetSize(Spinner::ENUM_SPINNER_SIZE_SMALL);
return $oSpinner;
}
/**
* @api
*
@@ -80,4 +79,4 @@ class SpinnerUIBlockFactory extends AbstractUIBlockFactory
$oSpinner->SetSize(Spinner::ENUM_SPINNER_SIZE_LARGE);
return $oSpinner;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
@@ -61,4 +62,4 @@ class TemplateUIBlockFactory extends AbstractUIBlockFactory
return $oBlock;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Text;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -34,7 +34,6 @@ class Text extends UIBlock
parent::__construct($sId);
}
/**
* @return string
*/
@@ -43,4 +42,4 @@ class Text extends UIBlock
return $this->sText;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Title;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Combodo\iTop\Application\UI\Base\UIBlock;
@@ -93,4 +93,4 @@ class Title extends UIContentBlock
return $this->bIsMedallion;
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Title;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Text\Text;
use Combodo\iTop\Application\UI\Base\UIBlock;
@@ -50,10 +49,12 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
* @return \Combodo\iTop\Application\UI\Base\Component\Title\Title
*/
public static function MakeForPageWithIcon(
string $sTitle, string $sIconUrl, string $sIconCoverMethod = Title::DEFAULT_ICON_COVER_METHOD, bool $bIsMedallion = true,
string $sTitle,
string $sIconUrl,
string $sIconCoverMethod = Title::DEFAULT_ICON_COVER_METHOD,
bool $bIsMedallion = true,
?string $sId = null
)
{
) {
$oTitle = new Title(new Text($sTitle), 1, $sId);
$oTitle->SetIcon($sIconUrl, $sIconCoverMethod, $bIsMedallion);
@@ -85,4 +86,4 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
{
return new Title($oTitle, $iLevel, $sId);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -23,4 +23,4 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
*/
class AbstractSeparator extends UIBlock
{
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar;
@@ -36,4 +35,4 @@ class ToolbarSeparatorUIBlockFactory extends AbstractUIBlockFactory
{
return new VerticalSeparator($sId);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator;
/**
* Class ToolbarSpacer
*
@@ -28,4 +28,4 @@ class VerticalSeparator extends AbstractSeparator
{
parent::__construct($sId);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
/**
@@ -24,4 +24,4 @@ class Toolbar extends UIContentBlock
{
parent::__construct($sId, $aContainerClasses);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -6,7 +7,6 @@
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarSpacer;
use Combodo\iTop\Application\UI\Base\UIBlock;
/**
@@ -24,4 +24,4 @@ class ToolbarSpacer extends UIBlock
{
parent::__construct($sId);
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarSpacer;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
@@ -35,4 +34,4 @@ class ToolbarSpacerUIBlockFactory extends AbstractUIBlockFactory
{
return new ToolbarSpacer($sId);
}
}
}

View File

@@ -1,13 +1,12 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
/**
@@ -59,4 +58,4 @@ class ToolbarUIBlockFactory extends AbstractUIBlockFactory
{
return new Toolbar($sId, array_merge($aContainerClasses, ['ibo-toolbar--button']));
}
}
}