improve export to add filtering parameters on result

The csv formatter now add a message about filtering parameters.

The filterInterface has been adapted to render a message.
This commit is contained in:
2016-12-01 22:29:41 +01:00
parent 2a21787ad4
commit 12dbb587df
3 changed files with 79 additions and 10 deletions

View File

@@ -33,5 +33,38 @@ namespace Chill\MainBundle\Export;
*/
interface FilterInterface extends ModifierInterface
{
const STRING_FORMAT = 'string';
/**
* Describe the filtering action.
*
* The description will be inserted in report to remains to the user the
* filters applyied on this report.
*
* Should return a statement about the filtering action, like :
* "filtering by date: from xxxx-xx-xx to xxxx-xx-xx" or
* "filtering by nationality: only Germany, France"
*
* The format will be determined by the $format. Currently, only 'string' is
* supported, later some 'html' will be added. The filter should always
* implement the 'string' format and fallback to it if other format are used.
*
* If no i18n is necessery, or if the filter translate the string by himself,
* this function should return a string. If the filter does not do any translation,
* the return parameter should be an array, where
*
* - the first element is the string,
* - and the second an array of parameters (may be an empty array)
* - the 3rd the domain (optional)
* - the 4th the locale (optional)
*
* Example: `array('my string with %parameter%', ['%parameter%' => 'good news'], 'mydomain', 'mylocale')`
*
* @param array $data
* @param string $format the format
* @return string|array a string with the data or, if translatable, an array where first element is string, second elements is an array of arguments
*/
public function describeAction($data, $format = 'string');
}