mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-26 03:58:45 +02:00
N°2847 - Rework iTopWebPage layout (WIP Part VI)
- iTopWebPage: Restore "open search" feature - iTopWebPage: Change all resources URL to absolute in order to benefit from the "duplicate removal" benefits - iTopWebPage: Remove obsolete method IsMenuPaneVisible() - Config: Add new parameters quick_create.enabled / global_search.enabled / breadcrumb.enabled - utils: Add new GetAppRevisionNumber() method - Introduce iUIBlock interface for UI layouts, components, ... - Introduce BlockRenderer to properly render blocks - Add "render_block" function to TwigHelper to render blocks directly from TWIG - Refactor layouts and components into proper block classes to fit the new architecture
This commit is contained in:
103
sources/application/UI/Component/QuickCreate/QuickCreate.php
Normal file
103
sources/application/UI/Component/QuickCreate/QuickCreate.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2013-2020 Combodo SARL
|
||||
*
|
||||
* This file is part of iTop.
|
||||
*
|
||||
* iTop is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* iTop is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Component\QuickCreate;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\UIBlock;
|
||||
use UserRights;
|
||||
|
||||
/**
|
||||
* Class QuickCreate
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Component\QuickCreate
|
||||
* @internal
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class QuickCreate extends UIBlock
|
||||
{
|
||||
const BLOCK_CODE = 'ibo-quick-create';
|
||||
|
||||
const HTML_TEMPLATE_REL_PATH = 'components/quick-create/layout';
|
||||
const JS_TEMPLATE_REL_PATH = 'components/quick-create/layout';
|
||||
const JS_FILES_REL_PATH = [
|
||||
'js/selectize.min.js',
|
||||
'js/components/quick-create.js',
|
||||
];
|
||||
const CSS_FILES_REL_PATH = [
|
||||
'css/selectize.default.css',
|
||||
];
|
||||
|
||||
const DEFAULT_ENDPOINT_REL_URL = 'pages/UI.php';
|
||||
|
||||
/** @var array $aAvailableClasses */
|
||||
protected $aAvailableClasses;
|
||||
/** @var array $aLastClasses */
|
||||
protected $aLastClasses;
|
||||
|
||||
/**
|
||||
* QuickCreate constructor.
|
||||
*
|
||||
* @param string $sId
|
||||
* @param array $aLastClasses
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \DictExceptionMissingString
|
||||
*/
|
||||
public function __construct($sId = null, $aLastClasses = [])
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->aAvailableClasses = UserRights::GetAllowedClasses(UR_ACTION_CREATE, array('bizmodel'), true);
|
||||
$this->aLastClasses = $aLastClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the available classes (to create) for the current user
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetAvailableClasses()
|
||||
{
|
||||
return $this->aAvailableClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all the last classes at once
|
||||
*
|
||||
* @param array $aLastClasses
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetLastClasses($aLastClasses)
|
||||
{
|
||||
$this->aLastClasses = $aLastClasses;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the last classes (class name, label as HTML, icon URL, ...)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetLastClasses()
|
||||
{
|
||||
return $this->aLastClasses;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user