mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
handle DirectExport in controller and export manager
This commit is contained in:
@@ -75,51 +75,55 @@ class ExportType extends AbstractType
|
||||
|
||||
$builder->add($exportBuilder, null, $exportOptions);
|
||||
|
||||
//add filters
|
||||
$filters = $this->exportManager->getFiltersApplyingOn($export, $options['picked_centers']);
|
||||
$filterBuilder = $builder->create(self::FILTER_KEY, FormType::class, array('compound' => true));
|
||||
if ($export instanceof \Chill\MainBundle\Export\ExportInterface) {
|
||||
//add filters
|
||||
$filters = $this->exportManager->getFiltersApplyingOn($export, $options['picked_centers']);
|
||||
$filterBuilder = $builder->create(self::FILTER_KEY, FormType::class, array('compound' => true));
|
||||
|
||||
foreach($filters as $alias => $filter) {
|
||||
$filterBuilder->add($alias, FilterType::class, array(
|
||||
'filter_alias' => $alias,
|
||||
'export_manager' => $this->exportManager,
|
||||
'label' => $filter->getTitle(),
|
||||
'constraints' => array(
|
||||
new ExportElementConstraint(['element' => $filter])
|
||||
)
|
||||
));
|
||||
foreach($filters as $alias => $filter) {
|
||||
$filterBuilder->add($alias, FilterType::class, array(
|
||||
'filter_alias' => $alias,
|
||||
'export_manager' => $this->exportManager,
|
||||
'label' => $filter->getTitle(),
|
||||
'constraints' => array(
|
||||
new ExportElementConstraint(['element' => $filter])
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
$builder->add($filterBuilder);
|
||||
|
||||
//add aggregators
|
||||
$aggregators = $this->exportManager
|
||||
->getAggregatorsApplyingOn($export, $options['picked_centers']);
|
||||
$aggregatorBuilder = $builder->create(self::AGGREGATOR_KEY, FormType::class,
|
||||
array('compound' => true));
|
||||
|
||||
foreach($aggregators as $alias => $aggregator) {
|
||||
$aggregatorBuilder->add($alias, AggregatorType::class, array(
|
||||
'aggregator_alias' => $alias,
|
||||
'export_manager' => $this->exportManager,
|
||||
'label' => $aggregator->getTitle(),
|
||||
'constraints' => array(
|
||||
new ExportElementConstraint(['element' => $aggregator])
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
$builder->add($aggregatorBuilder);
|
||||
}
|
||||
|
||||
$builder->add($filterBuilder);
|
||||
|
||||
//add aggregators
|
||||
$aggregators = $this->exportManager
|
||||
->getAggregatorsApplyingOn($export, $options['picked_centers']);
|
||||
$aggregatorBuilder = $builder->create(self::AGGREGATOR_KEY, FormType::class,
|
||||
array('compound' => true));
|
||||
|
||||
foreach($aggregators as $alias => $aggregator) {
|
||||
$aggregatorBuilder->add($alias, AggregatorType::class, array(
|
||||
'aggregator_alias' => $alias,
|
||||
'export_manager' => $this->exportManager,
|
||||
'label' => $aggregator->getTitle(),
|
||||
'constraints' => array(
|
||||
new ExportElementConstraint(['element' => $aggregator])
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
$builder->add($aggregatorBuilder);
|
||||
|
||||
// add export form
|
||||
$exportBuilder = $builder->create(self::EXPORT_KEY, FormType::class, array('compound' => true));
|
||||
$this->exportManager->getExport($options['export_alias'])
|
||||
->buildForm($exportBuilder);
|
||||
$builder->add($exportBuilder);
|
||||
|
||||
$builder->add(self::PICK_FORMATTER_KEY, PickFormatterType::class, array(
|
||||
'export_alias' => $options['export_alias']
|
||||
));
|
||||
if ($export instanceof \Chill\MainBundle\Export\ExportInterface) {
|
||||
$builder->add(self::PICK_FORMATTER_KEY, PickFormatterType::class, array(
|
||||
'export_alias' => $options['export_alias']
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user