- FilterWidget can represents the retrieved data with tablesorter or pivotUI

- Added new constants to FiltersLib
- Added new parameter pivotui to FHC-Header to load JS and CSS for pivotUI
- Renamed constat WIDGET_URL_TABLE_DATASET to WIDGET_URL_DATASET_TABLESORTER in FilterWidget
- Added new constat WIDGET_URL_DATASET_PIVOTUI to FilterWidget
- Added new private properties _datasetRepresentation and _datasetRepresentationOptions to FilterWidget
- Renamed FilterWidget->loadViewTableDataset to loadViewDataset
- FilterWidget->loadViewDataset loads tablesorter or pivotUI view depending on the value of property _datasetRepresentation
- FilterWidget accepts two new parameter: datasetRepresentation and datasetRepOptions
- datasetRepresentation is required
- FilterWidget stores in session the _datasetRepresentation and _datasetRepresentationOptions properties
- Adapted view views/widgets/filter/filter to use loadViewDataset
- All views using FilterWidget have been adapted to use the required parameter datasetRepresentation
- Added new constats DATASET_REP_TABLESORTER and DATASET_REP_PIVOTUI to public/js/FilterWidget.js
- Added new private property _datasetRepresentation to FHC_FilterWidget in public/js/FilterWidget.js
- Based on property _datasetRepresentation FilterWidget.js will represent the FilterWidget data with tablesorter or pivotUI
- Added new private method _renderDataset to FHC_FilterWidget in public/js/FilterWidget.js
- Renamed method _renderTableDataset to _renderDatasetTablesorter in FHC_FilterWidget in public/js/FilterWidget.js
- Added new method _renderDatasetPivotUI to FHC_FilterWidget in public/js/FilterWidget.js
- Added bew method _setDatasetRepresentation to FHC_FilterWidget in public/js/FilterWidget.js
This commit is contained in:
Paolo
2019-01-11 15:14:53 +01:00
parent a090468126
commit fa9976ec66
11 changed files with 229 additions and 21 deletions
+10
View File
@@ -20,6 +20,8 @@ class FiltersLib
const SESSION_DATASET = 'dataset';
const SESSION_ROW_NUMBER = 'rowNumber';
const SESSION_RELOAD_DATASET = 'reloadDataset';
const SESSION_DATASET_REPRESENTATION = 'datasetRepresentation';
const SESSION_DATASET_REP_OPTIONS = 'datasetRepresentationOptions';
// Alias for the dynamic table used to retrive the dataset
const DATASET_TABLE_ALIAS = 'datasetFilterTable';
@@ -55,6 +57,14 @@ class FiltersLib
const CUSTOM_MENU = 'customMenu'; // ...to specify if the menu for this filter is custom (true) or not (false)
// ...to specify how to represent the dataset (ex: tablesorter, pivotUI, ...)
const DATASET_REPRESENTATION = 'datasetRepresentation';
const DATASET_REP_OPTIONS = 'datasetRepOptions';
// Different dataset representations
const DATASET_REP_TABLESORTER = 'tablesorter';
const DATASET_REP_PIVOTUI = 'pivotUI';
// Filter operations values
const OP_EQUAL = 'equal';
const OP_NOT_EQUAL = 'nequal';
@@ -111,6 +111,7 @@
) data
",
'requiredPermissions' => 'infocenter',
'datasetRepresentation' => 'tablesorter',
'additionalColumns' => array('Details'),
'columnsAliases' => array(
'ReihungstestID',
+1
View File
@@ -13,6 +13,7 @@
person_id=tbl_person.person_id AND tbl_benutzer.aktiv=true)
',
'requiredPermissions' => 'admin',
'datasetRepresentation' => 'tablesorter',
'additionalColumns' => array('Details'),
'columnsAliases' => array(
'PersonID',
@@ -232,6 +232,7 @@
'filterKurzbz' => 'InfoCenterSentApplicationAll',
'filter_id' => $this->input->get('filter_id'),
'requiredPermissions' => 'infocenter',
'datasetRepresentation' => 'tablesorter',
'customMenu' => true,
'checkboxes' => 'PersonId',
'additionalColumns' => array('Details'),
@@ -192,6 +192,7 @@
'datasetName' => 'freigegeben',
'filter_id' => $this->input->get('filter_id'),
'requiredPermissions' => 'infocenter',
'datasetRepresentation' => 'tablesorter',
'checkboxes' => 'PersonId',
'additionalColumns' => array('Details'),
'columnsAliases' => array(
@@ -186,6 +186,7 @@
'datasetName' => 'reihungstestAbsolviert',
'filter_id' => $this->input->get('filter_id'),
'requiredPermissions' => 'infocenter',
'datasetRepresentation' => 'tablesorter',
'checkboxes' => 'PersonId',
'additionalColumns' => array('Details'),
'columnsAliases' => array(
@@ -26,6 +26,7 @@
$navigationwidget = isset($navigationwidget) ? $navigationwidget : false;
$sbadmintemplate = isset($sbadmintemplate) ? $sbadmintemplate : false;
$tablesorter = isset($tablesorter) ? $tablesorter : false;
$pivotui = isset($pivotui) ? $pivotui : false;
$tinymce = isset($tinymce) ? $tinymce : false;
?>
@@ -60,6 +61,12 @@
generateCSSsInclude('vendor/mottie/tablesorter/dist/css/jquery.tablesorter.pager.min.css');
}
// PivotUI CSS
if ($pivotui === true)
{
generateCSSsInclude('vendor/nicolaskruchten/pivottable/dist/pivot.min.css');
}
// SB Admin 2 template CSS
if ($sbadmintemplate === true)
{
@@ -121,6 +128,12 @@
generateJSsInclude('vendor/mottie/tablesorter/dist/js/extras/jquery.tablesorter.pager.min.js');
}
// PivotUI CSS
if ($pivotui === true)
{
generateJSsInclude('vendor/nicolaskruchten/pivottable/dist/pivot.min.js');
}
// Tinymce JS
if ($tinymce === true) generateJSsInclude('vendor/tinymce/tinymce/tinymce.min.js');
+1 -1
View File
@@ -46,7 +46,7 @@
<!-- Filter table -->
<div>
<?php FilterWidget::loadViewTableDataset(); ?>
<?php FilterWidget::loadViewDataset(); ?>
</div>
<!-- Filter info bottom -->
@@ -0,0 +1 @@
<div id="filterPivotUI"></div>
+55 -11
View File
@@ -8,7 +8,8 @@ class FilterWidget extends Widget
// Paths of the views
const WIDGET_URL_FILTER = 'widgets/filter/filter';
const WIDGET_URL_SELECT_FIELDS = 'widgets/filter/selectFields';
const WIDGET_URL_TABLE_DATASET = 'widgets/filter/tableDataset';
const WIDGET_URL_DATASET_TABLESORTER = 'widgets/filter/tableDataset';
const WIDGET_URL_DATASET_PIVOTUI = 'widgets/filter/pivotUIDataset';
const WIDGET_URL_SELECT_FILTERS = 'widgets/filter/selectFilters';
const WIDGET_URL_SAVE_FILTER = 'widgets/filter/saveFilter';
@@ -45,6 +46,9 @@ class FilterWidget extends Widget
private $_customMenu; // if true then method _setFilterMenu is NOT called
private $_datasetRepresentation; // dataset representation (ex: tablesorter, pivotUI, ...)
private $_datasetRepresentationOptions; // dataset representation options for tablesorter, pivotUI, ...
private static $_FilterWidgetInstance; // static property that contains the instance of itself
/**
@@ -119,11 +123,19 @@ class FilterWidget extends Widget
}
/**
* Loads the view related to the table dataset
* Loads the view related to the dataset, here is decided how to represent the dataset (ex: tablesorter, pivotUI, ...)
*/
public static function loadViewTableDataset()
public static function loadViewDataset()
{
self::_loadView(self::WIDGET_URL_TABLE_DATASET);
if (self::$_FilterWidgetInstance->_datasetRepresentation == FiltersLib::DATASET_REP_TABLESORTER)
{
self::_loadView(self::WIDGET_URL_DATASET_TABLESORTER);
}
if (self::$_FilterWidgetInstance->_datasetRepresentation == FiltersLib::DATASET_REP_PIVOTUI)
{
self::_loadView(self::WIDGET_URL_DATASET_PIVOTUI);
}
}
//------------------------------------------------------------------------------------------------------------------
@@ -153,6 +165,8 @@ class FilterWidget extends Widget
$this->_hideHeader = null;
$this->_hideSave = null;
$this->_customMenu = null;
$this->_datasetRepresentation = null;
$this->_datasetRepresentationOptions = null;
// Retrived the required permissions parameter if present
if (isset($args[FiltersLib::REQUIRED_PERMISSIONS_PARAMETER]))
@@ -234,10 +248,25 @@ class FilterWidget extends Widget
$this->_hideSave = $args[FiltersLib::HIDE_SAVE];
}
// If a custom menu is set
if (isset($args[FiltersLib::CUSTOM_MENU]) && is_bool($args[FiltersLib::CUSTOM_MENU]))
{
$this->_customMenu = $args[FiltersLib::CUSTOM_MENU];
}
// To specify how to represent the dataset (ex: tablesorter, pivotUI, ...)
if (isset($args[FiltersLib::DATASET_REPRESENTATION])
&& ($args[FiltersLib::DATASET_REPRESENTATION] == FiltersLib::DATASET_REP_TABLESORTER
|| $args[FiltersLib::DATASET_REPRESENTATION] == FiltersLib::DATASET_REP_PIVOTUI))
{
$this->_datasetRepresentation = $args[FiltersLib::DATASET_REPRESENTATION];
}
// To specify options for the dataset representation (ex: tablesorter, pivotUI, ...)
if (isset($args[FiltersLib::DATASET_REP_OPTIONS]) && !isEmptyString($args[FiltersLib::DATASET_REP_OPTIONS]))
{
$this->_datasetRepresentationOptions = $args[FiltersLib::DATASET_REP_OPTIONS];
}
}
/**
@@ -247,7 +276,7 @@ class FilterWidget extends Widget
{
if (!is_array($args) || (is_array($args) && count($args) == 0))
{
show_error('Second parameter of the widget call must be a not empty associative array');
show_error('Second parameter of the widget call must be a NOT empty associative array');
}
else
{
@@ -259,12 +288,25 @@ class FilterWidget extends Widget
FiltersLib::FILTER_ID.'" must be specified'
);
}
else
if (!isset($args[FiltersLib::QUERY_PARAMETER]))
{
if (!isset($args[FiltersLib::QUERY_PARAMETER]))
{
show_error('The parameters "'.FiltersLib::QUERY_PARAMETER.'" must be specified');
}
show_error('The parameters "'.FiltersLib::QUERY_PARAMETER.'" must be specified');
}
if (!isset($args[FiltersLib::DATASET_REPRESENTATION]))
{
show_error('The parameter "'.FiltersLib::DATASET_REPRESENTATION.'" must be specified');
}
if (isset($args[FiltersLib::DATASET_REPRESENTATION])
&& $args[FiltersLib::DATASET_REPRESENTATION] != FiltersLib::DATASET_REP_TABLESORTER
&& $args[FiltersLib::DATASET_REPRESENTATION] != FiltersLib::DATASET_REP_PIVOTUI)
{
show_error(
'The parameter "'.FiltersLib::DATASET_REPRESENTATION.
'" must be IN ("'.FiltersLib::DATASET_REP_TABLESORTER.'", "'.FiltersLib::DATASET_REP_PIVOTUI.'")'
);
}
}
}
@@ -370,7 +412,9 @@ class FilterWidget extends Widget
FiltersLib::SESSION_METADATA => $this->FiltersModel->getExecutedQueryMetaData(), // the metadata of the dataset
FiltersLib::SESSION_ROW_NUMBER => count($dataset->retval), // the number of loaded rows by this filter
FiltersLib::SESSION_DATASET => $dataset->retval, // the entire dataset
FiltersLib::SESSION_RELOAD_DATASET => false // if the dataset must be reloaded, not needed the first time
FiltersLib::SESSION_RELOAD_DATASET => false, // if the dataset must be reloaded, not needed the first time
FiltersLib::SESSION_DATASET_REPRESENTATION => $this->_datasetRepresentation, // the choosen dataset representation
FiltersLib::SESSION_DATASET_REP_OPTIONS => $this->_datasetRepresentationOptions // the choosen dataset representation options
)
);
}