mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°3540 - Migrate printable version of an object
This commit is contained in:
@@ -33,6 +33,7 @@ use WebPage;
|
||||
*/
|
||||
class DataTableFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* @param \WebPage $oPage
|
||||
* @param string $sListId
|
||||
@@ -758,7 +759,8 @@ class DataTableFactory
|
||||
|
||||
public Static function MakeForForm(string $sRef, array $aColumns): FormTable
|
||||
{
|
||||
$oTable = new FormTable($sRef);
|
||||
$oTable = new FormTable("datatable_".$sRef);
|
||||
$oTable->SetRef($sRef);
|
||||
$oTable->SetColumns($aColumns);
|
||||
|
||||
return $oTable;
|
||||
|
||||
@@ -31,7 +31,7 @@ class FormTable extends StaticTable
|
||||
|
||||
public function __construct(string $sRef, string $sContainerCSSClass = '')
|
||||
{
|
||||
parent::__construct("dt_{$sRef}", $sContainerCSSClass);
|
||||
parent::__construct($sRef, $sContainerCSSClass);
|
||||
$this->SetRef($sRef);
|
||||
$this->aRows = [];
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ class PageContentWithSideContent extends PageContent {
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-page-content-with-side-content';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/page-content/with-side-content';
|
||||
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/layouts/page-content/with-side-content';
|
||||
|
||||
// Specific constants
|
||||
public const ENUM_CONTENT_AREA_SIDE = 'side';
|
||||
|
||||
@@ -94,9 +94,9 @@ abstract class UIBlock implements iUIBlock
|
||||
$this->aJsFilesRelPath = static::DEFAULT_JS_FILES_REL_PATH;
|
||||
$this->aCssFilesRelPath = static::DEFAULT_CSS_FILES_REL_PATH;
|
||||
$this->sHtmlTemplateRelPath = static::DEFAULT_HTML_TEMPLATE_REL_PATH;
|
||||
$this->aJsTemplateRelPath[self::JS_TYPE_LIVE] = static::DEFAULT_JS_LIVE_TEMPLATE_REL_PATH;
|
||||
$this->aJsTemplateRelPath[self::JS_TYPE_ON_INIT] = static::DEFAULT_JS_TEMPLATE_REL_PATH;
|
||||
$this->aJsTemplateRelPath[self::JS_TYPE_ON_READY] = static::DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH;
|
||||
$this->aJsTemplateRelPath[self::ENUM_JS_TYPE_LIVE] = static::DEFAULT_JS_LIVE_TEMPLATE_REL_PATH;
|
||||
$this->aJsTemplateRelPath[self::ENUM_JS_TYPE_ON_INIT] = static::DEFAULT_JS_TEMPLATE_REL_PATH;
|
||||
$this->aJsTemplateRelPath[self::ENUM_JS_TYPE_ON_READY] = static::DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH;
|
||||
$this->sCssTemplateRelPath = static::DEFAULT_CSS_TEMPLATE_REL_PATH;
|
||||
$this->sGlobalTemplateRelPath = static::DEFAULT_GLOBAL_TEMPLATE_REL_PATH;
|
||||
$this->aDataAttributes = [];
|
||||
@@ -121,7 +121,7 @@ abstract class UIBlock implements iUIBlock
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function GetJsTemplateRelPath(string $sType) {
|
||||
if ($sType != self::JS_TYPE_LIVE && $sType != self::JS_TYPE_ON_INIT && $sType != self::JS_TYPE_ON_READY){
|
||||
if (!in_array($sType, [self::ENUM_JS_TYPE_LIVE, self::ENUM_JS_TYPE_ON_INIT, self::ENUM_JS_TYPE_ON_READY])) {
|
||||
throw new UIException($this, "Type of javascript $sType not supported");
|
||||
}
|
||||
return $this->aJsTemplateRelPath[$sType];
|
||||
|
||||
@@ -30,9 +30,9 @@ use Combodo\iTop\Application\UI\Base\UIException;
|
||||
* @since 3.0.0
|
||||
*/
|
||||
interface iUIBlock {
|
||||
public const JS_TYPE_ON_INIT = "js";
|
||||
public const JS_TYPE_LIVE = "live.js";
|
||||
public const JS_TYPE_ON_READY = "ready.js";
|
||||
public const ENUM_JS_TYPE_ON_INIT = "js";
|
||||
public const ENUM_JS_TYPE_LIVE = "live.js";
|
||||
public const ENUM_JS_TYPE_ON_READY = "ready.js";
|
||||
/**
|
||||
* Return the relative path (from <ITOP>/templates/) of the global template (HTML, JS, CSS) to use or null if it's not provided. Should not be used to often as JS/CSS files would be duplicated making the browser parsing time way longer.
|
||||
*
|
||||
@@ -50,7 +50,7 @@ interface iUIBlock {
|
||||
/**
|
||||
* Return the relative path (from <ITOP>/templates/) of the JS template to use or null if there is no inline JS to render
|
||||
*
|
||||
* @param string $sType javascript type only JS_TYPE_ON_INIT / JS_TYPE_ON_READY / JS_TYPE_LIVE
|
||||
* @param string $sType javascript type only ENUM_JS_TYPE_ON_INIT / ENUM_JS_TYPE_ON_READY / ENUM_JS_TYPE_LIVE
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user