diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index 3dc5e85ac..be9e39082 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -540,6 +540,21 @@ class DB_Model extends FHC_Model return $this->db->escape($value); } + /** + * This method call the method escape_like_str from class CI_DB_driver, therefore: + * this method should be used when strings are to be used in LIKE conditions so that LIKE wildcards (‘%’, ‘_’) + * in the string are also properly escaped. + * NOTE: The escape_like_str() method uses ‘!’ (exclamation mark) to escape special characters for LIKE conditions. + * Because this method escapes partial strings that you would wrap in quotes yourself, it cannot automatically + * add the ESCAPE '!' condition for you, and so you’ll have to manually do that. + * + * @return void + */ + public function escapeLike($value) + { + return $this->db->escape_like_str($value); + } + /** * Convert PG-Boolean to PHP-Boolean * diff --git a/application/views/system/infocenter/infocenter.php b/application/views/system/infocenter/infocenter.php index 8244e8c67..186353a1b 100644 --- a/application/views/system/infocenter/infocenter.php +++ b/application/views/system/infocenter/infocenter.php @@ -4,6 +4,7 @@ array( 'title' => 'Info Center', 'jquery' => true, + 'jqueryui' => true, 'bootstrap' => true, 'fontawesome' => true, 'sbadmintemplate' => true, diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index 28b2d018e..540125560 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -1,4 +1,7 @@ ' SELECT @@ -60,8 +63,10 @@ AND ps.person_id = p.person_id AND tbl_studiengang.typ in(\'b\') LIMIT 1 - ) AS "AnzahlAbgeschickt" + ) AS "AnzahlAbgeschickt", + pl.zeitpunkt AS "LockDate" FROM public.tbl_person p + LEFT JOIN (SELECT person_id, zeitpunkt FROM system.tbl_person_lock WHERE app = \''.$APP.'\') pl USING(person_id) WHERE EXISTS( SELECT 1 @@ -135,7 +140,24 @@ } } + if ($fieldName == 'LockDate') + { + if ($datasetRaw->{$fieldName} == '01.01.1970 01:00:00') + { + $datasetRaw->{$fieldName} = 'Not locked'; + } + } + return $datasetRaw; + }, + 'markRow' => function($datasetRaw) { + + if ($datasetRaw->LockDate != '') + { + return true; + } + + return false; } ); @@ -147,7 +169,7 @@ } else { - $filterWidgetArray['app'] = 'infocenter'; + $filterWidgetArray['app'] = $APP; $filterWidgetArray['datasetName'] = 'PersonActions'; $filterWidgetArray['filterKurzbz'] = 'InfoCenterNotSentApplicationAll'; } diff --git a/application/views/widgets/filter/filter.php b/application/views/widgets/filter/filter.php index c6df10073..5f2ba79e5 100644 --- a/application/views/widgets/filter/filter.php +++ b/application/views/widgets/filter/filter.php @@ -1,5 +1,13 @@
-
- -
-
- -
+ -
- +
+
+
+

+ Filter options +

+
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+

-
-
+
-
-
+
+
diff --git a/application/views/widgets/filter/selectFields.php b/application/views/widgets/filter/selectFields.php index c94168d6f..87694f3ca 100644 --- a/application/views/widgets/filter/selectFields.php +++ b/application/views/widgets/filter/selectFields.php @@ -1,63 +1,54 @@ -
-
-
-

- Select columns -

-
-
-
-
- + - - - -
-
- - Add field: - - - - -
-
-
-
+ if ($columnsAliases != null) + { + $indx = array_search($selectedField, $listFields); + if ($indx !== false) + { + $selectedFieldAlias = $columnsAliases[$indx]; + } + } + ?> + + + X + + + +
+ +
+ + Add field: + + + +
diff --git a/application/views/widgets/filter/selectFilters.php b/application/views/widgets/filter/selectFilters.php index 82986d064..a6b638224 100644 --- a/application/views/widgets/filter/selectFilters.php +++ b/application/views/widgets/filter/selectFilters.php @@ -1,82 +1,69 @@ -
-
-
-

- Select filters -

-
-
-
-
- + name; + $md = FilterWidget::getFilterMetaData($selectedFilter, $metaData); + $selectedFieldAlias = $md->name; - if ($columnsAliases != null) - { - $indx = array_search($selectedFilter, $listFields); - if ($indx !== false) - { - $selectedFieldAlias = $columnsAliases[$indx]; - } - } + if ($columnsAliases != null) + { + $indx = array_search($selectedFilter, $listFields); + if ($indx !== false) + { + $selectedFieldAlias = $columnsAliases[$indx]; + } + } - ?> -
+ ?> +
- - - + + + - + - - - + + + -
- - -
-
- - Add filter: - - - - - - - - -
-
+ + +
+
+ + Add filter: + + + + + + + +
-
diff --git a/application/views/widgets/filter/tableDataset.php b/application/views/widgets/filter/tableDataset.php index b8de42803..e84ae0715 100644 --- a/application/views/widgets/filter/tableDataset.php +++ b/application/views/widgets/filter/tableDataset.php @@ -55,7 +55,7 @@ { $result = $results[$resultsCounter]; ?> - + filterId = $filterSessionArray[self::FILTER_ID]; } + // + if ($this->filterName == null && isset($filterSessionArray[self::FILTER_NAME])) + { + $this->filterName = $filterSessionArray[self::FILTER_NAME]; + } + // if ($filterSessionArray[self::FILTER_ID] != $this->filterId) { @@ -385,6 +399,37 @@ class FilterWidget extends Widget return $tmpDatasetRaw; } + /** + * + */ + public static function markRow($datasetRaw) + { + $class = ''; + + if (is_object($datasetRaw)) + { + $markRow = self::$FilterWidgetInstance->getMarkRow(); + + if ($markRow != null) + { + if ($markRow($datasetRaw) === true) + { + $alternativeMarkRowClass = self::$FilterWidgetInstance->getAlternativeMarkRowClass(); + if ($alternativeMarkRowClass != null) + { + $class = $alternativeMarkRowClass; + } + else + { + $class = self::DEFAULT_MARK_ROW_CLASS; + } + } + } + } + + return $class; + } + /** * */ @@ -393,6 +438,17 @@ class FilterWidget extends Widget return self::$FilterWidgetInstance->_getCheckboxes(); } + /** + * + */ + public static function displayFilterName() + { + if (self::$FilterWidgetInstance->filterName != null && self::$FilterWidgetInstance->filterName != '') + { + echo '
'.self::$FilterWidgetInstance->filterName.'

'; + } + } + //------------------------------------------------------------------------------------------------------------------ // Protected @@ -419,6 +475,22 @@ class FilterWidget extends Widget return $this->formatRaw; } + /** + * + */ + protected function getMarkRow() + { + return $this->markRow; + } + + /** + * + */ + protected function getAlternativeMarkRowClass() + { + return $this->alternativeMarkRowClass; + } + /** * */ @@ -559,6 +631,11 @@ class FilterWidget extends Widget $filterSessionArray[self::COLUMNS_ALIASES] = array(); } + if (!isset($filterSessionArray[self::FILTER_NAME])) + { + $filterSessionArray[self::FILTER_NAME] = null; + } + $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); } @@ -574,10 +651,13 @@ class FilterWidget extends Widget $this->filterId = null; $this->additionalColumns = null; $this->formatRaw = null; + $this->markRow = null; + $this->alternativeMarkRowClass = null; $this->checkboxes = null; $this->hideHeader = false; $this->hideSave = false; $this->columnsAliases = null; + $this->filterName = null; if (!is_array($args) || (is_array($args) && count($args) == 0)) { @@ -638,6 +718,16 @@ class FilterWidget extends Widget $this->formatRaw = $args[self::FORMAT_RAW]; } + if (isset($args[self::MARK_ROW]) && is_callable($args[self::MARK_ROW])) + { + $this->markRow = $args[self::MARK_ROW]; + } + + if (isset($args[self::ALTERNATIVE_MARK_ROW_CLASS]) && $args[self::ALTERNATIVE_MARK_ROW_CLASS] != '') + { + $this->alternativeMarkRowClass = $args[self::ALTERNATIVE_MARK_ROW_CLASS]; + } + if (isset($args[self::CHECKBOXES]) && is_array($args[self::CHECKBOXES]) && count($args[self::CHECKBOXES]) > 0) @@ -723,6 +813,7 @@ class FilterWidget extends Widget $activeFilters = array(); $activeFiltersOperation = array(); $activeFiltersOption = array(); + $filterName = null; if (isset($jsonEncodedFilter->columns)) { @@ -756,12 +847,20 @@ class FilterWidget extends Widget } } + if (isset($jsonEncodedFilter->name)) + { + $filterName = $jsonEncodedFilter->name; + } + + $this->filterName = $filterName; + $filterSessionArray = array( self::SELECTED_FIELDS => $selectedFields, self::SELECTED_FILTERS => $selectedFilters, self::ACTIVE_FILTERS => $activeFilters, self::ACTIVE_FILTERS_OPERATION => $activeFiltersOperation, - self::ACTIVE_FILTERS_OPTION => $activeFiltersOption + self::ACTIVE_FILTERS_OPTION => $activeFiltersOption, + self::FILTER_NAME => $filterName ); $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); @@ -773,7 +872,8 @@ class FilterWidget extends Widget self::SELECTED_FILTERS => array(), self::ACTIVE_FILTERS => array(), self::ACTIVE_FILTERS_OPERATION => array(), - self::ACTIVE_FILTERS_OPTION => array() + self::ACTIVE_FILTERS_OPTION => array(), + self::FILTER_NAME => null ); $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); @@ -1038,6 +1138,7 @@ class FilterWidget extends Widget ); $filterSessionArray[self::FILTER_ID] = $this->filterId; + $filterSessionArray[self::FILTER_NAME] = $this->filterName; $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); } @@ -1130,9 +1231,11 @@ class FilterWidget extends Widget } break; case self::OP_CONTAINS: + $activeFilterValue = $this->FiltersModel->escapeLike($activeFilterValue); // escapes $condition = ' ILIKE \'%'.$activeFilterValue.'%\''; break; case self::OP_NOT_CONTAINS: + $activeFilterValue = $this->FiltersModel->escapeLike($activeFilterValue); // escapes $condition = ' NOT ILIKE \'%'.$activeFilterValue.'%\''; break; case self::OP_IS_TRUE: