Merge branch 'master' into feature-6237/Phrases_system_MkIII

This commit is contained in:
Paolo
2025-09-22 10:31:11 +02:00
2107 changed files with 226805 additions and 110583 deletions
+31 -2
View File
@@ -1,5 +1,22 @@
<?php
/**
* Copyright (C) 2023 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* To filter data using a SQL statement
*/
@@ -59,6 +76,8 @@ class FilterWidget extends Widget
private $_sessionTimeout; // session expiring time
private $_encryptedColumns; // contains info about encrypted columns
private static $_FilterWidgetInstance; // static property that contains the instance of itself
/**
@@ -195,6 +214,7 @@ class FilterWidget extends Widget
$this->_formatRow = null;
$this->_markRow = null;
$this->_checkboxes = null;
$this->_encryptedColumns = null;
$this->_hideOptions = null;
$this->_hideSelectFields = null;
$this->_hideSelectFilters = null;
@@ -252,6 +272,14 @@ class FilterWidget extends Widget
$this->_additionalColumns = $args[FilterWidgetLib::ADDITIONAL_COLUMNS];
}
// Parameter is used to define the ecrypted columns
if (isset($args[FilterWidgetLib::ENCRYPTED_COLUMNS])
&& is_array($args[FilterWidgetLib::ENCRYPTED_COLUMNS])
&& count($args[FilterWidgetLib::ENCRYPTED_COLUMNS]) > 0)
{
$this->_encryptedColumns = $args[FilterWidgetLib::ENCRYPTED_COLUMNS];
}
// Parameter is used to add use aliases for the columns fo the dataset
if (isset($args[FilterWidgetLib::COLUMNS_ALIASES])
&& is_array($args[FilterWidgetLib::COLUMNS_ALIASES])
@@ -440,7 +468,7 @@ class FilterWidget extends Widget
);
// Then retrieve dataset from DB
$dataset = $this->filterwidgetlib->getDataset($datasetQuery);
$dataset = $this->filterwidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Save changes into session if data are valid
if (!isError($dataset))
@@ -475,7 +503,7 @@ class FilterWidget extends Widget
$datasetQuery = $this->filterwidgetlib->generateDatasetQuery($this->_query, $parsedFilterJson->filters);
// Then retrieve dataset from DB
$dataset = $this->filterwidgetlib->getDataset($datasetQuery);
$dataset = $this->filterwidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Try to load the name of the filter using the PhrasesLib
$filterName = $this->filterwidgetlib->getFilterName($parsedFilterJson);
@@ -497,6 +525,7 @@ class FilterWidget extends Widget
FilterWidgetLib::SESSION_SELECTED_FIELDS => $this->_getColumnsNames($parsedFilterJson->columns),
FilterWidgetLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases
FilterWidgetLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns
FilterWidgetLib::SESSION_ENCRYPTED_COLUMNS => $this->_encryptedColumns, // encrypted columns
FilterWidgetLib::SESSION_CHECKBOXES => $this->_checkboxes, // the name of the field used to build the checkboxes column
FilterWidgetLib::SESSION_FILTERS => $parsedFilterJson->filters, // all the filters used to filter the dataset
FilterWidgetLib::SESSION_METADATA => $this->FiltersModel->getExecutedQueryMetaData(), // the metadata of the dataset
+43 -20
View File
@@ -1,5 +1,22 @@
<?php
/**
* Copyright (C) 2023 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* To display a table that shows data retriev by a SQL statement
*/
@@ -18,6 +35,9 @@ class TableWidget extends Widget
// Required permissions to use this TableWidget
private $_requiredPermissions;
// optional bootstrap version can be set to use different bootstrap classes
private $_bootstrapVersion=3;
// SQL statement
private $_query;
@@ -40,6 +60,8 @@ class TableWidget extends Widget
private $_sessionTimeout; // session expiring time
private $_encryptedColumns; // contains info about encrypted columns
private static $_TableWidgetInstance; // static property that contains the instance of itself
/**
@@ -116,6 +138,7 @@ class TableWidget extends Widget
// Initialize class properties
$this->_requiredPermissions = null;
$this->_bootstrapVersion = 3;
$this->_reloadDataset = true; // by default the dataset is NOT cached in session
$this->_query = null;
$this->_additionalColumns = null;
@@ -127,6 +150,7 @@ class TableWidget extends Widget
$this->_datasetRepresentationOptions = null;
$this->_datasetRepFieldsDefs = null;
$this->_sessionTimeout = TableWidgetLib::SESSION_DEFAULT_TIMEOUT;
$this->_encryptedColumns = null;
// Retrieved the required permissions parameter if present
if (isset($args[TableWidgetLib::REQUIRED_PERMISSIONS]))
@@ -134,6 +158,12 @@ class TableWidget extends Widget
$this->_requiredPermissions = $args[TableWidgetLib::REQUIRED_PERMISSIONS];
}
// Retrieved the optional tableWindget Bootstrap version
if (isset($args[TableWidgetLib::TABLE_BOOTSTRAP_VERSION]) && !isEmptyString($args[TableWidgetLib::TABLE_BOOTSTRAP_VERSION]))
{
$this->_bootstrapVersion = $args[TableWidgetLib::TABLE_BOOTSTRAP_VERSION];
}
// How to retrieve data for the table: SQL statement or a result from DB
if (isset($args[TableWidgetLib::QUERY]))
{
@@ -206,6 +236,14 @@ class TableWidget extends Widget
{
$this->_sessionTimeout = $args[TableWidgetLib::SESSION_TIMEOUT];
}
// Parameter is used to define the ecrypted columns
if (isset($args[TableWidgetLib::ENCRYPTED_COLUMNS])
&& is_array($args[TableWidgetLib::ENCRYPTED_COLUMNS])
&& count($args[TableWidgetLib::ENCRYPTED_COLUMNS]) > 0)
{
$this->_encryptedColumns = $args[TableWidgetLib::ENCRYPTED_COLUMNS];
}
}
/**
@@ -288,7 +326,7 @@ class TableWidget extends Widget
$datasetQuery = $this->tablewidgetlib->generateDatasetQuery($this->_query);
// Then retrieve dataset from DB
$dataset = $this->tablewidgetlib->getDataset($datasetQuery);
$dataset = $this->tablewidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Save changes into session if data are valid
if (!isError($dataset))
@@ -310,7 +348,7 @@ class TableWidget extends Widget
$datasetQuery = $this->tablewidgetlib->generateDatasetQuery($this->_query);
// Then retrieve dataset from DB
$dataset = $this->tablewidgetlib->getDataset($datasetQuery);
$dataset = $this->tablewidgetlib->getDataset($datasetQuery, $this->_encryptedColumns);
// Save changes into session if data are valid
if (!isError($dataset))
@@ -321,9 +359,11 @@ class TableWidget extends Widget
$this->tablewidgetlib->setSession(
array(
TableWidgetLib::TABLE_UNIQUE_ID => $tableUniqueId, // table unique id
TableWidgetLib::TABLE_BOOTSTRAP_VERSION => $this->_bootstrapVersion, // bootstrap version for tableWidget
TableWidgetLib::SESSION_FIELDS => $this->tablewidgetlib->getExecutedQueryListFields(), // all the fields of the dataset
TableWidgetLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases
TableWidgetLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns
TableWidgetLib::SESSION_ENCRYPTED_COLUMNS => $this->_encryptedColumns, // encrypted columns
TableWidgetLib::SESSION_CHECKBOXES => $this->_checkboxes, // the name of the field used to build the checkboxes column
TableWidgetLib::SESSION_METADATA => $this->tablewidgetlib->getExecutedQueryMetaData(), // the metadata of the dataset
TableWidgetLib::SESSION_ROW_NUMBER => count($dataset->retval), // the number of loaded rows by this table
@@ -411,24 +451,6 @@ class TableWidget extends Widget
return !isset($class) ? '' : $class;
}
/**
* Utility method that retrieves the name of the columns present in a table JSON definition
*/
private function _getColumnsNames($columns)
{
$columnsNames = array();
foreach ($columns as $key => $obj)
{
if (isset($obj->name))
{
$columnsNames[] = $obj->name;
}
}
return $columnsNames;
}
/**
* Loads a view using the given viewName and eventually other parameters
*/
@@ -438,3 +460,4 @@ class TableWidget extends Widget
$ci->load->view($viewName, $parameters);
}
}
+1
View File
@@ -27,6 +27,7 @@ class HTMLWidget extends Widget
const MIN_LENGTH = 'min-length';
const PLACEHOLDER = 'placeholder';
const DISABLED = 'disabled';
const STYLE = 'class';
/**
* It gets also the htmlArgs array as parameter, it will be used to set the HTML properties