From 73220d8dd6fb85ec501b6b6028865fb3f20005e0 Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 11 Jul 2019 09:42:13 +0200 Subject: [PATCH] More options to hide or show filter widget settings panel --- application/libraries/FilterWidgetLib.php | 4 +- application/views/widgets/filter/filter.php | 33 +------------ .../views/widgets/filter/filterOptions.php | 33 +++++++++++++ application/widgets/FilterWidget.php | 46 +++++++++++++++---- 4 files changed, 74 insertions(+), 42 deletions(-) create mode 100644 application/views/widgets/filter/filterOptions.php diff --git a/application/libraries/FilterWidgetLib.php b/application/libraries/FilterWidgetLib.php index bfdcbe331..c8a0134bd 100644 --- a/application/libraries/FilterWidgetLib.php +++ b/application/libraries/FilterWidgetLib.php @@ -54,7 +54,9 @@ class FilterWidgetLib const MARK_ROW = 'markRow'; // ...to hide the options for a filter - const HIDE_HEADER = 'hideHeader'; + const HIDE_OPTIONS = 'hideOptions'; + const HIDE_SELECT_FIELDS = 'hideSelectFields'; + const HIDE_SELECT_FILTERS = 'hideSelectFilters'; const HIDE_SAVE = 'hideSave'; const CUSTOM_MENU = 'customMenu'; // ...to specify if the menu for this filter is custom (true) or not (false) diff --git a/application/views/widgets/filter/filter.php b/application/views/widgets/filter/filter.php index dc20e58b6..34469747a 100644 --- a/application/views/widgets/filter/filter.php +++ b/application/views/widgets/filter/filter.php @@ -6,38 +6,7 @@
- -
-
- -
-
- -
- -
- -
- - -
- -
- -
- - -
- -
-
-
-
-
+
diff --git a/application/views/widgets/filter/filterOptions.php b/application/views/widgets/filter/filterOptions.php new file mode 100644 index 000000000..4d8fbde65 --- /dev/null +++ b/application/views/widgets/filter/filterOptions.php @@ -0,0 +1,33 @@ + + +
+
+ +
+
+ +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
+
+
+
+
diff --git a/application/widgets/FilterWidget.php b/application/widgets/FilterWidget.php index b87aa90e9..cb42995d5 100644 --- a/application/widgets/FilterWidget.php +++ b/application/widgets/FilterWidget.php @@ -7,6 +7,7 @@ class FilterWidget extends Widget { // Paths of the views const WIDGET_URL_FILTER = 'widgets/filter/filter'; + const WIDGET_URL_FILTER_OPTIONS = 'widgets/filter/filterOptions'; const WIDGET_URL_SELECT_FIELDS = 'widgets/filter/selectFields'; const WIDGET_URL_DATASET_TABLESORTER = 'widgets/filter/tableDataset'; const WIDGET_URL_DATASET_PIVOTUI = 'widgets/filter/pivotUIDataset'; @@ -41,9 +42,11 @@ class FilterWidget extends Widget // To have a column in the GUI with checkboxes to select rows in the table private $_checkboxes; - // To hide the GUI to operate or save the filter widget - private $_hideHeader; - private $_hideSave; + // To hide the GUI to operate with the filter widget or to save a custom filter + private $_hideOptions; // if true hides all the options + private $_hideSelectFields; // if true hides the fields selection + private $_hideSelectFilters; // if true hides the filters selections + private $_hideSave; // if true hides the GUI to save a custom filter private $_customMenu; // if true then method _setFilterMenu is NOT called @@ -93,12 +96,23 @@ class FilterWidget extends Widget //------------------------------------------------------------------------------------------------------------------ // Public static methods used to load views and to access statically to some properies of the FilterWidget + /** + * Loads the view related to the filter options + */ + public static function loadViewFilterOptions() + { + if (self::$_FilterWidgetInstance->_hideOptions != true) + { + self::_loadView(self::WIDGET_URL_FILTER_OPTIONS); + } + } + /** * Loads the view related to the selected fields */ public static function loadViewSelectFields() { - if (self::$_FilterWidgetInstance->_hideHeader != true) + if (self::$_FilterWidgetInstance->_hideSelectFields != true) { self::_loadView(self::WIDGET_URL_SELECT_FIELDS); } @@ -109,7 +123,7 @@ class FilterWidget extends Widget */ public static function loadViewSelectFilters() { - if (self::$_FilterWidgetInstance->_hideHeader != true) + if (self::$_FilterWidgetInstance->_hideSelectFilters != true) { self::_loadView(self::WIDGET_URL_SELECT_FILTERS); } @@ -172,7 +186,9 @@ class FilterWidget extends Widget $this->_formatRow = null; $this->_markRow = null; $this->_checkboxes = null; - $this->_hideHeader = null; + $this->_hideOptions = null; + $this->_hideSelectFields = null; + $this->_hideSelectFilters = null; $this->_hideSave = null; $this->_customMenu = null; $this->_datasetRepresentation = null; @@ -252,10 +268,22 @@ class FilterWidget extends Widget $this->_checkboxes = $args[FilterWidgetLib::CHECKBOXES]; } - // To specify if the header to operate with the FilterWidget is shown or not - if (isset($args[FilterWidgetLib::HIDE_HEADER]) && is_bool($args[FilterWidgetLib::HIDE_HEADER])) + // To specify if the filter options are shown ot not + if (isset($args[FilterWidgetLib::HIDE_OPTIONS]) && is_bool($args[FilterWidgetLib::HIDE_OPTIONS])) { - $this->_hideHeader = $args[FilterWidgetLib::HIDE_HEADER]; + $this->_hideOptions = $args[FilterWidgetLib::HIDE_OPTIONS]; + } + + // To specify if the form to select fields is shown or not + if (isset($args[FilterWidgetLib::HIDE_SELECT_FIELDS]) && is_bool($args[FilterWidgetLib::HIDE_SELECT_FIELDS])) + { + $this->_hideSelectFields = $args[FilterWidgetLib::HIDE_SELECT_FIELDS]; + } + + // To specify if the form to select filters is shown or not + if (isset($args[FilterWidgetLib::HIDE_SELECT_FILTERS]) && is_bool($args[FilterWidgetLib::HIDE_SELECT_FILTERS])) + { + $this->_hideSelectFilters = $args[FilterWidgetLib::HIDE_SELECT_FILTERS]; } // To specify if the form to save a custom FilterWidget is shown or not