mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
- Added new phrase for the filter widget and fixed GUI tranlations
- Fixed error logs in public/js/FilterWidget.js - Changed the behavior of the Apply and Save buttons for the FilterWidget - Changed the GUI aesthetic of the FilterWidget settings - Added new option reloadPage to the AjaxLib, to reload the page after the complete callback - Added new classes to the public/css/FilterWidget.css - Changed FilterWidgetLib->loadDefinition: added a new fallback to find a filter in the database for the currend FilterWidget - Changed FilterWidgetLib->removeCustomFilter: when a custom filter is removed from the database then it is removed even from the session - Added new private method _dropFromSessionFilterWidgetById to application/libraries/FilterWidgetLib.php
This commit is contained in:
@@ -203,7 +203,7 @@ class FilterWidgetLib
|
||||
// Loops in the session for all the filter widgets
|
||||
foreach ($filterWidgetsSession as $filterWidget => $filterWidgetData)
|
||||
{
|
||||
// If this filter widget is not the currrent used filter widget and the it is expired...
|
||||
// If this filter widget is not the current used filter widget and the it is expired...
|
||||
if ($this->_filterUniqueId != $filterWidget && $filterWidgetData[self::SESSION_TIMEOUT] <= time())
|
||||
{
|
||||
cleanSessionElement(self::SESSION_NAME, $filterWidget); // ...remove it
|
||||
@@ -232,7 +232,7 @@ class FilterWidgetLib
|
||||
if ($filterId != null && is_numeric($filterId) && $filterId > 0)
|
||||
{
|
||||
$whereParameters = array(
|
||||
'filter_id' => $filterId
|
||||
self::FILTER_ID => $filterId
|
||||
);
|
||||
}
|
||||
else
|
||||
@@ -279,6 +279,18 @@ class FilterWidgetLib
|
||||
if ($definition == null && $whereParameters != null)
|
||||
{
|
||||
$definition = $this->_ci->FiltersModel->loadWhere($whereParameters);
|
||||
|
||||
// Last chance!!!
|
||||
if (!hasData($definition)) // If no data have been found until now the tries the most desperate query
|
||||
{
|
||||
$this->_ci->FiltersModel->addOrder('filter_id', 'ASC'); // sort on column filter_id to get the oldest
|
||||
$whereParameters = array(
|
||||
'app' => $app,
|
||||
'dataset_name' => $datasetName
|
||||
);
|
||||
|
||||
$definition = $this->_ci->FiltersModel->loadWhere($whereParameters);
|
||||
}
|
||||
}
|
||||
|
||||
return $definition;
|
||||
@@ -712,8 +724,11 @@ class FilterWidgetLib
|
||||
{
|
||||
$this->_ci->load->model('system/Filters_model', 'FiltersModel'); // to remove the filter definitions from DB
|
||||
|
||||
// delete it!
|
||||
$this->_ci->FiltersModel->delete(array('filter_id' => $filterId));
|
||||
// Delete it from database
|
||||
$this->_ci->FiltersModel->delete(array(self::FILTER_ID => $filterId));
|
||||
|
||||
// Delete it from session
|
||||
$this->_dropFromSessionFilterWidgetById($filterId);
|
||||
|
||||
$removeCustomFilter = true;
|
||||
}
|
||||
@@ -735,7 +750,7 @@ class FilterWidgetLib
|
||||
$session = $this->getSession(); // The filter currently stored in session (the one that is currently used)
|
||||
if ($session != null)
|
||||
{
|
||||
// Loads the Fitlers model
|
||||
// Loads the Filters model
|
||||
$this->_ci->load->model('system/Filters_model', 'FiltersModel');
|
||||
|
||||
// Loads all the filters related to this page (same dataset_name and same app name)
|
||||
@@ -761,7 +776,7 @@ class FilterWidgetLib
|
||||
'%s?%s=%s',
|
||||
site_url($navigationPage),
|
||||
self::FILTER_ID,
|
||||
$filter->filter_id
|
||||
$filter->{self::FILTER_ID}
|
||||
) // link
|
||||
);
|
||||
|
||||
@@ -774,7 +789,7 @@ class FilterWidgetLib
|
||||
{
|
||||
$menuEntry['subscriptDescription'] = 'Remove';
|
||||
$menuEntry['subscriptLinkClass'] = 'remove-custom-filter';
|
||||
$menuEntry['subscriptLinkValue'] = $filter->filter_id;
|
||||
$menuEntry['subscriptLinkValue'] = $filter->{self::FILTER_ID};
|
||||
$childrenPersonalArray[] = $menuEntry; // adds to personal filters menu array
|
||||
}
|
||||
}
|
||||
@@ -974,5 +989,29 @@ class FilterWidgetLib
|
||||
|
||||
return $pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove from the session the given filter widget
|
||||
*/
|
||||
private function _dropFromSessionFilterWidgetById($filterId)
|
||||
{
|
||||
// Loads the session for all the filter widgets
|
||||
$filterWidgetsSession = getSession(self::SESSION_NAME);
|
||||
|
||||
// If something is present in session
|
||||
if ($filterWidgetsSession != null)
|
||||
{
|
||||
// Loops in the session for all the filter widgets
|
||||
foreach ($filterWidgetsSession as $filterWidget => $filterWidgetData)
|
||||
{
|
||||
// If this filter widget is not the one that we are looking for
|
||||
if ($filterWidgetData[self::FILTER_ID] == $filterId)
|
||||
{
|
||||
cleanSessionElement(self::SESSION_NAME, $filterWidget); // ...remove it
|
||||
break; // stop to search
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user