├── APYDataGridBundle.php ├── CHANGELOG.md ├── DependencyInjection ├── APYDataGridExtension.php ├── Compiler │ ├── GridExtensionPass.php │ ├── GridPass.php │ └── TranslationPass.php └── Configuration.php ├── Grid ├── AbstractType.php ├── Action │ ├── DeleteMassAction.php │ ├── MassAction.php │ ├── MassActionInterface.php │ ├── RowAction.php │ └── RowActionInterface.php ├── Column │ ├── ActionsColumn.php │ ├── ArrayColumn.php │ ├── BlankColumn.php │ ├── BooleanColumn.php │ ├── Column.php │ ├── DateColumn.php │ ├── DateTimeColumn.php │ ├── JoinColumn.php │ ├── MassActionColumn.php │ ├── NumberColumn.php │ ├── RankColumn.php │ ├── SimpleArrayColumn.php │ ├── TextColumn.php │ ├── TimeColumn.php │ └── UntypedColumn.php ├── Columns.php ├── Exception │ ├── ColumnAlreadyExistsException.php │ ├── ColumnNotFoundException.php │ ├── ExceptionInterface.php │ ├── InvalidArgumentException.php │ ├── PropertyAccessDeniedException.php │ ├── TypeAlreadyExistsException.php │ ├── TypeNotFoundException.php │ └── UnexpectedTypeException.php ├── Export │ ├── CSVExport.php │ ├── ContainerAwareInterface.php │ ├── DSVExport.php │ ├── ExcelExport.php │ ├── Export.php │ ├── ExportInterface.php │ ├── JSONExport.php │ ├── PHPExcel2003Export.php │ ├── PHPExcel2007Export.php │ ├── PHPExcel5Export.php │ ├── PHPExcelHTMLExport.php │ ├── PHPExcelPDFExport.php │ ├── SCSVExport.php │ ├── TSVExport.php │ └── XMLExport.php ├── Filter.php ├── Grid.php ├── GridBuilder.php ├── GridBuilderInterface.php ├── GridConfigBuilder.php ├── GridConfigBuilderInterface.php ├── GridConfigInterface.php ├── GridFactory.php ├── GridFactoryInterface.php ├── GridInterface.php ├── GridManager.php ├── GridRegistry.php ├── GridRegistryInterface.php ├── GridTypeInterface.php ├── Helper │ ├── ColumnsIterator.php │ └── ORMCountWalker.php ├── Mapping │ ├── Column.php │ ├── Driver │ │ ├── Annotation.php │ │ └── DriverInterface.php │ ├── Metadata │ │ ├── DriverHeap.php │ │ ├── Manager.php │ │ └── Metadata.php │ └── Source.php ├── Row.php ├── Rows.php ├── Source │ ├── Document.php │ ├── Entity.php │ ├── Source.php │ └── Vector.php └── Type │ └── GridType.php ├── LICENSE ├── README.md ├── Resources ├── config │ ├── columns.xml │ ├── grid.yml │ └── services.xml ├── doc │ ├── columns_configuration │ │ ├── annotations │ │ │ ├── association_mapping.md │ │ │ ├── column_annotation_class.md │ │ │ ├── column_annotation_property.md │ │ │ ├── dql_function.md │ │ │ └── source_annotation.md │ │ ├── filters │ │ │ ├── create_filter.md │ │ │ ├── input_filter.md │ │ │ └── select_filter.md │ │ ├── index.md │ │ └── types │ │ │ ├── array_column.md │ │ │ ├── blank_column.md │ │ │ ├── boolean_column.md │ │ │ ├── create_column.md │ │ │ ├── date_column.md │ │ │ ├── datetime_column.md │ │ │ ├── join_column.md │ │ │ ├── number_column.md │ │ │ ├── rank_column.md │ │ │ ├── text_column.md │ │ │ └── time_column.md │ ├── configuration.md │ ├── export │ │ ├── create_export.md │ │ ├── index.md │ │ ├── library-dependent_exports │ │ │ └── PHPExcel │ │ │ │ ├── PHPExcel_HTML_export.md │ │ │ │ ├── PHPExcel_PDF_export.md │ │ │ │ ├── PHPExcel_excel2003_export.md │ │ │ │ ├── PHPExcel_excel2007_export.md │ │ │ │ └── PHPExcel_excel5_export.md │ │ └── native_exports │ │ │ ├── CSV_export.md │ │ │ ├── DSV_export.md │ │ │ ├── Excel_export.md │ │ │ ├── JSON_export.md │ │ │ ├── SCSV_export.md │ │ │ ├── TSV_export.md │ │ │ └── XML_export.md │ ├── features.md │ ├── getting_started.md │ ├── grid.md │ ├── grid_configuration │ │ ├── add_actions_column.md │ │ ├── add_column.md │ │ ├── add_delete_mass_action.md │ │ ├── add_export.md │ │ ├── add_mass_action.md │ │ ├── add_row_action.md │ │ ├── always_show_grid.md │ │ ├── grid_response.md │ │ ├── hide_show_columns.md │ │ ├── index.md │ │ ├── manipulate_column.md │ │ ├── manipulate_column_render_cell.md │ │ ├── manipulate_count_query.md │ │ ├── manipulate_query.md │ │ ├── manipulate_row_action_rendering.md │ │ ├── manipulate_rows_data.md │ │ ├── multi_grid_manager.md │ │ ├── set_columns_order.md │ │ ├── set_data.md │ │ ├── set_default_filters.md │ │ ├── set_default_limit.md │ │ ├── set_default_order.md │ │ ├── set_default_page.md │ │ ├── set_grid_identifier.md │ │ ├── set_grid_persistence.md │ │ ├── set_grid_route.md │ │ ├── set_limits.md │ │ ├── set_max_results.md │ │ ├── set_no_data_message.md │ │ ├── set_no_result_message.md │ │ ├── set_permanent_filters.md │ │ ├── set_prefix_titles.md │ │ ├── set_size_actions_column.md │ │ ├── set_title_actions_column.md │ │ ├── working_example.css │ │ └── working_example.md │ ├── images │ │ ├── false.png │ │ ├── pagerfanta.png │ │ ├── screenshot_database.png │ │ ├── screenshot_en.png │ │ ├── screenshot_fr.png │ │ ├── screenshot_full.png │ │ ├── sort_down.gif │ │ ├── sort_up.gif │ │ └── true.png │ ├── index.md │ ├── source │ │ ├── document_source.md │ │ ├── entity_source.md │ │ ├── index.md │ │ └── vector_source.md │ ├── summary.md │ └── template │ │ ├── cell_rendering.md │ │ ├── filter_rendering.md │ │ ├── index.md │ │ ├── overriding_internal_blocks.md │ │ ├── pagerfanta_example.css │ │ ├── render_an_ajax_grid.md │ │ ├── render_external_filters.md │ │ └── render_pagerfanta_pager.md ├── translations │ ├── messages.cs.xliff │ ├── messages.de.xliff │ ├── messages.en.xliff │ ├── messages.es.xliff │ ├── messages.fr.xliff │ ├── messages.it.xliff │ ├── messages.ja.xliff │ ├── messages.nl.xliff │ ├── messages.pl.xliff │ ├── messages.pt_BR.xliff │ ├── messages.ru.xliff │ ├── messages.sk.xliff │ └── messages.tr.xliff └── views │ ├── blocks.html.twig │ └── blocks_js.jquery.html.twig ├── Translation └── ColumnTitleAnnotationTranslationExtractor.php ├── Twig └── DataGridExtension.php ├── UPGRADE-2.0.md └── composer.json /APYDataGridBundle.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle; 14 | 15 | use APY\DataGridBundle\DependencyInjection\Compiler\GridExtensionPass; 16 | use APY\DataGridBundle\DependencyInjection\Compiler\GridPass; 17 | use Symfony\Component\DependencyInjection\ContainerBuilder; 18 | use Symfony\Component\HttpKernel\Bundle\Bundle; 19 | 20 | class APYDataGridBundle extends Bundle 21 | { 22 | public function build(ContainerBuilder $container): void 23 | { 24 | parent::build($container); 25 | 26 | $container->addCompilerPass(new GridExtensionPass()); 27 | $container->addCompilerPass(new GridPass()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /DependencyInjection/APYDataGridExtension.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\DependencyInjection; 14 | 15 | use Symfony\Component\Config\FileLocator; 16 | use Symfony\Component\DependencyInjection\ContainerBuilder; 17 | use Symfony\Component\DependencyInjection\Extension\Extension; 18 | use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; 19 | use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; 20 | 21 | class APYDataGridExtension extends Extension 22 | { 23 | public function load(array $configs, ContainerBuilder $container): void 24 | { 25 | $configuration = new Configuration(); 26 | $config = $this->processConfiguration($configuration, $configs); 27 | 28 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); 29 | $loader->load('services.xml'); 30 | $loader->load('columns.xml'); 31 | 32 | $ymlLoader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); 33 | $ymlLoader->load('grid.yml'); 34 | 35 | $container->setParameter('apy_data_grid.limits', $config['limits']); 36 | $container->setParameter('apy_data_grid.theme', $config['theme']); 37 | $container->setParameter('apy_data_grid.persistence', $config['persistence']); 38 | $container->setParameter('apy_data_grid.no_data_message', $config['no_data_message']); 39 | $container->setParameter('apy_data_grid.no_result_message', $config['no_result_message']); 40 | $container->setParameter('apy_data_grid.actions_columns_size', $config['actions_columns_size']); 41 | $container->setParameter('apy_data_grid.actions_columns_title', $config['actions_columns_title']); 42 | $container->setParameter('apy_data_grid.pagerfanta', $config['pagerfanta']); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /DependencyInjection/Compiler/GridExtensionPass.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\DependencyInjection\Compiler; 14 | 15 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; 16 | use Symfony\Component\DependencyInjection\ContainerBuilder; 17 | use Symfony\Component\DependencyInjection\Reference; 18 | 19 | class GridExtensionPass implements CompilerPassInterface 20 | { 21 | public function process(ContainerBuilder $container): void 22 | { 23 | if (false === $container->hasDefinition('grid')) { 24 | return; 25 | } 26 | 27 | $definition = $container->getDefinition('grid'); 28 | 29 | // Extensions must always be registered before everything else. 30 | // For instance, global variable definitions must be registered 31 | // afterward. If not, the globals from the extensions will never 32 | // be registered. 33 | $calls = $definition->getMethodCalls(); 34 | $definition->setMethodCalls([]); 35 | 36 | foreach ($container->findTaggedServiceIds('grid.column.extension') as $id => $attributes) { 37 | $definition->addMethodCall('addColumnExtension', [new Reference($id)]); 38 | } 39 | 40 | $definition->setMethodCalls(array_merge($definition->getMethodCalls(), $calls)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /DependencyInjection/Compiler/GridPass.php: -------------------------------------------------------------------------------- 1 | hasDefinition('apy_grid.registry')) { 26 | return; 27 | } 28 | 29 | $definition = $container->getDefinition('apy_grid.registry'); 30 | 31 | $types = $container->findTaggedServiceIds('apy_grid.type'); 32 | foreach ($types as $id => $tag) { 33 | $definition->addMethodCall('addType', [new Reference($id)]); 34 | } 35 | 36 | $columns = $container->findTaggedServiceIds('apy_grid.column'); 37 | foreach ($columns as $id => $tag) { 38 | $definition->addMethodCall('addColumn', [new Reference($id)]); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /DependencyInjection/Compiler/TranslationPass.php: -------------------------------------------------------------------------------- 1 | hasDefinition('jms_translation.extractor.file_extractor')) { 22 | return; 23 | } 24 | 25 | $extractor = new Definition('APY\DataGridBundle\Translation\ColumnTitleAnnotationTranslationExtractor'); 26 | $extractor 27 | ->setPublic(false) 28 | ->addTag('jms_translation.file_visitor'); 29 | 30 | $container->setDefinition('grid.translation_extractor', $extractor); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DependencyInjection/Configuration.php: -------------------------------------------------------------------------------- 1 | getRootNode(); 22 | 23 | $rootNode 24 | ->children() 25 | ->arrayNode('limits') 26 | ->performNoDeepMerging() 27 | ->beforeNormalization() 28 | ->ifTrue(fn($v) => !is_array($v)) 29 | ->then(fn($v) => [$v]) 30 | ->end() 31 | ->defaultValue([20 => '20', 50 => '50', 100 => '100']) 32 | ->prototype('scalar')->end() 33 | ->end() 34 | ->booleanNode('persistence')->defaultFalse()->end() 35 | ->scalarNode('theme')->defaultValue('@APYDataGrid/blocks.html.twig')->end() 36 | ->scalarNode('no_data_message')->defaultValue('No data')->end() 37 | ->scalarNode('no_result_message')->defaultValue('No result')->end() 38 | ->scalarNode('actions_columns_size')->defaultValue(-1)->end() 39 | ->scalarNode('actions_columns_title')->defaultValue('Actions')->end() 40 | ->scalarNode('actions_columns_separator')->defaultValue('
')->end() // deprecated 41 | ->arrayNode('pagerfanta') 42 | ->addDefaultsIfNotSet() 43 | ->children() 44 | ->booleanNode('enable')->defaultFalse()->end() 45 | ->scalarNode('view_class')->defaultValue('Pagerfanta\View\DefaultView')->end() 46 | ->arrayNode('options') 47 | ->defaultValue(['prev_message' => '«', 'next_message' => '»']) 48 | ->useAttributeAsKey('options') 49 | ->prototype('scalar')->end() 50 | ->end() 51 | ->end() 52 | ->end() 53 | ->end(); 54 | 55 | return $treeBuilder; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Grid/AbstractType.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Action; 14 | 15 | class DeleteMassAction extends MassAction 16 | { 17 | /** 18 | * Default DeleteMassAction constructor. 19 | * 20 | * @param bool $confirm Show confirm message if true 21 | */ 22 | public function __construct($confirm = false) 23 | { 24 | parent::__construct('Delete', 'static::deleteAction', $confirm); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Grid/Action/MassActionInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Action; 14 | 15 | interface MassActionInterface 16 | { 17 | /** 18 | * get action title. 19 | * 20 | * @return string 21 | */ 22 | public function getTitle(); 23 | 24 | /** 25 | * get action callback. 26 | * 27 | * @return string 28 | */ 29 | public function getCallback(); 30 | 31 | /** 32 | * get action confirm. 33 | * 34 | * @return bool 35 | */ 36 | public function getConfirm(); 37 | 38 | /** 39 | * get action confirmMessage. 40 | * 41 | * @return bool 42 | */ 43 | public function getConfirmMessage(); 44 | 45 | /** 46 | * get additional parameters. 47 | * 48 | * @return array 49 | */ 50 | public function getParameters(); 51 | } 52 | -------------------------------------------------------------------------------- /Grid/Action/RowActionInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Action; 14 | 15 | // @todo: implementation seems to be more specific than interface. It obviously be the case but I've noticed that 16 | // only one method of this interface is used in our code. So I wonder if this interface is "updated" and is the mimimum 17 | // API methods that should be provided as a contract or not. 18 | interface RowActionInterface 19 | { 20 | /** 21 | * get action title. 22 | * 23 | * @return string 24 | */ 25 | public function getTitle(); 26 | 27 | /** 28 | * get action route. 29 | * 30 | * @return string 31 | */ 32 | public function getRoute(); 33 | 34 | /** 35 | * get action confirm. 36 | * 37 | * @return bool 38 | */ 39 | public function getConfirm(); 40 | 41 | /** 42 | * get action confirmMessage. 43 | * 44 | * @return string 45 | */ 46 | public function getConfirmMessage(); 47 | 48 | /** 49 | * get action target. 50 | * 51 | * @return string 52 | */ 53 | public function getTarget(); 54 | 55 | /** 56 | * get the action column id. 57 | * 58 | * @return string 59 | */ 60 | public function getColumn(); 61 | 62 | /** 63 | * get route parameters. 64 | * 65 | * @return array 66 | */ 67 | public function getRouteParameters(); 68 | 69 | /** 70 | * get attributes of the link. 71 | * 72 | * @return array 73 | */ 74 | public function getAttributes(); 75 | 76 | /** 77 | * get action enabled. 78 | * 79 | * @return bool 80 | */ 81 | public function getEnabled(); 82 | } 83 | -------------------------------------------------------------------------------- /Grid/Column/BlankColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | class BlankColumn extends Column 16 | { 17 | public function __initialize(array $params) 18 | { 19 | $params['filterable'] = false; 20 | $params['sortable'] = false; 21 | $params['source'] = false; 22 | 23 | parent::__initialize($params); 24 | } 25 | 26 | public function getType() 27 | { 28 | return 'blank'; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Grid/Column/BooleanColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | class BooleanColumn extends Column 16 | { 17 | public function __initialize(array $params) 18 | { 19 | $params['filter'] = 'select'; 20 | $params['selectFrom'] = 'values'; 21 | $params['operators'] = [self::OPERATOR_EQ]; 22 | $params['defaultOperator'] = self::OPERATOR_EQ; 23 | $params['operatorsVisible'] = false; 24 | $params['selectMulti'] = false; 25 | 26 | parent::__initialize($params); 27 | 28 | $this->setAlign($this->getParam('align', 'center')); 29 | $this->setSize($this->getParam('size', '30')); 30 | $this->setValues($this->getParam('values', [1 => 'true', 0 => 'false'])); 31 | } 32 | 33 | public function isQueryValid($query) 34 | { 35 | $query = (array) $query; 36 | if ($query[0] === true || $query[0] === false || $query[0] == 0 || $query[0] == 1) { 37 | return true; 38 | } 39 | 40 | return false; 41 | } 42 | 43 | public function renderCell($value, $row, $router) 44 | { 45 | $value = parent::renderCell($value, $row, $router); 46 | 47 | return $value ?: 'false'; 48 | } 49 | 50 | public function getDisplayedValue($value) 51 | { 52 | return is_bool($value) ? ($value ? 1 : 0) : $value; 53 | } 54 | 55 | public function getType() 56 | { 57 | return 'boolean'; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Grid/Column/DateColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | use APY\DataGridBundle\Grid\Filter; 16 | 17 | class DateColumn extends DateTimeColumn 18 | { 19 | protected $timeFormat = \IntlDateFormatter::NONE; 20 | 21 | protected $fallbackFormat = 'Y-m-d'; 22 | 23 | protected $fallbackInputFormat = 'Y-m-d'; 24 | 25 | public function getFilters($source) 26 | { 27 | $parentFilters = parent::getFilters($source); 28 | 29 | $filters = []; 30 | foreach ($parentFilters as $filter) { 31 | if ($filter->getValue() !== null) { 32 | $dateFrom = $filter->getValue(); 33 | $dateFrom->setTime(0, 0, 0); 34 | 35 | $dateTo = clone $dateFrom; 36 | $dateTo->setTime(23, 59, 59); 37 | 38 | switch ($filter->getOperator()) { 39 | case self::OPERATOR_EQ: 40 | $filters[] = new Filter(self::OPERATOR_GTE, $dateFrom); 41 | $filters[] = new Filter(self::OPERATOR_LTE, $dateTo); 42 | break; 43 | case self::OPERATOR_NEQ: 44 | $filters[] = new Filter(self::OPERATOR_LT, $dateFrom); 45 | $filters[] = new Filter(self::OPERATOR_GT, $dateTo); 46 | $this->setDataJunction(self::DATA_DISJUNCTION); 47 | break; 48 | case self::OPERATOR_LT: 49 | case self::OPERATOR_GTE: 50 | $filters[] = new Filter($filter->getOperator(), $dateFrom); 51 | break; 52 | case self::OPERATOR_GT: 53 | case self::OPERATOR_LTE: 54 | $filters[] = new Filter($filter->getOperator(), $dateTo); 55 | break; 56 | default: 57 | $filters[] = $filter; 58 | } 59 | } else { 60 | $filters[] = $filter; 61 | } 62 | } 63 | 64 | return $filters; 65 | } 66 | 67 | public function getType() 68 | { 69 | return 'date'; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Grid/Column/JoinColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | class JoinColumn extends TextColumn 16 | { 17 | protected $joinColumns = []; 18 | 19 | protected $dataJunction = self::DATA_DISJUNCTION; 20 | 21 | public function __initialize(array $params) 22 | { 23 | parent::__initialize($params); 24 | 25 | $this->setJoinColumns($this->getParam('columns', [])); 26 | $this->setSeparator($this->getParam('separator', ' ')); 27 | 28 | $this->setVisibleForSource(true); 29 | $this->setIsManualField(true); 30 | } 31 | 32 | public function setJoinColumns(array $columns) 33 | { 34 | $this->joinColumns = $columns; 35 | } 36 | 37 | public function getJoinColumns() 38 | { 39 | return $this->joinColumns; 40 | } 41 | 42 | public function getFilters($source) 43 | { 44 | $filters = []; 45 | 46 | // Apply same filters on each column 47 | foreach ($this->joinColumns as $columnName) { 48 | $tempFilters = parent::getFilters($source); 49 | 50 | foreach ($tempFilters as $filter) { 51 | $filter->setColumnName($columnName); 52 | } 53 | 54 | $filters = array_merge($filters, $tempFilters); 55 | } 56 | 57 | return $filters; 58 | } 59 | 60 | public function getType() 61 | { 62 | return 'join'; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Grid/Column/MassActionColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | class MassActionColumn extends Column 16 | { 17 | public const ID = '__action'; 18 | 19 | public function __construct() 20 | { 21 | parent::__construct([ 22 | 'id' => self::ID, 23 | 'title' => '', 24 | 'size' => 15, 25 | 'filterable' => true, 26 | 'sortable' => false, 27 | 'source' => false, 28 | 'align' => Column::ALIGN_CENTER, 29 | ]); 30 | } 31 | 32 | public function isVisible($isExported = false) 33 | { 34 | if ($isExported) { 35 | return false; 36 | } 37 | 38 | return parent::isVisible(); 39 | } 40 | 41 | public function getFilterType() 42 | { 43 | return $this->getType(); 44 | } 45 | 46 | public function getType() 47 | { 48 | return 'massaction'; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Grid/Column/RankColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | class RankColumn extends BlankColumn 16 | { 17 | protected $rank = 1; 18 | 19 | public function __initialize(array $params) 20 | { 21 | parent::__initialize($params); 22 | 23 | $this->setId($this->getParam('id', 'rank')); 24 | $this->setTitle($this->getParam('title', 'rank')); 25 | $this->setSize($this->getParam('size', '30')); 26 | $this->setAlign($this->getParam('align', 'center')); 27 | } 28 | 29 | public function renderCell($value, $row, $router) 30 | { 31 | return $this->rank++; 32 | } 33 | 34 | public function getType() 35 | { 36 | return 'rank'; 37 | } 38 | 39 | /** 40 | * Get the value of rank 41 | */ 42 | public function getRank() 43 | { 44 | return $this->rank; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Grid/Column/SimpleArrayColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | use APY\DataGridBundle\Grid\Filter; 16 | 17 | class SimpleArrayColumn extends Column 18 | { 19 | public function __initialize(array $params) 20 | { 21 | parent::__initialize($params); 22 | 23 | $this->setOperators($this->getParam('operators', [ 24 | self::OPERATOR_LIKE, 25 | self::OPERATOR_NLIKE, 26 | self::OPERATOR_EQ, 27 | self::OPERATOR_NEQ, 28 | self::OPERATOR_ISNULL, 29 | self::OPERATOR_ISNOTNULL, 30 | ])); 31 | $this->setDefaultOperator($this->getParam('defaultOperator', self::OPERATOR_LIKE)); 32 | } 33 | 34 | public function getFilters($source) 35 | { 36 | $parentFilters = parent::getFilters($source); 37 | 38 | $filters = []; 39 | foreach ($parentFilters as $filter) { 40 | switch ($filter->getOperator()) { 41 | case self::OPERATOR_EQ: 42 | case self::OPERATOR_NEQ: 43 | $value = $filter->getValue(); 44 | $filters[] = new Filter($filter->getOperator(), $value); 45 | break; 46 | case self::OPERATOR_LIKE: 47 | case self::OPERATOR_NLIKE: 48 | $value = $filter->getValue(); 49 | $filters[] = new Filter($filter->getOperator(), $value); 50 | break; 51 | case self::OPERATOR_ISNULL: 52 | $filters[] = new Filter(self::OPERATOR_ISNULL); 53 | $filters[] = new Filter(self::OPERATOR_EQ, ''); 54 | $this->setDataJunction(self::DATA_DISJUNCTION); 55 | break; 56 | case self::OPERATOR_ISNOTNULL: 57 | $filters[] = new Filter(self::OPERATOR_ISNOTNULL); 58 | $filters[] = new Filter(self::OPERATOR_NEQ, ''); 59 | break; 60 | default: 61 | $filters[] = $filter; 62 | } 63 | } 64 | 65 | return $filters; 66 | } 67 | 68 | public function renderCell($values, $row, $router) 69 | { 70 | if (is_callable($this->callback)) { 71 | return call_user_func($this->callback, $values, $row, $router); 72 | } 73 | 74 | // @todo: when it has an array as value? 75 | $return = []; 76 | if (is_array($values) || $values instanceof \Traversable) { 77 | foreach ($values as $key => $value) { 78 | if (!is_array($value) && isset($this->values[(string) $value])) { 79 | $value = $this->values[$value]; 80 | } 81 | 82 | $return[$key] = $value; 83 | } 84 | } 85 | 86 | return $return; 87 | } 88 | 89 | public function getType() 90 | { 91 | return 'simple_array'; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Grid/Column/TextColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | use APY\DataGridBundle\Grid\Filter; 16 | 17 | class TextColumn extends Column 18 | { 19 | public function isQueryValid($query) 20 | { 21 | $result = array_filter((array) $query, 'is_string'); 22 | 23 | return !empty($result); 24 | } 25 | 26 | public function getFilters($source) 27 | { 28 | $parentFilters = parent::getFilters($source); 29 | 30 | $filters = []; 31 | foreach ($parentFilters as $filter) { 32 | switch ($filter->getOperator()) { 33 | case self::OPERATOR_ISNULL: 34 | $filters[] = new Filter(self::OPERATOR_ISNULL); 35 | $filters[] = new Filter(self::OPERATOR_EQ, ''); 36 | $this->setDataJunction(self::DATA_DISJUNCTION); 37 | break; 38 | case self::OPERATOR_ISNOTNULL: 39 | $filters[] = new Filter(self::OPERATOR_ISNOTNULL); 40 | $filters[] = new Filter(self::OPERATOR_NEQ, ''); 41 | break; 42 | default: 43 | $filters[] = $filter; 44 | } 45 | } 46 | 47 | return $filters; 48 | } 49 | 50 | public function getType() 51 | { 52 | return 'text'; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Grid/Column/TimeColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | class TimeColumn extends DateTimeColumn 16 | { 17 | protected $dateFormat = \IntlDateFormatter::NONE; 18 | 19 | protected $fallbackFormat = 'H:i:s'; 20 | 21 | public function getType() 22 | { 23 | return 'time'; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Grid/Column/UntypedColumn.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Column; 14 | 15 | class UntypedColumn extends Column 16 | { 17 | protected $type = null; 18 | 19 | public function getParams() 20 | { 21 | return $this->params; 22 | } 23 | 24 | public function getType() 25 | { 26 | return $this->type; 27 | } 28 | 29 | public function setType($type) 30 | { 31 | $this->type = $type; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Grid/Exception/ColumnAlreadyExistsException.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | use APY\DataGridBundle\Grid\Grid; 16 | 17 | /** 18 | * Comma-Separated Values. 19 | */ 20 | class CSVExport extends DSVExport 21 | { 22 | protected $fileExtension = 'csv'; 23 | 24 | protected $mimeType = 'text/comma-separated-values'; 25 | 26 | protected $delimiter = ','; 27 | } 28 | -------------------------------------------------------------------------------- /Grid/Export/ContainerAwareInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | use APY\DataGridBundle\Grid\Grid; 16 | 17 | /** 18 | * Delimiter-Separated Values. 19 | */ 20 | class DSVExport extends Export 21 | { 22 | protected $fileExtension = null; 23 | 24 | protected $mimeType = 'application/octet-stream'; 25 | 26 | protected $delimiter = ''; 27 | 28 | protected $withBOM = true; 29 | 30 | public function __construct($title, $fileName = 'export', $params = [], $charset = 'UTF-8') 31 | { 32 | $this->delimiter = isset($params['delimiter']) ? $params['delimiter'] : $this->delimiter; 33 | $this->withBOM = isset($params['withBOM']) ? $params['withBOM'] : $this->withBOM; 34 | 35 | parent::__construct($title, $fileName, $params, $charset); 36 | } 37 | 38 | public function computeData(Grid $grid) 39 | { 40 | $data = $this->getFlatGridData($grid); 41 | 42 | // Array to dsv 43 | $outstream = fopen('php://temp', 'r+'); 44 | 45 | foreach ($data as $line) { 46 | fputcsv($outstream, $line, $this->delimiter, '"'); 47 | } 48 | 49 | rewind($outstream); 50 | 51 | $content = $this->withBOM ? "\xEF\xBB\xBF" : ''; 52 | 53 | while (($buffer = fgets($outstream)) !== false) { 54 | $content .= $buffer; 55 | } 56 | 57 | fclose($outstream); 58 | 59 | $this->content = $content; 60 | } 61 | 62 | /** 63 | * get delimiter. 64 | * 65 | * @return string 66 | */ 67 | public function getDelimiter() 68 | { 69 | return $this->delimiter; 70 | } 71 | 72 | /** 73 | * set delimiter. 74 | * 75 | * @param string $delimiter 76 | * 77 | * @return self 78 | */ 79 | public function setDelimiter($delimiter) 80 | { 81 | $this->delimiter = $delimiter; 82 | 83 | return $this; 84 | } 85 | 86 | /** 87 | * get BOM setting. 88 | * 89 | * @return string 90 | */ 91 | public function getWithBOM() 92 | { 93 | return $this->withBOM; 94 | } 95 | 96 | /*** set BOM setting. 97 | * 98 | * @param string $withBOM 99 | * 100 | * @return self 101 | */ 102 | public function setWithBOM($withBOM) 103 | { 104 | $this->withBOM = $withBOM; 105 | 106 | return $this; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /Grid/Export/ExcelExport.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | use APY\DataGridBundle\Grid\Grid; 16 | 17 | /** 18 | * Excel (This export produces a warning with new Office Excel). 19 | */ 20 | class ExcelExport extends Export 21 | { 22 | protected $fileExtension = 'xls'; 23 | 24 | protected $mimeType = 'application/vnd.ms-excel'; 25 | 26 | public function computeData(Grid $grid) 27 | { 28 | $data = $this->getGridData($grid); 29 | 30 | $this->content = ''; 31 | if (isset($data['titles'])) { 32 | $this->content .= ''; 33 | foreach ($data['titles'] as $title) { 34 | $this->content .= sprintf('', htmlentities($title, ENT_QUOTES)); 35 | } 36 | $this->content .= ''; 37 | } 38 | 39 | foreach ($data['rows'] as $row) { 40 | $this->content .= ''; 41 | foreach ($row as $cell) { 42 | $this->content .= sprintf('', htmlentities($cell, ENT_QUOTES)); 43 | } 44 | $this->content .= ''; 45 | } 46 | 47 | $this->content .= '
%s
%s
'; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Grid/Export/ExportInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | use APY\DataGridBundle\Grid\Grid; 16 | use Symfony\Component\HttpFoundation\Response; 17 | 18 | interface ExportInterface 19 | { 20 | /** 21 | * function call by the grid to fill the content of the export. 22 | * 23 | * @param Grid $grid The grid 24 | */ 25 | public function computeData(Grid $grid); 26 | 27 | /** 28 | * Get the export Response. 29 | * 30 | * @return Response 31 | */ 32 | public function getResponse(): Response; 33 | 34 | /** 35 | * Get the export title. 36 | * 37 | * @return string 38 | */ 39 | public function getTitle(): string; 40 | 41 | /** 42 | * Get the export role. 43 | * 44 | * @return mixed 45 | */ 46 | public function getRole(); 47 | } 48 | -------------------------------------------------------------------------------- /Grid/Export/JSONExport.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | use APY\DataGridBundle\Grid\Grid; 16 | 17 | /** 18 | * JSON. 19 | */ 20 | class JSONExport extends Export 21 | { 22 | protected $fileExtension = 'json'; 23 | 24 | public function computeData(Grid $grid) 25 | { 26 | $this->content = json_encode($this->getGridData($grid)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Grid/Export/PHPExcel2003Export.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | /** 16 | * PHPExcel_Excel 2003 Export (.xlsx). 17 | */ 18 | class PHPExcel2003Export extends PHPExcel2007Export 19 | { 20 | protected function getWriter() 21 | { 22 | $writer = parent::getWriter(); 23 | $writer->setOffice2003Compatibility(true); 24 | 25 | return $writer; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Grid/Export/PHPExcel2007Export.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | /** 16 | * PHPExcel 2007 Export. 17 | */ 18 | class PHPExcel2007Export extends PHPExcel5Export 19 | { 20 | protected $fileExtension = 'xlsx'; 21 | 22 | protected $mimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; 23 | 24 | protected function getWriter() 25 | { 26 | $writer = new \PHPExcel_Writer_Excel2007($this->objPHPExcel); 27 | $writer->setPreCalculateFormulas(false); 28 | 29 | return $writer; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Grid/Export/PHPExcel5Export.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | use APY\DataGridBundle\Grid\Grid; 16 | 17 | /** 18 | * PHPExcel 5 Export (97-2003) (.xls) 19 | * 52 columns maximum. 20 | */ 21 | class PHPExcel5Export extends Export 22 | { 23 | protected $fileExtension = 'xls'; 24 | 25 | protected $mimeType = 'application/vnd.ms-excel'; 26 | 27 | public $objPHPExcel; 28 | 29 | public function __construct($tilte, $fileName = 'export', $params = [], $charset = 'UTF-8') 30 | { 31 | $this->objPHPExcel = new \PHPExcel(); 32 | 33 | parent::__construct($tilte, $fileName, $params, $charset); 34 | } 35 | 36 | public function computeData(Grid $grid) 37 | { 38 | $data = $this->getFlatGridData($grid); 39 | 40 | $row = 1; 41 | foreach ($data as $line) { 42 | $column = 'A'; 43 | foreach ($line as $cell) { 44 | $this->objPHPExcel->getActiveSheet()->SetCellValue($column . $row, $cell); 45 | 46 | ++$column; 47 | } 48 | ++$row; 49 | } 50 | 51 | $objWriter = $this->getWriter(); 52 | 53 | ob_start(); 54 | 55 | $objWriter->save('php://output'); 56 | 57 | $this->content = ob_get_contents(); 58 | 59 | ob_end_clean(); 60 | } 61 | 62 | protected function getWriter() 63 | { 64 | return new \PHPExcel_Writer_Excel5($this->objPHPExcel); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Grid/Export/PHPExcelHTMLExport.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | /** 16 | * PHPExcel HTML Export. 17 | */ 18 | class PHPExcelHTMLExport extends PHPExcel5Export 19 | { 20 | protected $fileExtension = 'html'; 21 | 22 | protected $mimeType = 'text/html'; 23 | 24 | protected function getWriter() 25 | { 26 | $writer = new \PHPExcel_Writer_HTML($this->objPHPExcel); 27 | $writer->setPreCalculateFormulas(false); 28 | 29 | return $writer; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Grid/Export/PHPExcelPDFExport.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | /** 16 | * PHPExcel PDF Export. 17 | */ 18 | class PHPExcelPDFExport extends PHPExcel5Export 19 | { 20 | protected $fileExtension = 'pdf'; 21 | 22 | protected $mimeType = 'application/pdf'; 23 | 24 | protected function getWriter() 25 | { 26 | //$this->objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); 27 | //$this->objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4); 28 | //$this->objPHPExcel->getActiveSheet()->getPageSetup()->setScale(50); 29 | $writer = new \PHPExcel_Writer_PDF($this->objPHPExcel); 30 | $writer->setPreCalculateFormulas(false); 31 | //$writer->setSheetIndex(0); 32 | //$writer->setPaperSize("A4"); 33 | $writer->writeAllSheets(); 34 | 35 | return $writer; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Grid/Export/SCSVExport.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | /** 16 | * Semi-Colon-Separated Values. 17 | */ 18 | class SCSVExport extends CSVExport 19 | { 20 | protected $delimiter = ';'; 21 | } 22 | -------------------------------------------------------------------------------- /Grid/Export/TSVExport.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | /** 16 | * Tab-Separated Values. 17 | */ 18 | class TSVExport extends DSVExport 19 | { 20 | protected $fileExtension = 'tsv'; 21 | 22 | protected $mimeType = 'text/tab-separated-values'; 23 | 24 | protected $delimiter = "\t"; 25 | } 26 | -------------------------------------------------------------------------------- /Grid/Export/XMLExport.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Export; 14 | 15 | use APY\DataGridBundle\Grid\Grid; 16 | use Symfony\Component\Serializer\Encoder\XmlEncoder; 17 | use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer; 18 | use Symfony\Component\Serializer\Serializer; 19 | 20 | /** 21 | * XML. 22 | */ 23 | class XMLExport extends Export 24 | { 25 | protected $fileExtension = 'xml'; 26 | 27 | protected $mimeType = 'application/xml'; 28 | 29 | public function computeData(Grid $grid) 30 | { 31 | if (defined(XmlEncoder::class.'::ROOT_NODE_NAME')) { 32 | $xmlEncoder = new XmlEncoder([XmlEncoder::ROOT_NODE_NAME => 'grid']); 33 | } else { 34 | $xmlEncoder = new XmlEncoder(); 35 | $xmlEncoder->setRootNodeName('grid'); 36 | } 37 | $serializer = new Serializer([new GetSetMethodNormalizer()], [XmlEncoder::FORMAT => $xmlEncoder]); 38 | 39 | $data = $this->getGridData($grid); 40 | 41 | $convertData['titles'] = $data['titles']; 42 | $convertData['rows']['row'] = $data['rows']; 43 | 44 | $this->content = $serializer->serialize($convertData, XmlEncoder::FORMAT); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Grid/Filter.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid; 14 | 15 | class Filter 16 | { 17 | protected $value; 18 | protected $operator; 19 | protected $columnName; 20 | 21 | /** 22 | * @param string $operator 23 | * @param mixed|null $value 24 | * @param string|null $columnName 25 | */ 26 | public function __construct($operator, $value = null, $columnName = null) 27 | { 28 | $this->value = $value; 29 | $this->operator = $operator; 30 | $this->columnName = $columnName; 31 | } 32 | 33 | /** 34 | * @param string $operator 35 | * 36 | * @return Filter 37 | */ 38 | public function setOperator($operator) 39 | { 40 | $this->operator = $operator; 41 | 42 | return $this; 43 | } 44 | 45 | /** 46 | * @return string 47 | */ 48 | public function getOperator() 49 | { 50 | return $this->operator; 51 | } 52 | 53 | /** 54 | * @param mixed $value 55 | * 56 | * @return Filter 57 | */ 58 | public function setValue($value) 59 | { 60 | $this->value = $value; 61 | 62 | return $this; 63 | } 64 | 65 | /** 66 | * @return mixed|null 67 | */ 68 | public function getValue() 69 | { 70 | return $this->value; 71 | } 72 | 73 | /** 74 | * @return bool 75 | */ 76 | public function hasColumnName() 77 | { 78 | return $this->columnName !== null; 79 | } 80 | 81 | /** 82 | * @param string $columnName 83 | * 84 | * @return Filter 85 | */ 86 | public function setColumnName($columnName) 87 | { 88 | $this->columnName = $columnName; 89 | 90 | return $this; 91 | } 92 | 93 | /** 94 | * @return string|null 95 | */ 96 | public function getColumnName() 97 | { 98 | return $this->columnName; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Grid/GridBuilderInterface.php: -------------------------------------------------------------------------------- 1 | getName(); 42 | 43 | if ($this->hasType($name)) { 44 | throw new TypeAlreadyExistsException($name); 45 | } 46 | 47 | $this->types[$name] = $type; 48 | 49 | return $this; 50 | } 51 | 52 | /** 53 | * {@inheritdoc} 54 | */ 55 | public function getType($name) 56 | { 57 | if (!$this->hasType($name)) { 58 | throw new TypeNotFoundException($name); 59 | } 60 | 61 | $type = $this->types[$name]; 62 | 63 | return $type; 64 | } 65 | 66 | /** 67 | * {@inheritdoc} 68 | */ 69 | public function hasType($name) 70 | { 71 | if (isset($this->types[$name])) { 72 | return true; 73 | } 74 | 75 | return false; 76 | } 77 | 78 | /** 79 | * Add a column type. 80 | * 81 | * @param Column $column 82 | * 83 | * @return $this 84 | */ 85 | public function addColumn(Column $column) 86 | { 87 | $type = $column->getType(); 88 | 89 | if ($this->hasColumn($type)) { 90 | throw new ColumnAlreadyExistsException($type); 91 | } 92 | 93 | $this->columns[$type] = $column; 94 | 95 | return $this; 96 | } 97 | 98 | /** 99 | * {@inheritdoc} 100 | */ 101 | public function getColumn($type) 102 | { 103 | if (!$this->hasColumn($type)) { 104 | throw new ColumnNotFoundException($type); 105 | } 106 | 107 | $column = $this->columns[$type]; 108 | 109 | return $column; 110 | } 111 | 112 | /** 113 | * {@inheritdoc} 114 | */ 115 | public function hasColumn($type) 116 | { 117 | if (isset($this->columns[$type])) { 118 | return true; 119 | } 120 | 121 | return false; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /Grid/GridRegistryInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Helper; 14 | 15 | class ColumnsIterator extends \FilterIterator 16 | { 17 | /** @var bool */ 18 | protected $showOnlySourceColumns; 19 | 20 | /** 21 | * @param \Iterator $iterator 22 | * @param $showOnlySourceColumns 23 | */ 24 | public function __construct(\Iterator $iterator, $showOnlySourceColumns) 25 | { 26 | parent::__construct($iterator); 27 | 28 | $this->showOnlySourceColumns = $showOnlySourceColumns; 29 | } 30 | 31 | public function accept(): bool 32 | { 33 | $current = $this->getInnerIterator()->current(); 34 | 35 | return $this->showOnlySourceColumns ? $current->isVisibleForSource() : true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Grid/Mapping/Column.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Mapping; 14 | 15 | /** 16 | * @Annotation 17 | */ 18 | class Column 19 | { 20 | protected $metadata; 21 | protected $groups; 22 | 23 | public function __construct($metadata) 24 | { 25 | $this->metadata = $metadata; 26 | $this->groups = isset($metadata['groups']) ? (array) $metadata['groups'] : ['default']; 27 | } 28 | 29 | public function getMetadata() 30 | { 31 | return $this->metadata; 32 | } 33 | 34 | public function getGroups() 35 | { 36 | return $this->groups; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Grid/Mapping/Driver/DriverInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Mapping\Driver; 14 | 15 | interface DriverInterface 16 | { 17 | public function getClassColumns($class, $group = 'default'); 18 | 19 | public function getFieldsMetadata($class, $group = 'default'); 20 | 21 | public function getGroupBy($class, $group = 'default'); 22 | } 23 | -------------------------------------------------------------------------------- /Grid/Mapping/Metadata/DriverHeap.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | * 12 | * @todo check for column extensions 13 | */ 14 | 15 | namespace APY\DataGridBundle\Grid\Mapping\Metadata; 16 | 17 | class DriverHeap extends \SplPriorityQueue 18 | { 19 | /** 20 | * (non-PHPdoc). 21 | * 22 | * @see SplPriorityQueue::compare() 23 | */ 24 | public function compare($priority1, $priority2): int 25 | { 26 | if ($priority1 === $priority2) { 27 | return 0; 28 | } 29 | 30 | return $priority1 > $priority2 ? -1 : 1; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Grid/Mapping/Metadata/Manager.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | * 12 | * @todo check for column extensions 13 | */ 14 | 15 | namespace APY\DataGridBundle\Grid\Mapping\Metadata; 16 | 17 | class Manager 18 | { 19 | /** 20 | * @var \APY\DataGridBundle\Grid\Mapping\Driver\DriverInterface[] 21 | */ 22 | protected $drivers; 23 | 24 | public function __construct() 25 | { 26 | $this->drivers = new DriverHeap(); 27 | } 28 | 29 | public function addDriver($driver, $priority) 30 | { 31 | $this->drivers->insert($driver, $priority); 32 | } 33 | 34 | /** 35 | * @todo remove this hack 36 | * 37 | * @return \APY\DataGridBundle\Grid\Mapping\Metadata\DriverHeap 38 | */ 39 | public function getDrivers() 40 | { 41 | return clone $this->drivers; 42 | } 43 | 44 | public function getMetadata($className, $group = 'default') 45 | { 46 | $metadata = new Metadata(); 47 | 48 | $columns = $fieldsMetadata = $groupBy = []; 49 | 50 | foreach ($this->getDrivers() as $driver) { 51 | $columns = array_merge($columns, $driver->getClassColumns($className, $group)); 52 | $fieldsMetadata[] = $driver->getFieldsMetadata($className, $group); 53 | $groupBy = array_merge($groupBy, $driver->getGroupBy($className, $group)); 54 | } 55 | 56 | $mappings = $cols = []; 57 | 58 | foreach ($columns as $fieldName) { 59 | $map = []; 60 | 61 | foreach ($fieldsMetadata as $field) { 62 | if (isset($field[$fieldName]) && (!isset($field[$fieldName]['groups']) || in_array($group, (array) $field[$fieldName]['groups']))) { 63 | $map = array_merge($map, $field[$fieldName]); 64 | } 65 | } 66 | 67 | if (!empty($map)) { 68 | $mappings[$fieldName] = $map; 69 | $cols[] = $fieldName; 70 | } 71 | } 72 | 73 | $metadata->setFields($cols); 74 | $metadata->setFieldsMappings($mappings); 75 | $metadata->setGroupBy($groupBy); 76 | 77 | return $metadata; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Grid/Mapping/Metadata/Metadata.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Mapping\Metadata; 14 | 15 | class Metadata 16 | { 17 | protected $name; 18 | protected $fields; 19 | protected $fieldsMappings; 20 | protected $groupBy; 21 | 22 | public function setFields($fields) 23 | { 24 | $this->fields = $fields; 25 | } 26 | 27 | public function getFields() 28 | { 29 | return $this->fields; 30 | } 31 | 32 | public function setFieldsMappings($fieldsMappings) 33 | { 34 | $this->fieldsMappings = $fieldsMappings; 35 | 36 | return $this; 37 | } 38 | 39 | public function hasFieldMapping($field) 40 | { 41 | return isset($this->fieldsMappings[$field]); 42 | } 43 | 44 | public function getFieldMapping($field) 45 | { 46 | return $this->fieldsMappings[$field]; 47 | } 48 | 49 | public function getFieldMappingType($field) 50 | { 51 | return (isset($this->fieldsMappings[$field]['type'])) ? $this->fieldsMappings[$field]['type'] : 'text'; 52 | } 53 | 54 | public function setGroupBy($groupBy) 55 | { 56 | $this->groupBy = $groupBy; 57 | 58 | return $this; 59 | } 60 | 61 | public function getGroupBy() 62 | { 63 | return $this->groupBy; 64 | } 65 | 66 | public function setName($name) 67 | { 68 | $this->name = $name; 69 | 70 | return $this; 71 | } 72 | 73 | public function getName() 74 | { 75 | return $this->name; 76 | } 77 | 78 | /** 79 | * @todo move to another place 80 | * 81 | * @param $columnExtensions 82 | * 83 | * @throws \Exception 84 | * 85 | * @return \SplObjectStorage 86 | */ 87 | public function getColumnsFromMapping($columnExtensions) 88 | { 89 | $columns = new \SplObjectStorage(); 90 | 91 | foreach ($this->getFields() as $value) { 92 | $params = $this->getFieldMapping($value); 93 | $type = $this->getFieldMappingType($value); 94 | 95 | /* todo move available extensions from columns */ 96 | if ($columnExtensions->hasExtensionForColumnType($type)) { 97 | $column = clone $columnExtensions->getExtensionForColumnType($type); 98 | $column->__initialize($params); 99 | $columns->attach($column); 100 | } else { 101 | throw new \Exception(sprintf('No suitable Column Extension found for column type: %s', $type)); 102 | } 103 | } 104 | 105 | return $columns; 106 | } 107 | 108 | /** 109 | * Get the value of fieldsMappings 110 | */ 111 | public function getFieldsMappings() 112 | { 113 | return $this->fieldsMappings; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /Grid/Mapping/Source.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid\Mapping; 14 | 15 | /** 16 | * @Annotation 17 | */ 18 | class Source 19 | { 20 | protected $columns; 21 | protected $filterable; 22 | protected $sortable; 23 | protected $groups; 24 | protected $groupBy; 25 | 26 | public function __construct($metadata = []) 27 | { 28 | $this->columns = (isset($metadata['columns']) && $metadata['columns'] != '') ? array_map('trim', explode(',', $metadata['columns'])) : []; 29 | $this->filterable = isset($metadata['filterable']) ? $metadata['filterable'] : true; 30 | $this->sortable = isset($metadata['sortable']) ? $metadata['sortable'] : true; 31 | $this->groups = (isset($metadata['groups']) && $metadata['groups'] != '') ? (array) $metadata['groups'] : ['default']; 32 | $this->groupBy = (isset($metadata['groupBy']) && $metadata['groupBy'] != '') ? (array) $metadata['groupBy'] : []; 33 | } 34 | 35 | public function getColumns() 36 | { 37 | return $this->columns; 38 | } 39 | 40 | public function hasColumns() 41 | { 42 | return !empty($this->columns); 43 | } 44 | 45 | public function isFilterable() 46 | { 47 | return $this->filterable; 48 | } 49 | 50 | public function isSortable() 51 | { 52 | return $this->sortable; 53 | } 54 | 55 | public function getGroups() 56 | { 57 | return $this->groups; 58 | } 59 | 60 | public function getGroupBy() 61 | { 62 | return $this->groupBy; 63 | } 64 | 65 | /** 66 | * Get the value of sortable 67 | */ 68 | public function getSortable() 69 | { 70 | return $this->sortable; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Grid/Rows.php: -------------------------------------------------------------------------------- 1 | 7 | * (c) Stanislav Turza 8 | * 9 | * For the full copyright and license information, please view the LICENSE 10 | * file that was distributed with this source code. 11 | */ 12 | 13 | namespace APY\DataGridBundle\Grid; 14 | 15 | class Rows implements \IteratorAggregate, \Countable 16 | { 17 | /** @var \SplObjectStorage */ 18 | protected $rows; 19 | 20 | /** 21 | * @param array $rows 22 | */ 23 | public function __construct(array $rows = []) 24 | { 25 | $this->rows = new \SplObjectStorage(); 26 | 27 | foreach ($rows as $row) { 28 | $this->addRow($row); 29 | } 30 | } 31 | 32 | /** 33 | * (non-PHPdoc). 34 | * 35 | * @see IteratorAggregate::getIterator() 36 | */ 37 | public function getIterator(): \Traversable 38 | { 39 | return $this->rows; 40 | } 41 | 42 | /** 43 | * Add row. 44 | * 45 | * @param Row $row 46 | * 47 | * @return Rows 48 | */ 49 | public function addRow(Row $row) 50 | { 51 | $this->rows->attach($row); 52 | 53 | return $this; 54 | } 55 | 56 | /** 57 | * (non-PHPdoc). 58 | * 59 | * @see Countable::count() 60 | */ 61 | public function count(): int 62 | { 63 | return $this->rows->count(); 64 | } 65 | 66 | /** 67 | * Returns the iterator as an array. 68 | * 69 | * @return array 70 | */ 71 | public function toArray() 72 | { 73 | return iterator_to_array($this->getIterator(), true); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Grid/Type/GridType.php: -------------------------------------------------------------------------------- 1 | setRoute($options['route']) 23 | ->setRouteParameters($options['route_parameters']) 24 | ->setPersistence($options['persistence']) 25 | ->setPage($options['page']) 26 | ->setMaxResults($options['max_results']) 27 | ->setMaxPerPage($options['max_per_page']) 28 | ->setFilterable($options['filterable']) 29 | ->setSortable($options['sortable']) 30 | ->setSortBy($options['sort_by']) 31 | ->setOrder($options['order']) 32 | ->setGroupBy($options['group_by']); 33 | 34 | if (!empty($options['source'])) { 35 | $builder->setSource($options['source']); 36 | } 37 | } 38 | 39 | /** 40 | * {@inheritdoc} 41 | */ 42 | public function configureOptions(OptionsResolver $resolver) 43 | { 44 | $resolver->setDefaults([ 45 | 'source' => null, 46 | 'group_by' => null, 47 | 'sort_by' => null, 48 | 'order' => 'asc', 49 | 'page' => 1, 50 | 'route' => '', 51 | 'route_parameters' => [], 52 | 'persistence' => false, 53 | 'max_per_page' => 10, 54 | 'max_results' => null, 55 | 'filterable' => true, 56 | 'sortable' => true, 57 | ]); 58 | 59 | $allowedTypes = [ 60 | 'source' => ['null', 'APY\DataGridBundle\Grid\Source\Source'], 61 | 'group_by' => ['null', 'string', 'array'], 62 | 'route_parameters' => 'array', 63 | 'persistence' => 'bool', 64 | 'filterable' => 'bool', 65 | 'sortable' => 'bool', 66 | ]; 67 | $allowedValues = [ 68 | 'order' => ['asc', 'desc'], 69 | ]; 70 | if (method_exists($resolver, 'setDefault')) { 71 | // Symfony 2.6.0 and up 72 | foreach ($allowedTypes as $option => $types) { 73 | $resolver->setAllowedTypes($option, $types); 74 | } 75 | 76 | foreach ($allowedValues as $option => $values) { 77 | $resolver->setAllowedValues($option, $values); 78 | } 79 | } else { 80 | $resolver->setAllowedTypes($allowedTypes); 81 | $resolver->setAllowedValues($allowedValues); 82 | } 83 | } 84 | 85 | /** 86 | * {@inheritdoc} 87 | */ 88 | public function getName() 89 | { 90 | return 'grid'; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2017 Stanislav Turza - Abhoryo 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Resources/config/grid.yml: -------------------------------------------------------------------------------- 1 | services: 2 | # Core 3 | apy_grid.factory: 4 | class: APY\DataGridBundle\Grid\GridFactory 5 | arguments: ['@service_container', '@security.authorization_checker', '@twig', '@apy_grid.registry'] 6 | apy_grid.registry: 7 | class: APY\DataGridBundle\Grid\GridRegistry 8 | APY\DataGridBundle\Grid\GridFactoryInterface: 9 | alias: 'apy_grid.factory' 10 | APY\DataGridBundle\Grid\GridRegistryInterface: 11 | alias: 'apy_grid.registry' 12 | 13 | # Types 14 | apy_grid.type.grid: 15 | class: APY\DataGridBundle\Grid\Type\GridType 16 | tags: 17 | - { name: apy_grid.type } 18 | 19 | # Columns 20 | apy_grid.column.text: 21 | class: APY\DataGridBundle\Grid\Column\TextColumn 22 | tags: 23 | - { name: apy_grid.column } 24 | apy_grid.column.array: 25 | class: APY\DataGridBundle\Grid\Column\ArrayColumn 26 | tags: 27 | - { name: apy_grid.column } 28 | apy_grid.column.blank: 29 | class: APY\DataGridBundle\Grid\Column\BlankColumn 30 | tags: 31 | - { name: apy_grid.column } 32 | apy_grid.column.boolean: 33 | class: APY\DataGridBundle\Grid\Column\BooleanColumn 34 | tags: 35 | - { name: apy_grid.column } 36 | apy_grid.column.date: 37 | class: APY\DataGridBundle\Grid\Column\DateColumn 38 | tags: 39 | - { name: apy_grid.column } 40 | apy_grid.column.date_time: 41 | class: APY\DataGridBundle\Grid\Column\DateTimeColumn 42 | tags: 43 | - { name: apy_grid.column } 44 | apy_grid.column.join: 45 | class: APY\DataGridBundle\Grid\Column\JoinColumn 46 | tags: 47 | - { name: apy_grid.column } 48 | apy_grid.column.number: 49 | class: APY\DataGridBundle\Grid\Column\NumberColumn 50 | tags: 51 | - { name: apy_grid.column } 52 | apy_grid.column.rank: 53 | class: APY\DataGridBundle\Grid\Column\RankColumn 54 | tags: 55 | - { name: apy_grid.column } 56 | apy_grid.column.time: 57 | class: APY\DataGridBundle\Grid\Column\TimeColumn 58 | tags: 59 | - { name: apy_grid.column } 60 | -------------------------------------------------------------------------------- /Resources/config/services.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | APY\DataGridBundle\Twig\DataGridExtension 9 | APY\DataGridBundle\Grid\Grid 10 | APY\DataGridBundle\Grid\GridManager 11 | 12 | 13 | 14 | 15 | 16 | 17 | %apy_data_grid.theme% 18 | 19 | %apy_data_grid.pagerfanta% 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | %apy_data_grid.limits% 29 | 30 | 31 | %apy_data_grid.persistence% 32 | 33 | 34 | %apy_data_grid.no_data_message% 35 | 36 | 37 | %apy_data_grid.no_result_message% 38 | 39 | 40 | %apy_data_grid.actions_columns_size% 41 | 42 | 43 | %apy_data_grid.actions_columns_title% 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 1 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/annotations/association_mapping.md: -------------------------------------------------------------------------------- 1 | ORM association mapping support with `.` notation 2 | ================================================= 3 | 4 | Example of an association with multi related fields on the same property. 5 | 6 | ```php 7 | title = "category.name"` 89 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/annotations/column_annotation_class.md: -------------------------------------------------------------------------------- 1 | Column Annotation for a class 2 | ============================= 3 | 4 | The Column annotation for a class allows to add a non-mapped source column. 5 | 6 | Example: 7 | ```php 8 | = -1
(-1 means auto resize)|Size of the column| 29 | |type|string|text|text, boolean, date, datetime, array, blank|Type of the column.| 30 | |sortable|boolean|true|true or false|Sets the possibility of sortering of the column| 31 | |filterable|boolean|true|true or false|Sets the possibility of filtering of the column| 32 | |visible|boolean|true|true or false|Sets the visibilty of the column| 33 | |align|string|left|left, right or center|Sets the text alignment with a CSS class| 34 | |role|string||A symfony role|Sets the visiblity of the column to false if the access isn't granted for the defined role| 35 | |groups|string
or
array|Example: groups="group1",
groups={"group1"}, groups={"group1", "group2"}||Use this attribute to define more than one configuration for an Entity/Document.
If no groups is defined, the annotation is attributed for all groups.
$source = new Entity('MyProjectMyBundle:MyEntity', 'my_group');| 36 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/annotations/source_annotation.md: -------------------------------------------------------------------------------- 1 | Source Annotation for a class 2 | ============================= 3 | 4 | The Source annotation for a class allows to configure the grid. 5 | It's optional if you have declare Column annotation for your properties. 6 | 7 | ## Example 8 | ```php 9 | The primary key have to be defined in this list.| 33 | |filterable|boolean|false|true or false|Sets the default filterable value of all columns| 34 | |sortable|boolean|false|true or false|Sets the default sortable value of all columns| 35 | |groups|string
or
array|Example: groups="group1",
groups={"group1"}, groups={"group1", "group2"}||Use this attribute to define more than one configuration for an Entity/Document.
If no groups is defined, the annotation is attributed for all groups.
$source = new Entity('MyProjectMyBundle:MyEntity', 'my_group');| 36 | |groupBy|string
or
array|Example: groupBy="property1",
groupBy={"property1"}, groupBy={"property1", "property2"}||Use this attribute to add groupBy fields to the query| 37 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/filters/create_filter.md: -------------------------------------------------------------------------------- 1 | Create a filter 2 | =============== 3 | 4 | If you want another filter than the input and the select filters you can create your own filter. 5 | You just have to create your template for your filter and call it in the `filter` attribute of a column. 6 | 7 | **Note**: The name of your filter is converted to lowercase. 8 | 9 | ## Example with another input filter: 10 | 11 | #### Create the template 12 | 13 | This template is the input filter but with a different name. 14 | 15 | ```janjo 16 | {% block grid_column_filter_type_input2 %} 17 | 18 | {# Operator #} 19 | {% set btwOperator = constant('APY\\DataGridBundle\\Grid\\Column\\Column::OPERATOR_BTW') %} 20 | {% set btweOperator = constant('APY\\DataGridBundle\\Grid\\Column\\Column::OPERATOR_BTWE') %} 21 | {% set isNullOperator = constant('APY\\DataGridBundle\\Grid\\Column\\Column::OPERATOR_ISNULL') %} 22 | {% set isNotNullOperator = constant('APY\\DataGridBundle\\Grid\\Column\\Column::OPERATOR_ISNOTNULL') %} 23 | {% set op = column.data.operator is defined ? column.data.operator : column.defaultOperator %} 24 | 25 | {# Query #} 26 | {% set from = column.data.from is defined ? column.data.from : null %} 27 | {% set to = column.data.to is defined ? column.data.to : null %} 28 | 29 | {# Display #} 30 | 31 | {{ block('grid_column_operator')}} 32 | 33 | 34 | 35 | 36 | 37 | 38 | {% endblock grid_column_filter_type_input2 %} 39 | ``` 40 | 41 | #### Call your new filter 42 | 43 | In your column annotation configuration: 44 | 45 | ``` 46 | /* 47 | * @GRID/Column(filter="input2") 48 | */ 49 | protected $description; 50 | ``` 51 | 52 | OR in PHP: 53 | 54 | ```php 55 | setSource($source); 58 | 59 | $grid->getColumn('description')->setFilterType('input2'); 60 | ... 61 | ``` 62 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/filters/input_filter.md: -------------------------------------------------------------------------------- 1 | Input filter 2 | ============ 3 | 4 | This type of filter displays an input field. 5 | 6 | A second input field is displayed if you select a range operator (between). 7 | 8 | The two input fields are disabled if you select the `Is defined` and `Is not defined` operators. 9 | 10 | ### Additionnal attributes for a column annotation for a property 11 | 12 | |Attribute|Type|Default value|Possible values|Description| 13 | |:--:|:--|:--|:--|:--| 14 | |inputType|string|text||Define the type of inputs. See [HTML5 input types](http://www.w3schools.com/html5/html5_form_input_types.asp)| 15 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/filters/select_filter.md: -------------------------------------------------------------------------------- 1 | Select filter 2 | ============= 3 | 4 | This type of filter displays a choices selector instead of an input field. 5 | This selector can be filled by the query result, the source or an array of values. 6 | 7 | A second selector is displayed if you select a range oparator (between). 8 | 9 | The two selectors are disabled if the `Is defined` operator or the `Is not defined` operator are selected. 10 | 11 | 12 | ## Annotation 13 | 14 | #### Additionnal attributes 15 | 16 | |Attribute|Type|Default value|Possible values|Description| 17 | |:--:|:--|:--|:--|:--| 18 | |selectFrom|string|query|query, source or values|How to populate the selector of the select filters of the column.| 19 | |selectMulti|boolean|false|true/false|Set to true for multiple select. 20 | |selectExpanded|boolean|false|true/false|If sets to true, radio buttons or checkboxes (depending on the multiple value) will be rendered instead of a select element. 21 | |values|array|||Define the options values of the selector if selectFrom is set to `values` or if you want to replace values in the grid.| 22 | 23 | ## selectFrom informations 24 | 25 | When you choose a select filter for a column, you have three way to populate your selector: 26 | 27 | * `query` means that the selectors of the select filter will be populated by the values found in the current search. If no result is found, they will be populated with all values found in the source. 28 | 29 | * `source` means that the selectors of the select filter will be populated by all values found in the source. 30 | 31 | * `values` means that the selectors of the select filter will be populated by the values define in the `values` parameter. 32 | 33 | #### Examples 34 | 35 | From values: 36 | 37 | ```php 38 | setSource($source); 18 | 19 | // Add a column with a rendering callback 20 | $MyColumn = new BlankColumn(array('id'=>'informations', 'title'=>'informations')); 21 | 22 | $MyColumn->manipulateRenderCell(function($value, $row, $router) { 23 | return $row->getField('column4') . "
" . $row->getField('column5'); 24 | }); 25 | 26 | $grid->addColumn($MyColumn); 27 | ... 28 | ``` 29 | 30 | ### Overriding column block 31 | 32 | ```php 33 | ... 34 | $grid->setSource($source); 35 | 36 | $MyColumn = new BlankColumn(array('id'=>'informations', 'title'=>'informations')); 37 | 38 | $grid->addColumn($MyColumn); 39 | ... 40 | ``` 41 | 42 | ```django 43 | {% block grid_column_informations_cell %} 44 | {{ row.field('column4') }} 45 |
46 | {{ row.field('column5') }} 47 | {% endblock grid_column_informations_cell %} 48 | ``` 49 | 50 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/types/boolean_column.md: -------------------------------------------------------------------------------- 1 | Boolean Column 2 | ============== 3 | 4 | This column show by default a select filter with true/false values and the selector operator is not visible. Only the `eq` operator is used. 5 | 6 | ## Annotation 7 | ### Inherited Attributes 8 | 9 | See [Column annotation for properties](../annotations/column_annotation_property.md). 10 | 11 | ### Additionnal attributes 12 | 13 | See [Select filter - additionnal attributes](../filters/select_filter.md#additionnal-attributes) 14 | 15 | ## Filter 16 | ### Valid values 17 | 18 | 1 and 0 ####### A vérifier pour les entier 19 | 20 | ### Default Operator: `eq` 21 | 22 | ### Available Operators 23 | 24 | |Operator|Meaning| 25 | |:--|--:| 26 | |eq|Equals| 27 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/types/create_column.md: -------------------------------------------------------------------------------- 1 | Create a column 2 | =============== 3 | 4 | If the default types of column don't satisfy your application, you can create another column type or extend a existing one. 5 | 6 | First of all you have to extends the abstract Column class and give a name to your new column. 7 | 8 | ## Example informations 9 | 10 | We'll try to create a column to show the video of the preview in a column. 11 | 12 | The video path is store in the $preview property 13 | 14 | ## Extend the Column class 15 | 16 | ```php 17 | 36 | ... 37 | 38 | 39 | 40 | ... 41 | 42 | ``` 43 | 44 | ## Test your new column 45 | 46 | Clear your cache. 47 | Now you can use your new column type in annotation. 48 | 49 | ```php 50 | setPlayerFormat($this->getParam('playerFormat')); 85 | 86 | // Disable the filter of the column 87 | $this->setFilterable(false); 88 | $this->setOrder(false); 89 | } 90 | 91 | public function setPlayerFormat($playerFormat) 92 | { 93 | $this->playerFormat = $playerFormat; 94 | 95 | return $this; 96 | } 97 | 98 | public function getPlayerFormat() 99 | { 100 | return $this->playerFormat; 101 | } 102 | 103 | public function getType() 104 | { 105 | return 'video'; 106 | } 107 | } 108 | ``` 109 | 110 | ## Display the player 111 | 112 | In your twig template: 113 | 114 | ```janjo 115 | 116 | {% extends '@APYDataGrid/blocks.html.twig' %} 117 | 118 | {% block grid_column_type_video_cell %} 119 | {# Show your player with the file path store in the variable {{ value }} #} 120 | {% endblock grid_column_type_video_cell %} 121 | ``` 122 | 123 | ## Advanced column 124 | 125 | See the code of the default column types. -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/types/date_column.md: -------------------------------------------------------------------------------- 1 | Date Column 2 | =========== 3 | 4 | The Date Column extends the [DateTime Column](datetime_column.md) and the default fallback format and filter input format are `Y-m-d`. 5 | 6 | With this column, the time part of a datetime value is ignored when you filter the column. 7 | So, if you filter the column with the value `2012-04-26` or `2012-04-26 12:23:45` and with the operator `=`, the query will be `date >= '2012-04-26 0:00:00' AND date <= '2012-04-26 23:59:59'`. 8 | **Note**: We don't use the between operator because its behavior isn't the same for each database. 9 | 10 | 11 | ## Annotation 12 | 13 | See [DateTime Column](datetime_column.md#annotation). 14 | 15 | ## Filter 16 | 17 | See [DateTime Column](datetime_column.md#filter). 18 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/types/datetime_column.md: -------------------------------------------------------------------------------- 1 | DateTime Column 2 | =============== 3 | 4 | If no format is defined, the datetime is converted based on the locale and the time zone. 5 | If no format and if the Intl extension is not installed, a fallback format is used (Y-m-d H:i:s) 6 | 7 | ## Annotation 8 | #### Inherited Attributes 9 | 10 | See [Column annotation for properties](../annotations/column_annotation_property.md). 11 | 12 | #### Additionnal attributes 13 | 14 | |Attribute|Type|Default value|Possible values|Description| 15 | |:--:|:--|:--|:--|:--| 16 | |format|string| | |Define this attribute if you want to force the format of the displayed value.
(e.g. "Y-m-d H:i:s")| 17 | |timezone|string|System default timezone| |The timezone to use for rendering.
(e.g. "Europe/Paris")| 18 | |inputFormat|string|"Y-m-d H:i:s"| |Define this attribute if you want to force the format of the filtered value.
(e.g. "Y-m-d H:i:s")| 19 | 20 | **Note**: If you want to filter using date input (and not datetime input), you should use the [Date Column](date_column.md) type instead and configure the display format to render the time (e.g. "Y-m-d H:i:s"). 21 | 22 | ## Filter 23 | #### Valid values 24 | 25 | Everything that a DateTime instance can understand. 26 | Wrong values are ignored. 27 | 28 | #### Default Operator: `eq` 29 | 30 | #### Available Operators 31 | 32 | |Operator|Meaning| 33 | |:--:|:--| 34 | |eq|Equals| 35 | |neq|Not equal to| 36 | |lt|Lower than| 37 | |lte|Lower than or equal to| 38 | |gt|Greater than| 39 | |gte|Greater than or equal to| 40 | |like|Contains| 41 | |nlike|Not contain| 42 | |rlike|Starts with| 43 | |llike|Ends with| 44 | |btw|Between exclusive| 45 | |btwe|Between inclusive| 46 | |isNull|Is not defined| 47 | |isNotNull|Is defined| 48 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/types/join_column.md: -------------------------------------------------------------------------------- 1 | Join Column 2 | =========== 3 | 4 | Render several **text** columns inside this join column. 5 | This join column is sortable, filterable and you can also activate the 'search on click' feature. 6 | 7 | By default, a disjunction (OR operator) is performed with each column. 8 | 9 | 10 | ## Annotation 11 | #### Inherited Attributes 12 | 13 | See [Column annotation for properties](../annotations/column_annotation_property.md). 14 | 15 | **Note**: `id` attribute is required. 16 | **Note²**: The `source` and `isManuallyField` are forced to `true`. 17 | 18 | ### Additionnal attributes 19 | 20 | |Attribute|Type|Default value|Possible values|Description| 21 | |:--:|:--|:--|:--|:--| 22 | |columns|array|empty|The name of the columns|Name of the columns you want to show in this column| 23 | 24 | **Note**: Columns listed in the `columns` attributes must be declared too. 25 | 26 | ## Example 27 | 28 | ```php 29 | $grid = $this->get('grid'); 30 | 31 | $column = new JoinColumn(array('id' => 'my_join_column', 'title' => 'Full name', 'columns' => array('lastname', 'firstname'))); 32 | 33 | $grid->addColumn($column); 34 | ``` 35 | 36 | Or with a [Class column annotation](columns_configuration/annotations/column_annotation_class.md): 37 | 38 | ``` 39 | /** 40 | * @ORM\Entity 41 | * @ORM\Table(name="customer") 42 | * 43 | * @GRID\Source(columns="id, my_join_column") 44 | * @GRID\Column(id="my_join_column", type="join", title="Full name", columns={"lastname", "firstname"}) 45 | */ 46 | class Customer 47 | ``` 48 | 49 | ## Filter 50 | #### Valid values 51 | 52 | Everything. 53 | 54 | #### Default Operator: `like` 55 | 56 | #### Available Operators 57 | 58 | |Operator|Meaning| 59 | |:--|--:| 60 | |eq|Equals| 61 | |neq|Not equal to| 62 | |lt|Lower than| 63 | |lte|Lower than or equal to| 64 | |gt|Greater than| 65 | |gte|Greater than or equal to| 66 | |like|Contains (case insensitive)| 67 | |nlike|Not contain (case insensitive)| 68 | |rlike|Starts with (case insensitive)| 69 | |llike|Ends with (case insensitive)| 70 | |slike|Contains| 71 | |nslike|Not contain| 72 | |rslike|Starts with| 73 | |lslike|Ends with| 74 | |btw|Between exclusive| 75 | |btwe|Between inclusive| 76 | |isNull|Is not defined| 77 | |isNotNull|Is defined| 78 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/types/number_column.md: -------------------------------------------------------------------------------- 1 | Number Column 2 | ============= 3 | 4 | This column convert numbers based on the locale (e.g. `en`). The country is also used for currency number(e.g. `en_US`). 5 | 6 | **Note**: If you use a full locale denomination (e.g. `en_US`), don't set the translation fallback to this locale. It's avoid an temporary exception after clearing your cache. 7 | E.g. set the fallback to `en` for the locale `en_US`. 8 | 9 | 10 | ## Annotation 11 | #### Inherited Attributes 12 | 13 | See [Column annotation for properties](../annotations/column_annotation_property.md). 14 | 15 | ### Additionnal attributes 16 | 17 | |Attribute|Type|Default value|Possible values|Description| 18 | |:--:|:--|:--|:--|:--| 19 | |style|string|decimal|decimal, currency, percent,
duration, scientific, spellout|Type of the number you want to manage| 20 | |locale|string|'en' for the style `duration`||Set this attribute to force the locale| 21 | |precision|integer|0|Integer|Define the number of number after the comma| 22 | |grouping|boolean|false|true or false|Set to true to group numbers| 23 | |roundingMode|integer|Round half up|See [\NumberFormatter::ROUND_*](http://php.net/manual/en/class.numberformatter.php) values.|How do you want to round a decimal number if precision is defined.| 24 | |ruleSet|string|'%in-numerals' for the style `duration`|A rule set pattern|Set this attribute to define a particular behavior of the NumberFormatter.| 25 | |currencyCode|string|Locale currency code|ISO 4217 Code
(e.g. USD, EUR)|Set this attribute to force the currency code| 26 | |fractional|boolean|false|true or false|Set to true if your number is a fractional number (e.g. 0.5 instead of 50 for 50%)| 27 | 28 | ## Filter 29 | #### Valid values 30 | 31 | Numeric values. 32 | 33 | #### Default Operator: `eq` 34 | 35 | #### Available Operators 36 | 37 | |Operator|Meaning| 38 | |:--:|:--| 39 | |eq|Equals| 40 | |neq|Not equal to| 41 | |lt|Lower than| 42 | |lte|Lower than or equal to| 43 | |gt|Greater than| 44 | |gte|Greater than or equal to| 45 | |btw|Between exclusive| 46 | |btwe|Between inclusive| 47 | |isNull|Is not defined| 48 | |isNotNull|Is defined| 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/types/rank_column.md: -------------------------------------------------------------------------------- 1 | Rank Column 2 | ============== 3 | 4 | This column show the rank of a row in the grid with filters. 5 | This column isn't sortable and filterable. 6 | 7 | ## Annotation 8 | ### Inherited Attributes 9 | 10 | See [Column annotation for properties](../annotations/column_annotation_property.md). 11 | 12 | **Note**: If you use this column in annotation, values of the column will be overwrited in the render. 13 | 14 | ### Default id: `rank` 15 | 16 | ### Default title: `rank` 17 | 18 | ### Default size: `30` 19 | 20 | ### Default align: `center` 21 | 22 | ## PHP 23 | 24 | ```php 25 | $grid->addColumn(new RankColumn(array('title'=>'track')), 1); 26 | ``` -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/types/text_column.md: -------------------------------------------------------------------------------- 1 | Text Column 2 | =========== 3 | 4 | ## Annotation 5 | #### Inherited Attributes 6 | 7 | See [Column annotation for properties](../annotations/column_annotation_property.md). 8 | 9 | #### Additionnal attributes 10 | 11 | None 12 | 13 | ## Filter 14 | #### Valid values 15 | 16 | Everything. 17 | 18 | #### Default Operator: `like` 19 | 20 | #### Available Operators 21 | 22 | |Operator|Meaning| 23 | |:--|--:| 24 | |eq|Equals| 25 | |neq|Not equal to| 26 | |lt|Lower than| 27 | |lte|Lower than or equal to| 28 | |gt|Greater than| 29 | |gte|Greater than or equal to| 30 | |like|Contains (case insensitive)| 31 | |nlike|Not contain (case insensitive)| 32 | |rlike|Starts with (case insensitive)| 33 | |llike|Ends with (case insensitive)| 34 | |slike|Contains| 35 | |nslike|Not contain| 36 | |rslike|Starts with| 37 | |lslike|Ends with| 38 | |btw|Between exclusive| 39 | |btwe|Between inclusive| 40 | |isNull|Is not defined| 41 | |isNotNull|Is defined| -------------------------------------------------------------------------------- /Resources/doc/columns_configuration/types/time_column.md: -------------------------------------------------------------------------------- 1 | Time Column 2 | =========== 3 | 4 | **The Time Column is a clone of the DateTime Column but it displayed only the time.** 5 | **So the order does not correspond to what you'll see.** 6 | 7 | If no format and if the Intl extension is not installed, a fallback format is used (H:i:s) -------------------------------------------------------------------------------- /Resources/doc/configuration.md: -------------------------------------------------------------------------------- 1 | # APYDataGrid Configuration Reference 2 | 3 | All available configuration options are listed below with their default values. 4 | 5 | ```yaml 6 | apy_data_grid: 7 | limits: [20, 50, 100] 8 | persistence: false 9 | theme: '@APYDataGrid/blocks.html.twig' 10 | no_data_message: "No data" 11 | no_result_message: "No result" 12 | actions_columns_size: -1 13 | actions_columns_title: "Actions" 14 | actions_columns_separator: "
" 15 | pagerfanta: 16 | enable: false 17 | view_class: "Pagerfanta\\View\\DefaultView" 18 | options: 19 | prev_message: "«" 20 | next_message: "»" 21 | ``` 22 | -------------------------------------------------------------------------------- /Resources/doc/export/index.md: -------------------------------------------------------------------------------- 1 | # Export 2 | 3 | APYDataGrid bundle provides different ways for export your datas. This bundle proposes native exports such as a CSV or a JSON export and library-dependent exports such as Excel and PDF exports but everything is made that it is really easy to create your own export. 4 | 5 | > Note: An export don't export mass action and row actions columns. 6 | 7 | ## Native Exports 8 | 9 | * [CSV Export](native_exports/CSV_export.md) 10 | * [DSV Export](native_exports/DSV_export.md) 11 | * [Excel Export](native_exports/Excel_export.md) 12 | * [JSON Export](native_exports/JSON_export.md) 13 | * [SCVS Export](native_exports/SCVS_export.md) 14 | * [TSV Export](native_exports/TSV_export.md) 15 | * [XML Export](native_exports/XML_export.md) 16 | 17 | ## External Library Exports 18 | 19 | ### With PHPExcel 20 | 21 | Add the following package to your composer.json file: 22 | 23 | ```bash 24 | $ composer require phpoffice/phpexcel "dev-master" 25 | ``` 26 | 27 | * [PHPExcel Excel 2007 Export](library-dependent_exports/PHPExcel/PHPExcel_excel2007_export.md) 28 | * [PHPExcel Excel 2003 Export](library-dependent_exports/PHPExcel/PHPExcel_excel2003_export.md) 29 | * [PHPExcel Excel 5 (97-2003) Export](library-dependent_exports/PHPExcel/PHPExcel_excel5_export.md) 30 | * [PHPExcel Simple HTML Export](library-dependent_exports/PHPExcel/PHPExcel_HTML_export.md) 31 | * [PHPExcel simple PDF export](library-dependent_exports/PHPExcel/PHPExcel_PDF_export.md) 32 | 33 | ## Cook Book 34 | 35 | * [How to create your custom export](create_export.md) -------------------------------------------------------------------------------- /Resources/doc/export/library-dependent_exports/PHPExcel/PHPExcel_HTML_export.md: -------------------------------------------------------------------------------- 1 | PHPExcel simple HTML export 2 | ================================= 3 | 4 | File extension = `html` 5 | Mime type = `text/html` 6 | 7 | **Note**: This export is limited to 52 columns. 8 | 9 | ## Usage 10 | ```php 11 | setSource($source); 16 | 17 | $grid->addExport(new PHPExcelHTMLExport($title, $fileName, $params, $charset, $role)); 18 | ... 19 | ``` 20 | 21 | #### PHPExcelHTMLExport::__construct parameters 22 | 23 | |parameter|Type|Default value|Description| 24 | |:--:|:--|:--|:--|:--| 25 | |title|string||Title of the export in the selector.| 26 | |fileName|string|export|Name of the export file without the extension.| 27 | |params|array|array()|Additionnal parameters.| 28 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 29 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 30 | 31 | ## Additional parameters for the export 32 | 33 | _None_ 34 | 35 | ## Example 36 | 37 | ```php 38 | setSource($source); 41 | 42 | $grid->addExport(new PHPExcelHTMLExport('Simple HTML Export')); 43 | ... 44 | ``` 45 | 46 | ## Configure the export 47 | 48 | This export provides the object `objPHPExcel`. You can manipulate this PHPExcel object. 49 | See the ducmentation `PHPExcel developer documentation.doc` on the [official website](http://phpexcel.codeplex.com/) 50 | 51 | 52 | ```php 53 | setSource($source); 56 | 57 | $export = new PHPExcelHTMLExport('Simple HTML Export'); 58 | 59 | $export->objPHPExcel->getProperties()->setCreator("Maarten Balliauw"); 60 | $export->objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw"); 61 | $export->objPHPExcel->getProperties()->setTitle("Office Test Document"); 62 | $export->objPHPExcel->getProperties()->setSubject("Office Test Document"); 63 | $export->objPHPExcel->getProperties()->setDescription("Test document for Office, generated using PHP classes."); 64 | $export->objPHPExcel->getProperties()->setKeywords("office php"); 65 | $export->objPHPExcel->getProperties()->setCategory("Test result file"); 66 | 67 | $grid->addExport(export); 68 | ... 69 | ``` 70 | -------------------------------------------------------------------------------- /Resources/doc/export/library-dependent_exports/PHPExcel/PHPExcel_PDF_export.md: -------------------------------------------------------------------------------- 1 | PHPExcel simple PDF export (Not working!) 2 | ========================================= 3 | 4 | File extension = `pdf` 5 | Mime type = `application/pdf` 6 | 7 | **Note**: This export is limited to 52 columns. 8 | 9 | ## Usage 10 | ```php 11 | setSource($source); 16 | 17 | $grid->addExport(new PHPExcelPDFExport($title, $fileName, $params, $charset, $role)); 18 | ... 19 | ``` 20 | 21 | #### PHPExcelPDFExport::__construct parameters 22 | 23 | |parameter|Type|Default value|Description| 24 | |:--:|:--|:--|:--|:--| 25 | |title|string||Title of the export in the selector.| 26 | |fileName|string|export|Name of the export file without the extension.| 27 | |params|array|array()|Additionnal parameters.| 28 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 29 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 30 | 31 | ## Additional parameters for the export 32 | 33 | _None_ 34 | 35 | ## Example 36 | 37 | ```php 38 | setSource($source); 41 | 42 | $grid->addExport(new PHPExcelPDFExport('Simple PDF Export')); 43 | ... 44 | ``` 45 | 46 | ## Configure the export 47 | 48 | This export provides the object `objPHPExcel`. You can manipulate this PHPExcel object. 49 | See the ducmentation `PHPExcel developer documentation.doc` on the [official website](http://phpexcel.codeplex.com/) 50 | 51 | 52 | ```php 53 | setSource($source); 56 | 57 | $export = new PHPExcelPDFExport('Simple PDF Export'); 58 | 59 | $export->objPHPExcel->getProperties()->setCreator("Maarten Balliauw"); 60 | $export->objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw"); 61 | $export->objPHPExcel->getProperties()->setTitle("Office Test Document"); 62 | $export->objPHPExcel->getProperties()->setSubject("Office Test Document"); 63 | $export->objPHPExcel->getProperties()->setDescription("Test document for Office, generated using PHP classes."); 64 | $export->objPHPExcel->getProperties()->setKeywords("office php"); 65 | $export->objPHPExcel->getProperties()->setCategory("Test result file"); 66 | 67 | $export->objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); 68 | $export->objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4); 69 | $export->objPHPExcel->getActiveSheet()->getPageSetup()->setScale(50); 70 | 71 | $grid->addExport(export); 72 | ... 73 | ``` 74 | -------------------------------------------------------------------------------- /Resources/doc/export/library-dependent_exports/PHPExcel/PHPExcel_excel2003_export.md: -------------------------------------------------------------------------------- 1 | PHPExcel Excel 2003 export 2 | ================================= 3 | 4 | File extension = `xlsx` 5 | Mime type = `application/vnd.ms-excel` 6 | 7 | **Note**: This export is limited to 52 columns. 8 | 9 | ## Usage 10 | ```php 11 | setSource($source); 16 | 17 | $grid->addExport(new PHPExcel2003Export($title, $fileName, $params, $charset, $role)); 18 | ... 19 | ``` 20 | 21 | #### PHPExcel2003Export::__construct parameters 22 | 23 | |parameter|Type|Default value|Description| 24 | |:--:|:--|:--|:--|:--| 25 | |title|string||Title of the export in the selector.| 26 | |fileName|string|export|Name of the export file without the extension.| 27 | |params|array|array()|Additionnal parameters.| 28 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 29 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 30 | 31 | ## Additional parameters for the export 32 | 33 | _None_ 34 | 35 | ## Example 36 | 37 | ```php 38 | setSource($source); 41 | 42 | $grid->addExport(new PHPExcel2003Export('Excel 2003 Export')); 43 | ... 44 | ``` 45 | 46 | ## Configure the export 47 | 48 | This export provides the object `objPHPExcel`. You can manipulate this PHPExcel object. 49 | See the ducmentation `PHPExcel developer documentation.doc` on the [official website](http://phpexcel.codeplex.com/) 50 | 51 | 52 | ```php 53 | setSource($source); 56 | 57 | $export = new PHPExcel2003Export('Excel 2003 Export'); 58 | 59 | $export->objPHPExcel->getProperties()->setCreator("Maarten Balliauw"); 60 | $export->objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw"); 61 | $export->objPHPExcel->getProperties()->setTitle("Office Test Document"); 62 | $export->objPHPExcel->getProperties()->setSubject("Office Test Document"); 63 | $export->objPHPExcel->getProperties()->setDescription("Test document for Office, generated using PHP classes."); 64 | $export->objPHPExcel->getProperties()->setKeywords("office php"); 65 | $export->objPHPExcel->getProperties()->setCategory("Test result file"); 66 | 67 | $grid->addExport(export); 68 | ... 69 | ``` 70 | -------------------------------------------------------------------------------- /Resources/doc/export/library-dependent_exports/PHPExcel/PHPExcel_excel2007_export.md: -------------------------------------------------------------------------------- 1 | PHPExcel Excel 2007 export 2 | ================================= 3 | 4 | File extension = `xlsx` 5 | Mime type = `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` 6 | 7 | **Note**: This export is limited to 52 columns. 8 | 9 | ## Usage 10 | ```php 11 | setSource($source); 16 | 17 | $grid->addExport(new PHPExcel2007Export($title, $fileName, $params, $charset, $role)); 18 | ... 19 | ``` 20 | 21 | #### PHPExcel2007Export::__construct parameters 22 | 23 | |parameter|Type|Default value|Description| 24 | |:--:|:--|:--|:--|:--| 25 | |title|string||Title of the export in the selector.| 26 | |fileName|string|export|Name of the export file without the extension.| 27 | |params|array|array()|Additionnal parameters.| 28 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 29 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 30 | 31 | ## Additional parameters for the export 32 | 33 | _None_ 34 | 35 | ## Example 36 | 37 | ```php 38 | setSource($source); 41 | 42 | $grid->addExport(new PHPExcel2007Export('Excel 2007 Export')); 43 | ... 44 | ``` 45 | 46 | ## Configure the export 47 | 48 | This export provides the object `objPHPExcel`. You can manipulate this PHPExcel object. 49 | See the ducmentation `PHPExcel developer documentation.doc` on the [official website](http://phpexcel.codeplex.com/) 50 | 51 | 52 | ```php 53 | setSource($source); 56 | 57 | $export = new PHPExcel2007Export('Excel 2007 Export'); 58 | 59 | $export->objPHPExcel->getProperties()->setCreator("Maarten Balliauw"); 60 | $export->objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw"); 61 | $export->objPHPExcel->getProperties()->setTitle("Office Test Document"); 62 | $export->objPHPExcel->getProperties()->setSubject("Office Test Document"); 63 | $export->objPHPExcel->getProperties()->setDescription("Test document for Office, generated using PHP classes."); 64 | $export->objPHPExcel->getProperties()->setKeywords("office php"); 65 | $export->objPHPExcel->getProperties()->setCategory("Test result file"); 66 | 67 | $grid->addExport(export); 68 | ... 69 | ``` 70 | -------------------------------------------------------------------------------- /Resources/doc/export/library-dependent_exports/PHPExcel/PHPExcel_excel5_export.md: -------------------------------------------------------------------------------- 1 | PHPExcel Excel 5 (97-2003) export 2 | ================================= 3 | 4 | File extension = `xls` 5 | Mime type = `application/vnd.ms-excel` 6 | 7 | 8 | ## Usage 9 | ```php 10 | setSource($source); 15 | 16 | $grid->addExport(new PHPExcel5Export($title, $fileName, $params, $charset, $role)); 17 | ... 18 | ``` 19 | 20 | #### PHPExcel5Export::__construct parameters 21 | 22 | |parameter|Type|Default value|Description| 23 | |:--:|:--|:--|:--|:--| 24 | |title|string||Title of the export in the selector.| 25 | |fileName|string|export|Name of the export file without the extension.| 26 | |params|array|array()|Additionnal parameters.| 27 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 28 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 29 | 30 | ## Additional parameters for the export 31 | 32 | _None_ 33 | 34 | ## Example 35 | 36 | ```php 37 | setSource($source); 40 | 41 | $grid->addExport(new PHPExcel5Export('Excel 5 (97-2003) Export')); 42 | ... 43 | ``` 44 | 45 | ## Configure the export 46 | 47 | This export provides the object `objPHPExcel`. You can manipulate this PHPExcel object. 48 | See the ducmentation `PHPExcel developer documentation.doc` on the [official website](http://phpexcel.codeplex.com/) 49 | 50 | 51 | ```php 52 | setSource($source); 55 | 56 | $export = new PHPExcel5Export('Excel 5 (97-2003) Export'); 57 | 58 | $export->objPHPExcel->getProperties()->setCreator("Maarten Balliauw"); 59 | $export->objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw"); 60 | $export->objPHPExcel->getProperties()->setTitle("Office Test Document"); 61 | $export->objPHPExcel->getProperties()->setSubject("Office Test Document"); 62 | $export->objPHPExcel->getProperties()->setDescription("Test document for Office, generated using PHP classes."); 63 | $export->objPHPExcel->getProperties()->setKeywords("office php"); 64 | $export->objPHPExcel->getProperties()->setCategory("Test result file"); 65 | 66 | $grid->addExport(export); 67 | ... 68 | ``` 69 | -------------------------------------------------------------------------------- /Resources/doc/export/native_exports/CSV_export.md: -------------------------------------------------------------------------------- 1 | Comma-Separated Values export 2 | ================================= 3 | 4 | File extension = `csv` 5 | Mime type = `text/comma-separated-values` 6 | Delimiter = `,` 7 | 8 | ## Usage 9 | ```php 10 | setSource($source); 15 | 16 | $grid->addExport(new CSVExport($title, $fileName, $params, $charset, $role)); 17 | ... 18 | ``` 19 | 20 | #### CSVExport::__construct parameters 21 | 22 | |parameter|Type|Default value|Description| 23 | |:--:|:--|:--|:--|:--| 24 | |title|string||Title of the export in the selector.| 25 | |fileName|string|export|Name of the export file without the extension.| 26 | |params|array|array()|Additionnal parameters.| 27 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 28 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 29 | 30 | ## Additional parameters for the export 31 | 32 | |parameter|Type|Default value|Description| 33 | |:--:|:--|:--|:--|:--| 34 | |delimiter|string|,|The delimiter of csv columns.| 35 | 36 | ## Example 37 | ```php 38 | setSource($source); 43 | 44 | $grid->addExport(new CSVExport('CSV Export')); 45 | ... 46 | ``` 47 | 48 | Output: 49 | 50 | ``` 51 | Book name,page, 52 | This summer,300, 53 | "Sea, sex and sun",300, 54 | "He said ""Hello world!""",550, 55 | ``` 56 | -------------------------------------------------------------------------------- /Resources/doc/export/native_exports/DSV_export.md: -------------------------------------------------------------------------------- 1 | Delimiter-Separated Values export 2 | ================================= 3 | 4 | File extension = _none_ 5 | Mime type = `application/octet-stream` 6 | Delimiter = _none_ 7 | 8 | ## Usage 9 | ```php 10 | setSource($source); 15 | 16 | $grid->addExport(new DSVExport($title, $fileName, $params, $charset, $role)); 17 | ... 18 | ``` 19 | 20 | #### DSVExport::__construct parameters 21 | 22 | |parameter|Type|Default value|Description| 23 | |:--:|:--|:--|:--|:--| 24 | |title|string||Title of the export in the selector.| 25 | |fileName|string|export|Name of the export file without the extension.| 26 | |params|array|array()|Additionnal parameters (Delimiter and BOM).| 27 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 28 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 29 | 30 | ## Additional parameters for the export 31 | 32 | |parameter|Type|Default value|Description| 33 | |:--:|:--|:--|:--|:--| 34 | |delimiter|string|__empty__|The delimiter of csv columns.| 35 | 36 | ## Examples 37 | ```php 38 | setSource($source); 43 | 44 | $exporter = new DSVExport('DSV Export with , without BOM characters', 'export', array('delimiter' => ',', 'withBOM' => false)); 45 | $exporter->setFileExtension('csv'); 46 | $exporter->setMimeType('text/comma-separated-values'); 47 | 48 | $grid->addExport($exporter); 49 | ... 50 | ``` 51 | 52 | OR 53 | 54 | ```php 55 | setSource($source); 60 | 61 | $exporter = new DSVExport('DSV Export with ,'); 62 | $exporter->setDelimiter(','); 63 | $exporter->setWithBOM(false); 64 | $exporter->setFileName('export'); 65 | $exporter->setFileExtension('csv'); 66 | $exporter->setMimeType('text/comma-separated-values'); 67 | 68 | $grid->addExport($exporter); 69 | ... 70 | ``` 71 | 72 | Output: 73 | 74 | ``` 75 | Book namepage 76 | This summer300 77 | "Sea sex and sun"300 78 | "He said ""Hello world!"""550 79 | ``` -------------------------------------------------------------------------------- /Resources/doc/export/native_exports/Excel_export.md: -------------------------------------------------------------------------------- 1 | Excel export 2 | ============ 3 | 4 | **Warning**: This export produces a warning with new Office Excel. 5 | 6 | File extension = `xls` 7 | Mime type = `application/vnd.ms-excel` 8 | 9 | ## Usage 10 | ```php 11 | setSource($source); 16 | 17 | $grid->addExport(new ExcelExport($title, $fileName, $params, $charset, $role)); 18 | ... 19 | ``` 20 | 21 | #### ExcelExport::__construct parameters 22 | 23 | |parameter|Type|Default value|Description| 24 | |:--:|:--|:--|:--|:--| 25 | |title|string||Title of the export in the selector.| 26 | |fileName|string|export|Name of the export file without the extension.| 27 | |params|array|array()|Additionnal parameters.| 28 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 29 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 30 | 31 | ## Additional parameters for the export 32 | 33 | _None_ 34 | 35 | ## Example 36 | ```php 37 | setSource($source); 42 | 43 | $grid->addExport(new ExcelExport('Excel Export')); 44 | ... 45 | ``` 46 | -------------------------------------------------------------------------------- /Resources/doc/export/native_exports/JSON_export.md: -------------------------------------------------------------------------------- 1 | JSON export 2 | =========== 3 | 4 | File extension = `json` 5 | Mime type = `application/octet-stream` 6 | 7 | ## Usage 8 | ```php 9 | setSource($source); 14 | 15 | $grid->addExport(new JSONExport($title, $fileName, $params, $charset, $role)); 16 | ... 17 | ``` 18 | 19 | #### JSONExport::__construct parameters 20 | 21 | |parameter|Type|Default value|Description| 22 | |:--:|:--|:--|:--|:--| 23 | |title|string||Title of the export in the selector.| 24 | |fileName|string|export|Name of the export file without the extension.| 25 | |params|array|array()|Additionnal parameters.| 26 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 27 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 28 | 29 | ## Additional parameters for the export 30 | 31 | _None_ 32 | 33 | ## Example 34 | ```php 35 | setSource($source); 40 | 41 | $grid->addExport(new JSONExport('JSON Export')); 42 | ... 43 | ``` 44 | 45 | Output: 46 | ``` 47 | {"titles":{"text":"Text","datetime":"Datetime"},"rows":[{"text":"abcde","datetime":"Jun 14, 2012 12:01:16 AM"},{"text":"bcdef","datetime":"Jun 14, 2012 12:01:16 AM"}]} 48 | ``` 49 | -------------------------------------------------------------------------------- /Resources/doc/export/native_exports/SCSV_export.md: -------------------------------------------------------------------------------- 1 | Semi-Colon-Separated Values export 2 | ================================= 3 | 4 | File extension = `csv` 5 | Mime type = `text/comma-separated-values` 6 | Delimiter = `;` 7 | 8 | ## Usage 9 | ```php 10 | setSource($source); 15 | 16 | $grid->addExport(new SCSVExport($title, $fileName, $params, $charset, $role)); 17 | ... 18 | ``` 19 | 20 | #### SCSVExport::__construct parameters 21 | 22 | |parameter|Type|Default value|Description| 23 | |:--:|:--|:--|:--|:--| 24 | |title|string||Title of the export in the selector.| 25 | |fileName|string|export|Name of the export file without the extension.| 26 | |params|array|array()|Additionnal parameters.| 27 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 28 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 29 | 30 | ## Additional parameters for the export 31 | 32 | |parameter|Type|Default value|Description| 33 | |:--:|:--|:--|:--|:--| 34 | |delimiter|string|;|The delimiter of csv columns.| 35 | 36 | ## Example 37 | ```php 38 | setSource($source); 43 | 44 | $grid->addExport(new SCSVExport('SCCSV Export')); 45 | ... 46 | ``` 47 | 48 | Output: 49 | 50 | ``` 51 | Book name;page; 52 | This summer;300; 53 | "Sea; sex and sun";300; 54 | "He said ""Hello world!""";550; 55 | ``` 56 | -------------------------------------------------------------------------------- /Resources/doc/export/native_exports/TSV_export.md: -------------------------------------------------------------------------------- 1 | Tabulation-Separated Values export 2 | ================================= 3 | 4 | File extension = `tsv` 5 | Mime type = `text/tab-separated-values` 6 | Delimiter = `\t` 7 | 8 | ## Usage 9 | ```php 10 | setSource($source); 15 | 16 | $grid->addExport(new TSVExport($title, $fileName, $params, $charset, $role)); 17 | ... 18 | ``` 19 | 20 | #### TSVExport::__construct parameters 21 | 22 | |parameter|Type|Default value|Description| 23 | |:--:|:--|:--|:--|:--| 24 | |title|string||Title of the export in the selector.| 25 | |fileName|string|export|Name of the export file without the extension.| 26 | |params|array|array()|Additionnal parameters.| 27 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 28 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 29 | 30 | ## Additional parameters for the export 31 | 32 | |parameter|Type|Default value|Description| 33 | |:--:|:--|:--|:--|:--| 34 | |delimiter|string|\\t|The delimiter of csv columns.| 35 | 36 | ## Example 37 | ```php 38 | setSource($source); 43 | 44 | $grid->addExport(new TSVExport('TSV Export')); 45 | ... 46 | ``` 47 | 48 | Output: 49 | 50 | ``` 51 | Book name page 52 | This summer 300 53 | "Sea sex and sun" 300 54 | "He said ""Hello world!""" 550 55 | ``` 56 | 57 | **Note**: Invisible character. 58 | -------------------------------------------------------------------------------- /Resources/doc/export/native_exports/XML_export.md: -------------------------------------------------------------------------------- 1 | XML export 2 | ========== 3 | 4 | File extension = `xml` 5 | Mime type = `application/octet-stream` 6 | 7 | ## Usage 8 | ```php 9 | setSource($source); 14 | 15 | $grid->addExport(new XMLExport($title, $fileName, $params, $charset, $role)); 16 | ... 17 | ``` 18 | 19 | #### XMLExport::__construct parameters 20 | 21 | |parameter|Type|Default value|Description| 22 | |:--:|:--|:--|:--|:--| 23 | |title|string||Title of the export in the selector.| 24 | |fileName|string|export|Name of the export file without the extension.| 25 | |params|array|array()|Additionnal parameters.| 26 | |charset|string|UTF-8|Charset to convert the ouput of the export.| 27 | |role|mixed|null|Don't add this export if the access isn't granted for the defined role(s)| 28 | 29 | ## Additional parameters for the export 30 | 31 | _None_ 32 | 33 | ## Example 34 | ```php 35 | setSource($source); 40 | 41 | $grid->addExport(new XMLExport('XML Export')); 42 | ... 43 | ``` 44 | 45 | Output: 46 | ```xml 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | ``` 65 | -------------------------------------------------------------------------------- /Resources/doc/features.md: -------------------------------------------------------------------------------- 1 | # APYDataGrid Bundle Features 2 | 3 | - Supports Entity (ORM), Document (ODM) and Vector (Array) sources 4 | - Sortable and Filterable with operators (Comparison operators, range, starts/ends with, (not) contains, is (not) defined, regex) 5 | - Auto-typing columns (Text, Number, Boolean, Array, DateTime, Date, ...) 6 | - Locale support for DateTime, Date and Number columns (Decimal, Currency, Percent, Duration, Scientific, Spell out) 7 | - Input, Select, checkbox and radio button filters filled with the data of the grid or an array of values 8 | - Export (CSV, Excel, _PDF_, XML, JSON, HTML, ...) 9 | - Mass actions 10 | - Row actions 11 | - Supports mapped fields with Entity source 12 | - Securing the columns, actions and export with security roles 13 | - Annotations and PHP configuration 14 | - External filters box 15 | - Ajax loading 16 | - Pagination (You can also use Pagerfanta) 17 | - Column width and column align 18 | - Prefix translated titles 19 | - Grid manager for multi-grid on the same page 20 | - Groups configuration for ORM and ODM sources 21 | - Easy templates overriding (twig) 22 | - Custom columns and filters creation 23 | 24 | ## Screenshot 25 | 26 | Full example with this [CSS style file](https://github.com/APY/APYDataGridBundle/blob/master/Resources/doc/grid_configuration/working_example.css): 27 | 28 | ![test](https://github.com/APY/APYDataGridBundle/blob/master/Resources/doc/images/screenshot_full.png?raw=true) 29 | 30 | Simple example with the external filter box in english: 31 | 32 | ![test](https://github.com/APY/APYDataGridBundle/blob/master/Resources/doc/images/screenshot_en.png?raw=true) 33 | 34 | Same example in french: 35 | 36 | ![test](https://github.com/APY/APYDataGridBundle/blob/master/Resources/doc/images/screenshot_fr.png?raw=true) 37 | 38 | Data used in these screenshots (this is a phpMyAdmin screenshot): 39 | 40 | ![test](https://github.com/APY/APYDataGridBundle/blob/master/Resources/doc/images/screenshot_database.png?raw=true) -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/add_actions_column.md: -------------------------------------------------------------------------------- 1 | Add multiple row actions columns 2 | ================================ 3 | 4 | You can create other columns of row actions and choose the position of these ones. 5 | 6 | ## Usage 7 | ```php 8 | setSource($source); 14 | 15 | // Create an Actions Column 16 | $actionsColumn = new ActionsColumn($column, $title); 17 | $grid->addColumn($actionsColumn, $position); 18 | 19 | // Attach a rowAction to the Actions Column 20 | $rowAction1 = new RowAction('Show', 'route_to_show'); 21 | $rowAction1->setColumn($column); 22 | $grid->addRowAction($rowAction1); 23 | 24 | 25 | // OR add a second row action directly to a new action column 26 | $rowAction2 = new RowAction('Edit', 'route_to_edit'); 27 | 28 | $actionsColumn2 = new ActionsColumn($column, $title, array($rowAction2), $separator); 29 | $grid->addColumn($actionsColumn2, $position2); 30 | ... 31 | ``` 32 | 33 | ## Class ActionsColumn parameters 34 | 35 | |Parameter|Type|Default value|Description| 36 | |:--:|:--|:--|:--| 37 | |column|string||Identifier of the column| 38 | |title|string||Title of the column| 39 | |rowActions|array|array()|Array of rowAction| 40 | |separator|string|' '|The separator between each action| 41 | 42 | **Note**: This parameter accepts HTML tags. 43 | 44 | ## Method RowAction::setColumn parameters 45 | 46 | |Parameter|Type|Default value|Description| 47 | |:--:|:--|:--|:--| 48 | |column|string||Identifier of the actions column| 49 | 50 | Example: 51 | ```php 52 | setSource($source); 58 | 59 | // Create an Actions Column 60 | $actionsColumn = new ActionsColumn('info_column_1', 'Actions 1'); 61 | $actionsColumn->setSeparator("
"); 62 | $grid->addColumn($actionsColumn, 1); 63 | 64 | // Attach a rowAction to the Actions Column 65 | $rowAction1 = new RowAction('Show', 'route_to_show'); 66 | $rowAction1->setColumn('info_column_1'); 67 | $grid->addRowAction($rowAction1); 68 | 69 | 70 | // OR add a second row action directly to a new action column 71 | $rowAction2 = new RowAction('Edit', 'route_to_edit'); 72 | 73 | $actionsColumn2 = new ActionsColumn('info_column_2', 'Actions 3', array($rowAction2)); 74 | $grid->addColumn($actionsColumn2, 2); 75 | ... 76 | ``` 77 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/add_column.md: -------------------------------------------------------------------------------- 1 | Add a column 2 | ======================= 3 | 4 | You can add a column to the grid. You can fill it with the row manipulator, in your template or tell the grid what field the column will be mapped. 5 | A column must be defined after the source otherwise it will always appear before the columns of the source. 6 | If negative column numbers are used, then the column is added that far from the last column. 7 | 8 | ## Usage 9 | 10 | ```php 11 | setSource($source); 15 | 16 | // create a column 17 | $MyColumn = new BlankColumn($params); 18 | 19 | // Add the column to the last position 20 | $grid->addColumn($MyColumn); 21 | 22 | // OR add this column to the third position 23 | $grid->addColumn($MyColumn, 3); 24 | 25 | // OR add this column to the next to last position 26 | $grid->addColumn($MyColumn, -1); 27 | ... 28 | ``` 29 | 30 | **Note**: To keep the correct position of each column, it's better to define them in ascending order of position. 31 | 32 | ## Column parameters 33 | 34 | See [column annotations for property](../columns_configuration/annotations/column_annotation_property.md#available-attributes) 35 | 36 | ## Grid::addColumn parameters 37 | 38 | |parameter|Type|Default value|Possible values|Description| 39 | |:--:|:--|:--|:--|:--| 40 | |column|instance of Column||BlankColumn(), TextColumn(), DateColumn(), BooleanColumn...|| 41 | |position|integer|0|position >= 0|0 means last position| 42 | 43 | ## Example 44 | 45 | ```php 46 | setSource($source); 50 | 51 | // First parameter : Associative array of parameters (See column annotations for property) 52 | $MyBlankColumn = new BlankColumn(array('id' => 'myBlankColumn', 'title' => 'My Blank Column', 'size' => '54')); 53 | 54 | // Add the column to the last position 55 | $grid->addColumn($MyBlankColumn); 56 | 57 | // OR add this column to the third position 58 | $grid->addColumn($MyBlankColumn, 3); 59 | 60 | $MyTypedColumn = new DateColumn(array('id' => 'myTypedColumn', 'title' => 'My Typed Column', 'source' => false, 'filterable' => false, 'sortable' => false)); 61 | $grid->addColumn($MyTypedColumn); 62 | 63 | $MyMappedColumn = new DateColumn(array('id' => 'myMappedColumn', 'field' => 'myMappedColumn', 'title' => 'My Mapped Column')); 64 | $grid->addColumn($MyMappedColumn); 65 | ... 66 | ``` 67 | 68 | **Note:** If you want to use a typed column (Date, Array, ...), this column mustn't be marked as sortable, filterable and source. Else use the BlankColumn. 69 | **Note²:** If you want to map your new column to a field of your source you have to set `'source' => true` and define the field attribute equal to the id attribute. 70 | 71 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/add_delete_mass_action.md: -------------------------------------------------------------------------------- 1 | Add a native delete mass action 2 | =============================== 3 | 4 | This mass action calls the delete method of the source. 5 | It doesn't work with the `Select All` option, only the visible rows can be delete with this simple mass action. 6 | 7 | ## Example 8 | ```php 9 | setSource($source); 13 | 14 | $grid->addMassAction(new DeleteMassAction()); 15 | ... 16 | ``` 17 | 18 | **Notes**: The primary field of the grid must be the same that the primary key of your source. 19 | Don't use this mass action with the 'one' Entity or Document of a one-to-many relation. 20 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/add_export.md: -------------------------------------------------------------------------------- 1 | Add an export 2 | ============= 3 | 4 | ## Usage 5 | ```php 6 | setSource($source); 9 | 10 | $grid->addExport($export); 11 | ... 12 | ``` 13 | 14 | ## Example 15 | ```php 16 | setSource($source); 20 | 21 | $grid->addExport(new XMLExport('XML Export', 'export')); 22 | ... 23 | ``` 24 | 25 | See the [Export](../export/) chapter for additionnal information -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/always_show_grid.md: -------------------------------------------------------------------------------- 1 | Always show the grid when no data is found 2 | ========================================== 3 | 4 | When you render a grid with no data in the source, the grid isn't displayed and a no data message is displayed. 5 | See [Set no data message](set_no_data_message.md). 6 | 7 | With this same method, you can also tell the bundle to always display the grid with no row. 8 | 9 | ```php 10 | setSource($source); 13 | 14 | $grid->setNoDataMessage(false); 15 | ... 16 | ``` 17 | 18 | ## Set the default no data message in your config.yml 19 | ```yml 20 | apy_data_grid: 21 | no_data_message: false 22 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/grid_response.md: -------------------------------------------------------------------------------- 1 | Grid Response helper 2 | ==================== 3 | 4 | The getGridResponse method is an helper which manage the redirection, export and the rendering of the grid. 5 | For the rendering, the grid data is automatically passed to the parameters of the view with the identifier `grid`. 6 | 7 | ## Usage 8 | 9 | #### Before: 10 | 11 | ```php 12 | setSource($source); 15 | 16 | if ($grid->isReadyForRedirect()) { 17 | if ($grid->isReadyForExport()) { 18 | return $grid->getExportResponse(); 19 | } 20 | 21 | return new RedirectResponse($grid->getRouteUrl()); 22 | } else { 23 | return $this->render($view, $parameters, $response); 24 | } 25 | ... 26 | ``` 27 | 28 | #### After: 29 | 30 | ```php 31 | setSource($source); 34 | 35 | return $grid->getGridResponse($view, $parameters, $response); 36 | ... 37 | ``` 38 | 39 | ## Method parameters 40 | 41 | |Parameter|Type|Default value|Description| 42 | |:--:|:--|:--|:--| 43 | |view|string|null|The view name| 44 | |parameters|array|array()|An array of parameters to pass to the view| 45 | |response|Response|null|A response instance| 46 | 47 | **Note**: If you use the @Template annotation, you can define the parameters parameter in the first position (See the third example). 48 | 49 | ## Examples 50 | 51 | #### With the @template annotation and without additionnal parameters 52 | 53 | ```php 54 | setSource($source); 57 | 58 | return $grid->getGridResponse(); 59 | ... 60 | ``` 61 | 62 | #### With template and parameters 63 | 64 | ```php 65 | setSource($source); 68 | 69 | return $grid->getGridResponse('MyProjectMyBundle::my_grid.html.twig', array('param2' => $param2)); 70 | ... 71 | ``` 72 | 73 | #### With the @template annotation and additionnal parameters 74 | 75 | ```php 76 | setSource($source); 79 | 80 | return $grid->getGridResponse(array('param2' => $param2)); 81 | ... 82 | ``` 83 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/hide_show_columns.md: -------------------------------------------------------------------------------- 1 | Show and hide columns 2 | ===================== 3 | 4 | These functions are helpers to manipulate columns. 5 | 6 | ## Usage 7 | 8 | ```php 9 | setSource($source); 12 | 13 | $grid->showColumns($columnIds); 14 | 15 | $grid->hideColumns($columnIds); 16 | ... 17 | ``` 18 | 19 | ## Method parameters 20 | 21 | |parameter|Type|Default value|Description| 22 | |:--:|:--|:--|:--|:--| 23 | |columnIds|string or array||List of the identifier of the columns you want to show or hide.| 24 | 25 | ## Example 26 | 27 | ```php 28 | setSource($source); 31 | 32 | // Show columns 33 | $grid->showColumns('column1'); 34 | 35 | $grid->showColumns(array('column1', 'column2')); 36 | 37 | // Hide columns 38 | $grid->hideColumns('column3'); 39 | 40 | $grid->hideColumns(array('column3', 'column4')); 41 | ... 42 | ``` 43 | 44 | --- 45 | 46 | ## Use a visibility mask 47 | 48 | You can use a mask to set the visibility of your columns. 49 | 50 | #### Examples 51 | ```php 52 | setSource($source); 55 | 56 | //We want to display only A, C and E, setVisibleColumns sets B and D to hidden 57 | $grid->setVisibleColumns(array('A', 'C', 'E')); 58 | ... 59 | ``` 60 | 61 | OR 62 | 63 | ```php 64 | setSource($source); 67 | 68 | //We want to display only A, C and E, setHiddenColumns sets B and D to hidden 69 | $grid->setHiddenColumns(array('B', 'D')); 70 | ... 71 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/manipulate_column.md: -------------------------------------------------------------------------------- 1 | Manipulate column 2 | ================= 3 | 4 | You can manipulate the behavior of a column. 5 | 6 | ## Usage 7 | 8 | ```php 9 | setSource($source); 12 | 13 | // For auto-completion in your IDE 14 | /* @var $column \APY\DataGridBundle\Grid\Column\Column */ 15 | $column = $grid->getColumn('my_column_id'); 16 | 17 | $column->manipulateRenderCell($callback); 18 | 19 | $column->setTitle($title); 20 | ... 21 | ``` 22 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/manipulate_column_render_cell.md: -------------------------------------------------------------------------------- 1 | Manipulate column render cell 2 | ============================= 3 | 4 | You can set a callback to manipulate the render of a cell. 5 | If the callback returns nothing, the cell will be empty. 6 | 7 | ## Usage 8 | 9 | ```php 10 | setSource($source); 14 | 15 | $grid->getColumn('my_column_id')->manipulateRenderCell($callback); 16 | ... 17 | ``` 18 | 19 | ## Method Column::manipulateRenderCell parameters 20 | 21 | |parameter|Type|Default value|Description| 22 | |:--:|:--|:--|:--|:--| 23 | |callback|[\Closure](http://php.net/manual/en/functions.anonymous.php) or [callable](http://php.net/manual/en/language.types.callable.php)|null|Callback to manipulate rows. Null means no callback.| 24 | 25 | ## Callback parameters 26 | 27 | |parameter|Type|Description| 28 | |:--:|:--|:--|:--|:--| 29 | |value|string|The value of the cell| 30 | |row|instance of Row|The current row| 31 | |router|instance of the router engine|The symfony router| 32 | 33 | ## Examples 34 | 35 | ```php 36 | setSource($source); 39 | 40 | $grid->getColumn('my_column_id')->manipulateRenderCell( 41 | function($value, $row, $router) { 42 | return $router->generate('_my_route', array('param' => $row->getField('column4'))); 43 | } 44 | ); 45 | ... 46 | ``` 47 | 48 | **Note**: You can fetch hidden columns if the source attribute is set to true. 49 | 50 | Use this method to fill an empty column: 51 | 52 | ```php 53 | setSource($source); 56 | 57 | // Add a column with a rendering callback 58 | $MyColumn = new TextColumn(array('id' => 'Another Column')); 59 | 60 | $MyColumn->manipulateRenderCell(function($value, $row, $router) { 61 | return $router->generate('_my_route', array('param' => $row->getField('column4')));} 62 | ); 63 | 64 | $grid->addColumn($MyColumn); 65 | ... 66 | ``` 67 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/manipulate_count_query.md: -------------------------------------------------------------------------------- 1 | Manipulating the count query builder 2 | ============================ 3 | 4 | The grid requires the total number of results (COUNT (...)). The grid clones the source QueryBuilder and wraps it with a COUNT DISTINCT clause. 5 | If you use a lot of aggregation in the source queryBuilder you may encounter performance problems. 6 | You can manipulate the query before it is processed to remove useless fields for the COUNT clause. 7 | 8 | ## 1. Using a callback 9 | 10 | ```php 11 | manipulateCountQuery($callback); 14 | 15 | $grid->setSource($source); 16 | ... 17 | ``` 18 | 19 | ### Method Source::manipulateCountQuery parameters 20 | 21 | |parameter|Type|Default value|Description| 22 | |:--:|:--|:--|:--|:--| 23 | |callback|[\Closure](http://php.net/manual/en/functions.anonymous.php) or [callable](http://php.net/manual/en/language.types.callable.php)|null|Callback to manipulate the query. Null means no callback.| 24 | 25 | ### Callback parameters 26 | 27 | |parameter|Type|Description| 28 | |:--:|:--|:--|:--|:--| 29 | |queryBuilder|instance of QueryBuilder|The QueryBuilder instance before its execution (clone of the source QueryBuilder)| 30 | 31 | ### Examples 32 | 33 | ```php 34 | manipulateCountQuery( 37 | function ($queryBuilder) 38 | { 39 | $queryBuilder->resetDQLPart('select'); 40 | } 41 | ); 42 | 43 | $grid->setSource($source); 44 | ... 45 | ``` 46 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/manipulate_row_action_rendering.md: -------------------------------------------------------------------------------- 1 | Manipulate row action rendering 2 | ============================= 3 | 4 | You can set a callback to manipulate the rendering of an action. 5 | If the callback returns `null` or don't return the action, the action won't be displayed. 6 | 7 | ## Usage 8 | 9 | ```php 10 | manipulateRender($callback); 13 | 14 | $grid->addRowAction($rowAction); 15 | ... 16 | ``` 17 | 18 | ## Method RowAction::manipulateRender parameters 19 | 20 | |parameter|Type|Default value|Description| 21 | |:--:|:--|:--|:--|:--| 22 | |callback|[\Closure](http://php.net/manual/en/functions.anonymous.php) or [callable](http://php.net/manual/en/language.types.callable.php)|null|Callback to manipulate action rendering. Null means no callback.| 23 | 24 | ## Callback parameters 25 | 26 | |parameter|Type|Description| 27 | |:--:|:--|:--|:--|:--| 28 | |action|instance of RowAction|The action| 29 | |row|instance of Row|The current row| 30 | 31 | ## Action disabling 32 | 33 | The action can be disabled using the manipulate render callback. See the example. 34 | If the action is disabled, only its title is displayed, with all additional attributes used. 35 | 36 | ## Example 37 | 38 | ```php 39 | manipulateRender( 42 | function ($action, $row) 43 | { 44 | if ($row->getField('quantity') == 0) { 45 | $action->setTitle('Sold out'); 46 | } 47 | 48 | if ($row->getField('price') > 20) { 49 | return null; 50 | } 51 | 52 | if ($row->getField('enabled') == false) { 53 | $action->setEnabled(false); 54 | } 55 | 56 | return $action; 57 | } 58 | ); 59 | 60 | $grid->addRowAction($rowAction); 61 | ... 62 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/manipulate_rows_data.md: -------------------------------------------------------------------------------- 1 | Manipulate rows data 2 | ==================== 3 | 4 | You can set a callback to manipulate the row of the grid. 5 | If the callback returns `null` or don't return the row, the row won't be displayed. 6 | 7 | ## Usage 8 | ```php 9 | manipulateRow($callback); 12 | 13 | $grid->setSource($source); 14 | ... 15 | ``` 16 | 17 | ## Method Source::manipulateRow parameters 18 | 19 | |parameter|Type|Default value|Description| 20 | |:--:|:--|:--|:--|:--| 21 | |callback|[\Closure](http://php.net/manual/en/functions.anonymous.php) or [callable](http://php.net/manual/en/language.types.callable.php)|null|Callback to manipulate rows. Null means no callback.| 22 | 23 | ## Callback parameters 24 | 25 | |parameter|Type|Description| 26 | |:--:|:--|:--|:--|:--| 27 | |row|instance of Row|The current row to manipulate| 28 | 29 | ## Examples 30 | 31 | ```php 32 | manipulateRow( 35 | function ($row) 36 | { 37 | if ($row->getField('enabled') == '1') { 38 | $row->setClass('border-enabled'); // add a css class to the tag 39 | $row->setColor('#00ff00'); // set background-color as inline style 40 | } 41 | 42 | // Don't show the row if the price is greater than 10 43 | if ($row->getField('price')>10) { 44 | return null; 45 | } 46 | 47 | return $row; 48 | } 49 | ); 50 | 51 | $grid->setSource($source); 52 | ... 53 | ``` 54 | 55 | If you want to pass some context parameters: 56 | ```php 57 | manipulateRow( 63 | function ($row) use ($maxPrice, $soldOutLabel) 64 | { 65 | // Don't show the row if the price is greater than $maxPrice 66 | if ($row->getField('price') > $maxPrice) { 67 | return null; 68 | } 69 | 70 | // Change the ouput of the column quantity if anarticle is sold out 71 | if ($row->getField('quantity') == 0) { 72 | $row->setField('quantity', $soldOutLabel); 73 | } 74 | 75 | return $row; 76 | } 77 | ); 78 | 79 | $grid->setSource($source); 80 | ... 81 | ``` 82 | 83 | Or if you want use the entity of the row: 84 | ```php 85 | price * (1 + $this->tax); 96 | } 97 | } 98 | ?> 99 | 100 | manipulateRow( 104 | function ($row) 105 | { 106 | // Change the output of the new column with your own code at entity. 107 | $row->setField('myNewColumn', $row->getEntity()->getPriceWithTax()); 108 | } 109 | ); 110 | 111 | $grid->setSource($source); 112 | 113 | ``` 114 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/multi_grid_manager.md: -------------------------------------------------------------------------------- 1 | Handle multiple grids on the same page 2 | ========================================= 3 | 4 | There is an example of how to fully manage grids in the same controller: 5 | 6 | ```php 7 | get('grid'); 10 | $grid2 = $this->get('grid'); 11 | 12 | $grid->setSource($source1); 13 | $grid2->setSource($source2); 14 | 15 | if ($grid->isReadyForRedirect() || $grid2->isReadyForRedirect() ) 16 | { 17 | if ($grid->isReadyForExport()) 18 | { 19 | return $grid->getExportResponse(); 20 | } 21 | 22 | if ($grid2->isReadyForExport()) 23 | { 24 | return $grid2->getExportResponse(); 25 | } 26 | 27 | // Url is the same for the grids 28 | return new RedirectResponse($grid->getRouteUrl()); 29 | } 30 | else 31 | { 32 | return $this->render('MyProjectMyBundle::my_grid.html.twig', array('grid' => $grid, 'grid2' => $grid2)); 33 | } 34 | ``` 35 | 36 | But you'll have a grid collision if you use the same source for your grids with the same columns. 37 | 38 | ## Grids collision 39 | 40 | If you use the same source for two grids, you have to define a identifier for your grids 41 | 42 | ```php 43 | get('grid'); 46 | $grid2 = $this->get('grid'); 47 | 48 | $grid->setId("first"); 49 | $grid->setSource($source1); 50 | 51 | $grid2->setId("second"); 52 | $grid2->setSource($source1); 53 | ... 54 | ``` 55 | 56 | ## Grid manager 57 | 58 | To easily manage your grids, you can use the grid manager. 59 | 60 | ```php 61 | get('grid.manager'); 63 | 64 | $grid = $gridManager->createGrid(); 65 | $grid->setSource($source1); 66 | 67 | $grid2 = $gridManager->createGrid(); 68 | $grid2->setSource($source2); 69 | 70 | if ($gridManager->isReadyForRedirect()) 71 | { 72 | return new RedirectResponse($gridManager->getRouteUrl()); 73 | } 74 | else 75 | { 76 | return $this->render('MyProjectMyBundle::my_grid.html.twig', array('grid' => $grid, 'grid2' => $grid2)); 77 | } 78 | 79 | ``` 80 | 81 | A getGridManagerResponse method is also available which manage the redirection, export and the rendering 82 | 83 | ```php 84 | get('grid.manager'); 87 | 88 | $grid = $gridManager->createGrid(); 89 | $grid->setId('first'); 90 | $grid->setSource($source1); 91 | 92 | $grid2 = $gridManager->createGrid('second'); // same as $grid2->setId('second'); 93 | $grid2->setSource($source1); 94 | 95 | return $gridManager->getGridManagerResponse('MyProjectMyBundle::my_grid.html.twig'); 96 | ... 97 | ``` 98 | 99 | **Note**: For the rendering, grids data are automatically passed to the parameters of the view with identifiers `grid1`, `grid2`, `grid3`, .... 100 | 101 | ## Method parameters 102 | 103 | See [Grid Response](grid_response.md#method_parameters). 104 | 105 | ## Override the getGridManagerResponse function 106 | 107 | Example with two grids: 108 | 109 | ```php 110 | isReadyForRedirect()) { 113 | return $gridManager->getGridManagerResponse(); 114 | } else { 115 | 116 | // Your code 117 | 118 | return $this->render('MyProjectMyBundle::my_grid.html.twig', array('grid' => $grid, 'grid2' => $grid2)); 119 | } 120 | ... 121 | ``` 122 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_columns_order.md: -------------------------------------------------------------------------------- 1 | Set the order of the columns 2 | ============================ 3 | 4 | You can already define the order of the columns with the columns option of the [Source annotation](../columns_configuration/annotations/source_annotation.md). 5 | You can also define the order in a controller. 6 | 7 | ## Usage 8 | ```php 9 | $grid->setColumnsOrder($columnIds, $keepOtherColumns); 10 | ``` 11 | 12 | ## Grid::setColumnsOrder parameters 13 | 14 | |parameter|Type|Default value|Possible values|Description| 15 | |:--:|:--|:--|:--|:--| 16 | |columnIds|array|_none_|Ids of the columns|Order of the columns| 17 | |keepOtherColumns|boolean|true|true or false|Keep or not the columns not in columnIds| 18 | 19 | **Note**: Don't forget to keep your primary column in columnsIds if keepOtherColumns is false. 20 | 21 | ## Example 22 | 23 | Initial columns : Column1, Column2, Column3, Column4, Column5 24 | 25 | ```php 26 | $userColumns = array('Column2', 'Column5', 'Column1'); 27 | $grid->setColumnsOrder(userColumns); 28 | ``` 29 | 30 | The new order will be : Column2, Column5, Column1, Column3, Column4 31 | 32 | ```php 33 | $userColumns = array('Column2', 'Column5', 'Column1'); 34 | $grid->setColumnsOrder($userColumns, false); 35 | ``` 36 | 37 | The new order will be : Column2, Column5, Column1 38 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_data.md: -------------------------------------------------------------------------------- 1 | Set data 2 | ======== 3 | 4 | You can use fetched data to avoid unnecessary queries. 5 | 6 | **Note**: With setData, operators `Equals` and `Contains` support regular expression. 7 | 8 | Imagine a user with bookmarks represented by a type (youtube, twitter,...) and a link. 9 | Current behavior to display the bookmarks of a user: 10 | 11 | ```php 12 | container->get('security.context')->getToken()->getUser(); 18 | if (!is_object($user) || !$user instanceof UserInterface) { 19 | throw new AccessDeniedException('This user does not have access to this section.'); 20 | } 21 | 22 | // Instanciate the grid 23 | $grid = $this->get('grid'); 24 | 25 | // Define the source of the grid 26 | $source = new Entity('MyProjectMyBundle:Bookmark'); 27 | 28 | // Add a where condition to the query to get only bookmarks of the user 29 | $tableAlias = $source->getTableAlias(); 30 | 31 | $source->manipulateQuery(function ($query) use ($tableAlias, $user) { 32 | $query->where($tableAlias . '.member = '.$user->getId()); 33 | }); 34 | 35 | $grid->setSource($source); 36 | 37 | return $grid->getGridResponse(); 38 | } 39 | ``` 40 | 41 | Bookmarks are related by the logged user, so you can retrieve it directly from the user instance and use it for the grid: 42 | 43 | ## Usage 44 | ```php 45 | setData($data); 48 | 49 | $grid->setSource($source); 50 | ... 51 | ``` 52 | 53 | ## Method parameters 54 | 55 | |parameter|Type|Default value|Description| 56 | |:--:|:--|:--|:--|:--| 57 | |data|array||Array of data compatible with the source.| 58 | 59 | ## Example 60 | ```php 61 | container->get('security.context')->getToken()->getUser(); 67 | if (!is_object($user) || !$user instanceof UserInterface) { 68 | throw new AccessDeniedException('This user does not have access to this section.'); 69 | } 70 | 71 | // Instanciate the grid 72 | $grid = $this->get('grid'); 73 | 74 | $source = new Entity('MyProjectMyBundle:Bookmark'); 75 | 76 | // Get bookmarks related to the user and set the grid data 77 | $source->setData($user->getBookmarks()); 78 | 79 | // Define the source of the grid 80 | $grid->setSource($source); 81 | 82 | return $grid->getGridResponse(); 83 | } 84 | ... 85 | ``` 86 | 87 | ## Unsupport feature 88 | 89 | Aggregate DQL functions and GroupBy option are not supported. 90 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_default_filters.md: -------------------------------------------------------------------------------- 1 | Set default filters of the grid 2 | =============================== 3 | 4 | You can define default filters. These values will be used on each new session of the grid. 5 | 6 | ## Usage 7 | 8 | ```php 9 | setSource($source); 13 | 14 | // Set default filters of the grid 15 | $grid->setDefaultFilters($filters); 16 | ... 17 | ``` 18 | 19 | ## Grid::setDefaultFilters parameters 20 | 21 | |parameter|Type|Default value|Description| 22 | |:--:|:--|:--|:--|:--| 23 | |filters|array|array()|Array of array or string pair| 24 | 25 | ## Values for the filters parameter 26 | 27 | |parameter|Type|Default value|Description| 28 | |:--:|:--|:--|:--|:--| 29 | |operator|string|default operator of the column|Operator used to filter| 30 | |from|string|null|The value of the filter or the _from_ value for the between operators| 31 | |to|string|null|The _to_ value for the between operators| 32 | 33 | **Note**: If these three parameters are not defined and only a string value is defined, this value will be attributed to the _from_ value of the filter and will use the default operator of the column. 34 | 35 | ## Available Operators 36 | 37 | |Operator|Meaning| 38 | |:--:|:--| 39 | |eq|Equals| 40 | |neq|Not equal to| 41 | |lt|Lower than| 42 | |lte|Lower than or equal to| 43 | |gt|Greater than| 44 | |gte|Greater than or equal to| 45 | |like|Contains (case insensitive)| 46 | |nlike|Not contain (case insensitive)| 47 | |rlike|Starts with (case insensitive)| 48 | |llike|Ends with (case insensitive)| 49 | |slike|Contains| 50 | |nslike|Not contain| 51 | |rslike|Starts with| 52 | |lslike|Ends with| 53 | |btw|Between exclusive| 54 | |btwe|Between inclusive| 55 | |isNull|Is not defined| 56 | |isNotNull|Is defined| 57 | 58 | **Note**: LIKE filter is case insensitive by default, the resulting SQL query will look like `LOWER(column) LIKE LOWER(:criteria)`. 59 | 60 | SLIKE filter does not mean "case sensitive like", it is strict/simple LIKE so case sensitivity will depend of your RDBSM (collation, etc.). 61 | 62 | ## Example 63 | 64 | ```php 65 | setSource($source); 69 | 70 | // Set default filters of the grid 71 | $grid->setDefaultFilters(array( 72 | 'your_column_to_filter1' => 'your_init_value1', // Use the default operator of the column 73 | 'your_column_to_filter1' => array('from' => 'your_init_value1'), // Use the default operator of the column 74 | 'your_column_to_filter2' => array('operator' => 'eq', 'from' => 'your_init_value_from2'), // Define an operator 75 | 'your_column_to_filter3' => array('from' => 'your_init_value_from3', 'to' => 'your_init_value_to3'), // Range filter with the default operator 'btw' 76 | 'your_column_to_filter4' => array('operator' => 'btw', 'from' => 'your_init_value_from4', 'to' => 'your_init_value_to4') // Range filter with the operator 'tbw' 77 | 'your_column_to_filter4' => array('operator' => 'isNull') // isNull operator 78 | )); 79 | ... 80 | ``` 81 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_default_limit.md: -------------------------------------------------------------------------------- 1 | Set the default items per page of the grid 2 | ========================================== 3 | 4 | You can define a default limit. This limit will be used on each new session of the grid. 5 | If no default limit is defined, the grid take the first limit found in the limits values. 6 | 7 | ## Example 8 | ```php 9 | setSource($source); 13 | 14 | // Set the limits 15 | $grid->setLimits(array(5, 10, 15)); 16 | 17 | // Set the default limit 18 | $grid->setDefaultLimit(15); 19 | ... 20 | ``` 21 | 22 | **Note**: The default limit must be positive and found in limits values. -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_default_order.md: -------------------------------------------------------------------------------- 1 | Set the default order of the grid 2 | ==================================== 3 | 4 | You can define a default order. This order will be used on each new session of the grid. 5 | 6 | ## Usage 7 | ```php 8 | setSource($source); 12 | 13 | // Set the default order of the grid 14 | $grid->setDefaultOrder($columnId, $order); 15 | ... 16 | ``` 17 | 18 | ## Grid::setDefaultOrder parameters 19 | 20 | |parameter|Type|Default value|Possible values|Description| 21 | |:--:|:--|:--|:--|:--| 22 | |columnId|string|_none_||Identifier of the column| 23 | |order|string|asc|asc or desc|Order of the column| 24 | 25 | ## Available Order 26 | 27 | |Order|Meaning| 28 | |:--:|:--| 29 | |asc|Ascending| 30 | |desc|Descending| 31 | 32 | ## Example 33 | ```php 34 | setSource($source); 38 | 39 | // Set the default order of the grid 40 | $grid->setDefaultOrder('my_column_id', 'asc'); 41 | 42 | ... 43 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_default_page.md: -------------------------------------------------------------------------------- 1 | Set the default page of the grid 2 | =================================== 3 | 4 | You can define a default page. This page will be used on each new session of the grid. 5 | If the default page is greater than the number of page, the page is set to 1. 6 | 7 | ## Example 8 | ```php 9 | setSource($source); 13 | 14 | // Set the default page 15 | $grid->setDefaultPage(4); 16 | ... 17 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_grid_identifier.md: -------------------------------------------------------------------------------- 1 | Set the identifier of the grid 2 | ============================== 3 | 4 | You can set the identifier of a grid to manage easily the grid with css and javascript for instance. 5 | 6 | You have to define the identifier of a grid if you use two grids with the same source on the same page. 7 | 8 | The grid will have the identifier grid_ in html pages. And every request will use this variable to query the grid. 9 | 10 | **Note:** The Identifier mustn't use special chars for url like dot (. or +) 11 | 12 | ## Usage 13 | 14 | ```php 15 | setSource($source); 18 | 19 | $grid->setId($id); 20 | ... 21 | ``` 22 | ## Method parameters 23 | 24 | |parameter|Type|Default value|Description| 25 | |:--:|:--|:--|:--|:--| 26 | |id|string|_none_|Identifier of the grid| 27 | 28 | ## Example 29 | 30 | ```php 31 | setSource($source); 34 | 35 | $grid->setId('user'); 36 | ... 37 | ``` 38 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_grid_persistence.md: -------------------------------------------------------------------------------- 1 | Set the persistence of the grid 2 | =============================== 3 | 4 | By default, filters, page and order are reset when you quit the page where your grid is. 5 | 6 | If you set to true the persistence, its parameters are kept until you close your web browser or you kill the session cookie yourself. 7 | But don't forget to define an different identifier of your grids else your sessions will be reset by another grid with the same identifier. 8 | 9 | ## Usage 10 | 11 | ```php 12 | setSource($source); 15 | 16 | $grid->setPersistence($persistence); 17 | ... 18 | ``` 19 | ## Method parameters 20 | 21 | |parameter|Type|Default value|Description| 22 | |:--:|:--|:--|:--|:--| 23 | |persistence|boolean|false|Persistence of the grid| 24 | 25 | ## Example 26 | 27 | ```php 28 | setSource($source); 31 | 32 | $grid->setPersistence(true); 33 | ... 34 | ``` 35 | 36 | ## Set the default persistence in your config.yml 37 | ```yml 38 | apy_data_grid: 39 | persistence: true 40 | ``` 41 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_grid_route.md: -------------------------------------------------------------------------------- 1 | Set the route of the grid 2 | ========================= 3 | 4 | The route of a grid is automatically retrieved from the request. But when you render a controller which contains a grid from twig, the route cannot be retrieved so you have to define it. 5 | 6 | ## Usage 7 | 8 | ```php 9 | setSource($source); 12 | 13 | $grid->setRouteUrl($routeUrl); 14 | ... 15 | ``` 16 | ## Method parameters 17 | 18 | |parameter|Type|Default value|Description| 19 | |:--:|:--|:--|:--| 20 | |routeUrl|string|_none_|Url of the grid| 21 | 22 | ## Example 23 | 24 | ```php 25 | setSource($source); 38 | 39 | $grid->setRouteUrl($this->generateUrl('my_grid_route')); 40 | 41 | return $grid->getGridResponse('MyProjectMyBundle::grid.html.twig'); 42 | } 43 | } 44 | ... 45 | ``` 46 | 47 | In a twig template: 48 | 49 | ```django 50 | {% render 'MyProjectMyBundle:Default:grid' %} 51 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_limits.md: -------------------------------------------------------------------------------- 1 | Define the selector of the number of items per page 2 | =================================================== 3 | 4 | Default limits = array(20 => '20', 50 => '50', 100 => '100') 5 | 6 | ## Example 7 | ```php 8 | setSource($source); 12 | 13 | // Set the selector of the number of items per page 14 | $grid->setLimits(array(5, 10, 15)); 15 | 16 | // OR with only one value 17 | $grid->setLimits(50); 18 | 19 | // OR with labels 20 | $grid->setLimits(array(5 => 'five', 10 => 'ten', 15 => 'fifteen')); 21 | ... 22 | ``` 23 | 24 | Note that the selector and accompanying pager will not appear if the total number of rows in the grid is less than the 25 | minimum pager limit. For example, if the minimum pager limit is 20 and the number of results in the grid is 10, then 26 | the the limit selector and pager will not be rendered. 27 | 28 | ## Method parameters 29 | 30 | |parameter|Type|Default value|Description| 31 | |:--:|:--|:--|:--|:--| 32 | |limits|string or array||Values of items per page| 33 | 34 | ## Set default limits in your config.yml 35 | ```yml 36 | apy_data_grid: 37 | limits: {5: 'five', 10: 'ten', 15: 'fifteen'} 38 | ``` 39 | Or 40 | ```yml 41 | apy_data_grid: 42 | limits: [5, 10, 15] 43 | ``` 44 | Or 45 | ```yml 46 | apy_data_grid: 47 | limits: 5 48 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_max_results.md: -------------------------------------------------------------------------------- 1 | Set max results 2 | =============== 3 | 4 | ## Usage 5 | 6 | ```php 7 | setSource($source); 10 | 11 | $grid->setMaxResults($maxResults); 12 | ... 13 | ``` 14 | 15 | ## Method parameters 16 | 17 | |parameter|Type|Default value|Description| 18 | |:--:|:--|:--|:--|:--| 19 | |maxResults|integer|null|Max items in the grid| 20 | 21 | ## Example 22 | 23 | ```php 24 | setSource($source); 27 | 28 | $grid->setMaxResults(50); 29 | ... 30 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_no_data_message.md: -------------------------------------------------------------------------------- 1 | Set the no data message 2 | ======================= 3 | 4 | When you render a grid with no data in the source, the grid isn't displayed and a no data message is displayed. 5 | 6 | ## Usage 7 | 8 | ```php 9 | setSource($source); 12 | 13 | $grid->setNoDataMessage($noDataMessage); 14 | ... 15 | ``` 16 | 17 | ## Grid::setNoDataMessage parameters 18 | 19 | |parameter|Type|Default value|Description| 20 | |:--:|:--|:--|:--| 21 | |noDataMessage|string|No data|No data message| 22 | 23 | ## Example 24 | 25 | ```php 26 | setSource($source); 29 | 30 | $grid->setNoDataMessage('There is no data!'); 31 | ... 32 | ``` 33 | 34 | ## Set the default no data message in your config.yml 35 | ```yml 36 | apy_data_grid: 37 | no_data_message: There is no data! 38 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_no_result_message.md: -------------------------------------------------------------------------------- 1 | Set the no result message 2 | ========================= 3 | 4 | When you render a grid with no result after a filtering, a no result message is displayed in a unique row. 5 | 6 | ## Usage 7 | 8 | ```php 9 | setSource($source); 12 | 13 | $grid->setNoResultMessage($noResultMessage); 14 | ... 15 | ``` 16 | 17 | ## Grid::setNoResultMessage parameters 18 | 19 | |parameter|Type|Default value|Description| 20 | |:--:|:--|:--|:--| 21 | |noResultMessage|string|No result|No result message| 22 | 23 | ## Example 24 | 25 | ```php 26 | setSource($source); 29 | 30 | $grid->setNoResultMessage('There is no result!'); 31 | ... 32 | ``` 33 | 34 | ## Set the default no result message in your config.yml 35 | ```yml 36 | apy_data_grid: 37 | no_result_message: There is no result! 38 | ``` -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_permanent_filters.md: -------------------------------------------------------------------------------- 1 | Set permanent filters of the grid 2 | =============================== 3 | 4 | You can define permanent filters. These values will be used every time and the filter part will be disable for columns which have a permanent filter. 5 | 6 | ## Usage 7 | 8 | ```php 9 | setSource($source); 13 | 14 | // Set permanent filters of the grid 15 | $grid->setPermanentFilters($filters); 16 | ... 17 | ``` 18 | 19 | ## Grid::setPermanentFilters parameters 20 | 21 | |parameter|Type|Default value|Description| 22 | |:--:|:--|:--|:--|:--| 23 | |filters|array|array()|Array of array or string pair| 24 | 25 | ## Values for the filters parameter 26 | 27 | |parameter|Type|Default value|Description| 28 | |:--:|:--|:--|:--|:--| 29 | |operator|string|default operator of the column|Operator used to filter| 30 | |from|string|null|The value of the filter or the _from_ value for the between operators| 31 | |to|string|null|The _to_ value for the between operators| 32 | 33 | **Note**: If these three parameters are not defined and only a string value is defined, this value will be attributed to the _from_ value of the filter and will use the default operator of the column. 34 | 35 | ## Available Operators 36 | 37 | |Operator|Meaning| 38 | |:--:|:--| 39 | |eq|Equals| 40 | |neq|Not equal to| 41 | |lt|Lower than| 42 | |lte|Lower than or equal to| 43 | |gt|Greater than| 44 | |gte|Greater than or equal to| 45 | |like|Contains (case insensitive)| 46 | |nlike|Not contain (case insensitive)| 47 | |rlike|Starts with (case insensitive)| 48 | |llike|Ends with (case insensitive)| 49 | |slike|Contains| 50 | |nslike|Not contain| 51 | |rslike|Starts with| 52 | |lslike|Ends with| 53 | |btw|Between exclusive| 54 | |btwe|Between inclusive| 55 | |isNull|Is not defined| 56 | |isNotNull|Is defined| 57 | 58 | ## Example 59 | 60 | ```php 61 | setSource($source); 65 | 66 | // Set default filters of the grid 67 | $grid->setPermanentFilters(array( 68 | 'your_column_to_filter1' => 'your_init_value1', // Use the default operator of the column 69 | 'your_column_to_filter1' => array('from' => 'your_init_value1'), // Use the default operator of the column 70 | 'your_column_to_filter2' => array('operator' => 'eq', 'from' => 'your_init_value_from2'), // Define an operator 71 | 'your_column_to_filter3' => array('from' => 'your_init_value_from3', 'to' => 'your_init_value_to3'), // Range filter with the default operator 'btw' 72 | 'your_column_to_filter4' => array('operator' => 'btw', 'from' => 'your_init_value_from4', 'to' => 'your_init_value_to4') // Range filter with the operator 'btw' 73 | 'your_column_to_filter5' => array('operator' => 'isNull') // isNull operator 74 | )); 75 | ... 76 | ``` 77 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_prefix_titles.md: -------------------------------------------------------------------------------- 1 | Set a prefix titles 2 | =================== 3 | 4 | You can define a prefix title for all columns of the grid. 5 | 6 | ## Example 7 | 8 | ```php 9 | setSource($source); 12 | 13 | $grid->setPrefixTitle($prefixTitle); 14 | ... 15 | ``` 16 | 17 | ## Class parameters 18 | 19 | |parameter|Type|Default value|Description| 20 | |:--:|:--|:--|:--|:--| 21 | |prefixTitle|string|_none_|Prefix title of columns| 22 | 23 | ## Example 24 | 25 | ```php 26 | setSource($source); 29 | 30 | $grid->setPrefixTitle('member.field.') 31 | ... 32 | ``` 33 | 34 | If you have a column with the identifier field `group`, the column will have the title `member.field.group`. 35 | In your translation file, put `member.field.group: User group` and the column will be translated to `User group`. 36 | 37 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_size_actions_column.md: -------------------------------------------------------------------------------- 1 | Set the size of the actions column 2 | =========================================== 3 | 4 | ## Usage 5 | 6 | ```php 7 | setSource($source); 10 | 11 | $grid->setActionsColumnSize($size); 12 | ... 13 | ``` 14 | 15 | ## Grid::setActionsColumnSize parameters 16 | 17 | |Parameter|Type|Default value|Description| 18 | |:--:|:--|:--|:--| 19 | |size|integer||Size of the default actions column| 20 | 21 | ## Example 22 | 23 | ```php 24 | setSource($source); 29 | 30 | $grid->setActionsColumnSize(150); 31 | 32 | // Attach a rowAction to the Actions Column 33 | $rowAction1 = new RowAction('Show', 'route_to_show'); 34 | $grid->addRowAction($rowAction1); 35 | 36 | $rowAction2 = new RowAction('Edit', 'route_to_edit'); 37 | $grid->addRowAction($rowAction2); 38 | 39 | $rowAction3 = new RowAction('Delete', 'route_to_delete'); 40 | $grid->addRowAction($rowAction3); 41 | ... 42 | ``` 43 | 44 | ## Set the default size of the actions column in your config.yml 45 | ```yml 46 | apy_data_grid: 47 | actions_columns_size: 50 48 | ``` 49 | -------------------------------------------------------------------------------- /Resources/doc/grid_configuration/set_title_actions_column.md: -------------------------------------------------------------------------------- 1 | Set the title of the actions column 2 | =========================================== 3 | 4 | ## Usage 5 | 6 | ```php 7 | setSource($source); 10 | 11 | $grid->setActionsColumnTitle($title); 12 | ... 13 | ``` 14 | 15 | ## Grid::setActionsColumnTitle parameters 16 | 17 | |Parameter|Type|Default value|Description| 18 | |:--:|:--|:--|:--| 19 | |title|string|Actions|Title of the default actions column| 20 | 21 | ## Example 22 | 23 | ```php 24 | setSource($source); 29 | 30 | $grid->setActionsColumnTitle('default_actions_column'); 31 | 32 | // Attach a rowAction to the Actions Column 33 | $rowAction1 = new RowAction('Show', 'route_to_show'); 34 | $grid->addRowAction($rowAction1); 35 | 36 | $rowAction2 = new RowAction('Edit', 'route_to_edit'); 37 | $grid->addRowAction($rowAction2); 38 | 39 | $rowAction3 = new RowAction('Delete', 'route_to_delete'); 40 | $grid->addRowAction($rowAction3); 41 | ... 42 | ``` 43 | 44 | ## Set the default title of the actions column in your config.yml 45 | ```yml 46 | apy_data_grid: 47 | actions_columns_title: Actions 48 | ``` 49 | -------------------------------------------------------------------------------- /Resources/doc/images/false.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/APY/APYDataGridBundle/6cc1a94cb243729a5eafb3014932d4cfd083e541/Resources/doc/images/false.png -------------------------------------------------------------------------------- /Resources/doc/images/pagerfanta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/APY/APYDataGridBundle/6cc1a94cb243729a5eafb3014932d4cfd083e541/Resources/doc/images/pagerfanta.png -------------------------------------------------------------------------------- /Resources/doc/images/screenshot_database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/APY/APYDataGridBundle/6cc1a94cb243729a5eafb3014932d4cfd083e541/Resources/doc/images/screenshot_database.png -------------------------------------------------------------------------------- /Resources/doc/images/screenshot_en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/APY/APYDataGridBundle/6cc1a94cb243729a5eafb3014932d4cfd083e541/Resources/doc/images/screenshot_en.png -------------------------------------------------------------------------------- /Resources/doc/images/screenshot_fr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/APY/APYDataGridBundle/6cc1a94cb243729a5eafb3014932d4cfd083e541/Resources/doc/images/screenshot_fr.png -------------------------------------------------------------------------------- /Resources/doc/images/screenshot_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/APY/APYDataGridBundle/6cc1a94cb243729a5eafb3014932d4cfd083e541/Resources/doc/images/screenshot_full.png -------------------------------------------------------------------------------- /Resources/doc/images/sort_down.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/APY/APYDataGridBundle/6cc1a94cb243729a5eafb3014932d4cfd083e541/Resources/doc/images/sort_down.gif -------------------------------------------------------------------------------- /Resources/doc/images/sort_up.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/APY/APYDataGridBundle/6cc1a94cb243729a5eafb3014932d4cfd083e541/Resources/doc/images/sort_up.gif -------------------------------------------------------------------------------- /Resources/doc/images/true.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/APY/APYDataGridBundle/6cc1a94cb243729a5eafb3014932d4cfd083e541/Resources/doc/images/true.png -------------------------------------------------------------------------------- /Resources/doc/source/document_source.md: -------------------------------------------------------------------------------- 1 | Document source 2 | =============== 3 | 4 | Document source supports ODM dbal. 5 | 6 | **Note**: Operators `Equals` and `Contains` support regular expression. 7 | 8 | ## Usage 9 | 10 | ```php 11 | get('grid'); 25 | 26 | $grid->setSource($source); 27 | 28 | return $grid->getGridResponse('MyProjectMyBundle::my_grid.html.twig'); 29 | } 30 | } 31 | ``` 32 | 33 | ## Document::__construct parameters 34 | 35 | |parameter|Type|Default value|Description| 36 | |:--:|:--|:--|:--|:--| 37 | |entity|string|_none_|Entity expression. _\\:\_| 38 | |group|string|default|Group of annotations used. See [groups parameter in annotation](../columns_configuration/annotations/column_annotation_property.md#available-attributes)| 39 | 40 | ## Example 41 | 42 | ```php 43 | get('grid'); 57 | 58 | $grid->setSource($source); 59 | 60 | return $grid->getGridResponse('MyProjectMyBundle::grid.html.twig'); 61 | } 62 | } 63 | ``` 64 | 65 | And the template: 66 | 67 | ```janjo 68 | 69 | 70 | {{ grid(grid) }} 71 | ``` 72 | 73 | ## Missing features 74 | 75 | * Mapped fileds (Referenced or embed) 76 | * GroupBy attributes and aggregate DQL functions (If someone is skilled with the mapReduce feature, contact us) 77 | * Array column 78 | * Filter doesn't work with a ODM timestamp but it is show as a date and it can be sort 79 | 80 | ## Unsupported features 81 | 82 | * The primary column is not filterable. (We can create a special column to manage this filter but why do you want to filter an Id ?) 83 | * With ascending sort, null values are displayed first. Workaround, put a high number or `zz` and bind the value with the values attributes array('zz' => '', '9999999999' => '') 84 | -------------------------------------------------------------------------------- /Resources/doc/source/entity_source.md: -------------------------------------------------------------------------------- 1 | Entity source 2 | ============= 3 | 4 | Entity source supports ORM dbal. 5 | 6 | ## Usage 7 | 8 | ```php 9 | get('grid'); 23 | 24 | $grid->setSource($source); 25 | 26 | return $grid->getGridResponse('MyProjectMyBundle::my_grid.html.twig'); 27 | } 28 | } 29 | ``` 30 | 31 | ## Entity::__construct parameters 32 | 33 | |parameter|Type|Default value|Description| 34 | |:--:|:--|:--|:--|:--| 35 | |entity|string|_none_|Entity expression. _\\:\_| 36 | |group|string|default|Group of annotations used. See [groups parameter in annotation](../columns_configuration/annotations/column_annotation_property.md#available-attributes)| 37 | |managerName|string|null|Set this value if you want to use another manager| 38 | 39 | ## Example 40 | 41 | ```php 42 | get('grid'); 56 | 57 | $grid->setSource($source); 58 | 59 | return $grid->getGridResponse('MyProjectMyBundle::grid.html.twig'); 60 | } 61 | } 62 | ``` 63 | 64 | And the template: 65 | 66 | ```janjo 67 | 68 | 69 | {{ grid(grid) }} 70 | ``` 71 | 72 | ## Unsupported features 73 | 74 | * Entity Source doesn't support regex operator 75 | 76 | ## Known limitations 77 | 78 | * When you use a DQL fonction on a field, \*LIKE, \*NULL and REGEX operators don't work. They are disabled if your version of doctrine is < `2.5`. See [Doctrine issue](http://www.doctrine-project.org/jira/browse/DDC-1858) 79 | -------------------------------------------------------------------------------- /Resources/doc/source/index.md: -------------------------------------------------------------------------------- 1 | # Setting the Grid Source 2 | 3 | Your are in the Source settings for a Grid chapter. You can access to : 4 | 5 | * [Entity source (ORM)](entity_source.md) 6 | * [Document source (ODM)](document_source.md) 7 | * [Vector source (Array)](vector_source.md) -------------------------------------------------------------------------------- /Resources/doc/template/cell_rendering.md: -------------------------------------------------------------------------------- 1 | Cell rendering 2 | ============== 3 | 4 | Cell rendering in the grid is handled by specific blocks in your template. 5 | If this block doesn't exist, the value is displayed without any transformation. 6 | The following parameters are passed to the block `grid_column_type_%column_type%_cell`. 7 | 8 | ## Block parameters 9 | 10 | |Parameter|Type|Description| 11 | |:--|:--|:--| 12 | |grid|APY/DataGridBundle/Grid/Grid|The grid object| 13 | |column|APY/DataGridBundle/Grid/Column/Colomn|The column currently being rendered| 14 | |row|APY/DataGridBundle/Grid/Row|The row of the source being rendered| 15 | |value|mixed|The value of the cell| 16 | |params|array|Additional parameters passed to the grid| 17 | 18 | ## Overriding block names (ordered) 19 | 20 | You can override the default block `grid_column_type_%column_type%_cell` or use one of these following blocks. 21 | They are called before the default block. 22 | 23 | * `grid_%id%_column_id_%column_id%_cell` 24 | * `grid_%id%_column_type_%column_type%_cell` 25 | * `grid_%id%_column_type_%column_parent_type%_cell` 26 | * `grid_column_id_%column_id%_cell` 27 | * `grid_column_type_%column_type%_cell` 28 | * `grid_column_type_%column_parent_type%_cell` 29 | 30 | **Note 1**: It is also possible to name blocks using `..._column_...` instead of `..._column_id_...` and `..._column_type_...`. 31 | However this naming convention is not advised as it is ambiguous. It is only supported for backward compatibility. 32 | 33 | **Note 2**: `.` and `:` characters in mapped field with a DQL aggregate function are replaced by an underscore. 34 | 35 | ## Examples 36 | 37 | #### Use icons for boolean columns with passed additional parameters 38 | 39 | ```janjo 40 | grid(grid, 'my_grid_template.html.twig', '', {'imgDir': 'img/'}) 41 | ``` 42 | 43 | ```janjo 44 | 45 | {% extends '@APYDataGrid/blocks.html.twig' %} 46 | 47 | {% block grid_column_type_boolean_cell %} 48 | {{ value }} 49 | {% endblock grid_column_type_boolean_cell %} 50 | ``` 51 | 52 | #### Use the SearchOnclick functionality with the previous block 53 | 54 | ```janjo 55 | grid(grid, 'my_grid_template.html.twig', '', {'imgDir': 'img/'}) 56 | ``` 57 | 58 | ```janjo 59 | 60 | {% extends '@APYDataGrid/blocks.html.twig' %} 61 | 62 | {% block grid_column_type_boolean_cell %} 63 | {% set value = '~value~' %} 64 | {{ block('grid_column_cell') }} 65 | {% endblock grid_column_type_boolean_cell %} 66 | ``` 67 | -------------------------------------------------------------------------------- /Resources/doc/template/filter_rendering.md: -------------------------------------------------------------------------------- 1 | Filter rendering 2 | ================ 3 | 4 | Filter rendering in the grid is handled by specific blocks in your template. 5 | The following parameters are passed to the block `grid_column_type_%column_type%_filter`: 6 | 7 | ## Block parameters 8 | 9 | |Parameter|Type|Description| 10 | |:--|:--|:--| 11 | |grid|APY/DataGridBundle/Grid/Grid|The grid object| 12 | |column|APY/DataGridBundle/Grid/Column/Colomn|The column currently being rendered| 13 | |submitOnChange|boolean|For select filters| 14 | |params|array|Additional parameters passed to the grid| 15 | 16 | ## Overriding block names (ordered) 17 | 18 | You can override the default block `grid_column_type_%column_type%_filter` or use one of these following blocks. 19 | They are called before the default block. 20 | 21 | * `grid_%id%_column_id_%column_id%_filter` 22 | * `grid_%id%_column_type_%column_type%_filter` 23 | * `grid_%id%_column_type_%column_parent_type%_filter` 24 | * `grid_%id%_column_filter_type_%column_filter_type%` 25 | * `grid_column_id_%column_id%_filter` 26 | * `grid_column_type_%column_type%_filter` 27 | * `grid_column_type_%column_parent_type%_filter` 28 | * `grid_column_filter_type_%column_filter_type%` 29 | 30 | **Note 1**: It is also possible to name blocks using `..._column_...` instead of `..._column_id_...`. 31 | However this naming convention is not advised as it is ambiguous. It is only supported for backward compatibility. 32 | 33 | **Note 2**: `.` and `:` characters in mapped field with a DQL aggregate function are replaced by an underscore. 34 | 35 | ## Examples 36 | 37 | See [Create a filter](../columns_configuration/filters/create_filter.md) 38 | -------------------------------------------------------------------------------- /Resources/doc/template/index.md: -------------------------------------------------------------------------------- 1 | # Display the Grid (Twig template) 2 | 3 | ## Usage 4 | 5 | Pass the $grid object to the view and call your grid render in your template. This will automatically populate a 6 | Twig variable ```grid```. 7 | 8 | ```php 9 | get('grid'); 16 | 17 | $grid->setSource($source); 18 | 19 | return $grid->getGridResponse('MyProjectMyBundle::my_grid.html.twig'); 20 | } 21 | // [...] 22 | } 23 | ``` 24 | 25 | And the Twig template 26 | 27 | ```djanjo 28 | 29 | 30 | {{ grid(grid, theme, id, params) }} 31 | ``` 32 | 33 | ## Grid Function Parameters Reference 34 | 35 | |parameter|Type|Default value|Description| 36 | |:--:|:--|:--|:--|:--| 37 | |grid|APY/DataGridBundle/Grid/Grid||The grid object| 38 | |theme|string|Template defined in configuration ([see here](overriding_internal_blocks.md#external-template))|Template used to render the grid| 39 | |id|string|_none_|Set the identifier of the grid.| 40 | |params|array|array()|Additional parameters passed to each block.| 41 | 42 | ## Overriding the getGridResponse function 43 | 44 | See [Grid Response helper](../grid_configuration/grid_response.md) for a detailed outline of ```getGridResponse```. 45 | 46 | Example with two grids: 47 | 48 | ```php 49 | isReadyForRedirect()) { 52 | return $grid->getGridResponse(); 53 | } elseif ($grid2->isReadyForRedirect()) { 54 | return $grid2->getGridResponse(); 55 | } else { 56 | 57 | // Your code 58 | 59 | return $this->render('MyProjectMyBundle::my_grid.html.twig', array('grid' => $grid, 'grid2' => $grid2)); 60 | } 61 | ... 62 | ``` 63 | 64 | **Note:** GridResponse parameters are useless in this case and exports are managed directly in the getGridResponse function. 65 | 66 | ## Learn more about advanced features and usages 67 | 68 | * [Display an ajax grid](render_an_ajax_grid.md) 69 | * [Cell rendering](cell_rendering.md) 70 | * [Filter rendering](filter_rendering.md) 71 | * [Overriding internal blocks](overriding_internal_blocks.md) 72 | * [Display an external filters box](render_external_filters.md) 73 | * [Display a pagerfanta pager](render_pagerfanta_pager.md) -------------------------------------------------------------------------------- /Resources/doc/template/pagerfanta_example.css: -------------------------------------------------------------------------------- 1 | nav { 2 | text-align: center; 3 | } 4 | nav a, nav span { 5 | display: inline-block; 6 | border: 1px solid blue; 7 | color: blue; 8 | margin-right: .2em; 9 | padding: .25em .35em; 10 | } 11 | 12 | nav a { 13 | text-decoration: none; 14 | } 15 | 16 | nav a:hover { 17 | background: #ccf; 18 | } 19 | 20 | nav .dots { 21 | border-width: 0; 22 | } 23 | 24 | nav .current { 25 | background: #ccf; 26 | font-weight: bold; 27 | } 28 | 29 | nav .disabled { 30 | border-color: #ccf; 31 | color: #ccf; 32 | } -------------------------------------------------------------------------------- /Resources/doc/template/render_an_ajax_grid.md: -------------------------------------------------------------------------------- 1 | Render an ajax grid 2 | =================== 3 | 4 | You can load the grid with ajax interactions. 5 | Simply call or extend the template `@APYDataGrid/blocks_js.jquery.html.twig` instead of `@APYDataGrid/blocks.html.twig`. 6 | This template only works with the jQuery Javascript Framework but you can change it to manage this feature with your own Javascript Framework. 7 | 8 | 9 | ## Usage 10 | 11 | Before : `{{ grid(data, '@APYDataGrid/blocks.html.twig') }}` 12 | After: `{{ grid(data, '@APYDataGrid/blocks_js.jquery.html.twig') }}` 13 | 14 | **Note**: The grid_search twig function doesn't need to extend this same template because its script are already included in the grid template. 15 | 16 | #### Example 17 | 18 | ```django 19 | {{ grid_search(data, '@APYDataGrid/blocks.html.twig') }} 20 | 21 | {{ grid(data, '@APYDataGrid/blocks_js.jquery.html.twig') }} 22 | ``` -------------------------------------------------------------------------------- /Resources/doc/template/render_external_filters.md: -------------------------------------------------------------------------------- 1 | Render external filters 2 | ======================= 3 | 4 | ## Usage 5 | 6 | Pass the $grid object to the view and call your grid render in your template. 7 | 8 | ```php 9 | get('grid'); 12 | 13 | return $grid->getGridResponse('grid.html.twig'); 14 | ... 15 | ``` 16 | 17 | And the template 18 | 19 | ```janjo 20 | 21 | 22 | {{ grid_search(grid, theme, id, params) }} 23 | ... 24 | ``` 25 | 26 | 27 | #### grid_search function parameters 28 | 29 | |parameter|Type|Default value|Description| 30 | |:--:|:--|:--|:--|:--| 31 | |grid|APY/DataGridBundle/Grid/Grid||The grid object| 32 | |theme|string|@APYDataGrid/blocks.html.twig|Template used to render the filters blocks| 33 | |id|string|_none_|Set the identifier of the grid.| 34 | |params|array|array()|Additional parameters passed to each block.| 35 | 36 | **Note**: You have to define the same `id` in this function and in the grid function. Same thing with the `param` argument if you use additionnal parameters in the rendering of the filters. 37 | 38 | #### Example 39 | 40 | ```janjo 41 | 42 | 43 | {{ grid_search(grid) }} 44 | 45 | {{ grid(grid) }} 46 | ... 47 | ``` 48 | 49 | **Note**: You can use a different template for the external filters but only the filters blocks can be useful. 50 | 51 | #### Hide the grid filters 52 | 53 | If you don't want to show the filter in the grid columns, you can disable the grid_filters blocks with an external template. 54 | 55 | `{{ grid(grid, 'grid.html.twig') }}` 56 | 57 | And in your `grid.html.twig` template 58 | 59 | ```janjo 60 | {% block grid_filters %}{% endblock %} 61 | ``` 62 | 63 | Or directly use the same template : 64 | 65 | ```janjo 66 | {{ grid_search(grid) }} 67 | 68 | {{ grid(grid, _self) }} 69 | 70 | {% block grid_filters %}{% endblock %} 71 | ``` -------------------------------------------------------------------------------- /Resources/doc/template/render_pagerfanta_pager.md: -------------------------------------------------------------------------------- 1 | Render a pagerfanta pager 2 | ========================= 3 | 4 | ## Installation 5 | 6 | You have to install the [pagerfanta library](https://github.com/whiteoctober/Pagerfanta) in the directory `vendor/pagerfanta/`. 7 | 8 | Then add this new library to your autoload.php file. 9 | 10 | ```php 11 | registerNamespaces(array( 14 | // ... 15 | 'APY' => __DIR__.'/../vendor/bundles', 16 | 'Pagerfanta' => __DIR__.'/../vendor/pagerfanta/src', 17 | // ... 18 | )); 19 | ``` 20 | 21 | ## Usage 22 | 23 | in config.yml: 24 | 25 | 26 | ``` 27 | apy_data_grid: 28 | pagerfanta: 29 | enable: true #default false 30 | view_class: Pagerfanta\View\TwitterBootstrapView #default Pagerfanta\View\DefaultView 31 | options: #all options of pager fanta view constructor 32 | prev_message : « 33 | next_message : » 34 | 35 | ``` 36 | 37 | ## grid_pagerfanta function parameters 38 | 39 | |parameter|Type|Default value|Description| 40 | |:--:|:--|:--|:--|:--| 41 | |grid|APY/DataGridBundle/Grid/Grid||The grid object| 42 | 43 | ## Example of css associated with this pager (from [Pagerfanta Github page](https://github.com/whiteoctober/Pagerfanta)) 44 | 45 | ![Pagerfanta screenshot](../images/pagerfanta.png?raw=true) 46 | 47 | ```css 48 | nav { 49 | text-align: center; 50 | } 51 | nav a, nav span { 52 | display: inline-block; 53 | border: 1px solid blue; 54 | color: blue; 55 | margin-right: .2em; 56 | padding: .25em .35em; 57 | } 58 | 59 | nav a { 60 | text-decoration: none; 61 | } 62 | 63 | nav a:hover { 64 | background: #ccf; 65 | } 66 | 67 | nav .dots { 68 | border-width: 0; 69 | } 70 | 71 | nav .current { 72 | background: #ccf; 73 | font-weight: bold; 74 | } 75 | 76 | nav .disabled { 77 | border-color: #ccf; 78 | color: #ccf; 79 | } 80 | ``` 81 | -------------------------------------------------------------------------------- /Resources/translations/messages.ja.xliff: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Page 7 | ページ 8 | 9 | 10 | , Display 11 | , 12 | 13 | 14 | of %count% 15 | ~ %count% 16 | 17 | 18 | Items per page 19 | 項目を表示する 20 | 21 | 22 | Select visible 23 | このページの項目を選択 24 | 25 | 26 | Select all 27 | すべて選択 28 | 29 | 30 | Deselect visible 31 | このページの項目を選択しない 32 | 33 | 34 | Deselect all 35 | すべて選択しない 36 | 37 | 38 | Action 39 | アクション 40 | 41 | 42 | Submit Action 43 | 入力 44 | 45 | 46 | From: 47 | から: 48 | 49 | 50 | To: 51 | まで: 52 | 53 | 54 | Delete 55 | 削除 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Resources/translations/messages.sk.xliff: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Page 7 | Strana 8 | 9 | 10 | , Display 11 | , Zobraz 12 | 13 | 14 | of %count% 15 | z %count% 16 | 17 | 18 | Items per page 19 | Položiek na stranu 20 | 21 | 22 | Select visible 23 | Označ viditelné 24 | 25 | 26 | Select all 27 | Označ všetko 28 | 29 | 30 | Deselect visible 31 | Odznač viditelné 32 | 33 | 34 | Deselect all 35 | Odznač všetko 36 | 37 | 38 | Action 39 | Akcia 40 | 41 | 42 | Submit Action 43 | Odoslať 44 | 45 | 46 | From: 47 | Od: 48 | 49 | 50 | To: 51 | Do: 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Resources/views/blocks_js.jquery.html.twig: -------------------------------------------------------------------------------- 1 | {% extends '@APYDataGrid/blocks.html.twig' %} 2 | 3 | {% block grid_scripts_goto %} 4 | function {{ grid.hash }}_goto(url, data, type) 5 | { 6 | type = type || 'GET'; 7 | data = data || []; 8 | 9 | $.ajax({ 10 | url: url, 11 | data: data, 12 | type: type 13 | }).done(function( msg ) { 14 | $('#{{ grid.hash }}').parent().replaceWith(msg); 15 | }); 16 | 17 | return false 18 | } 19 | {% endblock grid_scripts_goto %} 20 | 21 | {% block grid_scripts_submit_form %} 22 | function {{ grid.hash }}_submitForm(event, form) 23 | { 24 | if (event.type != 'keypress' || event.which == 13) { 25 | var data = ''; 26 | $('.grid-filter-operator select, .grid-filter-input-query-from, .grid-filter-input-query-to, .grid-filter-select-query-from, .grid-filter-select-query-to', form).each(function () { 27 | if ($(this).is(':disabled') == false) { 28 | var name = $(this).attr('name'); 29 | var value = $(this).val(); 30 | if (value != null) { 31 | if ($(this).attr('multiple') == 'multiple') { 32 | for(var i= 0; i < value.length; i++) 33 | { 34 | data += '&' + name + '=' + encodeURIComponent(value[i]); 35 | } 36 | } else { 37 | data += '&' + name + '=' + encodeURIComponent(value); 38 | } 39 | } else { 40 | data += '&' + name + '='; 41 | } 42 | } 43 | }); 44 | 45 | {{ grid.hash }}_goto('{{ grid.routeUrl }}', data.substring(1), 'POST'); 46 | 47 | return false; 48 | } 49 | } 50 | {% endblock grid_scripts_submit_form %} 51 | 52 | {% block grid_scripts_ajax %} 53 | $(function () { 54 | // Order and pagerfanta links 55 | $('.pagination li.disabled a', '#{{ grid.hash }}').click(function (e) { 56 | return false; 57 | }); 58 | 59 | // Order and pagerfanta links 60 | $('a.order, nav a, a.searchOnClick, .pagination li:not(.disabled) a', '#{{ grid.hash }}').click(function () { 61 | {{ grid.hash }}_goto(this.href); 62 | 63 | return false; 64 | }); 65 | 66 | // Reset link 67 | $('#{{ grid.hash }} a.grid-reset').click(function () { 68 | {{ grid.hash }}_reset(); 69 | 70 | return false; 71 | }); 72 | 73 | // Mass actions submit 74 | $('#{{ grid.hash }} input.submit-massaction').click(function () { 75 | var selector = $('#{{ grid.hash }} .grid_massactions select'); 76 | 77 | {{ grid.hash }}_goto('{{ grid.routeUrl }}', selector.attr('name') + '=' + selector.val(), 'POST'); 78 | 79 | return false; 80 | }); 81 | 82 | // Grid_search submit (load only one time) 83 | $('#{{ grid.hash }}_search').one('submit', function (event) { 84 | {{ grid.hash }}_submitForm(event, this); 85 | 86 | return false; 87 | }); 88 | }); 89 | {% endblock grid_scripts_ajax %} 90 | -------------------------------------------------------------------------------- /Translation/ColumnTitleAnnotationTranslationExtractor.php: -------------------------------------------------------------------------------- 1 | annotated = false; 22 | $this->parsedClassName = null; 23 | } 24 | 25 | public function enterNode(\PHPParser_Node $node) 26 | { 27 | if ($node instanceof \PHPParser_Node_Stmt_Namespace) { 28 | // Base namespace 29 | $this->parsedClassName = $node->name->toString(); 30 | } elseif ($node instanceof \PHPParser_Node_Stmt_UseUse) { 31 | // Don't worry about classes that don't import the grid mapper 32 | if ('APY_DataGridBundle_Grid_Mapping' == $node->name->toString('_')) { 33 | $this->annotated = true; 34 | } 35 | } elseif ($node instanceof \PHPParser_Node_Stmt_Class) { 36 | // Append class name to base namespace 37 | $this->parsedClassName .= '\\' . $node->name; 38 | } 39 | } 40 | 41 | public function leaveNode(\PHPParser_Node $node) 42 | { 43 | } 44 | public function afterTraverse(array $nodes) 45 | { 46 | } 47 | 48 | public function visitFile(\SplFileInfo $file, MessageCatalogue $catalogue) 49 | { 50 | } 51 | 52 | public function visitPhpFile(\SplFileInfo $file, MessageCatalogue $catalogue, array $ast) 53 | { 54 | $this->catalogue = $catalogue; 55 | 56 | // Traverse document to assemble class name 57 | $traverser = new \PHPParser_NodeTraverser(); 58 | $traverser->addVisitor($this); 59 | $traverser->traverse($ast); 60 | 61 | if ($this->annotated) { 62 | // Get annotations for the class 63 | $annotationDriver = new Annotation(new DoctrineAnnotationReader()); 64 | $manager = new Manager(); 65 | $manager->addDriver($annotationDriver, -1); 66 | $metadata = $manager->getMetadata($this->parsedClassName); 67 | 68 | // Save messages for title 69 | foreach ($metadata->getFields() as $field) { 70 | $mappedField = $metadata->getFieldMapping($field); 71 | if ((!isset($mappedField['visible']) || $mappedField['visible']) && isset($mappedField['title'])) { 72 | $message = new Message($mappedField['title']); 73 | $message->addSource(new FileSource((string) $file)); 74 | $catalogue->add($message); 75 | } 76 | } 77 | } 78 | } 79 | 80 | public function visitTwigFile(\SplFileInfo $file, MessageCatalogue $catalogue, \Twig_Node $node) 81 | { 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "apy/datagrid-bundle", 3 | "description": "Symfony Datagrid Bundle", 4 | "keywords": ["Symfony", "datagrid"], 5 | "homepage": "https://github.com/apy/APYDataGridBundle", 6 | "type": "symfony-bundle", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Yoann Petit", 11 | "email": "abhoryo@free.fr" 12 | }, 13 | { 14 | "name": "Stanislav Turza", 15 | "email": "stanislav.turza@gmail.com" 16 | }, 17 | { 18 | "name": "Evan Owens", 19 | "email": "eaowens@gmail.com" 20 | }, 21 | { 22 | "name": "Nicolas Potier", 23 | "email": "contact@acseo.fr" 24 | } 25 | ], 26 | "require": { 27 | "php": "^7.4 || ^8.0", 28 | "symfony/form": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 29 | "symfony/dependency-injection": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 30 | "symfony/config": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 31 | "symfony/http-foundation": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 32 | "symfony/http-kernel": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 33 | "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 34 | "symfony/security-core": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 35 | "symfony/serializer": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 36 | "twig/twig": "^2.14 || ^3.0" 37 | }, 38 | "require-dev": { 39 | "symfony/browser-kit": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 40 | "symfony/expression-language": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 41 | "symfony/framework-bundle": "^4.3 || ^5.0 || ^6.0 || ^7.0", 42 | "symfony/security-bundle": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 43 | "symfony/twig-bundle": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", 44 | "phpunit/phpunit": "^9.5", 45 | "friendsofphp/php-cs-fixer": "^3.0", 46 | "php-coveralls/php-coveralls": "^2.0", 47 | "doctrine/orm": "~2.10,>=2.10.0", 48 | "doctrine/mongodb-odm": "^2.2", 49 | "rector/rector": "^0.12.13", 50 | "dg/bypass-finals": "^1.3", 51 | "doctrine/doctrine-bundle": "^2.5" 52 | }, 53 | "suggest": { 54 | "ext-intl": "Translate the grid", 55 | "ext-mbstring": "Convert your data with the right charset", 56 | "PHPExcel": "Export the grid (Excel, HTML or PDF)", 57 | "doctrine/orm": "If you want to use Entity as source, please require doctrine/orm", 58 | "doctrine/mongodb-odm": "If you want to use Document as source, please require doctrine/mongodb-odm", 59 | "jms/translation-bundle": "If you want to use translations" 60 | }, 61 | "autoload": { 62 | "psr-4": { "APY\\DataGridBundle\\": "" } 63 | }, 64 | "extra": { 65 | "branch-alias": { 66 | "dev-master": "6.x-dev" 67 | } 68 | }, 69 | "provide": { 70 | "ext-mongo": "1.5" 71 | } 72 | } 73 | --------------------------------------------------------------------------------