diff --git a/application/libraries/TableWidgetLib.php b/application/libraries/TableWidgetLib.php index 3af99cca7..feda0d67c 100644 --- a/application/libraries/TableWidgetLib.php +++ b/application/libraries/TableWidgetLib.php @@ -26,6 +26,8 @@ class TableWidgetLib { const TABLE_UNIQUE_ID = 'tableUniqueId'; // TableWidget unique id + const TABLE_BOOTSTRAP_VERSION = 'bootstrapVersion'; // TableWidget bootstrap version + // TableWidget session name const SESSION_NAME = 'FHC_TABLE_WIDGET'; diff --git a/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php b/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php index 24a6caeb3..398389e90 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php +++ b/application/views/lehre/anrechnung/approveAnrechnungUebersichtData.php @@ -172,6 +172,7 @@ $query.= ' FROM anrechnungen $filterWidgetArray = array( 'query' => $query, + 'bootstrapVersion' => 5, 'tableUniqueId' => 'approveAnrechnungUebersicht', 'requiredPermissions' => 'lehre/anrechnung_genehmigen', 'datasetRepresentation' => 'tabulator', diff --git a/application/widgets/TableWidget.php b/application/widgets/TableWidget.php index e59efce10..be368fc2c 100644 --- a/application/widgets/TableWidget.php +++ b/application/widgets/TableWidget.php @@ -35,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; @@ -92,8 +95,9 @@ class TableWidget extends Widget */ public function display($widgetData) { + $this->view(self::WIDGET_URL_TABLE, array( - 'tableUniqueId' => $widgetData[TableWidgetLib::TABLE_UNIQUE_ID] + 'tableUniqueId' => $widgetData[TableWidgetLib::TABLE_UNIQUE_ID], )); // GUI starts here } @@ -135,6 +139,7 @@ class TableWidget extends Widget // Initialize class properties $this->_requiredPermissions = null; + $this->_bootstrapVersion = null; $this->_reloadDataset = true; // by default the dataset is NOT cached in session $this->_query = null; $this->_additionalColumns = null; @@ -154,6 +159,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])) { @@ -349,6 +360,7 @@ 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 diff --git a/public/js/TableWidget.js b/public/js/TableWidget.js index 3aa1367cf..a6b8a10b1 100644 --- a/public/js/TableWidget.js +++ b/public/js/TableWidget.js @@ -20,6 +20,7 @@ var FHC_TableWidget = { _datasetRepresentation: null, // contains the current data representation + _bootstrapVersion:3, //------------------------------------------------------------------------------------------------------------------ // Public methods @@ -152,6 +153,8 @@ var FHC_TableWidget = { FHC_TableWidget._setDatasetRepresentation(data); // set what type of dataset representation was choosen + FHC_TableWidget._setBootstrapVersion(data); // set the bootstrap version used for the tableWidget + var tableWidgetDiv = $('div[tableUniqueId="' + data.tableUniqueId + '"]'); FHC_TableWidget._turnOffEvents(tableWidgetDiv); // turns all the events off @@ -163,6 +166,7 @@ var FHC_TableWidget = { FHC_TableWidget._turnOnEvents(tableWidgetDiv); // turns all the events off FHC_TableWidget._onTableBuilt(tableWidgetDiv, data); + }, @@ -766,6 +770,11 @@ var FHC_TableWidget = { } }, + _setBootstrapVersion: function(data) { + + _bootstrapVersion = data.bootstrapVersion + }, + _getTableWidgetUniqueIdArray: function() { var tableWidgetUniqueIdArray = []; @@ -817,17 +826,17 @@ function _renderTabulatorHeaderHTML(tableWidgetDiv){ tabulatorHeaderHTML += '