├── .gitignore ├── .scrutinizer.yml ├── .travis.yml ├── AdmingeneratorGeneratorBundle.php ├── Builder ├── Admin │ ├── ActionsBuilder.php │ ├── ActionsBuilderAction.php │ ├── ActionsBuilderTemplate.php │ ├── BaseBuilder.php │ ├── EditBuilder.php │ ├── EditBuilderAction.php │ ├── EditBuilderTemplate.php │ ├── EditBuilderType.php │ ├── EmptyBuilderAction.php │ ├── ExcelBuilder.php │ ├── ExcelBuilderAction.php │ ├── FiltersBuilder.php │ ├── FiltersBuilderType.php │ ├── ListBuilder.php │ ├── ListBuilderAction.php │ ├── ListBuilderTemplate.php │ ├── NestedListBuilder.php │ ├── NestedListBuilderAction.php │ ├── NestedListBuilderTemplate.php │ ├── NewBuilder.php │ ├── NewBuilderAction.php │ ├── NewBuilderTemplate.php │ ├── NewBuilderType.php │ ├── ShowBuilder.php │ ├── ShowBuilderAction.php │ └── ShowBuilderTemplate.php ├── BaseBuilder.php ├── Doctrine │ ├── ActionsBuilderAction.php │ ├── ActionsBuilderTemplate.php │ ├── EditBuilderAction.php │ ├── EditBuilderTemplate.php │ ├── EditBuilderType.php │ ├── ExcelBuilderAction.php │ ├── FiltersBuilderType.php │ ├── ListBuilderAction.php │ ├── ListBuilderTemplate.php │ ├── NestedListBuilderAction.php │ ├── NestedListBuilderTemplate.php │ ├── NewBuilderAction.php │ ├── NewBuilderTemplate.php │ ├── NewBuilderType.php │ ├── ShowBuilderAction.php │ └── ShowBuilderTemplate.php ├── DoctrineODM │ ├── ActionsBuilderAction.php │ ├── ActionsBuilderTemplate.php │ ├── EditBuilderAction.php │ ├── EditBuilderTemplate.php │ ├── EditBuilderType.php │ ├── ExcelBuilderAction.php │ ├── FiltersBuilderType.php │ ├── ListBuilderAction.php │ ├── ListBuilderTemplate.php │ ├── NewBuilderAction.php │ ├── NewBuilderTemplate.php │ ├── NewBuilderType.php │ ├── ShowBuilderAction.php │ └── ShowBuilderTemplate.php ├── EmptyGenerator.php ├── Generator.php └── Propel │ ├── ActionsBuilderAction.php │ ├── ActionsBuilderTemplate.php │ ├── EditBuilderAction.php │ ├── EditBuilderTemplate.php │ ├── EditBuilderType.php │ ├── ExcelBuilderAction.php │ ├── FiltersBuilderType.php │ ├── ListBuilderAction.php │ ├── ListBuilderTemplate.php │ ├── NestedListBuilderAction.php │ ├── NestedListBuilderTemplate.php │ ├── NewBuilderAction.php │ ├── NewBuilderTemplate.php │ ├── NewBuilderType.php │ ├── ShowBuilderAction.php │ └── ShowBuilderTemplate.php ├── CONTRIBUTING.md ├── CacheWarmer ├── GeneratorCacheWarmer.php └── GeneratorFinder.php ├── ClassLoader └── AdmingeneratedClassLoader.php ├── Command ├── GenerateAdminAdminCommand.php ├── GenerateAdminCommand.php └── SetupOrUpgradeCommand.php ├── Controller ├── Doctrine │ └── BaseController.php ├── DoctrineODM │ └── BaseController.php └── Propel │ └── BaseController.php ├── DependencyInjection ├── AdmingeneratorGeneratorExtension.php ├── Compiler │ ├── FormCompilerPass.php │ └── ValidatorCompilerPass.php └── Configuration.php ├── EventListener └── ControllerListener.php ├── Exception ├── CantGenerateException.php ├── GeneratedModelClassNotFoundException.php ├── ModelClassNotFoundException.php ├── ModelManagerNotSelectedException.php ├── NotAdminGeneratedException.php ├── NotImplementedException.php └── ValidationException.php ├── Generator ├── Action.php ├── Action │ ├── Batch │ │ └── DeleteAction.php │ ├── Generic │ │ ├── ExcelAction.php │ │ ├── ListAction.php │ │ ├── NewAction.php │ │ ├── SaveAction.php │ │ ├── SaveAndAddAction.php │ │ └── SaveAndListAction.php │ └── Object │ │ ├── DeleteAction.php │ │ ├── EditAction.php │ │ └── ShowAction.php ├── BundleGenerator.php ├── Column.php ├── DoctrineGenerator.php ├── DoctrineODMGenerator.php ├── Generator.php ├── GeneratorInterface.php ├── PropelColumn.php └── PropelGenerator.php ├── Guesser ├── DoctrineODMFieldGuesser.php ├── DoctrineORMFieldGuesser.php └── PropelORMFieldGuesser.php ├── LICENSE ├── Menu ├── AdmingeneratorMenuBuilder.php └── DefaultMenuBuilder.php ├── Pagerfanta └── View │ └── AdmingeneratorView.php ├── QueryFilter ├── BaseQueryFilter.php ├── DoctrineODMQueryFilter.php ├── DoctrineQueryFilter.php ├── PropelQueryFilter.php └── QueryFilterInterface.php ├── README.md ├── Resources ├── config │ ├── default.yml │ ├── doctrine_odm.xml │ ├── doctrine_orm.xml │ ├── propel.xml │ └── services.xml ├── doc │ ├── builders │ │ ├── actions-builder.md │ │ ├── common │ │ │ ├── localized-date.md │ │ │ └── title.md │ │ ├── edit-builder.md │ │ ├── edit │ │ │ └── concurrency-lock.md │ │ ├── excel-builder.md │ │ └── list-builder.md │ ├── cookbook │ │ ├── a2lixTranslationFormBundle-integration.md │ │ ├── changeing-web-directory.md │ │ ├── commandLine.md │ │ ├── conditional-actions.md │ │ ├── controllers.md │ │ ├── custom-view-types.md │ │ ├── extending-generator-templates.md │ │ ├── formTypes.md │ │ ├── images │ │ │ ├── a2lix-integrations.png │ │ │ └── console-example.png │ │ ├── menu.md │ │ └── templating.md │ ├── documentation.md │ ├── features │ │ ├── doctrine-odm-features.md │ │ ├── doctrine-orm-features.md │ │ └── propel-features.md │ ├── generator │ │ ├── embed-types.md │ │ ├── entity-manager.md │ │ └── pk-requirement.md │ ├── installation │ │ ├── configuration.md │ │ └── installation-via-composer.md │ ├── internationalization │ │ └── generator-translation.md │ ├── security │ │ ├── credentials.md │ │ └── csrf-protection.md │ └── support-and-contribution │ │ ├── contributing.md │ │ ├── gfm-cheat-sheet.png │ │ ├── submitting-issues.md │ │ └── upgrade-notes.md ├── less │ ├── bootstrap-extended.less │ └── datepicker.less ├── old-doc │ ├── README-old.md │ ├── change-the-menu-class.markdown │ ├── doc_edit.png │ ├── doc_list.png │ ├── entitypicker-type.markdown │ └── upload-type.markdown ├── preview │ ├── dashboard-welcome-preview.png │ ├── edit-preview.png │ └── list-preview.png ├── public │ ├── css │ │ ├── bootstrap-extended.css │ │ ├── general.css │ │ ├── nested-list.css │ │ └── profile.css │ ├── cur │ │ ├── closedhand.cur │ │ └── openhand.cur │ ├── ico │ │ ├── admingenerator_gravatar.png │ │ ├── apple-touch-icon-114-precomposed.png │ │ ├── apple-touch-icon-144-precomposed.png │ │ ├── apple-touch-icon-57-precomposed.png │ │ ├── apple-touch-icon-72-precomposed.png │ │ └── favicon.ico │ └── js │ │ ├── admingenerator │ │ ├── batch-actions.js │ │ ├── general.js │ │ ├── generic-actions.js │ │ ├── nestedset.js │ │ └── object-actions.js │ │ └── treeTable │ │ └── jquery.treeTable-extended.js ├── skeleton │ └── bundle │ │ ├── Bundle.php.twig │ │ ├── DefaultController.php.twig │ │ ├── DefaultType.php.twig │ │ ├── default_view.html.twig │ │ └── generator.yml.twig ├── templates │ ├── CommonAdmin │ │ ├── ActionsAction │ │ │ ├── ActionsBuilderAction.php.twig │ │ │ ├── batch_action.php.twig │ │ │ ├── batch_delete.php.twig │ │ │ ├── object_action.php.twig │ │ │ └── object_delete.php.twig │ │ ├── ActionsTemplate │ │ │ ├── ActionsBuilderTemplate.php.twig │ │ │ ├── actions.php.twig │ │ │ ├── form.php.twig │ │ │ └── title.php.twig │ │ ├── EditAction │ │ │ ├── EditBuilderAction.php.twig │ │ │ ├── index.php.twig │ │ │ └── update.php.twig │ │ ├── EditTemplate │ │ │ ├── EditBuilderTemplate.php.twig │ │ │ ├── FormBuilderTemplate.php.twig │ │ │ └── fieldset.php.twig │ │ ├── EditType │ │ │ ├── EditBuilderType.php.twig │ │ │ └── type.php.twig │ │ ├── ExcelAction │ │ │ └── ExcelBuilderAction.php.twig │ │ ├── ListAction │ │ │ ├── ListBuilderAction.php.twig │ │ │ ├── filters.php.twig │ │ │ ├── index.php.twig │ │ │ ├── pager.php.twig │ │ │ ├── scopes.php.twig │ │ │ └── sorter.php.twig │ │ ├── ListTemplate │ │ │ ├── Column │ │ │ │ ├── boolean.php.twig │ │ │ │ ├── collection.php.twig │ │ │ │ ├── date.php.twig │ │ │ │ ├── datetime.php.twig │ │ │ │ ├── decimal.php.twig │ │ │ │ └── money.php.twig │ │ │ ├── FiltersBuilderTemplate.php.twig │ │ │ ├── ListBuilderTemplate.php.twig │ │ │ ├── ResultsBuilderTemplate.php.twig │ │ │ ├── RowBuilderTemplate.php.twig │ │ │ ├── nbresults.php.twig │ │ │ ├── paginator.php.twig │ │ │ ├── row.php.twig │ │ │ ├── scopes.php.twig │ │ │ ├── tbody.php.twig │ │ │ └── thead.php.twig │ │ ├── NestedListAction │ │ │ ├── NestedListBuilderAction.php.twig │ │ │ └── index.php.twig │ │ ├── NestedListTemplate │ │ │ ├── NestedListBuilderTemplate.php.twig │ │ │ ├── ResultsBuilderTemplate.php.twig │ │ │ ├── RowBuilderTemplate.php.twig │ │ │ ├── modal.php.twig │ │ │ ├── nbresults.php.twig │ │ │ └── thead.php.twig │ │ ├── NewAction │ │ │ ├── NewBuilderAction.php.twig │ │ │ ├── create.php.twig │ │ │ └── index.php.twig │ │ ├── ShowAction │ │ │ ├── ShowBuilderAction.php.twig │ │ │ └── index.php.twig │ │ ├── ShowTemplate │ │ │ ├── ShowBuilderTemplate.php.twig │ │ │ ├── show.php.twig │ │ │ └── sidebar.php.twig │ │ ├── batch_actions.php.twig │ │ ├── csrf_protection.php.twig │ │ ├── generic_actions.php.twig │ │ ├── javascripts.php.twig │ │ ├── object_actions.php.twig │ │ ├── security_action.php.twig │ │ ├── stylesheets.php.twig │ │ ├── tabs.php.twig │ │ └── title.php.twig │ ├── Doctrine │ │ ├── ActionsBuilderAction.php.twig │ │ ├── ActionsBuilderTemplate.php.twig │ │ ├── Edit │ │ │ └── FormBuilderTemplate.php.twig │ │ ├── EditBuilderAction.php.twig │ │ ├── EditBuilderTemplate.php.twig │ │ ├── EditBuilderType.php.twig │ │ ├── ExcelBuilderAction.php.twig │ │ ├── List │ │ │ ├── FiltersBuilderTemplate.php.twig │ │ │ ├── ResultsBuilderTemplate.php.twig │ │ │ └── RowBuilderTemplate.php.twig │ │ ├── ListBuilderAction.php.twig │ │ ├── ListBuilderTemplate.php.twig │ │ ├── NestedList │ │ │ ├── ResultsBuilderTemplate.php.twig │ │ │ └── RowBuilderTemplate.php.twig │ │ ├── NestedListBuilderAction.php.twig │ │ ├── NestedListBuilderTemplate.php.twig │ │ ├── NewBuilderAction.php.twig │ │ ├── ShowBuilderAction.php.twig │ │ └── ShowBuilderTemplate.php.twig │ ├── DoctrineODM │ │ ├── ActionsBuilderAction.php.twig │ │ ├── ActionsBuilderTemplate.php.twig │ │ ├── Edit │ │ │ └── FormBuilderTemplate.php.twig │ │ ├── EditBuilderAction.php.twig │ │ ├── EditBuilderTemplate.php.twig │ │ ├── EditBuilderType.php.twig │ │ ├── ExcelBuilderAction.php.twig │ │ ├── List │ │ │ ├── FiltersBuilderTemplate.php.twig │ │ │ ├── ResultsBuilderTemplate.php.twig │ │ │ └── RowBuilderTemplate.php.twig │ │ ├── ListBuilderAction.php.twig │ │ ├── ListBuilderTemplate.php.twig │ │ ├── NestedList │ │ │ ├── ResultsBuilderTemplate.php.twig │ │ │ └── RowBuilderTemplate.php.twig │ │ ├── NewBuilderAction.php.twig │ │ ├── ShowBuilderAction.php.twig │ │ └── ShowBuilderTemplate.php.twig │ ├── EmptyBuilderAction.php.twig │ └── Propel │ │ ├── ActionsBuilderAction.php.twig │ │ ├── ActionsBuilderTemplate.php.twig │ │ ├── Edit │ │ └── FormBuilderTemplate.php.twig │ │ ├── EditBuilderAction.php.twig │ │ ├── EditBuilderTemplate.php.twig │ │ ├── EditBuilderType.php.twig │ │ ├── ExcelBuilderAction.php.twig │ │ ├── List │ │ ├── FiltersBuilderTemplate.php.twig │ │ ├── ResultsBuilderTemplate.php.twig │ │ └── RowBuilderTemplate.php.twig │ │ ├── ListBuilderAction.php.twig │ │ ├── ListBuilderTemplate.php.twig │ │ ├── NestedList │ │ ├── ResultsBuilderTemplate.php.twig │ │ └── RowBuilderTemplate.php.twig │ │ ├── NestedListBuilderAction.php.twig │ │ ├── NestedListBuilderTemplate.php.twig │ │ ├── NewBuilderAction.php.twig │ │ ├── ShowBuilderAction.php.twig │ │ └── ShowBuilderTemplate.php.twig ├── translations │ ├── Admingenerator.de.yml │ ├── Admingenerator.el.yml │ ├── Admingenerator.en.yml │ ├── Admingenerator.es.yml │ ├── Admingenerator.fa.yml │ ├── Admingenerator.fr.yml │ ├── Admingenerator.it.yml │ ├── Admingenerator.ja.yml │ ├── Admingenerator.nl.yml │ ├── Admingenerator.pl.yml │ ├── Admingenerator.pt.yml │ ├── Admingenerator.ro.yml │ ├── Admingenerator.ru.yml │ ├── Admingenerator.sl.yml │ ├── Admingenerator.tr.yml │ └── Admingenerator.uk.yml └── views │ ├── Form │ └── fields.html.twig │ ├── KnpMenu │ └── knp_menu_trans.html.twig │ ├── base_admin.html.twig │ ├── base_admin_assetic_less.html.twig │ └── base_admin_navbar.html.twig ├── Routing ├── Manipulator │ └── RoutingManipulator.php ├── NestedRoutingLoader.php └── RoutingLoader.php ├── Tests ├── Builder │ ├── BaseBuilderTest.php │ └── Fixtures │ │ └── BaseBuilder.php.twig ├── ClassLoader │ └── AdmingeneratedClassLoaderTest.php ├── DependencyInjection │ └── ConfigurationTest.php ├── Generator │ ├── ActionTest.php │ └── ColumnTest.php ├── Mocks │ └── Doctrine │ │ ├── ConnectionMock.php │ │ ├── DatabasePlatformMock.php │ │ ├── DriverConnectionMock.php │ │ ├── DriverMock.php │ │ ├── EntityManagerMock.php │ │ └── SchemaManagerMock.php ├── QueryFilter │ ├── DoctrineQueryFilterTest.php │ └── Entity │ │ ├── Movie.php │ │ └── MovieRepository.php ├── Routing │ └── RoutingLoaderTest.php ├── TestCase.php ├── Twig │ ├── Extension │ │ ├── EchoExtensionTest.php │ │ └── Object.php │ └── Fixtures │ │ └── .gitkeep ├── autoload.php.dist └── bootstrap.php ├── Twig ├── Extension │ ├── ConfigExtension.php │ ├── CsrfTokenExtension.php │ ├── EchoExtension.php │ ├── ExtendsAdmingeneratedExtension.php │ └── LocalizedMoneyExtension.php └── TokenParser │ └── ExtendsAdmingeneratedTokenParser.php ├── Validator ├── BaseValidator.php ├── ModelClassValidator.php ├── PropelModelClassValidator.php └── ValidatorInterface.php ├── composer.json └── phpunit.xml.dist /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/* 2 | 3 | # Eclipse configuration 4 | .buildpath 5 | .project 6 | .settings 7 | -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | tools: 2 | 3 | # Runs the PHP CS Fixer (http://http://cs.sensiolabs.org/). 4 | php_cs_fixer: 5 | extensions: 6 | 7 | # Default: 8 | - php 9 | command: php-cs-fixer 10 | enabled: true 11 | filter: 12 | paths: [] 13 | excluded_paths: [] 14 | config: 15 | level: all # Allowed Values: "psr0", "psr1", "psr2", "all" 16 | fixers: [] 17 | 18 | sensiolabs_security_checker: true 19 | 20 | #php code sniffer 21 | php_code_sniffer: 22 | extensions: 23 | 24 | # Default: 25 | - php 26 | command: phpcs 27 | enabled: true 28 | filter: 29 | paths: [] 30 | excluded_paths: [] 31 | config: 32 | 33 | # Built-in standards: PEAR, PHPCS, PSR1, PSR2, Squiz, Zend 34 | standard: PSR2 35 | sniffs: [] 36 | severity: ~ 37 | error_severity: ~ 38 | warning_severity: ~ 39 | tab_width: ~ 40 | encoding: ~ 41 | config: 42 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.3 5 | - 5.4 6 | 7 | env: 8 | - SYMFONY_VERSION=origin/2.1 9 | - SYMFONY_VERSION=origin/2.2 10 | - SYMFONY_VERSION=origin/2.3 11 | 12 | before_script: 13 | - composer self-update 14 | - composer install --dev 15 | 16 | notifications: 17 | webhooks: 18 | urls: 19 | - https://webhooks.gitter.im/e/4235a4d7b989b3e1ac53 20 | on_success: change 21 | on_failure: always 22 | on_start: false 23 | -------------------------------------------------------------------------------- /AdmingeneratorGeneratorBundle.php: -------------------------------------------------------------------------------- 1 | initAdmingeneratorClassLoader($this->container); 26 | } 27 | 28 | /** 29 | * (non-PHPdoc) 30 | * @see \Symfony\Component\HttpKernel\Bundle\Bundle::build() 31 | */ 32 | public function build(ContainerBuilder $container) 33 | { 34 | $this->initAdmingeneratorClassLoader($container); 35 | 36 | parent::build($container); 37 | 38 | $container->addCompilerPass(new ValidatorCompilerPass()); 39 | $container->addCompilerPass(new FormCompilerPass()); 40 | } 41 | 42 | /** 43 | * (non-PHPdoc) 44 | * @see \Symfony\Component\HttpKernel\Bundle\Bundle::getContainerExtension() 45 | */ 46 | public function getContainerExtension() 47 | { 48 | $this->extension = new DependencyInjection\AdmingeneratorGeneratorExtension(); 49 | 50 | return $this->extension; 51 | } 52 | 53 | /** 54 | * Initialize Admingenerator Class loader 55 | * 56 | * @param ContainerBuilder $container 57 | */ 58 | private function initAdmingeneratorClassLoader(ContainerInterface $container) 59 | { 60 | if (!$this->classLoaderInitialized) { 61 | $this->classLoaderInitialized = true; 62 | 63 | $AdmingeneratedClassLoader = new AdmingeneratedClassLoader(); 64 | $AdmingeneratedClassLoader->setBasePath($container->getParameter('kernel.cache_dir')); 65 | $AdmingeneratedClassLoader->register(); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Builder/Admin/ActionsBuilderAction.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | class ActionsBuilderAction extends ActionsBuilder 10 | { 11 | public function getOutputName() 12 | { 13 | return $this->getGenerator()->getGeneratedControllerFolder().'/ActionsController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/ActionsBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | class ActionsBuilderTemplate extends ActionsBuilder 10 | { 11 | public function getOutputName() 12 | { 13 | return 'Resources/views/'.$this->getBaseGeneratorName().'Actions/index.html.twig'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/EditBuilder.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class EditBuilder extends BaseBuilder 14 | { 15 | /** 16 | * (non-PHPdoc) 17 | * @see Admingenerator\GeneratorBundle\Builder.BaseBuilder::getYamlKey() 18 | */ 19 | public function getYamlKey() 20 | { 21 | return 'edit'; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Builder/Admin/EditBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/EditController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/EditBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 'Resources/views/'.$this->getBaseGeneratorName().'Edit/index.html.twig', 20 | 'Edit/FormBuilderTemplate'.self::TWIG_EXTENSION 21 | => 'Resources/views/'.$this->getBaseGeneratorName().'Edit/form.html.twig', 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Builder/Admin/EditBuilderType.php: -------------------------------------------------------------------------------- 1 | getBaseGeneratorName().'Type/EditType.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/EmptyBuilderAction.php: -------------------------------------------------------------------------------- 1 | 13 | * @author Bob van de Vijver 14 | */ 15 | class ExcelBuilder extends ListBuilder 16 | { 17 | /** 18 | * (non-PHPdoc) 19 | * @see Admingenerator\GeneratorBundle\Builder.BaseBuilder::getYamlKey() 20 | */ 21 | public function getYamlKey() 22 | { 23 | return 'excel'; 24 | } 25 | 26 | public function getFileName(){ 27 | if(null === ($filename = $this->getVariable('filename'))){ 28 | $filename = 'admin_export_'. str_replace(' ', '_', strtolower($this->getGenerator()->getFromYaml('builders.list.params.title'))); 29 | } 30 | return $filename; 31 | } 32 | 33 | public function getFileType(){ 34 | if(null === ($filetype = $this->getVariable('filetype'))){ 35 | $filetype = 'Excel2007'; 36 | } 37 | return $filetype; 38 | } 39 | 40 | public function getDateTimeFormat(){ 41 | if(null === ($dateTimeFormat = $this->getVariable('datetime_format'))){ 42 | $dateTimeFormat = 'Y-m-d H:i:s'; 43 | } 44 | return $dateTimeFormat; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Builder/Admin/ExcelBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/ExcelController.php'; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Builder/Admin/FiltersBuilder.php: -------------------------------------------------------------------------------- 1 | getVariable('display'); 25 | 26 | if (null == $display) { 27 | $display = $this->getAllFields(); 28 | } 29 | 30 | foreach ($display as $columnName) { 31 | $column = new Column($columnName); 32 | 33 | $column->setDbType( 34 | $this->getFieldOption( 35 | $column, 36 | 'dbType', 37 | $this->getFieldGuesser()->getDbType( 38 | $this->getVariable('model'), 39 | $columnName 40 | ) 41 | ) 42 | ); 43 | 44 | $column->setFormType( 45 | $this->getFieldGuesser()->getFilterType( 46 | $column->getDbType(), 47 | $columnName 48 | ) 49 | ); 50 | 51 | $column->setFormOptions( 52 | $this->getFieldGuesser()->getFilterOptions( 53 | $column->getFormType(), 54 | $column->getDbType(), 55 | $columnName 56 | ) 57 | ); 58 | 59 | //Set the user parameters 60 | $this->setUserColumnConfiguration($column); 61 | 62 | $this->addColumn($column); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Builder/Admin/FiltersBuilderType.php: -------------------------------------------------------------------------------- 1 | getBaseGeneratorName().'Type/FiltersType.php'; 14 | } 15 | 16 | public function getTemplateName() 17 | { 18 | return 'EditBuilderType' . self::TWIG_EXTENSION; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Builder/Admin/ListBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/ListController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/ListBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 'Resources/views/'.$this->getBaseGeneratorName().'List/index.html.twig', 20 | 'List/FiltersBuilderTemplate'.self::TWIG_EXTENSION 21 | => 'Resources/views/'.$this->getBaseGeneratorName().'List/filters.html.twig', 22 | 'List/ResultsBuilderTemplate'.self::TWIG_EXTENSION 23 | => 'Resources/views/'.$this->getBaseGeneratorName().'List/results.html.twig', 24 | 'List/RowBuilderTemplate'.self::TWIG_EXTENSION 25 | => 'Resources/views/'.$this->getBaseGeneratorName().'List/row.html.twig', 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Builder/Admin/NestedListBuilder.php: -------------------------------------------------------------------------------- 1 | root field 26 | * left => left field 27 | * right => right field 28 | * parent => parent field 29 | * 30 | * @return array 31 | */ 32 | public function getTreeConfiguration() 33 | { 34 | if (empty($this->treeConfiguration)) { 35 | $this->findTreeConfiguration(); 36 | } 37 | 38 | return $this->treeConfiguration; 39 | } 40 | 41 | /** 42 | * Extract tree configuration from generator. 43 | * If none defined, default is: 44 | * array: 45 | * root => root 46 | * left => lft 47 | * right => rgt 48 | * parent => parent 49 | */ 50 | protected function findTreeConfiguration() 51 | { 52 | $this->treeConfiguration = array_merge(array( 53 | 'root' => 'root', 54 | 'left' => 'lft', 55 | 'right' => 'rgt', 56 | 'parent' => 'parent' 57 | ), $this->getGenerator()->getFromYaml('builders.nested_list.tree') ?: array()); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Builder/Admin/NestedListBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/ListController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/NestedListBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 'Resources/views/'.$this->getBaseGeneratorName().'List/index.html.twig', 20 | 'NestedList/ResultsBuilderTemplate'.self::TWIG_EXTENSION 21 | => 'Resources/views/'.$this->getBaseGeneratorName().'List/results.html.twig', 22 | 'NestedList/RowBuilderTemplate'.self::TWIG_EXTENSION 23 | => 'Resources/views/'.$this->getBaseGeneratorName().'List/row.html.twig', 24 | 'List/FiltersBuilderTemplate'.self::TWIG_EXTENSION 25 | => 'Resources/views/'.$this->getBaseGeneratorName().'List/filters.html.twig', 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Builder/Admin/NewBuilder.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class NewBuilder extends BaseBuilder 12 | { 13 | /** 14 | * (non-PHPdoc) 15 | * @see Admingenerator\GeneratorBundle\Builder.BaseBuilder::getYamlKey() 16 | */ 17 | public function getYamlKey() 18 | { 19 | return 'new'; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Builder/Admin/NewBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/NewController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/NewBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 'Resources/views/'.$this->getBaseGeneratorName().'New/index.html.twig', 20 | 'Edit/FormBuilderTemplate'.self::TWIG_EXTENSION 21 | => 'Resources/views/'.$this->getBaseGeneratorName().'New/form.html.twig', 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Builder/Admin/NewBuilderType.php: -------------------------------------------------------------------------------- 1 | getBaseGeneratorName().'Type/NewType.php'; 14 | } 15 | 16 | public function getTemplateName() 17 | { 18 | return 'EditBuilderType' . self::TWIG_EXTENSION; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Builder/Admin/ShowBuilder.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ShowBuilder extends BaseBuilder 12 | { 13 | /** 14 | * (non-PHPdoc) 15 | * @see Admingenerator\GeneratorBundle\Builder.BaseBuilder::getYamlKey() 16 | */ 17 | public function getYamlKey() 18 | { 19 | return 'show'; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Builder/Admin/ShowBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/ShowController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/ShowBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | getBaseGeneratorName().'Show/index.html.twig'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Doctrine/ActionsBuilderAction.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderAction extends AdminActionsBuilderAction 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/Doctrine/ActionsBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderTemplate extends AdminActionsBuilderTemplate 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/Doctrine/EditBuilderAction.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderAction extends AdminActionsBuilderAction 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/DoctrineODM/ActionsBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderTemplate extends AdminActionsBuilderTemplate 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/DoctrineODM/EditBuilderAction.php: -------------------------------------------------------------------------------- 1 | tempDir = $baseTempDir.DIRECTORY_SEPARATOR.self::TEMP_DIR_PREFIX; 24 | 25 | if (!is_dir($this->tempDir)) { 26 | mkdir($this->tempDir, 0777, true); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Builder/Propel/ActionsBuilderAction.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderAction extends AdminActionsBuilderAction 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/Propel/ActionsBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderTemplate extends AdminActionsBuilderTemplate 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/Propel/EditBuilderAction.php: -------------------------------------------------------------------------------- 1 | kernel = $kernel; 27 | } 28 | 29 | /** 30 | * Find all the generator.yml in the bundle and in the kernel Resources folder. 31 | * 32 | * @return array An array of yaml files 33 | */ 34 | public function findAllGeneratorYamls() 35 | { 36 | if (null !== $this->yamls) { 37 | return $this->yamls; 38 | } 39 | 40 | $yamls = array(); 41 | 42 | foreach ($this->kernel->getBundles() as $name => $bundle) { 43 | foreach ($this->findGeneratorYamlInBundle($bundle) as $yaml) { 44 | $yamls[$yaml] = $yaml; 45 | } 46 | } 47 | 48 | return $this->yamls = $yamls; 49 | } 50 | 51 | /** 52 | * Find templates in the given bundle. 53 | * 54 | * @param BundleInterface $bundle The bundle where to look for templates 55 | * 56 | * @return array of yaml paths 57 | */ 58 | private function findGeneratorYamlInBundle(BundleInterface $bundle) 59 | { 60 | $yamls = array(); 61 | 62 | if (!file_exists($bundle->getPath().'/Resources/config')) { 63 | return $yamls; 64 | } 65 | 66 | $finder = new Finder(); 67 | $finder->files() 68 | ->name('generator.yml') 69 | ->name('*-generator.yml') 70 | ->in($bundle->getPath().'/Resources/config'); 71 | 72 | foreach ($finder as $file) { 73 | $yamls[$file->getRealPath()] = $file->getRealPath(); 74 | } 75 | 76 | return $yamls; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Controller/Doctrine/BaseController.php: -------------------------------------------------------------------------------- 1 | container->has('doctrine_mongodb')) { 21 | throw new \LogicException('The DoctrineMongoDBBundle is not registered in your application.'); 22 | } 23 | 24 | return $this->container->get('doctrine_mongodb'); 25 | } 26 | 27 | /** 28 | * @return \Doctrine\ODM\MongoDB\DocumentManager 29 | */ 30 | protected function getDocumentManager() 31 | { 32 | return $this->get('doctrine.odm.mongodb.document_manager'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Controller/Propel/BaseController.php: -------------------------------------------------------------------------------- 1 | getParameter('admingenerator.twig')) !== false) { 16 | $resources = $container->getParameter('twig.form.resources'); 17 | $alreadyIn = in_array('AdmingeneratorGeneratorBundle:Form:fields.html.twig', $resources); 18 | 19 | if ($twigConfiguration['use_form_resources'] && !$alreadyIn) { 20 | // Insert right after form_div_layout.html.twig if exists 21 | if (($key = array_search('form_div_layout.html.twig', $resources)) !== false) { 22 | array_splice( 23 | $resources, 24 | ++$key, 25 | 0, 26 | array('AdmingeneratorGeneratorBundle:Form:fields.html.twig') 27 | ); 28 | } else { 29 | // Put it in first position 30 | array_unshift( 31 | $resources, 32 | array('AdmingeneratorGeneratorBundle:Form:fields.html.twig') 33 | ); 34 | } 35 | 36 | $container->setParameter('twig.form.resources', $resources); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Exception/CantGenerateException.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class DeleteAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'batch'); 18 | 19 | $this->setIcon('fa-times'); 20 | $this->setLabel('action.batch.delete.label'); 21 | $this->setConfirm('action.batch.delete.confirm'); 22 | $this->setCsrfProtected(true); 23 | 24 | $this->setOptions(array( 25 | 'success' => 'action.batch.delete.success', 26 | 'error' => 'action.batch.delete.success', 27 | 'i18n' => 'Admingenerator' 28 | )); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Generator/Action/Generic/ExcelAction.php: -------------------------------------------------------------------------------- 1 | 12 | * @author Bob van de Vijver 13 | */ 14 | class ExcelAction extends Action 15 | { 16 | public function __construct($name, BaseBuilder $builder) 17 | { 18 | parent::__construct($name, 'generic'); 19 | 20 | $this->setClass('btn-primary'); 21 | $this->setIcon('fa-print'); 22 | $this->setLabel('action.generic.excel'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Generator/Action/Generic/ListAction.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class ListAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'generic'); 18 | 19 | $this->setIcon('fa-list-alt'); 20 | $this->setLabel('action.generic.list'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Generator/Action/Generic/NewAction.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class NewAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'generic'); 18 | 19 | $this->setClass('btn-primary'); 20 | $this->setIcon('fa-plus'); 21 | $this->setLabel('action.generic.new'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Generator/Action/Generic/SaveAction.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class SaveAction extends Action 13 | { 14 | public function __construct($name, BaseBuilder $builder) 15 | { 16 | parent::__construct($name, 'generic'); 17 | 18 | $this->setSubmit(true); 19 | $this->setClass('btn-success'); 20 | $this->setIcon('fa-check'); 21 | $this->setLabel('action.generic.save'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Generator/Action/Generic/SaveAndAddAction.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class SaveAndAddAction extends Action 13 | { 14 | public function __construct($name, BaseBuilder $builder) 15 | { 16 | parent::__construct($name, 'generic'); 17 | 18 | $this->setSubmit(true); 19 | $this->setClass('btn-primary'); 20 | $this->setIcon('fa-check'); 21 | $this->setLabel('action.generic.save-and-add'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Generator/Action/Generic/SaveAndListAction.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class SaveAndListAction extends Action 13 | { 14 | public function __construct($name, BaseBuilder $builder) 15 | { 16 | parent::__construct($name, 'generic'); 17 | 18 | $this->setSubmit(true); 19 | $this->setClass('btn-info'); 20 | $this->setIcon('fa-check'); 21 | $this->setLabel('action.generic.save-and-list'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Generator/Action/Object/DeleteAction.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | class DeleteAction extends Action 15 | { 16 | public function __construct($name, BaseBuilder $builder) 17 | { 18 | parent::__construct($name, 'object'); 19 | 20 | $this->setIcon('fa-times'); 21 | $this->setLabel('action.object.delete.label'); 22 | $this->setConfirm('action.object.delete.confirm'); 23 | $this->setCsrfProtected(true); 24 | 25 | $this->setRoute($builder->getObjectActionsRoute()); 26 | 27 | $this->setParams(array( 28 | 'pk' => '{{ '.$builder->getModelClass().'.'.$builder->getModelPrimaryKeyName().' }}', 29 | 'action' => 'delete' 30 | )); 31 | 32 | $this->setOptions(array( 33 | 'title' => 'action.object.delete.confirm', 34 | 'success' => 'action.object.delete.success', 35 | 'error' => 'action.object.delete.error', 36 | 'i18n' => 'Admingenerator' 37 | )); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Generator/Action/Object/EditAction.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class EditAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'object'); 18 | 19 | $this->setIcon('fa-edit'); 20 | $this->setLabel('action.object.edit.label'); 21 | 22 | $this->setRoute($builder->getBaseActionsRoute().'_edit'); 23 | 24 | $this->setParams(array( 25 | 'pk' => '{{ '.$builder->getModelClass().'.'.$builder->getModelPrimaryKeyName().' }}', 26 | )); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Generator/Action/Object/ShowAction.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class ShowAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'object'); 18 | 19 | $this->setIcon('fa-eye'); 20 | $this->setLabel('action.object.show.label'); 21 | 22 | $this->setRoute($builder->getBaseActionsRoute().'_show'); 23 | 24 | $this->setParams(array( 25 | 'pk' => '{{ '.$builder->getModelClass().'.'.$builder->getModelPrimaryKeyName().' }}', 26 | )); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Generator/GeneratorInterface.php: -------------------------------------------------------------------------------- 1 | sortOn != "" ? $this->sortOn : Inflector::classify($this->name); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012 Cedric LOMBARDOT 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 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all 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 | -------------------------------------------------------------------------------- /Menu/DefaultMenuBuilder.php: -------------------------------------------------------------------------------- 1 | createItem('root'); 15 | $menu->setChildrenAttributes(array('id' => 'main_navigation', 'class' => 'nav navbar-nav')); 16 | 17 | $overwrite = $this->addDropdown($menu, 'Replace this menu'); 18 | 19 | $this->addLinkURI( 20 | $overwrite, 21 | 'Create new menu builder', 22 | 'https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle' 23 | .'/blob/master/Resources/doc/cookbook/menu.md' 24 | )->setExtra('icon', 'glyphicon glyphicon-wrench'); 25 | 26 | $this->addLinkURI( 27 | $overwrite, 28 | 'Customize menu block', 29 | 'https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle'. 30 | '/blob/master/Resources/views/base_admin_navbar.html.twig' 31 | )->setExtra('icon', 'glyphicon glyphicon-fork'); 32 | 33 | return $menu; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /QueryFilter/BaseQueryFilter.php: -------------------------------------------------------------------------------- 1 | query = $query; 16 | } 17 | 18 | /** 19 | * (non-PHPdoc) 20 | * @see GeneratorBundle\QueryFilter.QueryFilterInterface::getQuery() 21 | */ 22 | public function getQuery() 23 | { 24 | return $this->query; 25 | } 26 | 27 | /** 28 | * (non-PHPdoc) 29 | * @see \GeneratorBundle\QueryFilter.QueryFilterInterface::addDefaultFilter() 30 | */ 31 | public function addDefaultFilter($field, $value) 32 | { 33 | throw new \LogicException('No method defined to execute this type of filters'); 34 | } 35 | 36 | /** 37 | * 38 | * By default we call addDefaultFilter 39 | * 40 | * @param $name 41 | * @param $values 42 | */ 43 | public function __call($name, $values = array()) 44 | { 45 | if (preg_match('/add(.+)Filter/', $name)) { 46 | $this->addDefaultFilter($values[0], $values[1]); 47 | } 48 | } 49 | 50 | protected function formatDate($date, $format) 51 | { 52 | if (!($date instanceof \DateTime)) { 53 | $date = new \DateTime($date); 54 | } 55 | 56 | if (false !== $date) { 57 | return $date->format($format); 58 | } 59 | 60 | return $date; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /QueryFilter/DoctrineODMQueryFilter.php: -------------------------------------------------------------------------------- 1 | query->field($field)->equals($value); 12 | } elseif (count($value) > 0) { 13 | $this->query->field($field)->in($value); 14 | } 15 | } 16 | 17 | public function addStringFilter($field, $value) 18 | { 19 | $this->query->field($field)->equals(new \MongoRegex("/.*$value.*/i")); 20 | } 21 | 22 | public function addBooleanFilter($field, $value) 23 | { 24 | if ("" !== $value) { 25 | $this->query->field($field)->equals((boolean) $value); 26 | } 27 | } 28 | 29 | public function addDateFilter($field, $value, $format = 'Y-m-d') 30 | { 31 | if (is_array($value)) { 32 | $from = array_key_exists('from', $value) ? $this->formatDate($value['from'], $format) : false; 33 | $to = array_key_exists('to', $value) ? $this->formatDate($value['to'], $format) : false; 34 | 35 | if ($to && $from) { 36 | $this->query->field($field)->range($from, $to); 37 | } elseif ($from) { 38 | $this->query->field($field)->gte($from); 39 | } elseif ($to) { 40 | $this->query->field($field)->lte($to); 41 | } 42 | } else { 43 | if (false !== $date = $this->formatDate($value, $format)) { 44 | $this->query->field($field)->equals($date); 45 | } 46 | } 47 | } 48 | 49 | public function addDocumentFilter($field, $value) 50 | { 51 | $this->query->field($field.'.$id')->equals(new \MongoId($value->getId())); 52 | } 53 | 54 | public function addCollectionFilter($field, $value) 55 | { 56 | $this->query->field($field.'.$id')->equals(new \MongoId($value->getId())); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /QueryFilter/QueryFilterInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Admingenerator\GeneratorBundle\Generator\DoctrineODMGenerator 8 | Admingenerator\GeneratorBundle\Guesser\DoctrineODMFieldGuesser 9 | Admingenerator\GeneratorBundle\QueryFilter\DoctrineODMQueryFilter 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | %kernel.root_dir% 24 | %kernel.cache_dir% 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Resources/config/doctrine_orm.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Admingenerator\GeneratorBundle\Generator\DoctrineGenerator 8 | Admingenerator\GeneratorBundle\Guesser\DoctrineORMFieldGuesser 9 | Admingenerator\GeneratorBundle\QueryFilter\DoctrineQueryFilter 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | %kernel.root_dir% 24 | %kernel.cache_dir% 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Resources/config/propel.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Admingenerator\GeneratorBundle\Generator\PropelGenerator 8 | Admingenerator\GeneratorBundle\Guesser\PropelORMFieldGuesser 9 | Admingenerator\GeneratorBundle\QueryFilter\PropelQueryFilter 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | %kernel.root_dir% 23 | %kernel.cache_dir% 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Resources/doc/builders/common/title.md: -------------------------------------------------------------------------------- 1 | Sorry, this has not yet been rewritten. -------------------------------------------------------------------------------- /Resources/doc/builders/edit-builder.md: -------------------------------------------------------------------------------- 1 | # Edit builder 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#4-generator 7 | 8 | ### Concurrency lock 9 | 10 | Read more about this feature [here][concurrency-lock]. 11 | 12 | [concurrency-lock]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/builders/edit/concurrency-lock.md 13 | -------------------------------------------------------------------------------- /Resources/doc/builders/edit/concurrency-lock.md: -------------------------------------------------------------------------------- 1 | # Concurrency lock 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#8-cookbook 7 | 8 | ### 1. Usage 9 | 10 | To protect your models edit action against concurrent modifications during long-running 11 | business transactions Admingenerator introduced a new generator parameter `concurrency_lock`. 12 | If enabled, before updateing object, Admingenerator will check if there were any 13 | modifications in between by compareing object versions. 14 | 15 | ### 2. Support 16 | 17 | Concurrency lock is avaliable for **Doctrine ORM**, **Doctrine ODM** and **Propel**. 18 | 19 | ### 3. Setting up 20 | 21 | #### Enable in generator.yml 22 | 23 | ```yaml 24 | # ... 25 | params: 26 | concurrency_lock: true 27 | ``` 28 | 29 | #### Add versionable field (Doctrine ORM and Doctrine ODM) 30 | 31 | ```php 32 | version; 47 | } 48 | // ... 49 | } 50 | ``` 51 | 52 | #### Enable versionable behaviour (Propel) 53 | 54 | In the schema.xml, use the `` tag to add the versionable behavior to a table: 55 | 56 | ```xml 57 | 58 | 59 | 60 | 61 |
62 | ``` -------------------------------------------------------------------------------- /Resources/doc/builders/excel-builder.md: -------------------------------------------------------------------------------- 1 | # Excel builder 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#4-generator 7 | 8 | ### Requirements 9 | 10 | To use the Excel export make sure you have installed the recommended dependency `liuggio/excelbundle` (version `>= 2.0`) and enabled it in your AppKernel.php (`new Liuggio\ExcelBundle\LiuggioExcelBundle()`). Without this bundle enabled the ExcelAction will not work. 11 | 12 | ### 1. Usage 13 | The Excel builder provides an Excel export of the list view. The export uses the data that is visible on the screen (and the next pages) and thus uses the filters and scopes selected. You can use object associations by just entering a dot. 14 | 15 | ### 2. Options 16 | 17 | * `display`: The same as in list/new/show/edit, selects the columns to export 18 | * `filename`: Specify the export filename. When null 'admin_export_{list title}' is used 19 | * `filetype`: Default Excel2007. See the [excelbundle documention](https://github.com/liuggio/excelbundle#not-only-excel5) for the possible options. 20 | * `datetime_format`: Specify the DateTime format to be used in the Excel export. Default is `Y-m-d H:i:s`. 21 | 22 | ### 3. Header titles in Excel 23 | 24 | The header titles are fully customizable just as every other block. Just use the `fields` key directly under the builder. This even works for associated fields like `person.fullname`. 25 | -------------------------------------------------------------------------------- /Resources/doc/builders/list-builder.md: -------------------------------------------------------------------------------- 1 | # List builder 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#4-generator 7 | 8 | Sorry, this has not yet been completely rewritten. 9 | 10 | List builder features: 11 | 12 | * [Title](common/title.md) 13 | * [Localized date](common/localized-date.md) 14 | 15 | ### Filters 16 | 17 | It's now possible to filter by multiple values for a single field. 18 | Just set your ```formType``` for that field as ```choice``` and then add the ```multiple``` option with ```true``` as value. As example: 19 | ``` 20 | filters: 21 | params: 22 | fields: 23 | occurrenceWeek: 24 | formType: choice 25 | formOptions: 26 | required: false 27 | multiple: true 28 | choices: '\Your\AwesomeBundle\YourAwesomeBundle::getYearWeeks()' 29 | ``` 30 | -------------------------------------------------------------------------------- /Resources/doc/cookbook/changeing-web-directory.md: -------------------------------------------------------------------------------- 1 | # Changeing web directory 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#7-cookbook 7 | 8 | ### 1. Overview 9 | 10 | Some hosts have reserved `web` directory name. Make symfony2 run on such hosts 11 | you must rename `web` directory. In this cookbook you will learn how to rename 12 | `web` directory to `pub`. 13 | 14 | ### 2. Configure Symfony2 15 | 16 | Add a `symfony-web-dir` under *extra* in your `composer.json`: 17 | 18 | ```json 19 | "extra": { 20 | "symfony-web-dir": "pub" 21 | }, 22 | ``` 23 | 24 | ### 3. Configure RobLoach/component-installer 25 | 26 | Admingenerator uses RobLoach/component-installer to install third-party assets like 27 | jquery, jqueryui or twitter bootstrap. To change the web directory add `component-dir` 28 | under *config* in your `composer.json`: 29 | 30 | ```json 31 | "config": { 32 | "component-dir": "pub/components" 33 | } 34 | ``` 35 | -------------------------------------------------------------------------------- /Resources/doc/cookbook/commandLine.md: -------------------------------------------------------------------------------- 1 | # Command Line 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#7-cookbook 7 | 8 | There are two ways to create an admin using console. 9 | 10 | ## 1. Add an admin on an existing bundle 11 | 12 | Imagine you created a bundle before, using symfony standard commands. 13 | 14 | [(how to create a bundle?)][symfony-1] 15 | 16 | [symfony-1]: http://symfony.com/doc/2.0/book/page_creation.html 17 | 18 | now you should generate an admin for this bundle. 19 | use this command to generate an admin on an existing bundle : 20 | 21 | ``` bash 22 | $ php app/console admin:generate-admin 23 | ``` 24 | 25 | Answer all questions step by step and admingenerator will generate your admin according to your answers. 26 | 27 | ##### here is an example: 28 | 29 | ![i18n 30 | form](https://raw.github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/master/Resources/doc/cookbook/images/console-example.png)) 31 | 32 | 33 | Now you have your admin. 34 | 35 | ## 2. Generating a bundle using admingenerator 36 | 37 | (writing ...) 38 | -------------------------------------------------------------------------------- /Resources/doc/cookbook/conditional-actions.md: -------------------------------------------------------------------------------- 1 | # Conditional actions 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#7-cookbook 7 | 8 | ### 0. Deprecated parameter 9 | 10 | > **Note:** deprecated method, use `Expressions` from JMSDiExtraBundle instead. You can easily migrate your conditions 11 | using this logic: 12 | 13 | ```yaml 14 | # Before 15 | params: 16 | fields: 17 | condition: 18 | function: canDelete 19 | parameters: [ app.user ] 20 | inverse: true 21 | 22 | # After 23 | params: 24 | fields: 25 | credentials: !object.canDelete(user) 26 | ``` 27 | 28 | ### 1. Usage 29 | 30 | You may customize list by specifying conditional actions. For example, you may display 31 | delete button only if user has group "ProductEditor" and Product has no sales yet. 32 | 33 | ### 2. Support 34 | 35 | Conditional actions are avaliable for **Doctrine ORM**, **Doctrine ODM** and **Propel**. 36 | 37 | ### 3. Configuration 38 | 39 | Add conditional function to your `generator.yml` file: 40 | 41 | ```yaml 42 | object_actions: 43 | delete: 44 | condition: 45 | function: canDelete 46 | parameters: [ app.user ] 47 | inverse: false 48 | ``` 49 | 50 | In this case, the generator's model object must contain a "canDelete" method: 51 | 52 | ```php 53 | class ProductEntity 54 | { 55 | public function canDelete($user) 56 | { 57 | return ($this->countProductSales() == 0 && $user->hasGroup('ProductEditor'); 58 | } 59 | } 60 | ``` -------------------------------------------------------------------------------- /Resources/doc/cookbook/controllers.md: -------------------------------------------------------------------------------- 1 | # Controllers - Tips and Tricks 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#7-cookbook 7 | 8 | ### 1. Adding parameters in view from controllers 9 | 10 | Sometimes, you may need to transmit some parameters from your *generated* controller to your *generated* view. 11 | You can simply do it by overriding the protected **getAdditionalRenderParameters** function into your bundle. Depending on controller *type*, prototype is different: 12 | 13 | In *list* controllers (`ListController` and `NestedListController`) prototype is: 14 | ```php 15 | protected function getAdditionalRenderParameters(); // No parameters 16 | ``` 17 | 18 | In *edit*, *show* and *new* controllers (`EditController`, `ShowController` and `NewController`) prototype is: 19 | ```php 20 | protected function getAdditionalRenderParameters(\Full\Path\To\Your\Object $Object); 21 | ``` 22 | 23 | This function **must** return an array. 24 | By default, it returns an empty array. 25 | 26 | > **Note:** this function is not available in `DeleteController` because it always returns a `RedirectResponse`. 27 | -------------------------------------------------------------------------------- /Resources/doc/cookbook/custom-view-types.md: -------------------------------------------------------------------------------- 1 | # Custom View types 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#7-cookbook 7 | 8 | Sometimes, you might want to change the way the list or show view of a specific entity field is rendered. This can be done with a few simple steps! 9 | 10 | 1. Create a twig html template with your custom view block. Your block needs to start with `column_` and a viewname of your choice. We use gender as example 11 | ```twig 12 | #example custom_blocks.html.twig 13 | {% block column_gender %} 14 | {% spaceless %} 15 | {% if(field_value == 'm') %} 16 | 17 | {% elseif(field_value == 'f') %} 18 | 19 | {% else %} 20 | 21 | {% endif %} 22 | {% endspaceless %} 23 | {% endblock %} 24 | ``` 25 | 26 | 2. Specify the location of the custom template file in the `generator.yml` by using the `custom_blocks` param in the general, edit or show builder 27 | ```yaml 28 | #example for the show and list builder 29 | params: 30 | custom_blocks: AcmeDemoBundle:Form:custom_blocks.html.twig 31 | ``` 32 | ```yaml 33 | #example for just the show builder 34 | builder: 35 | show: 36 | params: 37 | custom_blocks: Acme:Form:custom_blocks.html.twig 38 | ``` 39 | 40 | 3. In the generator.yml, add the option `customView: %viewname%` for the wanted field 41 | ```yaml 42 | # Example 43 | params: 44 | fields: 45 | gender: 46 | customView: gender # %viewname% 47 | ``` 48 | 49 | Now you can make your own templates which will be rendered only in the specified list/show views! -------------------------------------------------------------------------------- /Resources/doc/cookbook/extending-generator-templates.md: -------------------------------------------------------------------------------- 1 | # Extending Generator Templates 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#7-cookbook 7 | 8 | Sometimes, you may want to extend/overwrite some of the generator templates in the Resources/templates dir. This is quite easy, but you will have to do some steps 9 | 10 | 1. First, you will need to add the template you will be using to the admingenerator config 11 | ```yaml 12 | # config.yml 13 | admingenerator_generator: 14 | templates_dirs: [ "%kernel.root_dir%/../app/Resources/AdmingeneratorGeneratorBundle/templates" ] 15 | ``` 16 | 17 | 2. Keep in mind that you will at least need **one dir** in the previous specified template directory, namely of the DBAL layer used, so one of [Doctrine, DoctrineODM, Propel]. 18 | Without this directory, the specified template directory will not be used for extending/overwriting any of the templates, even in the CommonAdmin dir. 19 | Note: If you are using git and your directory is empty you will [need to add least one file to add this directory to git](https://git.wiki.kernel.org/index.php/GitFaq#Can_I_add_empty_directories.3F). It's convention to add a .gitkeep file. 20 | 21 | 3. Be free to extend/overwrite any template in the Resources/templates dir of the AdminGenerator! 22 | 23 | Please note that your own templates might need adjustment when new releases of the AdminGenerator arrive. So if anything breaks after a update and you're using custom templates, please check those first! 24 | -------------------------------------------------------------------------------- /Resources/doc/cookbook/formTypes.md: -------------------------------------------------------------------------------- 1 | # Form Types - Tips and Tricks 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#7-cookbook 7 | 8 | ## 1. Customize form options with PHP logic 9 | 10 | If you need to customize your form options using some PHP logic, you have to overwrite function `getFormOption` in 11 | the generated form type. 12 | 13 | Prototype is: 14 | ```php 15 | protected function getFormOption($name /*field name*/, array $formOptions /*generated form options*/); 16 | ``` 17 | 18 | This function **must** return an array. 19 | By default, it returns pre-configured options. 20 | 21 | > **Note:** use this only if you need some PHP logic (QueryBuilder is a good example). Otherwise, generator.yml file is 22 | the good location to configure a field (using `addFormOptions` parameter). 23 | 24 | Example: 25 | ```php 26 | /** 27 | * (non-PHPdoc) 28 | * @see \Admingenerated\ApplicationAdminBundle\Form\BaseProductType\FiltersType::getFormOption() 29 | */ 30 | protected function getFormOption($name, array $formOptions) 31 | { 32 | switch($name) { 33 | case 'category': 34 | $formOptions['query_builder'] = function (CategoryRepository $er) { 35 | return $er->getQueryBuilderForFind(); 36 | }; 37 | break; 38 | } 39 | 40 | return $formOptions; 41 | } 42 | ``` -------------------------------------------------------------------------------- /Resources/doc/cookbook/images/a2lix-integrations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/doc/cookbook/images/a2lix-integrations.png -------------------------------------------------------------------------------- /Resources/doc/cookbook/images/console-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/doc/cookbook/images/console-example.png -------------------------------------------------------------------------------- /Resources/doc/cookbook/templating.md: -------------------------------------------------------------------------------- 1 | # Templating - Tips and Tricks 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#7-cookbook 7 | 8 | ### 1. Adding log in/log out button in navbar 9 | 10 | If you want to automatically add a "Log in" / "Log out" / "Exit impersonation mode" button in your navbar, you have to specify route names under `admingenerator_generator`: 11 | ```yaml 12 | admingenerator_generator: 13 | login_path: MyLogin_path 14 | logout_path: MyLogout_path 15 | exit_path: MyExit_path 16 | ``` 17 | 18 | -------------------------------------------------------------------------------- /Resources/doc/features/doctrine-odm-features.md: -------------------------------------------------------------------------------- 1 | # Doctrine ODM features 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#3-features 7 | 8 | Soon, all features tested and working on Doctrine ODM will be listed here. -------------------------------------------------------------------------------- /Resources/doc/features/doctrine-orm-features.md: -------------------------------------------------------------------------------- 1 | # Doctrine ORM features 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#3-features 7 | 8 | Soon, all features tested and working on Doctrine ORM will be listed here. -------------------------------------------------------------------------------- /Resources/doc/features/propel-features.md: -------------------------------------------------------------------------------- 1 | # Propel features 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#3-features 7 | 8 | Soon, all features tested and working on Propel will be listed here. -------------------------------------------------------------------------------- /Resources/doc/generator/entity-manager.md: -------------------------------------------------------------------------------- 1 | # Usage of different Doctrine Entity Managers 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#4-generator 7 | 8 | ### 1. Usage 9 | 10 | When using Doctrine ORM, all Managers are auto-selected by the use of getManagerForClass of Doctrine. 11 | 12 | ### 2. Support 13 | 14 | Multiple Entity Managers are only automatically implemented for **Doctrine ORM**. -------------------------------------------------------------------------------- /Resources/doc/generator/pk-requirement.md: -------------------------------------------------------------------------------- 1 | # Primary Key requirement 2 | --------------------------------------- 3 | 4 | [go back to Table of contents][back-to-index] 5 | 6 | [back-to-index]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/blob/master/Resources/doc/documentation.md#4-generator 7 | 8 | ### 1. Usage 9 | 10 | This option allows you to specify primary key requirements to make admingenerator routes less greedy. 11 | 12 | ### 2. Support 13 | 14 | Primary Key requirement supports **Doctrine ORM**, **Doctrine ODM** and **Propel**. 15 | 16 | ### 3. Example 17 | 18 | Usage for the default Entity Manager 19 | ```yaml 20 | generator: admingenerator.generator.doctrine 21 | params: 22 | model: Acme\GalleryBundle\Entity\Album 23 | pk_requirement: \d+ 24 | ``` 25 | 26 | Will add a `\d+` requirement to these paths: 27 | 28 | * edit path `/{pk}/edit` 29 | * update path `/{pk}/update` 30 | * show path `/{pk}/show}` 31 | * object action path `/{pk}/{action}` 32 | -------------------------------------------------------------------------------- /Resources/doc/support-and-contribution/gfm-cheat-sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/doc/support-and-contribution/gfm-cheat-sheet.png -------------------------------------------------------------------------------- /Resources/less/bootstrap-extended.less: -------------------------------------------------------------------------------- 1 | // 2 | // Bootstrap extended 3 | // -------------------------------------------------- 4 | 5 | 6 | // Sortable 7 | .sorted-asc, .sorted-desc { 8 | border-left: 5px solid transparent; 9 | border-right: 5px solid transparent; 10 | border-top: 5px solid @linkColor; 11 | content: ""; 12 | width: 0; 13 | height: 0; 14 | display: inline-block; 15 | vertical-align: top; 16 | margin-top: 7px; 17 | margin-left: 4px; 18 | } 19 | 20 | .sorted-desc { 21 | border-top: 0px solid transparent; 22 | border-bottom: 5px solid @linkColor; 23 | } -------------------------------------------------------------------------------- /Resources/old-doc/change-the-menu-class.markdown: -------------------------------------------------------------------------------- 1 | # Change the class used to render the help menu by your 2 | 3 | In config.yml set : 4 | 5 | ````yaml 6 | admingenerator_generator: 7 | knp_menu_class: YourVendor\YourBackBundle\Menu\AdminMenu 8 | ```` 9 | 10 | To create your class you can use Admingenerator\GeneratorBundle\Menu\DefaultMenu to know how use the css classes 11 | 12 | # Extend default knp_menu_theme 13 | 14 | In config.yml set : 15 | 16 | ````yaml 17 | knp_menu: 18 | twig: 19 | template: AdmingeneratorGeneratorBundle:KnpMenu:knp_menu_trans.html.twig 20 | ```` 21 | 22 | This theme enables: 23 | 24 | * prepending menu items with icons 25 | * appending caret to dropdown menu items 26 | * translation of menu item labels 27 | 28 | -------------------------------------------------------------------------------- /Resources/old-doc/doc_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/old-doc/doc_edit.png -------------------------------------------------------------------------------- /Resources/old-doc/doc_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/old-doc/doc_list.png -------------------------------------------------------------------------------- /Resources/preview/dashboard-welcome-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/preview/dashboard-welcome-preview.png -------------------------------------------------------------------------------- /Resources/preview/edit-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/preview/edit-preview.png -------------------------------------------------------------------------------- /Resources/preview/list-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/preview/list-preview.png -------------------------------------------------------------------------------- /Resources/public/css/profile.css: -------------------------------------------------------------------------------- 1 | /* Profile styles 2 | -------------------------------------------------- */ 3 | 4 | /* Invert profile colors */ 5 | .profile { 6 | padding-left: 15px; 7 | padding-right: 15px; 8 | background-color: #f5f5f5; 9 | } 10 | 11 | /* Fixes for small screens */ 12 | @media (max-width: 979px) { 13 | .profile li { 14 | display: inline-block; 15 | } 16 | .navbar-collapse.in .profile li.btn-group { 17 | margin-top: 0px; 18 | } 19 | .navbar-collapse .nav > li > a, .navbar-collapse .dropdown-menu a { 20 | color: #FFFFFF; 21 | } 22 | } 23 | 24 | .profile .navbar-text { 25 | color: #0B6CBC; 26 | text-shadow: 0 1px 0 #FFFFFF; 27 | margin-right: 10px; 28 | } 29 | 30 | .navbar .profile .btn-group .btn-xs { 31 | margin-top: 2px; 32 | } 33 | 34 | .btn-profile { 35 | color: #ffffff; 36 | text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); 37 | background-color: #62A8D1; 38 | background-image: -moz-linear-gradient(top, #438EB9, #62A8D1); 39 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#438EB9), to(#62A8D1)); 40 | background-image: -webkit-linear-gradient(top, #438EB9, #62A8D1); 41 | background-image: -o-linear-gradient(top, #438EB9, #62A8D1); 42 | background-image: linear-gradient(to bottom, #438EB9, #62A8D1); 43 | background-repeat: repeat-x; 44 | border-color: #0B6CBC #0B6CBC #1f6377; 45 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 46 | filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ff438EB9', endColorstr='#ff62A8D1', GradientType=0); 47 | filter: progid:dximagetransform.microsoft.gradient(enabled=false); 48 | } 49 | 50 | .btn.btn-profile:hover, 51 | .btn.btn-profile:focus, 52 | .btn.btn-profile:active, 53 | .btn.btn-profile.active, 54 | .btn.btn-profile.disabled, 55 | .btn.btn-profile[disabled] { 56 | color: #ffffff; 57 | background-color: #62A8D1; 58 | } 59 | 60 | .btn-profile:active, 61 | .btn-profile.active { 62 | background-color: #3983C2 \9; 63 | } -------------------------------------------------------------------------------- /Resources/public/cur/closedhand.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/public/cur/closedhand.cur -------------------------------------------------------------------------------- /Resources/public/cur/openhand.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/public/cur/openhand.cur -------------------------------------------------------------------------------- /Resources/public/ico/admingenerator_gravatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/public/ico/admingenerator_gravatar.png -------------------------------------------------------------------------------- /Resources/public/ico/apple-touch-icon-114-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/public/ico/apple-touch-icon-114-precomposed.png -------------------------------------------------------------------------------- /Resources/public/ico/apple-touch-icon-144-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/public/ico/apple-touch-icon-144-precomposed.png -------------------------------------------------------------------------------- /Resources/public/ico/apple-touch-icon-57-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/public/ico/apple-touch-icon-57-precomposed.png -------------------------------------------------------------------------------- /Resources/public/ico/apple-touch-icon-72-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/public/ico/apple-touch-icon-72-precomposed.png -------------------------------------------------------------------------------- /Resources/public/ico/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Resources/public/ico/favicon.ico -------------------------------------------------------------------------------- /Resources/public/js/admingenerator/general.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | // Twitter Bootstrap hack for menus on touch device 3 | $('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); }); 4 | 5 | $('a[rel=tooltip]').tooltip({ 6 | container: 'body' 7 | }); 8 | 9 | // Moved all scripts to dedicated widgets 10 | // Do not remove, this file is used when developing new features 11 | }); 12 | -------------------------------------------------------------------------------- /Resources/skeleton/bundle/Bundle.php.twig: -------------------------------------------------------------------------------- 1 | 22 | {{ block('form') }} 23 | 24 | {{ echo_endblock() }} 25 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ActionsTemplate/actions.php.twig: -------------------------------------------------------------------------------- 1 | {% block form_actions %} 2 | 5 | 6 | {{ echo_trans('action.custom.cancel') }} 7 | 8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ActionsTemplate/form.php.twig: -------------------------------------------------------------------------------- 1 | {% use "../CommonAdmin/ActionsTemplate/actions.php.twig" %} 2 | 3 | {% block form %} 4 |
5 | {{ echo_block('form') }} 6 |
7 | 8 | {{ echo_block("form_buttons") }} 9 |
10 | {{ block("form_actions") }} 11 |
12 | {{ echo_endblock() }} 13 |
14 | {{ echo_endblock() }} 15 |
16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ActionsTemplate/title.php.twig: -------------------------------------------------------------------------------- 1 | {% block title %} 2 | {{ echo_block("page_title") }} 3 |
4 |

{{ echo_twig('title') }}

5 |
6 | {{ echo_endblock() }} 7 | {% endblock %} 8 | 9 | {% block site_title %} 10 | {{ echo_block("title") }} 11 | {{ echo_twig('parent()') }} - {{ echo_twig('title') }} 12 | {{ echo_endblock() }} 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/EditAction/index.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/security_action.php.twig' %} 2 | {% block index_use %} 3 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; 4 | use {{ builder.namespacePrefixWithSubfolder }}\{{ bundle_name }}\Form\Type\{{ builder.BaseGeneratorName ? builder.BaseGeneratorName ~ char(92) : "" }}EditType; 5 | {% endblock %} 6 | 7 | {% block index %} 8 | 9 | public function indexAction($pk) 10 | { 11 | ${{ builder.ModelClass }} = $this->getObject($pk); 12 | 13 | {% if concurrency_lock -%} 14 | $this->saveVersion($pk, ${{ builder.ModelClass }}->getVersion()); 15 | {%- endif %} 16 | 17 | {{ block('security_action_with_object') }} 18 | 19 | if (!${{ builder.ModelClass }}) { 20 | throw new NotFoundHttpException("The {{ model }} with {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} $pk can't be found"); 21 | } 22 | 23 | $this->preBindRequest(${{ builder.ModelClass }}); 24 | $form = $this->createForm($this->getEditType(), ${{ builder.ModelClass }}, $this->getFormOptions(${{ builder.ModelClass }})); 25 | 26 | return $this->render('{{ builder.namespacePrefixForTemplate }}{{ bundle_name }}:{{ builder.BaseGeneratorName }}Edit:index.html.twig', $this->getAdditionalRenderParameters(${{ builder.ModelClass }}) + array( 27 | "{{ builder.ModelClass }}" => ${{ builder.ModelClass }}, 28 | "form" => $form->createView(), 29 | )); 30 | } 31 | {% endblock %} 32 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/EditTemplate/EditBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/title.php.twig' %} 2 | {% use '../CommonAdmin/stylesheets.php.twig' %} 3 | {% use '../CommonAdmin/javascripts.php.twig' %} 4 | {% use '../CommonAdmin/tabs.php.twig' %} 5 | {% use '../CommonAdmin/object_actions.php.twig' %} 6 | 7 | {{ echo_extends( builder.getBaseAdminTemplate ) }} 8 | 9 | {{ echo_block("stylesheets") }} 10 | {{- block('complementary_stylesheets') -}} 11 | {{ echo_endblock() }} 12 | 13 | {{ echo_block("javascripts") }} 14 | {{- block('complementary_javascripts') -}} 15 | {{- block('object_actions_script') -}} 16 | {{ echo_endblock() }} 17 | 18 | {{- block('site_title') -}} 19 | 20 | {{ echo_block("body") }} 21 | 22 | {{- block('title') -}} 23 | 24 |
25 |
26 |
27 | {{- block('object_actions') -}} 28 |
29 |
30 | 31 |
32 | {{- block('tabs') }} 33 | {{ echo_include(builder.namespacePrefixForTemplate ~ bundle_name ~ ':' ~ builder.BaseGeneratorName ~ (builder.yamlKey | capitalize) ~ ':form.html.twig') }} 34 |
35 |
36 | {{ echo_endblock() }} 37 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/EditTemplate/FormBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use "../CommonAdmin/EditTemplate/fieldset.php.twig" %} 2 | {% use '../CommonAdmin/generic_actions.php.twig' %} 3 | 4 | {% block form %} 5 | {{ echo_block('form') }} 6 |
13 | 14 | {{ echo_twig("form_errors(form)") }} 15 | {% if tabs is defined and tabs|length > 0 %} 16 |
17 | {% endif %} 18 | {% for fieldset in builder.fieldsets|keys %} 19 | {{- block('form_fieldset') }} 20 | {% endfor -%} 21 | {% if tabs is defined and tabs|length > 0 %} 22 |
23 | {% endif %} 24 | 25 | {{ echo_twig("form_rest(form)") }} 26 | 27 | {{ echo_block("form_buttons") }} 28 |
29 | 32 |
33 | {{ echo_endblock() }} 34 |
35 | {{ echo_endblock() }} 36 | {% endblock %} 37 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/EditTemplate/fieldset.php.twig: -------------------------------------------------------------------------------- 1 | {% block form_fieldset %} 2 | {{ echo_block("form_fieldset_" ~ fieldset|classify|replace({'.': '_'})) }} 3 |
4 | {% if "NONE" != fieldset[:4] %} 5 | {{ echo_trans(fieldset,{}, i18n_catalog|default("Admin") ) }} 6 | {% endif %} 7 | 8 | {% for rows in builder.fieldsets[fieldset] %} 9 |
10 | {% for field in rows %} 11 | {% if builder.Columns[field].credentials %} 12 | {{ echo_if_granted(builder.Columns[field].credentials, builder.ModelClass) }} 13 | {% endif %} 14 |
15 | {{ echo_block("form_" ~ field) }} 16 | {{ echo_twig("form_row(form['" ~ field ~ "'])") }} 17 | {{ echo_endblock() }} 18 |
19 | {% if builder.Columns[field].credentials %} 20 | {{ echo_endif () }} 21 | {% endif %} 22 | {% endfor %} 23 |
24 | {% endfor %} 25 |
26 | {{ echo_endblock() }} 27 | {% endblock %} 28 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/EditType/EditBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/EditType/type.php.twig' %} 2 | {{- block('type') -}} 3 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/EditType/type.php.twig: -------------------------------------------------------------------------------- 1 | {% block type %} 2 | securityContext->isGranted(array(new Expression('{{ column.credentials }}')), $builder->getData())) { 19 | {%- endif %} 20 | 21 | $formOptions = $this->getFormOption('{{ column.name }}', {{ column.formOptions|merge({ 22 | 'label': column.label, 23 | 'translation_domain': i18n_catalog|default('Admin') 24 | })|as_php|convert_as_form(column.formType) }}); 25 | $builder->add('{{ column.name }}', {{ column.formType|as_php|convert_as_form(column.formType) }}, $formOptions); 26 | 27 | {% if column.credentials %} 28 | } 29 | {%- endif -%} 30 | {%- endfor %} 31 | 32 | } 33 | 34 | protected function getFormOption($name, array $formOptions) 35 | { 36 | return $formOptions; 37 | } 38 | 39 | public function getName() 40 | { 41 | return '{{ builder.YamlKey }}_{{ builder.ModelClass|lower }}'; 42 | } 43 | 44 | public function setSecurityContext($securityContext) 45 | { 46 | $this->securityContext = $securityContext; 47 | } 48 | 49 | } 50 | {% endblock %} 51 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListAction/filters.php.twig: -------------------------------------------------------------------------------- 1 | {% block filters %} 2 | public function filtersAction() 3 | { 4 | if ($this->get('request')->get('reset')) { 5 | $this->setFilters(array()); 6 | 7 | return new RedirectResponse($this->generateUrl("{{ builder.routePrefixWithSubfolder }}_{{ bundle_name }}{{ builder.BaseGeneratorName ? "_" ~ builder.BaseGeneratorName : "" }}_list")); 8 | } 9 | 10 | if ($this->getRequest()->getMethod() == "POST") { 11 | $form = $this->getFilterForm(); 12 | $form->bind($this->get('request')); 13 | 14 | if ($form->isValid()) { 15 | $filters = $form->getViewData(); 16 | } 17 | } 18 | 19 | if ($this->getRequest()->getMethod() == "GET") { 20 | $filters = $this->getRequest()->query->all(); 21 | } 22 | 23 | if (isset($filters)) { 24 | $this->setFilters($filters); 25 | } 26 | 27 | return new RedirectResponse($this->generateUrl("{{ builder.routePrefixWithSubfolder }}_{{ bundle_name }}{{ builder.BaseGeneratorName ? "_" ~ builder.BaseGeneratorName : "" }}_list")); 28 | } 29 | 30 | {% block setFilters -%} 31 | protected function setFilters($filters) 32 | { 33 | $this->get('session')->set('{{ namespace_prefix }}\{{ bundle_name }}\{{ builder.BaseGeneratorName }}List\Filters', $filters); 34 | } 35 | {% endblock %} 36 | 37 | {% block getFilters -%} 38 | protected function getFilters() 39 | { 40 | return $this->get('session')->get('{{ namespace_prefix }}\{{ bundle_name }}\{{ builder.BaseGeneratorName }}List\Filters', array()); 41 | } 42 | {% endblock %} 43 | {% endblock %} 44 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListAction/index.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/security_action.php.twig' %} 2 | {% block index_use %} 3 | use {{ builder.namespacePrefixWithSubfolder }}\{{ bundle_name }}\Form\Type\{{ builder.BaseGeneratorName ? builder.BaseGeneratorName ~ char(92) : "" }}FiltersType; 4 | {% endblock %} 5 | {% block index %} 6 | 7 | public function indexAction() 8 | { 9 | {{ block('security_action') }} 10 | 11 | $this->parseRequestForPager(); 12 | 13 | $form = $this->getFilterForm(); 14 | 15 | return $this->render('{{ builder.namespacePrefixForTemplate }}{{ bundle_name }}:{{ builder.BaseGeneratorName }}List:index.html.twig', $this->getAdditionalRenderParameters() + array( 16 | '{{ builder.ModelClass }}s' => $this->getPager(), 17 | 'form' => $form->createView(), 18 | 'sortColumn' => $this->getSortColumn(), 19 | 'sortOrder' => $this->getSortOrder(), 20 | 'scopes' => $this->getScopes(), 21 | )); 22 | } 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListAction/sorter.php.twig: -------------------------------------------------------------------------------- 1 | {% block sorter %} 2 | /** 3 | * Store in the session service the current sort 4 | * 5 | * @param string $column The column 6 | * @param string $order_by The order sorting (ASC,DESC) 7 | */ 8 | protected function setSort($column, $order_by) 9 | { 10 | $this->get('session')->set('{{ namespace_prefix }}\{{ bundle_name }}\{{ builder.BaseGeneratorName }}List\Sort', $column); 11 | 12 | if ($order_by == 'desc') { 13 | $this->get('session')->set('{{ namespace_prefix }}\{{ bundle_name }}\{{ builder.BaseGeneratorName }}List\OrderBy', 'DESC'); 14 | } else { 15 | $this->get('session')->set('{{ namespace_prefix }}\{{ bundle_name }}\{{ builder.BaseGeneratorName }}List\OrderBy', 'ASC'); 16 | } 17 | } 18 | 19 | /** 20 | * Return the stored sort 21 | * 22 | * @return string The column to sort 23 | */ 24 | protected function getSortColumn() 25 | { 26 | {% if sort is defined and sort[0] != '' -%} 27 | 28 | return $this->get('session')->get('{{ namespace_prefix }}\{{ bundle_name }}\{{ builder.BaseGeneratorName }}List\Sort', '{{ sort[0] }}'); 29 | {% else -%} 30 | 31 | return $this->get('session')->get('{{ namespace_prefix }}\{{ bundle_name }}\{{ builder.BaseGeneratorName }}List\Sort'); 32 | {% endif -%} 33 | } 34 | 35 | /** 36 | * Return the stored sort order 37 | * 38 | * @return string the order mode ASC|DESC 39 | */ 40 | protected function getSortOrder() 41 | { 42 | {% if sort is defined and sort[1] is defined -%} 43 | 44 | return $this->get('session')->get('{{ namespace_prefix }}\{{ bundle_name }}\{{ builder.BaseGeneratorName }}List\OrderBy', '{{ sort[1] }}'); 45 | {% else -%} 46 | 47 | return $this->get('session')->get('{{ namespace_prefix }}\{{ bundle_name }}\{{ builder.BaseGeneratorName }}List\OrderBy', 'ASC'); 48 | {% endif -%} 49 | } 50 | 51 | {% endblock %} 52 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/Column/boolean.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_boolean %} 2 | {% spaceless %} 3 | {{ echo_if(builder.ModelClass ~ '.' ~ column.getter) }} 4 | 5 | {{ echo_else() }} 6 | 7 | {{ echo_endif() }} 8 | {% endspaceless %} 9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/Column/collection.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_collection %} 2 | {% spaceless %} 3 | 8 | {% endspaceless %} 9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/Column/date.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_date %} 2 | {% spaceless %} 3 | {%- if builder.generator.TwigParams.use_localized_date == true -%} 4 | {{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }} 5 | {%- if column.localized_date_format is defined -%} 6 | {{ echo_set('localized_date_format', column.formOptions.localized_date_format) }} 7 | {%- else -%} 8 | {{ echo_set('localized_date_format', builder.generator.TwigParams.localized_date_format) }} 9 | {%- endif -%} 10 | {%- if column.formOptions.format is defined -%} 11 | {{ echo_set('date_format', column.formOptions.format) }} 12 | {%- else -%} 13 | {{ echo_set('date_format', builder.generator.TwigParams.date_format) }} 14 | {%- endif -%} 15 | 16 | {{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|localizeddate(localized_date_format, "none", null, null, date_format)') }} 17 | {{ echo_endif() }} 18 | {%- else -%} 19 | {{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }} 20 | {%- if column.formOptions.format is defined -%} 21 | {{ echo_set('date_format', column.formOptions.format) }} 22 | {%- else -%} 23 | {{ echo_set('date_format', builder.generator.TwigParams.date_format) }} 24 | {%- endif -%} 25 | 26 | {{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(date_format)') }} 27 | {{ echo_endif() }} 28 | {%- endif -%} 29 | {% endspaceless %} 30 | {% endblock %} 31 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/Column/datetime.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_datetime %} 2 | {% spaceless %} 3 | {% if builder.generator.TwigParams.use_localized_date == true -%} 4 | {{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }} 5 | {%- if column.localized_date_format is defined -%} 6 | {{ echo_set('localized_date_format', column.formOptions.localized_date_format) }} 7 | {%- else -%} 8 | {{ echo_set('localized_date_format', builder.generator.TwigParams.localized_date_format) }} 9 | {%- endif -%} 10 | {%- if column.localized_time_format is defined -%} 11 | {{ echo_set('localized_time_format', column.formOptions.localized_datetime_format) }} 12 | {%- else -%} 13 | {{ echo_set('localized_time_format', builder.generator.TwigParams.localized_datetime_format) }} 14 | {%- endif -%} 15 | {%- if column.formOptions.format is defined -%} 16 | {{ echo_set('datetime_format', column.formOptions.format) }} 17 | {%- else -%} 18 | {{ echo_set('datetime_format', builder.generator.TwigParams.datetime_format) }} 19 | {%- endif -%} 20 | 21 | {{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|localizeddate(localized_date_format, localized_time_format, null, null, datetime_format)') }} 22 | {{ echo_endif() }} 23 | {%- else -%} 24 | {{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }} 25 | {% if column.formOptions.format is defined %} 26 | {{ echo_set('datetime_format', column.formOptions.format) }} 27 | {% else %} 28 | {{ echo_set('datetime_format', builder.generator.TwigParams.datetime_format) }} 29 | {% endif %} 30 | 31 | {{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(datetime_format)') }} 32 | {{ echo_endif() }} 33 | {%- endif %} 34 | {% endspaceless %} 35 | {% endblock %} 36 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/Column/decimal.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_decimal %} 2 | {% spaceless %} 3 | {{- echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|number_format') -}} 4 | {% endspaceless %} 5 | {% endblock %} 6 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/Column/money.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_money %} 2 | {% spaceless %} 3 | {% set currency = column.formOptions.currency|default('EUR') %} 4 | {% set precision = column.formOptions.precision|default(2) %} 5 | {% set grouping = column.formOptions.grouping|default(true) %} 6 | {% set divisor = column.formOptions.divisor|default(1) %} 7 | 8 | {{ echo_twig('localized_money('~ builder.ModelClass~'.'~column.getter ~', "'~ currency ~'", "'~ precision ~'", '~ grouping ~', '~ divisor ~')') }} 9 | {% endspaceless %} 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/FiltersBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_filters %} 2 | {{ echo_block('list_filters') }} 3 |
4 |
5 | {{ echo_trans('list.filters') }} 6 |
7 | {{ echo_twig("form_errors(form)") }} 8 | {% for field in builder.filterColumns %} 9 | {% if builder.filterColumns[field.name].credentials %} 10 | {{ echo_if_granted(builder.filterColumns[field.name].credentials) }} 11 | {% endif %} 12 |
13 |
14 | {{ echo_twig("form_label(form['" ~ field.name ~ "'], '" ~ builder.FilterColumns[field.name].label|addslashes ~ "'|trans({}, '" ~ i18n_catalog|default("Admin") ~ "'))") }} 15 | {{ echo_twig("form_widget(form['" ~ field.name ~ "'], {'attr':{'class': 'form-control input-sm'}})") }} 16 | {{ echo_twig("form_errors(form['" ~ field.name ~ "'], {'attr': {'class': 'form-control-feedback'}})") }} 17 |
18 |
19 | {% if builder.filterColumns[field.name].credentials %} 20 | {{ echo_endif () }} 21 | {% endif %} 22 | {% endfor %} 23 | {{ echo_twig("form_rest(form)") }} 24 |
25 |
26 | 27 | 28 |
29 |
30 |
31 | {{ echo_endblock() }} 32 | {% endblock list_filters %} 33 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/ListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/ListTemplate/scopes.php.twig' %} 2 | {% use '../CommonAdmin/stylesheets.php.twig' %} 3 | {% use '../CommonAdmin/javascripts.php.twig' %} 4 | {% use '../CommonAdmin/title.php.twig' %} 5 | 6 | {{ echo_extends( builder.getBaseAdminTemplate ) }} 7 | 8 | {{ echo_block("stylesheets") }} 9 | {{- block('complementary_stylesheets') -}} 10 | {{ echo_endblock() }} 11 | 12 | {{ echo_block("javascripts") }} 13 | {{- block('complementary_javascripts') -}} 14 | {{ echo_endblock() }} 15 | 16 | {{- block('site_title') -}} 17 | 18 | {{ echo_block("body") }} 19 | {{- block('title') -}} 20 | 21 |
22 |
23 | {{- block('list_scopes') -}} 24 | 25 | {{ echo_include(builder.namespacePrefixForTemplate ~ bundle_name ~ ':' ~ builder.BaseGeneratorName ~ 'List:results.html.twig') }} 26 |
27 | 28 | {{ echo_block("filters") }} 29 | {% if builder.filterColumns|length > 0 %} 30 |
31 | {{ echo_include(builder.namespacePrefixForTemplate ~ bundle_name ~ ':' ~ builder.BaseGeneratorName ~ 'List:filters.html.twig') }} 32 |
33 | {% endif %} 34 | {{ echo_endblock() }} 35 |
36 | {{ echo_endblock() }} 37 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/ListTemplate/nbresults.php.twig' %} 2 | {% use '../CommonAdmin/ListTemplate/thead.php.twig' %} 3 | {% use '../CommonAdmin/ListTemplate/tbody.php.twig' %} 4 | {% use '../CommonAdmin/ListTemplate/paginator.php.twig' %} 5 | {% use '../CommonAdmin/generic_actions.php.twig' %} 6 | {% use '../CommonAdmin/batch_actions.php.twig' %} 7 | 8 | {% block list_results %} 9 |
10 | {{- block('list_nbresults') -}} 11 | 12 | {{- block('form_batch_actions') }} 13 | 14 | 15 | {{ block('list_thead') -}} 16 | {{- block('list_tbody') }} 17 |
18 | 19 |
20 | {% if batch_actions is defined and batch_actions|length > 0 %} 21 | 24 | {% endif -%} 25 | 26 | {% if actions is defined and actions|length > 0 %} 27 | 30 | {% endif -%} 31 | 32 | 35 | 36 | 39 |
40 | {{- block('endform_batch_actions') }} 41 |
42 | {% endblock list_results %} -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/ListTemplate/row.php.twig' %} 2 | {% use '../CommonAdmin/object_actions.php.twig' %} 3 | 4 | {% block list_row %} 5 | {{ echo_block('list_row') }} 6 | 7 | {{- block('list_row_content') -}} 8 | 9 | {{- block('object_actions') }} 10 | 11 | {{ echo_endblock() }} 12 | {% endblock list_row %} -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/nbresults.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_nbresults %} 2 | {{ echo_block("list_nbresults") }} 3 |
4 | {{ echo_set("count", builder.ModelClass ~ "s.nbResults", false ) }} 5 | {{ echo_set("start", "( " ~ builder.ModelClass ~ "s.currentPage - 1 ) * " ~ builder.ModelClass ~ "s.maxPerPage + 1", false ) }} 6 | {{ echo_set("end", "start + " ~ builder.ModelClass ~ "s.maxPerPage - 1", false ) }} 7 | {{ echo_set("end", "end > count ? count : end", false) }} 8 | 9 | {{ echo_if ( builder.ModelClass ~ "s.haveToPaginate") }} 10 | {{ echo_trans("list.display.range|{ start, end, count }|") }} 11 | {{ echo_elseif (" count > 0 ") }} 12 | {{ echo_trans("list.display.all|{ count }|") }} 13 | {{ echo_endif () }} 14 |
15 | {{ echo_endblock() }} 16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/paginator.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_paginator_perpage %} 2 | {{ echo_block("list_paginator_perpage") }} 3 | {{ echo_if( builder.ModelClass ~ "s.haveToPaginate or "~ builder.ModelClass ~ "s.maxPerPage is not sameas(10)") }} 4 |
5 |
{{ echo_trans('pagerfanta.view.perpage') }}
6 | 9 | 18 |
19 | {{ echo_endif() }} 20 | {{ echo_endblock() }} 21 | {% endblock %} 22 | 23 | {% block list_paginator_pages %} 24 | {{ echo_block('list_paginator_pages') }} 25 | {{ echo_twig("pagerfanta(" ~ builder.ModelClass ~ "s, 'admingenerator')") }} 26 | {{ echo_endblock() }} 27 | {% endblock %} 28 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/scopes.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_scopes %} 2 | {{ echo_block("list_scopes") }} 3 | {% if scopes is defined %} 4 | 17 | {% endif %} 18 | {{ echo_endblock() }} 19 | {% endblock %} 20 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ListTemplate/tbody.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/object_actions.php.twig' %} 2 | 3 | {% block list_tbody %} 4 | {{ echo_block("list_tbody") }} 5 | 6 | {{ echo_if (builder.ModelClass ~ "s|length > 0") }} 7 | 8 | {{ echo_for(builder.ModelClass, builder.ModelClass ~ "s" ) }} 9 | {{ echo_include(builder.namespacePrefixForTemplate ~ bundle_name ~ ':' ~ builder.BaseGeneratorName ~ 'List:row.html.twig') }} 10 | {{ echo_endfor() }} 11 | 12 | {{- block('object_actions_script') -}} 13 | 14 | {{ echo_else() }} 15 | 16 | {% if batch_actions is defined and batch_actions|length > 0 %} 17 | {{ echo_trans('list.no.results') }} 18 | {% else %} 19 | {{ echo_trans('list.no.results') }} 20 | {% endif %} 21 | 22 | {{ echo_endif () }} 23 | 24 | {{ echo_endblock() }} 25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/NestedListAction/index.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/security_action.php.twig' %} 2 | {% block index_use %} 3 | use {{ builder.namespacePrefixWithSubfolder }}\{{ bundle_name }}\Form\Type\{{ builder.BaseGeneratorName ? builder.BaseGeneratorName ~ char(92) : "" }}FiltersType; 4 | {% endblock %} 5 | {% block index %} 6 | 7 | public function indexAction() 8 | { 9 | {{ block('security_action') }} 10 | 11 | $form = $this->getFilterForm(); 12 | 13 | return $this->render('{{ builder.namespacePrefixForTemplate }}{{ bundle_name }}:{{ builder.BaseGeneratorName }}List:index.html.twig', $this->getAdditionalRenderParameters() + array( 14 | '{{ builder.ModelClass }}s' => $this->getTree(), 15 | 'form' => $form->createView(), 16 | 'scopes' => $this->getScopes(), 17 | )); 18 | } 19 | {% endblock %} 20 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/NestedListTemplate/NestedListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/NestedListTemplate/modal.php.twig' %} 2 | {% use '../CommonAdmin/ListTemplate/scopes.php.twig' %} 3 | {% use '../CommonAdmin/stylesheets.php.twig' %} 4 | {% use '../CommonAdmin/javascripts.php.twig' %} 5 | {% use '../CommonAdmin/title.php.twig' %} 6 | 7 | {{ echo_extends( builder.getBaseAdminTemplate ) }} 8 | 9 | {{ echo_block("javascripts") }} 10 | {{- block('complementary_javascripts') -}} 11 | 12 | 13 | {{ echo_endblock() }} 14 | 15 | {{ echo_block("stylesheets") }} 16 | {{- block('complementary_stylesheets') -}} 17 | {{ echo_endblock() }} 18 | 19 | {{- block('site_title') -}} 20 | 21 | {{ echo_block("body") }} 22 | {{- block('title') -}} 23 | 24 |
25 |
26 | {{ block('list_scopes') -}} 27 | 28 | {{ echo_include(builder.namespacePrefixForTemplate ~ bundle_name ~ ':' ~ builder.BaseGeneratorName ~ 'List:results.html.twig') }} 29 |
30 | 31 | {{ echo_block("filters") }} 32 | {% if builder.filterColumns|length > 0 %} 33 |
34 | {{ echo_include(builder.namespacePrefixForTemplate ~ bundle_name ~ ':' ~ builder.BaseGeneratorName ~ 'List:filters.html.twig') }} 35 |
36 | {% endif %} 37 | {{ echo_endblock() }} 38 |
39 | {{- block('nestedset_modal') -}} 40 | {{ echo_endblock() }} 41 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/NestedListTemplate/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/NestedListTemplate/nbresults.php.twig' %} 2 | {% use '../CommonAdmin/NestedListTemplate/thead.php.twig' %} 3 | {% use '../CommonAdmin/ListTemplate/tbody.php.twig' %} 4 | {% use '../CommonAdmin/generic_actions.php.twig' %} 5 | {% use '../CommonAdmin/batch_actions.php.twig' %} 6 | 7 | {% block list_results %} 8 |
9 | {{- block('list_nbresults') }} 10 | 11 | {{- block('form_batch_actions') }} 12 | 13 | {{ block('list_thead') -}} 14 | {{- block('list_tbody') }} 15 |
16 | 17 |
18 | {% if batch_actions is defined and batch_actions|length > 0 %} 19 | 22 | {% endif -%} 23 | 24 | {% if actions is defined and actions|length > 0 %} 25 | 28 | {% endif -%} 29 |
30 | {{- block('endform_batch_actions') -}} 31 |
32 | 33 | {% set admingeneratorNestedRoute=builder.routePrefixWithSubfolder ~ "_" ~ bundle_name ~ ( builder.BaseGeneratorName ? "_" ~ builder.BaseGeneratorName : "" ) ~ "_nested_move" %} 34 | 49 | {% endblock list_results %} -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/NestedListTemplate/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/ListTemplate/row.php.twig' %} 2 | {% use '../CommonAdmin/object_actions.php.twig' %} 3 | 4 | {% block list_row %} 5 | {{ echo_block('list_row') }} 6 | 8 | {{- block('list_row_content') -}} 9 | 10 | {{- block('object_actions') }} 11 | 12 | {{ echo_endblock() }} 13 | {% endblock list_row %} -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/NestedListTemplate/modal.php.twig: -------------------------------------------------------------------------------- 1 | {% block nestedset_modal %} 2 | {{ echo_block("nestedset_modal") }} 3 | 15 | 16 | 27 | {{ echo_endblock() }} 28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/NestedListTemplate/nbresults.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_nbresults %} 2 | {{ echo_block("list_nbresults") }} 3 |
4 | {# Nestedset requiers a fake root node, which is hidden in the result table. See documentation. #} 5 | {{ echo_set("count", builder.ModelClass ~ "s.count - 1", false ) }} 6 | 7 | {{ echo_trans("list.display.all|{ count }|") }} 8 |
9 | {{ echo_endblock() }} 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/NestedListTemplate/thead.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_thead %} 2 | {{ echo_block("list_thead") }} 3 | 4 | 5 | {% if batch_actions is defined and batch_actions|length > 0 %} 6 | 7 | 8 | 9 | {% endif %} 10 | {% for column in builder.columns -%} 11 | {% if column.credentials %} 12 | {{ echo_if_granted(column.credentials) }} 13 | {% endif %} 14 | 15 | {{ echo_twig("'" ~ column.label|addslashes ~ "'|trans({}, '" ~ i18n_catalog|default("Admin") ~ "')") }} 16 | 17 | {% if column.credentials %} 18 | {{ echo_endif () }} 19 | {% endif %} 20 | {% endfor -%} 21 | 22 | {%- if object_actions|length > 0 -%} 23 | {{ echo_trans('list.header.actions') }} 24 | {% endif -%} 25 | 26 | 27 | {{ echo_endblock() }} 28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/NewAction/NewBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/NewAction/index.php.twig' %} 2 | {% use '../CommonAdmin/NewAction/create.php.twig' %} 3 | {% use '../CommonAdmin/security_action.php.twig' %} 4 | setSecurityContext($this->get('security.context')); 51 | 52 | return $type; 53 | } 54 | 55 | protected function getNewObject() 56 | { 57 | return new \{{ model }}; 58 | } 59 | 60 | {% block saveObject -%} 61 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 62 | { 63 | // ORM JOB 64 | } 65 | {% endblock %} 66 | } 67 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/NewAction/index.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/security_action.php.twig' %} 2 | {% block index_use %} 3 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; 4 | use {{ builder.namespacePrefixWithSubfolder }}\{{ bundle_name }}\Form\Type\{{ builder.BaseGeneratorName ? builder.BaseGeneratorName ~ char(92) : "" }}NewType; 5 | {% endblock %} 6 | {% block index %} 7 | 8 | public function indexAction() 9 | { 10 | {{ block('security_action') }} 11 | 12 | ${{ builder.ModelClass }} = $this->getNewObject(); 13 | 14 | $this->preBindRequest(${{ builder.ModelClass }}); 15 | $form = $this->createForm($this->getNewType(), ${{ builder.ModelClass }}, $this->getFormOptions(${{ builder.ModelClass }})); 16 | 17 | return $this->render('{{ builder.namespacePrefixForTemplate }}{{ bundle_name }}:{{ builder.BaseGeneratorName }}New:index.html.twig', $this->getAdditionalRenderParameters(${{ builder.ModelClass }}) + array( 18 | "{{ builder.ModelClass }}" => ${{ builder.ModelClass }}, 19 | "form" => $form->createView(), 20 | )); 21 | } 22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ShowAction/ShowBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/ShowAction/index.php.twig' %} 2 | {% use '../CommonAdmin/security_action.php.twig' %} 3 | getObject($pk); 11 | 12 | {{ block('security_action_with_object') }} 13 | 14 | if (!${{ builder.ModelClass }}) { 15 | throw new NotFoundHttpException("The {{ model }} with {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} $pk can't be found"); 16 | } 17 | 18 | return $this->render('{{ builder.namespacePrefixForTemplate }}{{ bundle_name }}:{{ builder.BaseGeneratorName }}Show:index.html.twig', $this->getAdditionalRenderParameters(${{ builder.ModelClass }}) + array( 19 | "{{ builder.ModelClass }}" => ${{ builder.ModelClass }} 20 | )); 21 | } 22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ShowTemplate/ShowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '../CommonAdmin/ShowTemplate/show.php.twig' %} 2 | {% use '../CommonAdmin/ShowTemplate/sidebar.php.twig' %} 3 | {% use '../CommonAdmin/stylesheets.php.twig' %} 4 | {% use '../CommonAdmin/javascripts.php.twig' %} 5 | {% use '../CommonAdmin/title.php.twig' %} 6 | {% use '../CommonAdmin/tabs.php.twig' %} 7 | {% use '../CommonAdmin/object_actions.php.twig' %} 8 | 9 | {{ echo_extends( builder.getBaseAdminTemplate ) }} 10 | 11 | {{ echo_block("stylesheets") }} 12 | {{- block('complementary_stylesheets') -}} 13 | {{ echo_endblock() }} 14 | 15 | {{ echo_block("javascripts") }} 16 | {{- block('complementary_javascripts') -}} 17 | {{- block('object_actions_script') -}} 18 | {{ echo_endblock() }} 19 | 20 | {{- block('site_title') -}} 21 | 22 | {{ echo_block("body") }} 23 | {{- block('title') -}} 24 | 25 |
26 |
27 |
28 | {{- block('object_actions') -}} 29 |
30 |
31 | 32 |
33 | {% if sidebar is defined and sidebar|length > 0 %} 34 |
35 | {% endif %} 36 | {{- block('tabs') }} 37 | {% if tabs is defined and tabs|length > 0 %} 38 |
39 | {% endif %} 40 | {{- block('show') -}} 41 | {% if tabs is defined and tabs|length > 0 %} 42 |
43 | {% endif %} 44 | {% if sidebar is defined and sidebar|length > 0 %} 45 |
46 |
47 | {{- block('show_sidebar') -}} 48 |
49 | {% endif %} 50 |
51 |
52 | {{ echo_endblock() }} 53 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/ShowTemplate/sidebar.php.twig: -------------------------------------------------------------------------------- 1 | {% block show_sidebar %} 2 | {{ echo_block("show_sidebar") }} 3 | {% for name, widget in sidebar %} 4 | {% if widget.credentials is defined %} 5 | {{ echo_if_granted(widget.credentials, builder.ModelClass) }} 6 | {% endif %} 7 |
8 |

{{ echo_trans(name,{}, i18n_catalog is defined ? i18n_catalog : "Admin" ) }}

9 | {% if widget.partial %} 10 | {{ echo_include(widget.partial) }} 11 | {% elseif widget.render %} 12 | {{ echo_render(widget.render is iterable ? widget.render.controller : widget.render, widget.render is iterable ? widget.render.params : {}) }} 13 | {% endif %} 14 |
15 | {% if widget.credentials is defined %} 16 | {{ echo_endif () }} 17 | {% endif %} 18 | {% endfor %} 19 | {{ echo_endblock() }} 20 | {% endblock %} -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/csrf_protection.php.twig: -------------------------------------------------------------------------------- 1 | {% block csrf_protection_use %} 2 | use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException; 3 | {% endblock %} 4 | 5 | {% block csrf_check_token %} 6 | 7 | /** 8 | * Check crsf token provided for action 9 | * 10 | * @throw InvalidCsrfTokenException if token is invalid 11 | */ 12 | protected function isCsrfTokenValid($intention) 13 | { 14 | $token = $this->getRequest()->request->get('_csrf_token'); 15 | if (!$this->get('form.csrf_provider')->isCsrfTokenValid($intention, $token)) { 16 | throw new InvalidCsrfTokenException(); 17 | } 18 | } 19 | 20 | {% endblock %} 21 | 22 | {% block csrf_action_check_token %} 23 | // Check CSRF token for action 24 | $intention = $this->getRequest()->getRequestUri(); 25 | $this->isCsrfTokenValid($intention); 26 | {% endblock %} 27 | 28 | {% block csrf_action_check_batch_token %} 29 | // Check CSRF token for batch action 30 | $intention = '{{ namespace_prefix }}_{{ bundle_name ~ (builder.BaseGeneratorName ? '_' ~ builder.BaseGeneratorName :'')}}_batch'; 31 | $this->isCsrfTokenValid($intention); 32 | {% endblock %} 33 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/javascripts.php.twig: -------------------------------------------------------------------------------- 1 | {% block complementary_javascripts %} 2 | {{ echo_twig('parent()') }} 3 | {% for js in builder.getJavascripts() %} 4 | 5 | {% endfor %} 6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/security_action.php.twig: -------------------------------------------------------------------------------- 1 | {% block security_use %} 2 | use Symfony\Component\Security\Core\Exception\AccessDeniedException; 3 | use JMS\SecurityExtraBundle\Security\Authorization\Expression\Expression; 4 | {% endblock %} 5 | 6 | {% block security_check %} 7 | /** 8 | * Check user credentials 9 | * 10 | * @param string $credentials 11 | * @param \{{ model }} ${{ builder.ModelClass }} 12 | * @throw AccessDeniedException if is not allowed 13 | */ 14 | protected function checkCredentials($credentials, \{{ model }} ${{ builder.ModelClass }} = null) 15 | { 16 | $securityContext = $this->get('security.context'); 17 | 18 | if (false === $securityContext->isGranted(array(new Expression($credentials)), ${{ builder.ModelClass }})) { 19 | throw new AccessDeniedException(); 20 | } 21 | } 22 | {% endblock %} 23 | 24 | {% block security_action %} 25 | {% if builder.yamlKey is sameas('actions') %} 26 | {% if action is defined and action.credentials %} 27 | $this->checkCredentials('{{ action.credentials }}'); 28 | {% endif %} 29 | {% elseif credentials %} 30 | $this->checkCredentials('{{ credentials }}'); 31 | {% endif %} 32 | {% endblock %} 33 | 34 | {% block security_action_with_object %} 35 | {% if builder.yamlKey is sameas('actions') %} 36 | {% if action is defined and action.credentials %} 37 | $this->checkCredentials('{{ action.credentials }}', ${{ builder.ModelClass }}); 38 | {% endif %} 39 | {% elseif credentials %} 40 | $this->checkCredentials('{{ credentials }}', ${{ builder.ModelClass }}); 41 | {% endif %} 42 | {% endblock %} 43 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/stylesheets.php.twig: -------------------------------------------------------------------------------- 1 | {% block complementary_stylesheets %} 2 | {{ echo_twig('parent()') }} 3 | {% for css in builder.getStylesheets() %} 4 | 5 | {% endfor %} 6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/tabs.php.twig: -------------------------------------------------------------------------------- 1 | {% block tabs %} 2 | {{ echo_block("form_tabs") }} 3 | {% if tabs is defined and tabs|length > 0 %} 4 | 14 | 30 | {% endif %} 31 | {{ echo_endblock() }} 32 | {% endblock %} 33 | -------------------------------------------------------------------------------- /Resources/templates/CommonAdmin/title.php.twig: -------------------------------------------------------------------------------- 1 | {% block title %} 2 | {{ echo_block("page_title") }} 3 |
4 |

{{ echo_trans(title,{}, i18n_catalog|default("Admin") ) }}

5 |
6 | {{ echo_endblock() }} 7 | {% endblock %} 8 | 9 | {% block site_title %} 10 | {{ echo_block("title") }} 11 | {{ echo_twig('parent()') }} - {{ echo_trans(title,{}, i18n_catalog|default("Admin") ) }} 12 | {{ echo_endblock() }} 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/ActionsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ActionsTemplate/ActionsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/Edit/FormBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditTemplate/FormBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/EditBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditAction/EditBuilderAction.php.twig' %} 2 | 3 | {% block orm_use %} 4 | use Doctrine\DBAL\LockMode; 5 | use Doctrine\ORM\OptimisticLockException; 6 | {% endblock %} 7 | 8 | {% block getObject -%} 9 | /** 10 | * Get object \{{ model }} with identifier $pk 11 | * 12 | * @param mixed $pk 13 | * @return \{{ model }} 14 | */ 15 | protected function getObject($pk) 16 | { 17 | return $this->getQuery($pk)->getOneOrNullResult(); 18 | } 19 | {% endblock %} 20 | 21 | {% block getQuery -%} 22 | /** 23 | * Get query from query builder 24 | * 25 | * @param mixed $pk 26 | * @return Doctrine\ORM\Query 27 | */ 28 | protected function getQuery($pk) 29 | { 30 | return $this->getQueryBuilder($pk)->getQuery(); 31 | } 32 | 33 | /** 34 | * Creates a QueryBuilder instance filtering on {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} 35 | * property. 36 | * 37 | * @param mixed $pk 38 | * @return Doctrine\ORM\QueryBuilder 39 | */ 40 | protected function getQueryBuilder($pk) 41 | { 42 | return $this->getDoctrine() 43 | ->getManagerForClass('{{ model }}') 44 | ->getRepository('{{ model }}') 45 | ->createQueryBuilder('q') 46 | ->where('q.{{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} = :pk') 47 | ->setParameter(':pk', $pk); 48 | } 49 | {% endblock %} 50 | 51 | {% block saveObject -%} 52 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 53 | { 54 | $em = $this->getDoctrine()->getManagerForClass('{{ model }}'); 55 | $em->persist(${{ builder.ModelClass }}); 56 | $em->flush(); 57 | } 58 | {% endblock %} 59 | 60 | {% block checkVersion -%} 61 | $this->getDoctrine()->getManagerForClass('{{ model }}')->lock(${{ builder.ModelClass }}, LockMode::OPTIMISTIC, $versions[$pk]); 62 | {% endblock %} 63 | 64 | {% block lockException %}OptimisticLockException{% endblock %} -------------------------------------------------------------------------------- /Resources/templates/Doctrine/EditBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditTemplate/EditBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/EditBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditType/EditBuilderType.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/ExcelBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ExcelAction/ExcelBuilderAction.php.twig' %} 2 | 3 | {% block getResults %} 4 | protected function getResults(){ 5 | return $this->getQuery()->getResult(); 6 | } 7 | {% endblock %} -------------------------------------------------------------------------------- /Resources/templates/Doctrine/List/FiltersBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/FiltersBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/List/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/List/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/ListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/ListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/NestedList/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NestedListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/NestedList/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NestedListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/NestedListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NestedListTemplate/NestedListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/NewBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NewAction/NewBuilderAction.php.twig' %} 2 | 3 | {% block saveObject -%} 4 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 5 | { 6 | $em = $this->getDoctrine()->getManagerForClass('{{ model }}'); 7 | $em->persist(${{ builder.ModelClass }}); 8 | $em->flush(); 9 | } 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/ShowBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ShowAction/ShowBuilderAction.php.twig' %} 2 | {% block getObject -%} 3 | /** 4 | * Get object \{{ model }} with identifier $pk 5 | * 6 | * @param mixed $pk 7 | * @return \{{ model }} 8 | */ 9 | protected function getObject($pk) 10 | { 11 | return $this->getQuery($pk)->getOneOrNullResult(); 12 | } 13 | {% endblock %} 14 | 15 | 16 | {% block getQuery -%} 17 | /** 18 | * Get query from query builder 19 | * 20 | * @param mixed $pk 21 | * @return Doctrine\ORM\Query 22 | */ 23 | protected function getQuery($pk) 24 | { 25 | return $this->getQueryBuilder($pk)->getQuery(); 26 | } 27 | 28 | /** 29 | * Creates a QueryBuilder instance filtering on {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} 30 | * property. 31 | * 32 | * @param mixed $pk 33 | * @return Doctrine\ORM\QueryBuilder 34 | */ 35 | protected function getQueryBuilder($pk) 36 | { 37 | return $this->getDoctrine() 38 | ->getManagerForClass('{{ model }}') 39 | ->getRepository('{{ model }}') 40 | ->createQueryBuilder('q') 41 | ->where('q.{{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} = :pk') 42 | ->setParameter(':pk', $pk); 43 | } 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /Resources/templates/Doctrine/ShowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ShowTemplate/ShowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/ActionsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ActionsTemplate/ActionsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/Edit/FormBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditTemplate/FormBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/EditBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditAction/EditBuilderAction.php.twig' %} 2 | 3 | {% block orm_use %} 4 | use Doctrine\ODM\MongoDB\LockMode; 5 | use Doctrine\ODM\MongoDB\LockException; 6 | {% endblock %} 7 | 8 | {% block getObject -%} 9 | /** 10 | * Get object \{{ model }} with identifier $pk 11 | * 12 | * @param mixed $pk 13 | * @return \{{ model }} 14 | */ 15 | protected function getObject($pk) 16 | { 17 | $pk = is_numeric($pk) ? intval($pk) : $pk; 18 | 19 | return $this->getQuery($pk)->getSingleResult(); 20 | } 21 | {% endblock %} 22 | 23 | {% block getQuery -%} 24 | /** 25 | * Get query from query builder 26 | * 27 | * @param mixed $pk 28 | * @return Doctrine\ODM\Query 29 | */ 30 | protected function getQuery($pk) 31 | { 32 | return $this->getQueryBuilder($pk)->getQuery(); 33 | } 34 | 35 | /** 36 | * Creates a QueryBuilder instance filtering on {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} 37 | * property. 38 | * 39 | * @param mixed $pk 40 | * @return Doctrine\ODM\QueryBuilder 41 | */ 42 | protected function getQueryBuilder($pk) 43 | { 44 | return $this->getDocumentManager() 45 | ->getRepository('{{ model }}') 46 | ->createQueryBuilder() 47 | ->field('{{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }}')->equals($pk); 48 | } 49 | {% endblock %} 50 | 51 | {% block saveObject -%} 52 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 53 | { 54 | $dm = $this->getDocumentManager(); 55 | $dm->persist(${{ builder.ModelClass }}); 56 | $dm->flush(); 57 | } 58 | {% endblock %} 59 | 60 | {% block checkVersion -%} 61 | $this->getDocumentManager()->lock(${{ builder.ModelClass }}, LockMode::OPTIMISTIC, $versions[$pk]); 62 | {% endblock %} 63 | 64 | {% block lockException %}LockException{% endblock %} 65 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/EditBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditTemplate/EditBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/EditBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditType/EditBuilderType.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/ExcelBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ExcelAction/ExcelBuilderAction.php.twig' %} 2 | 3 | {% block getResults %} 4 | protected function getResults(){ 5 | return $this->getQuery()->getResult(); 6 | } 7 | {% endblock %} -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/List/FiltersBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/FiltersBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/List/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/List/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/ListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/ListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/NestedList/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NestedListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/NestedList/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NestedListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/NewBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NewAction/NewBuilderAction.php.twig' %} 2 | 3 | {% block saveObject -%} 4 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 5 | { 6 | $em = $this->getDocumentManager(); 7 | $em->persist(${{ builder.ModelClass }}); 8 | $em->flush(); 9 | } 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/ShowBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ShowAction/ShowBuilderAction.php.twig' %} 2 | 3 | {% block getObject -%} 4 | /** 5 | * Get object \{{ model }} with identifier $pk 6 | * 7 | * @param mixed $pk 8 | * @return \{{ model }} 9 | */ 10 | protected function getObject($pk) 11 | { 12 | $pk = is_numeric($pk) ? intval($pk) : $pk; 13 | 14 | return $this->getQuery($pk)->getSingleResult(); 15 | } 16 | {% endblock %} 17 | 18 | {% block getQuery -%} 19 | /** 20 | * Get query from query builder 21 | * 22 | * @param mixed $pk 23 | * @return Doctrine\ODM\Query 24 | */ 25 | protected function getQuery($pk) 26 | { 27 | return $this->getQueryBuilder($pk)->getQuery(); 28 | } 29 | 30 | /** 31 | * Creates a QueryBuilder instance filtering on {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} 32 | * property. 33 | * 34 | * @param mixed $pk 35 | * @return Doctrine\ODM\QueryBuilder 36 | */ 37 | protected function getQueryBuilder($pk) 38 | { 39 | return $this->getDocumentManager() 40 | ->getRepository('{{ model }}') 41 | ->createQueryBuilder() 42 | ->field('{{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }}')->equals($pk); 43 | } 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /Resources/templates/DoctrineODM/ShowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ShowTemplate/ShowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/EmptyBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | get('request')->get('stop_loop')) { 16 | throw new CantGenerateException('Opps an error occurred in your configuration. If you\'re in prod try cache:warmup'); 17 | } 18 | 19 | return $this->redirect($this->get('request')->getRequestUri()."?stop_loop=true"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Resources/templates/Propel/ActionsBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ActionsAction/ActionsBuilderAction.php.twig' %} 2 | 3 | {% block getObject %} 4 | 5 | protected function getObject($pk) 6 | { 7 | ${{ builder.ModelClass }} = $this->getObjectQuery($pk)->findPk($pk); 8 | 9 | if (!${{ builder.ModelClass }}) { 10 | throw new \InvalidArgumentException("No {{ model }} found on {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} : $pk"); 11 | } 12 | 13 | return ${{ builder.ModelClass }}; 14 | } 15 | 16 | {% endblock %} 17 | 18 | {% block getQuery -%} 19 | protected function getObjectQuery($pk) 20 | { 21 | return \{{ model }}Query::create(); 22 | } 23 | {% endblock %} 24 | 25 | {% block executeObjectDelete %} 26 | 27 | protected function executeObjectDelete(\{{ model }} ${{ builder.ModelClass }}) 28 | { 29 | ${{ builder.ModelClass }}->delete(); 30 | } 31 | 32 | {% endblock %} 33 | 34 | {% block executeBatchDelete %} 35 | 36 | protected function executeBatchDelete(array $selected) 37 | { 38 | \{{ model }}Query::create() 39 | ->filterByPrimaryKeys($selected) 40 | ->delete(); 41 | } 42 | 43 | {% endblock %} -------------------------------------------------------------------------------- /Resources/templates/Propel/ActionsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ActionsTemplate/ActionsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/Edit/FormBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditTemplate/FormBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/EditBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditAction/EditBuilderAction.php.twig' %} 2 | 3 | {% block orm_use %} 4 | use \PropelException; 5 | {% endblock %} 6 | 7 | {% block getObject -%} 8 | protected function getObject($pk) 9 | { 10 | return $this->getQuery($pk)->findPk($pk); 11 | } 12 | {% endblock %} 13 | 14 | {% block getQuery -%} 15 | protected function getQuery($pk) 16 | { 17 | return \{{ model }}Query::create(); 18 | } 19 | {% endblock %} 20 | 21 | {% block saveObject -%} 22 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 23 | { 24 | ${{ builder.ModelClass }}->save(); 25 | } 26 | {% endblock %} 27 | 28 | {% block checkVersion -%} 29 | if (${{ builder.ModelClass }}->getVersion() !== $versions[$pk]) { 30 | throw new PropelException("The lock failed, version ".$versions[$pk]." was expected, but is actually ".${{ builder.ModelClass }}->getVersion()); 31 | } 32 | {% endblock %} 33 | 34 | {% block lockException %}PropelException{% endblock %} -------------------------------------------------------------------------------- /Resources/templates/Propel/EditBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditTemplate/EditBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/EditBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/EditType/EditBuilderType.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/ExcelBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ExcelAction/ExcelBuilderAction.php.twig' %} 2 | 3 | {% block getResults %} 4 | protected function getResults(){ 5 | return $this->getQuery()->find(); 6 | } 7 | {% endblock %} -------------------------------------------------------------------------------- /Resources/templates/Propel/List/FiltersBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/FiltersBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/List/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/List/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/ListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ListTemplate/ListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/NestedList/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NestedListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/NestedList/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NestedListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/NestedListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NestedListTemplate/NestedListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/templates/Propel/NewBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/NewAction/NewBuilderAction.php.twig' %} 2 | 3 | {% block saveObject -%} 4 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 5 | { 6 | ${{ builder.ModelClass }}->save(); 7 | } 8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /Resources/templates/Propel/ShowBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ShowAction/ShowBuilderAction.php.twig' %} 2 | 3 | {% block getObject -%} 4 | protected function getObject($pk) 5 | { 6 | return $this->getQuery($pk)->findPk($pk); 7 | } 8 | {% endblock %} 9 | 10 | {% block getQuery -%} 11 | protected function getQuery($pk) 12 | { 13 | return \{{ model }}Query::create(); 14 | } 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /Resources/templates/Propel/ShowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '../CommonAdmin/ShowTemplate/ShowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/KnpMenu/knp_menu_trans.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'knp_menu.html.twig' %} 2 | {% block label %} 3 | {% if item.getExtra('icon') is defined %}{% endif %} 4 | {% set labelText = item.label|trans(item.getExtra('translation_params', {}), item.getExtra('translation_domain', 'messages')) %} 5 | {% if options.allow_safe_labels and item.getExtra('safe_label', false) %}{{ labelText|raw }}{% else %}{{ labelText }}{% endif %} 6 | {% if item.getExtra('caret') %}{% endif %} 7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /Routing/NestedRoutingLoader.php: -------------------------------------------------------------------------------- 1 | actions['nested_move'] = array( 10 | 'pattern' => '/nested-move/{dragged}/{action}/{dropped}', 11 | 'defaults' => array(), 12 | 'requirements' => array(), 13 | 'controller' => 'list', 14 | ); 15 | 16 | return parent::load($resource, $type); 17 | } 18 | 19 | public function supports($resource, $type = null) 20 | { 21 | return 'admingenerator_nested' == $type; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Tests/Builder/Fixtures/BaseBuilder.php.twig: -------------------------------------------------------------------------------- 1 | Hello {{ name }}! 2 | -------------------------------------------------------------------------------- /Tests/ClassLoader/AdmingeneratedClassLoaderTest.php: -------------------------------------------------------------------------------- 1 | setBasePath(realpath(sys_get_temp_dir())); 18 | $loader->loadClass($testClassName); 19 | $this->assertTrue(class_exists($className), $message); 20 | } 21 | 22 | public function getLoadClassTests() 23 | { 24 | return array( 25 | array('\\Admingenerated\\AdmingeneratorDemoBundle\\BaseController\\ListController', 'Admingenerated\\AdmingeneratorDemoBundle\\BaseController\\ListController', '->loadClass() loads admingenerated class'), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Tests/Generator/ActionTest.php: -------------------------------------------------------------------------------- 1 | 'name', 16 | 'underscored_name' => 'underscored_name', 17 | ); 18 | 19 | $this->checkAction($from_to_array, 'getName'); 20 | } 21 | 22 | public function testGetLabel() 23 | { 24 | $from_to_array = array( 25 | 'name' => 'Name', 26 | 'underscored_name' => 'Underscored name', 27 | ); 28 | 29 | $this->checkAction($from_to_array, 'getLabel'); 30 | } 31 | 32 | protected function checkAction($from_to_array, $method) 33 | { 34 | foreach ($from_to_array as $from => $to) { 35 | $action = new Action($from); 36 | $this->assertEquals($to, $action->$method()); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Tests/Mocks/Doctrine/DriverConnectionMock.php: -------------------------------------------------------------------------------- 1 | _platformMock) { 33 | $this->_platformMock = new DatabasePlatformMock; 34 | } 35 | 36 | return $this->_platformMock; 37 | } 38 | 39 | /** 40 | * @override 41 | */ 42 | public function getSchemaManager(\Doctrine\DBAL\Connection $conn) 43 | { 44 | if ($this->_schemaManagerMock == null) { 45 | return new SchemaManagerMock($conn); 46 | } else { 47 | return $this->_schemaManagerMock; 48 | } 49 | } 50 | 51 | /* MOCK API */ 52 | 53 | public function setDatabasePlatform(\Doctrine\DBAL\Platforms\AbstractPlatform $platform) 54 | { 55 | $this->_platformMock = $platform; 56 | } 57 | 58 | public function setSchemaManager(\Doctrine\DBAL\Schema\AbstractSchemaManager $sm) 59 | { 60 | $this->_schemaManagerMock = $sm; 61 | } 62 | 63 | public function getName() 64 | { 65 | return 'mock'; 66 | } 67 | 68 | public function getDatabase(\Doctrine\DBAL\Connection $conn) 69 | { 70 | return; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Tests/Mocks/Doctrine/SchemaManagerMock.php: -------------------------------------------------------------------------------- 1 | id; 44 | } 45 | 46 | /** 47 | * Set title 48 | * 49 | * @param string $title 50 | */ 51 | public function setTitle($title) 52 | { 53 | $this->title = $title; 54 | } 55 | 56 | /** 57 | * Get title 58 | * 59 | * @return string 60 | */ 61 | public function getTitle() 62 | { 63 | return $this->title; 64 | } 65 | 66 | /** 67 | * Set desc 68 | * 69 | * @param string $desc 70 | */ 71 | public function setDesc($desc) 72 | { 73 | $this->desc = $desc; 74 | } 75 | 76 | /** 77 | * Get desc 78 | * 79 | * @return string 80 | */ 81 | public function getDesc() 82 | { 83 | return $this->desc; 84 | } 85 | 86 | /** 87 | * Set is_published 88 | * 89 | * @param boolean $isPublished 90 | */ 91 | public function setIsPublished($isPublished) 92 | { 93 | $this->is_published = $isPublished; 94 | } 95 | 96 | /** 97 | * Get is_published 98 | * 99 | * @return boolean 100 | */ 101 | public function getIsPublished() 102 | { 103 | return $this->is_published; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Tests/QueryFilter/Entity/MovieRepository.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('No DemoBundle found'); 19 | } 20 | } 21 | 22 | public function testLoad() 23 | { 24 | if (file_exists('/host/admingen/src/Admingenerator/DemoBundle/Controller/')) { 25 | $routing = new RoutingLoader(new FileLocator(array())); 26 | $routes = $routing->load('/host/admingen/src/Admingenerator/DemoBundle/Controller/', 'admingenerated'); 27 | $this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $routes); 28 | } 29 | 30 | if (file_exists('c:\admingen\src\Admingenerator\DemoBundle\Controller\\')) { 31 | $routing = new RoutingLoader(new FileLocator(array())); 32 | $routes = $routing->load('c:\admingen\src\Admingenerator\DemoBundle\Controller\\', 'admingenerated'); 33 | $this->assertInstanceOf('Symfony\Component\Routing\RouteCollection', $routes); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Tests/TestCase.php: -------------------------------------------------------------------------------- 1 | false, 17 | ))); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Tests/Twig/Extension/Object.php: -------------------------------------------------------------------------------- 1 | 0, 14 | 'foo' => 0, 15 | 'getFooBar' => 0, 16 | ); 17 | 18 | public function __construct($bar = 'bar') 19 | { 20 | 21 | } 22 | 23 | public static function reset() 24 | { 25 | self::$called = array( 26 | '__toString' => 0, 27 | 'foo' => 0, 28 | 'getFooBar' => 0, 29 | ); 30 | } 31 | 32 | public function __toString() 33 | { 34 | ++self::$called['__toString']; 35 | 36 | return 'foo'; 37 | } 38 | 39 | public function foo() 40 | { 41 | ++self::$called['foo']; 42 | 43 | return 'foo'; 44 | } 45 | 46 | public function getFooBar() 47 | { 48 | ++self::$called['getFooBar']; 49 | 50 | return 'foobar'; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Tests/Twig/Fixtures/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/58008ec61746da9e6829d0e9b94b8f39589a623f/Tests/Twig/Fixtures/.gitkeep -------------------------------------------------------------------------------- /Tests/autoload.php.dist: -------------------------------------------------------------------------------- 1 | registerNamespaces(array( 18 | 'Symfony' => $vendorDir.'/symfony/src', 19 | 'Sensio\Bundle' => $vendorDir, 20 | 'WhiteOctober\PagerfantaBundle' => $vendorDir, 21 | 'Pagerfanta' => $vendorDir.'/src', 22 | 'Knp' => $vendorDir, 23 | 'Knp\Menu' => $vendorDir.'/src', 24 | 'Assetic' => $vendorDir.'/src', 25 | 'TwigGenerator' => $vendorDir.'/twig-generator/src', 26 | 'Doctrine\Common' => $vendorDir.'/doctrine-common/lib', 27 | 'Doctrine\DBAL' => $vendorDir.'/../vendor/doctrine-dbal/lib', 28 | 'Doctrine\Tests' => $vendorDir.'/doctrine/tests', 29 | 'Doctrine' => $vendorDir.'/doctrine/lib', 30 | )); 31 | $loader->registerPrefixes(array( 32 | 'Twig_' => array($vendorDir.'/twig/lib', $vendorDir.'/twig-extensions/lib'), 33 | )); 34 | $loader->register(); 35 | 36 | spl_autoload_register(function($class) { 37 | if (0 === strpos($class, 'Admingenerator\\GeneratorBundle\\')) { 38 | $path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php'; 39 | if (!stream_resolve_include_path($path)) { 40 | return false; 41 | } 42 | require_once $path; 43 | 44 | return true; 45 | } 46 | }); 47 | -------------------------------------------------------------------------------- /Tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class ConfigExtension extends \Twig_Extension 11 | { 12 | protected $container; 13 | 14 | public function __construct(ContainerInterface $container) 15 | { 16 | $this->container = $container; 17 | } 18 | 19 | /** 20 | * {@inheritdoc} 21 | */ 22 | public function getFunctions() 23 | { 24 | return array( 25 | 'admingenerator_config' => new \Twig_Function_Method($this, 'getAdmingeneratorConfig'), 26 | ); 27 | } 28 | 29 | /** 30 | * Returns admingenerator parameter 31 | * 32 | * @param string $name 33 | * @return string Parameter value 34 | */ 35 | public function getAdmingeneratorConfig($name) 36 | { 37 | return $this->container->getParameter('admingenerator.'.$name); 38 | } 39 | 40 | /** 41 | * Returns the name of the extension. 42 | * 43 | * @return string The extension name 44 | */ 45 | public function getName() 46 | { 47 | return 'admingenerator_config'; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Twig/Extension/CsrfTokenExtension.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class CsrfTokenExtension extends \Twig_Extension 11 | { 12 | protected $container; 13 | 14 | public function __construct(ContainerInterface $container) 15 | { 16 | $this->container = $container; 17 | } 18 | 19 | public function getFilters() 20 | { 21 | return array( 22 | 'csrf_token' => new \Twig_Filter_Method($this, 'getCsrfToken'), 23 | ); 24 | } 25 | 26 | public function getCsrfToken($intention) 27 | { 28 | $token = $this->container->get('form.csrf_provider')->generateCsrfToken($intention); 29 | 30 | return $token; 31 | } 32 | 33 | /** 34 | * Returns the name of the extension. 35 | * 36 | * @return string The extension name 37 | */ 38 | public function getName() 39 | { 40 | return 'admingenerator_csrf'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Twig/Extension/ExtendsAdmingeneratedExtension.php: -------------------------------------------------------------------------------- 1 | loader = $loader; 16 | } 17 | 18 | public function addCachePath(ContainerInterface $container) 19 | { 20 | $this->loader->addPath($container->getParameter('kernel.cache_dir')); 21 | } 22 | 23 | public function getTokenParsers() 24 | { 25 | return array( 26 | new ExtendsAdmingeneratedTokenParser(), 27 | ); 28 | } 29 | 30 | public function getName() 31 | { 32 | return 'extends_admingenerated'; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Twig/TokenParser/ExtendsAdmingeneratedTokenParser.php: -------------------------------------------------------------------------------- 1 | parser->getParent()) { 18 | throw new \Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine()); 19 | } 20 | 21 | list($bundle, $folder, $file) = explode(':', $this->parser->getCurrentToken()->getValue()); 22 | 23 | $path = "Admingenerated/$bundle/Resources/views/$folder/$file"; 24 | 25 | $value = $this->parser->getExpressionParser()->parseExpression(); 26 | 27 | $this->parser->setParent(new \Twig_Node_Expression_Constant($path,$token->getLine())); 28 | $this->parser->getStream()->expect(\Twig_Token::BLOCK_END_TYPE); 29 | 30 | return null; 31 | } 32 | 33 | /** 34 | * Gets the tag name associated with this token parser. 35 | * 36 | * @return string The tag name 37 | */ 38 | public function getTag() 39 | { 40 | return 'extends_admingenerated'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Validator/BaseValidator.php: -------------------------------------------------------------------------------- 1 | getGeneratorYml()); 13 | 14 | $yaml_path = explode('.',$yaml_path); 15 | foreach ($yaml_path as $key) { 16 | if (!isset($search_in[$key])) { 17 | return $default; 18 | } 19 | $search_in = $search_in[$key]; 20 | } 21 | 22 | return $search_in; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Validator/ModelClassValidator.php: -------------------------------------------------------------------------------- 1 | getFromYaml($generator, 'params.model')) { 13 | throw new ModelClassNotFoundException(sprintf('You should define params.model option in %s', $generator->getGeneratorYml())); 14 | } 15 | 16 | if (!class_exists($model)) { 17 | throw new ModelClassNotFoundException(sprintf('Unable to find class %s for %s', $model, $generator->getGeneratorYml())); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Validator/PropelModelClassValidator.php: -------------------------------------------------------------------------------- 1 | getFromYaml($generator, 'params.model'); 13 | $parts = explode('\\', $model); 14 | $modelName = $parts[sizeof($parts) -1]; 15 | unset($parts[sizeof($parts) -1]); 16 | 17 | $model = implode('\\', $parts).'\\om\\Base'.$modelName; 18 | 19 | if (!class_exists($model)) { 20 | throw new GeneratedModelClassNotFoundException(sprintf('Unable to find class %s for %s', $model, $generator->getGeneratorYml())); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Validator/ValidatorInterface.php: -------------------------------------------------------------------------------- 1 | = 2.2.0", 25 | "doctrine/common" : "~2.2", 26 | "sensio/generator-bundle" : ">= 2.3.3", 27 | "cedriclombardot/twig-generator" : "1.0.*", 28 | "knplabs/knp-menu-bundle" : ">1.0,<2.1", 29 | "white-october/pagerfanta-bundle" : "1.0.*@dev", 30 | "twig/twig" : ">= 1.9.0", 31 | "twig/extensions" : "~1.0", 32 | "robloach/component-installer" : ">= 0.0.11", 33 | "afarkas/html5shiv" : ">= 3.7.0", 34 | "components/jquery" : ">= 1.9.0, < 2.0.0", 35 | "components/jqueryui" : ">= 1.9.0", 36 | "components/bootstrap" : "~3.0", 37 | "components/font-awesome" : "~4.0" 38 | }, 39 | "require-dev" : { 40 | "doctrine/orm" : ">=2.2.3,<2.5-dev", 41 | "doctrine/dbal" : ">=2.2.3,<2.5-dev" 42 | }, 43 | "suggest" : { 44 | "avocode/form-extensions-bundle" : "Symfony2 form extensions for Admingenerator", 45 | "liuggio/excelbundle" : "(version >= 2.0) Allows the usage of the Excel export.", 46 | "cedriclombardot/admingenerator-user-bundle" : "FOSUserBundle integration for Admingenerator", 47 | "jms/security-extra-bundle" : "Allows expressions in credential checks for generated actions" 48 | }, 49 | "target-dir" : "Admingenerator/GeneratorBundle", 50 | "autoload" : { 51 | "psr-0" : { 52 | "Admingenerator\\GeneratorBundle" : "" 53 | } 54 | }, 55 | "extra" : { 56 | "branch-alias" : { 57 | "dev-master" : "1.2-dev" 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | ./Tests 18 | 19 | 20 | 21 | 22 | ./ 23 | 24 | ./Tests 25 | 26 | 27 | 28 | 29 | --------------------------------------------------------------------------------