mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 17:02:19 +00:00
- Removed not used methods sortSelectedFields, removeSelectedField and addSelectedField from controllers/components/Filter
- Removed not used methods sortSelectedFields, addSelectedField and removeSelectedField from libraries/FilterCmptLib - CSS fixes for FilterComponent and NavigationComponent - Removed not used API calls from public/js/components/filter/API.js - Added second level menu entries to the NavigationComponent - Added new property side-menu to the FilterComponent to render the filters selection via the NavigationComponent or directly from the FilterComponent - FilterComponent: - Column positioning is now managed by tabulator - Splitted the column selection from the filter options - Added the rendering of the filters selection via an optional dropdown - Changed the usability and the look of the filter options - German translation
This commit is contained in:
@@ -41,62 +41,6 @@ class Filter extends FHC_Controller
|
||||
$this->outputJsonSuccess($this->filtercmptlib->getSession());
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the sort of the selected fields of the current filter and
|
||||
* its data will be written on the output in JSON format
|
||||
*/
|
||||
public function sortSelectedFields()
|
||||
{
|
||||
$request = $this->getPostJSON();
|
||||
|
||||
if (property_exists($request, 'selectedFields')
|
||||
&& $this->filtercmptlib->sortSelectedFields($request->selectedFields) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Fields sorted');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Wrong parameter');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a selected field from the current filter and
|
||||
* its data will be written on the output in JSON format
|
||||
*/
|
||||
public function removeSelectedField()
|
||||
{
|
||||
$request = $this->getPostJSON();
|
||||
|
||||
if (property_exists($request, 'selectedField')
|
||||
&& $this->filtercmptlib->removeSelectedField($request->selectedField) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Field removed');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Error occurred');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a field to the current filter and its data will be written on the output in JSON format
|
||||
*/
|
||||
public function addSelectedField()
|
||||
{
|
||||
$request = $this->getPostJSON();
|
||||
|
||||
if (property_exists($request, 'selectedField')
|
||||
&& $this->filtercmptlib->addSelectedField($request->selectedField) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Field added');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Error occurred');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an applied filter (SQL where condition) from the current filter
|
||||
*/
|
||||
|
||||
@@ -271,95 +271,6 @@ class FilterCmptLib
|
||||
$this->_setSessionElement(FilterCmptLib::SESSION_TIMEOUT, strtotime('+'.$this->_sessionTimeout.' minutes', time()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the sort of the selected fields of the current filter
|
||||
*/
|
||||
public function sortSelectedFields($selectedFields)
|
||||
{
|
||||
$sortSelectedFields = false;
|
||||
|
||||
// Checks the parameter selectedFields
|
||||
if (isset($selectedFields) && is_array($selectedFields) && count($selectedFields) > 0)
|
||||
{
|
||||
// Retrieves all the used fields by the current filter
|
||||
$fields = $this->_getSessionElement(self::SESSION_FIELDS);
|
||||
|
||||
// Checks that the given selected fields are present in all the used fields by the current filter
|
||||
if (!array_diff($selectedFields, $fields))
|
||||
{
|
||||
$this->_setSessionElement(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
|
||||
|
||||
$sortSelectedFields = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $sortSelectedFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a field to the current filter
|
||||
*/
|
||||
public function addSelectedField($selectedField)
|
||||
{
|
||||
$removeSelectedField = false;
|
||||
|
||||
// Checks the parameter selectedField
|
||||
if (!isEmptyString($selectedField))
|
||||
{
|
||||
// Retrieves all the used fields by the current filter
|
||||
$fields = $this->_getSessionElement(self::SESSION_FIELDS);
|
||||
// Retrieves the selected fields by the current filter
|
||||
$selectedFields = $this->_getSessionElement(self::SESSION_SELECTED_FIELDS);
|
||||
|
||||
// Checks that the given selected field is present in the list of all the used fields by the current filter
|
||||
if (in_array($selectedField, $fields))
|
||||
{
|
||||
array_push($selectedFields, $selectedField); // place the new filed at the end of the selected fields list
|
||||
|
||||
$this->_setSessionElement(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
|
||||
|
||||
$removeSelectedField = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $removeSelectedField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a selected field from the current filter
|
||||
*/
|
||||
public function removeSelectedField($selectedField)
|
||||
{
|
||||
$removeSelectedField = false;
|
||||
|
||||
// Checks the parameter selectedField
|
||||
if (!isEmptyString($selectedField))
|
||||
{
|
||||
// Retrieves all the used fields by the current filter
|
||||
$fields = $this->_getSessionElement(self::SESSION_FIELDS);
|
||||
// Retrieves the selected fields by the current filter
|
||||
$selectedFields = $this->_getSessionElement(self::SESSION_SELECTED_FIELDS);
|
||||
|
||||
// Checks that the given selected field is present in the list of all the used fields by the current filter
|
||||
if (in_array($selectedField, $fields))
|
||||
{
|
||||
// If the selected field is present in the list of the selected fields by the current filter
|
||||
$pos = array_search($selectedField, $selectedFields);
|
||||
if ($pos !== false)
|
||||
{
|
||||
// Then remove it and shift the rest of elements by one if needed
|
||||
array_splice($selectedFields, $pos, 1);
|
||||
}
|
||||
|
||||
$this->_setSessionElement(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
|
||||
|
||||
$removeSelectedField = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $removeSelectedField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a filter (SQL where clause) to be applied to the current filter
|
||||
*/
|
||||
@@ -665,7 +576,7 @@ class FilterCmptLib
|
||||
}
|
||||
else // otherwise
|
||||
{
|
||||
$menuEntry->subscriptDescription = 'Remove';
|
||||
$menuEntry->subscriptDescription = '(Remove)';
|
||||
$menuEntry->subscriptLinkClass = 'remove-custom-filter';
|
||||
$menuEntry->subscriptLinkValue = $filter->{self::FILTER_ID};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user