mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-02 07:34:13 +01:00
PHP CS-Fixer
This commit is contained in:
@@ -1067,8 +1067,7 @@ JS
|
||||
$oUDSet = new DBObjectSet($oUDSearch);
|
||||
|
||||
return ($oUDSet->Count() > 0);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1102,7 +1101,8 @@ JS
|
||||
}
|
||||
|
||||
// TODO 3.3 Check if we need different action for custom dashboard creation / edition
|
||||
$oActionEditButton = ButtonUIBlockFactory::MakeIconAction('fas fa-pen',
|
||||
$oActionEditButton = ButtonUIBlockFactory::MakeIconAction(
|
||||
'fas fa-pen',
|
||||
$this->HasCustomDashboard() ? Dict::S('UI:Dashboard:EditCustom') : Dict::S('UI:Dashboard:CreateCustom'),
|
||||
$sActionEditId,
|
||||
'',
|
||||
@@ -1123,8 +1123,8 @@ JS
|
||||
$sFile = addslashes(utils::LocalPath($this->sDefinitionFile));
|
||||
$sJSExtraParams = json_encode($aExtraParams);
|
||||
if ($this->HasCustomDashboard()) {
|
||||
// $oEdit = new JSPopupMenuItem('UI:Dashboard:Edit', Dict::S('UI:Dashboard:EditCustom'), "return EditDashboard('{$this->sId}', '$sFile', $sJSExtraParams)");
|
||||
// $aActions[$oEdit->GetUID()] = $oEdit->GetMenuItem();
|
||||
// $oEdit = new JSPopupMenuItem('UI:Dashboard:Edit', Dict::S('UI:Dashboard:EditCustom'), "return EditDashboard('{$this->sId}', '$sFile', $sJSExtraParams)");
|
||||
// $aActions[$oEdit->GetUID()] = $oEdit->GetMenuItem();
|
||||
$oRevert = new JSPopupMenuItem(
|
||||
'UI:Dashboard:RevertConfirm',
|
||||
Dict::S('UI:Dashboard:DeleteCustom'),
|
||||
@@ -1132,8 +1132,8 @@ JS
|
||||
);
|
||||
$aActions[$oRevert->GetUID()] = $oRevert->GetMenuItem();
|
||||
} else {
|
||||
// $oEdit = new JSPopupMenuItem('UI:Dashboard:Edit', Dict::S('UI:Dashboard:CreateCustom'), "return EditDashboard('{$this->sId}', '$sFile', $sJSExtraParams)");
|
||||
// $aActions[$oEdit->GetUID()] = $oEdit->GetMenuItem();
|
||||
// $oEdit = new JSPopupMenuItem('UI:Dashboard:Edit', Dict::S('UI:Dashboard:CreateCustom'), "return EditDashboard('{$this->sId}', '$sFile', $sJSExtraParams)");
|
||||
// $aActions[$oEdit->GetUID()] = $oEdit->GetMenuItem();
|
||||
}
|
||||
|
||||
utils::GetPopupMenuItems($oPage, iPopupMenuExtension::MENU_DASHBOARD_ACTIONS, $this, $aActions);
|
||||
@@ -1639,8 +1639,7 @@ JS
|
||||
try {
|
||||
$oFilter = $oDashlet->GetDBSearch($aExtraParams);
|
||||
$aClassAliases = $oFilter->GetSelectedClasses();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
//on error, return default value
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -61,4 +61,4 @@ class DashboardGrid extends UIBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ class DashboardGridSlot extends UIBlock
|
||||
$this->iHeight = random_int(1, 4) || $iHeight;
|
||||
}
|
||||
|
||||
|
||||
public function GetSubBlocks(): array
|
||||
{
|
||||
return [$this->oUIBlock];
|
||||
|
||||
@@ -13,6 +13,7 @@ use Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectOptionUIBlockF
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Dict;
|
||||
|
||||
use function Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
|
||||
|
||||
// TODO 3.3 Remove old dashboard methods, make dict entries for elements, etc
|
||||
@@ -54,7 +55,8 @@ class DashboardLayout extends UIBlock
|
||||
$this->oButtonsToolbar = $this->MakeButtonsToolbar();
|
||||
}
|
||||
|
||||
public function MakeTitleInput() {
|
||||
public function MakeTitleInput()
|
||||
{
|
||||
$oTitleInput = new \Combodo\iTop\Application\UI\Base\Component\Input\Input();
|
||||
$oTitleInput->SetName('dashboard_title');
|
||||
$oTitleInput->SetType('text');
|
||||
@@ -63,7 +65,8 @@ class DashboardLayout extends UIBlock
|
||||
return $oTitleInput;
|
||||
}
|
||||
|
||||
public function MakeRefreshInput() {
|
||||
public function MakeRefreshInput()
|
||||
{
|
||||
$oRefreshInput = \Combodo\iTop\Application\UI\Base\Component\Input\Select\SelectUIBlockFactory::MakeForSelect('refresh_interval');
|
||||
$aRefreshRateOptions = [
|
||||
['value' => '0', 'label' => 'No auto-refresh'],
|
||||
@@ -82,7 +85,8 @@ class DashboardLayout extends UIBlock
|
||||
|
||||
return $oRefreshInput;
|
||||
}
|
||||
public function MakeButtonsToolbar() {
|
||||
public function MakeButtonsToolbar()
|
||||
{
|
||||
$oContainer = new UIContentBlock(null, ['ibo-dashboard--buttons-toolbar']);
|
||||
$oCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel', 'cancel');
|
||||
$oSaveButton = ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Save'), 'save', 'save');
|
||||
@@ -162,13 +166,15 @@ class DashboardLayout extends UIBlock
|
||||
return $this->aDashboardRows;
|
||||
}
|
||||
|
||||
public function SetGrid(DashboardGrid $oDashboardGrid) {
|
||||
public function SetGrid(DashboardGrid $oDashboardGrid)
|
||||
{
|
||||
$this->oDashboardGrid = $oDashboardGrid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function GetGrid() {
|
||||
public function GetGrid()
|
||||
{
|
||||
return $this->oDashboardGrid;
|
||||
}
|
||||
|
||||
@@ -177,11 +183,13 @@ class DashboardLayout extends UIBlock
|
||||
return $this->oTitleInput;
|
||||
}
|
||||
|
||||
public function GetRefreshInput() {
|
||||
public function GetRefreshInput()
|
||||
{
|
||||
return $this->oRefreshInput;
|
||||
}
|
||||
|
||||
public function GetButtonsToolbar() {
|
||||
public function GetButtonsToolbar()
|
||||
{
|
||||
return $this->oButtonsToolbar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace Combodo\iTop\Application\UI\Base\Layout\DashletPanel;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use utils;
|
||||
|
||||
class DashletEntry extends UIBlock {
|
||||
class DashletEntry extends UIBlock
|
||||
{
|
||||
public const BLOCK_CODE = 'ibo-dashlet-entry';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/dashlet-panel/dashlet-entry';
|
||||
|
||||
@@ -18,7 +19,6 @@ class DashletEntry extends UIBlock {
|
||||
protected $sDashletPreferredWidth;
|
||||
protected $sDashletPreferredHeight;
|
||||
|
||||
|
||||
public function __construct(string $sDashletClass, string $sDashletLabel, string $sDashletDescription, string $sDashletIconRelUrl, ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
@@ -159,5 +159,4 @@ class DashletEntry extends UIBlock {
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace Combodo\iTop\Application\UI\Base\Layout\DashletPanel;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Dashlet;
|
||||
|
||||
class DashletPanel extends UIBlock {
|
||||
class DashletPanel extends UIBlock
|
||||
{
|
||||
public const BLOCK_CODE = 'ibo-dashlet-panel';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/dashlet-panel/layout';
|
||||
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/layouts/dashlet-panel/layout';
|
||||
@@ -19,17 +20,20 @@ class DashletPanel extends UIBlock {
|
||||
$this->AddDataAttribute('role', static::BLOCK_CODE);
|
||||
}
|
||||
|
||||
public function AddDashletEntry(DashletEntry $oDashletEntry) {
|
||||
public function AddDashletEntry(DashletEntry $oDashletEntry)
|
||||
{
|
||||
$this->aDashletsEntries[] = $oDashletEntry;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function GetDashletEntries() : array {
|
||||
public function GetDashletEntries(): array
|
||||
{
|
||||
return $this->aDashletsEntries;
|
||||
}
|
||||
|
||||
public function SetDashletEntries(array $aDashletEntries) {
|
||||
public function SetDashletEntries(array $aDashletEntries)
|
||||
{
|
||||
$this->aDashletsEntries = $aDashletEntries;
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\DashletPanel;
|
||||
|
||||
|
||||
use Combodo\iTop\Service\Dashboard\DashletService;
|
||||
|
||||
class DashletPanelFactory {
|
||||
class DashletPanelFactory
|
||||
{
|
||||
public static function MakeForDashboardEditor(string $sId = null): DashletPanel
|
||||
{
|
||||
$oDashletPanel = new DashletPanel($sId);
|
||||
@@ -15,16 +15,16 @@ class DashletPanelFactory {
|
||||
foreach ($aAvailableDashlets as $sDashletClass => $aDashletInformation) {
|
||||
$oDashletEntry = new DashletEntry($sDashletClass, $aDashletInformation['label'], $aDashletInformation['description'], $aDashletInformation['icon']);
|
||||
|
||||
if(isset($aDashletInformation['min_width'])) {
|
||||
if (isset($aDashletInformation['min_width'])) {
|
||||
$oDashletEntry->SetDashletMinWidth($aDashletInformation['min_width']);
|
||||
}
|
||||
if(isset($aDashletInformation['min_height'])) {
|
||||
if (isset($aDashletInformation['min_height'])) {
|
||||
$oDashletEntry->SetDashletMinHeight($aDashletInformation['min_height']);
|
||||
}
|
||||
if(isset($aDashletInformation['preferred_width'])) {
|
||||
if (isset($aDashletInformation['preferred_width'])) {
|
||||
$oDashletEntry->SetDashletPreferredWidth($aDashletInformation['preferred_width']);
|
||||
}
|
||||
if(isset($aDashletInformation['preferred_height'])) {
|
||||
if (isset($aDashletInformation['preferred_height'])) {
|
||||
$oDashletEntry->SetDashletPreferredHeight($aDashletInformation['preferred_height']);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,8 @@ class PageContentFactory
|
||||
return $oLayout;
|
||||
}
|
||||
|
||||
public static function MakeForDashboard() {
|
||||
public static function MakeForDashboard()
|
||||
{
|
||||
$oLayout = new PageContentWithSideContent();
|
||||
|
||||
// TODO 3.3 Add dashboard specific blocks
|
||||
|
||||
@@ -4,8 +4,10 @@ namespace Combodo\iTop\Service\Dashboard;
|
||||
|
||||
use ReflectionClass;
|
||||
|
||||
class DashletService {
|
||||
public static function GetAvailableDashlets(): array {
|
||||
class DashletService
|
||||
{
|
||||
public static function GetAvailableDashlets(): array
|
||||
{
|
||||
$aDashlets = [];
|
||||
|
||||
foreach (get_declared_classes() as $sDashletClass) {
|
||||
|
||||
Reference in New Issue
Block a user