├── .bowerrc ├── .gitattributes ├── .gitignore ├── .php_cs ├── .scrutinizer.yml ├── .travis.yml ├── Gruntfile.js ├── LICENSE ├── README.md ├── bower.json ├── bundle ├── Command │ ├── DataAnonymizerCommand.php │ └── DeleteOldCollectedInfoCommand.php ├── Controller │ ├── Admin │ │ ├── AdminController.php │ │ ├── Controller.php │ │ ├── Export │ │ │ └── Export.php │ │ └── TreeController.php │ └── CollectInformation.php ├── DataCollector │ └── InformationCollectionCollector.php ├── DependencyInjection │ ├── Configuration.php │ └── NetgenInformationCollectionExtension.php ├── EzPlatform │ ├── EzPlatformAdmin │ │ ├── EventListener │ │ │ └── SetPageLayoutListener.php │ │ └── MenuListener.php │ ├── PolicyProvider │ │ └── InformationCollectionPolicyProvider.php │ └── RepositoryForms │ │ ├── FieldDefinitionTypeExtension.php │ │ ├── InformationCollectionFieldType.php │ │ ├── InformationCollectionMapper.php │ │ └── InformationCollectionType.php ├── Form │ ├── CaptchaType.php │ └── ExportType.php ├── Listener │ ├── CaptchaValidationListener.php │ └── InformationCollectedListener.php ├── NetgenInformationCollectionBundle.php ├── ParamConverter │ └── CollectionParamConverter.php ├── Resources │ ├── config │ │ ├── controllers.yml │ │ ├── routing.yaml │ │ ├── services.yml │ │ └── validation.yml │ ├── es6 │ │ └── app.js │ ├── public │ │ └── admin │ │ │ ├── css │ │ │ ├── ezadmin_style.css │ │ │ └── style.css │ │ │ ├── fonts │ │ │ ├── MaterialIcons-Regular.eot │ │ │ ├── MaterialIcons-Regular.ijmap │ │ │ ├── MaterialIcons-Regular.svg │ │ │ ├── MaterialIcons-Regular.ttf │ │ │ ├── MaterialIcons-Regular.woff │ │ │ ├── MaterialIcons-Regular.woff2 │ │ │ └── Roboto │ │ │ │ ├── Roboto-300.eot │ │ │ │ ├── Roboto-300.svg │ │ │ │ ├── Roboto-300.ttf │ │ │ │ ├── Roboto-300.woff │ │ │ │ ├── Roboto-300.woff2 │ │ │ │ ├── Roboto-500.eot │ │ │ │ ├── Roboto-500.svg │ │ │ │ ├── Roboto-500.ttf │ │ │ │ ├── Roboto-500.woff │ │ │ │ ├── Roboto-500.woff2 │ │ │ │ ├── Roboto-700.eot │ │ │ │ ├── Roboto-700.svg │ │ │ │ ├── Roboto-700.ttf │ │ │ │ ├── Roboto-700.woff │ │ │ │ ├── Roboto-700.woff2 │ │ │ │ ├── Roboto-regular.eot │ │ │ │ ├── Roboto-regular.svg │ │ │ │ ├── Roboto-regular.ttf │ │ │ │ ├── Roboto-regular.woff │ │ │ │ └── Roboto-regular.woff2 │ │ │ ├── images │ │ │ ├── Document.png │ │ │ ├── additional │ │ │ │ ├── ic-icon-color.svg │ │ │ │ ├── ic-logo-color-white-text.svg │ │ │ │ ├── ic-logo-color.png │ │ │ │ ├── ic-logo-color.svg │ │ │ │ ├── ic-logo-dark.svg │ │ │ │ └── ic-logo-white.svg │ │ │ ├── favicon │ │ │ │ ├── apple-touch-icon-114-precomposed.png │ │ │ │ ├── apple-touch-icon-120-precomposed.png │ │ │ │ ├── apple-touch-icon-144-precomposed.png │ │ │ │ ├── apple-touch-icon-152-precomposed.png │ │ │ │ ├── apple-touch-icon-57-precomposed.png │ │ │ │ ├── apple-touch-icon-72-precomposed.png │ │ │ │ ├── apple-touch-icon-76-precomposed.png │ │ │ │ ├── favicon-16x16.png │ │ │ │ ├── favicon-32x32.png │ │ │ │ └── favicon.ico │ │ │ ├── ic-logo-full.svg │ │ │ ├── ic-logo-silhouette.svg │ │ │ ├── ic-logo-white.svg │ │ │ ├── ic-logo.svg │ │ │ ├── jqmodal │ │ │ │ ├── buttons.gif │ │ │ │ ├── corners.gif │ │ │ │ └── horizontal.gif │ │ │ └── loader.svg │ │ │ └── js │ │ │ ├── app.js │ │ │ └── field │ │ │ ├── jqmodal.js │ │ │ ├── jquery-ui.min.js │ │ │ ├── jquery.eztags.js │ │ │ ├── jquery.eztags.select.js │ │ │ └── jquery.eztags.tree.js │ ├── sass │ │ └── admin │ │ │ ├── _base.scss │ │ │ ├── _fonts.scss │ │ │ ├── _variables.scss │ │ │ └── style.scss │ ├── translations │ │ ├── content_type.en.yml │ │ ├── ezrepoforms_content_type.en.yml │ │ ├── forms.en.yml │ │ ├── netgen_information_collection_admin.en.yml │ │ ├── netgen_information_collection_fields.en.yml │ │ ├── netgen_information_collection_flash.en.yml │ │ └── netgen_information_collection_profiler.en.yml │ └── views │ │ ├── admin │ │ ├── collection_list.html.twig │ │ ├── content_fields.html.twig │ │ ├── export_menu.html.twig │ │ ├── flash_messages.html.twig │ │ ├── header.html.twig │ │ ├── javascripts.html.twig │ │ ├── main_menu.html.twig │ │ ├── overview.html.twig │ │ ├── pagelayout.html.twig │ │ ├── pagerfanta.html.twig │ │ ├── path.html.twig │ │ ├── stylesheets.html.twig │ │ ├── tree.html.twig │ │ └── view.html.twig │ │ ├── data_collector │ │ ├── ic-icon-color.svg.twig │ │ └── template.html.twig │ │ ├── email │ │ └── default.html.twig │ │ ├── ezadminui │ │ ├── pagelayout.html.twig │ │ └── stylesheets.html.twig │ │ ├── form │ │ └── form_fields.html.twig │ │ └── test.html.twig └── Templating │ └── Twig │ ├── AdminGlobalVariable.php │ └── Extensions │ ├── CaptchaExtension.php │ ├── CaptchaRuntime.php │ ├── FieldRenderingExtension.php │ └── FieldRenderingRuntime.php ├── codecov.yml ├── composer.json ├── doc ├── Makefile ├── _images │ └── ic-logo-color.svg ├── _static │ └── css │ │ └── style.css ├── conf.py ├── cookbook │ ├── adding_captcha_to_forms.rst │ ├── ajax.rst │ ├── custom_action.rst │ ├── custom_export_formatter.rst │ ├── custom_field_anonymizer.rst │ ├── custom_field_handler.rst │ ├── custom_value_view.rst │ ├── index.rst │ ├── map.rst.inc │ └── override_something_on_form.rst ├── getting_started │ ├── configuration.rst │ ├── content_curation.rst │ ├── index.rst │ ├── installation.rst │ └── map.rst.inc ├── index.rst ├── overview │ ├── features.rst │ ├── how_it_works.rst │ ├── index.rst │ ├── introduction.rst │ └── map.rst.inc ├── reference │ ├── commands.rst │ ├── configuration.rst │ ├── container_parameters.rst │ ├── container_tags.rst │ ├── events.rst │ ├── ez_policies.rst │ ├── index.rst │ ├── info_collector_actions.rst │ ├── map.rst.inc │ └── twig.rst ├── requirements.txt └── upgrades │ ├── changelog.rst │ ├── index.rst │ ├── map.rst.inc │ └── upgrade_to_v2.rst ├── lib ├── .gitkeep ├── API │ ├── Action │ │ ├── ActionInterface.php │ │ ├── CrucialActionInterface.php │ │ └── EmailDataProviderInterface.php │ ├── ConfigurationConstants.php │ ├── Constants.php │ ├── Events.php │ ├── Exception │ │ ├── ActionFailedException.php │ │ ├── EmailNotSentException.php │ │ ├── MissingAdditionalParameterException.php │ │ ├── MissingEmailBlockException.php │ │ ├── MissingValueException.php │ │ ├── PersistingFailedException.php │ │ ├── RemoveAttributeFailedException.php │ │ ├── RemoveCollectionFailedException.php │ │ ├── RetrieveCountException.php │ │ ├── StoringAttributeFailedException.php │ │ └── StoringCollectionFailedException.php │ ├── Export │ │ └── ExportResponseFormatter.php │ ├── Factory │ │ ├── EmailContentFactoryInterface.php │ │ └── FieldValueFactoryInterface.php │ ├── FieldHandler │ │ ├── CustomFieldHandlerInterface.php │ │ └── CustomLegacyFieldHandlerInterface.php │ ├── InformationCollectionTrait.php │ ├── MailerInterface.php │ ├── Permissions.php │ ├── Persistence │ │ └── Anonymizer │ │ │ ├── Anonymizer.php │ │ │ └── Visitor │ │ │ └── FieldAnonymizerVisitor.php │ ├── Service │ │ ├── CaptchaService.php │ │ ├── CaptchaValue.php │ │ ├── Exporter.php │ │ └── InformationCollection.php │ └── Value │ │ ├── Attribute.php │ │ ├── AttributeValue.php │ │ ├── Captcha │ │ ├── NullObject.php │ │ └── ReCaptcha.php │ │ ├── Collection.php │ │ ├── CollectionCount.php │ │ ├── Collections.php │ │ ├── Content.php │ │ ├── ContentsWithCollections.php │ │ ├── DataTransfer │ │ ├── AdditionalContent.php │ │ ├── EmailContent.php │ │ └── TemplateContent.php │ │ ├── Event │ │ └── InformationCollected.php │ │ ├── Export │ │ ├── Export.php │ │ └── ExportCriteria.php │ │ ├── Filter │ │ ├── CollectionFields.php │ │ ├── CollectionId.php │ │ ├── Collections.php │ │ ├── ContentId.php │ │ ├── Contents.php │ │ ├── FilterCriteria.php │ │ ├── Query.php │ │ ├── SearchCountQuery.php │ │ └── SearchQuery.php │ │ ├── InformationCollectionStruct.php │ │ ├── Legacy │ │ └── FieldValue.php │ │ ├── NullUser.php │ │ ├── ObjectCount.php │ │ ├── SearchCount.php │ │ └── ValueObject.php ├── Core │ ├── Action │ │ ├── ActionRegistry.php │ │ ├── AutoResponderAction.php │ │ ├── BaseEmailAction.php │ │ ├── ConfigurationUtility.php │ │ ├── DatabaseAction.php │ │ ├── EmailAction.php │ │ └── Identifier.php │ ├── EmailDataProvider │ │ ├── AbstractProvider.php │ │ ├── AutoResponderProvider.php │ │ └── DefaultProvider.php │ ├── Export │ │ ├── CsvExportResponseFormatter.php │ │ ├── ExportResponseFormatterRegistry.php │ │ ├── JsonExportResponseFormatter.php │ │ ├── XlsExportResponseFormatter.php │ │ └── XlsxExportResponseFormatter.php │ ├── Factory │ │ ├── AutoResponderDataFactory.php │ │ ├── EmailDataFactory.php │ │ └── FieldDataFactory.php │ ├── Mailer │ │ ├── SwiftMailerBasedMailer.php │ │ └── SymfonyMailerBasedMailer.php │ ├── Mapper │ │ └── DomainObjectMapper.php │ ├── Pagination │ │ ├── BaseAdapter.php │ │ ├── InformationCollectionCollectionListAdapter.php │ │ ├── InformationCollectionCollectionListSearchAdapter.php │ │ ├── InformationCollectionContentsAdapter.php │ │ └── Pagerfanta │ │ │ └── View │ │ │ └── InformationCollectionAdminView.php │ ├── Persistence │ │ ├── Anonymizer │ │ │ ├── AnonymizerService.php │ │ │ ├── AnonymizerServiceFacade.php │ │ │ └── Visitor │ │ │ │ └── Field │ │ │ │ ├── Aggregate.php │ │ │ │ ├── Email.php │ │ │ │ └── Simple.php │ │ ├── ContentTypeUtils.php │ │ ├── FieldHandler │ │ │ ├── Custom │ │ │ │ ├── CheckboxFieldHandler.php │ │ │ │ ├── CountryFieldHandler.php │ │ │ │ ├── DateAndTimeFieldHandler.php │ │ │ │ ├── DateFieldHandler.php │ │ │ │ ├── FloatFieldHandler.php │ │ │ │ ├── IntegerFieldHandler.php │ │ │ │ └── TimeFieldHandler.php │ │ │ └── FieldHandlerRegistry.php │ │ └── Gateway │ │ │ └── DoctrineDatabase.php │ └── Service │ │ ├── CaptchaService.php │ │ ├── ExporterService.php │ │ └── InformationCollectionService.php ├── Doctrine │ ├── Entity │ │ ├── EzInfoCollection.php │ │ └── EzInfoCollectionAttribute.php │ ├── Repository │ │ ├── EzInfoCollectionAttributeRepository.php │ │ └── EzInfoCollectionRepository.php │ └── mappings │ │ ├── EzInfoCollection.orm.xml │ │ └── EzInfoCollectionAttribute.orm.xml ├── Handler.php └── Resources │ └── config │ ├── actions.yml │ ├── admin.yml │ ├── anonymizers.yml │ ├── core │ ├── persistence.yml │ └── services.yml │ ├── default_settings.yml │ ├── ezplatform_admin.yml │ ├── factories.yml │ ├── legacy_handlers.yml │ ├── parameters.yml │ ├── services.yml │ └── twig.yml ├── package.json ├── phpstan.neon ├── phpunit.xml ├── tests ├── bundle │ └── .gitkeep ├── lib │ ├── .gitkeep │ └── FakeTest.php └── old │ ├── API │ └── Value │ │ └── InformationCollection │ │ └── QueryTest.php │ ├── Action │ ├── ActionRegistryTest.php │ ├── AutoResponderActionTest.php │ ├── DatabaseActionTest.php │ └── EmailActionTest.php │ ├── ContentViewStub.php │ ├── Controller │ └── InformationCollectionControllerTest.php │ ├── DependencyInjection │ ├── Compiler │ │ ├── ActionsPassTest.php │ │ ├── CustomFieldHandlersPassTest.php │ │ └── FieldAnonymizerVisitorPassTest.php │ ├── ConfigurationTest.php │ └── NetgenInformationCollectionExtensionTest.php │ ├── Entity │ ├── EzInfoCollectionAttributeTest.php │ └── EzInfoCollectionTest.php │ ├── Event │ └── InformationCollectedTest.php │ ├── Exception │ ├── ActionFailedExceptionTest.php │ ├── EmailNotSentExceptionTest.php │ ├── MissingEmailBlockExceptionTest.php │ └── MissingValueExceptionTest.php │ ├── Factory │ ├── AutoResponderDataFactoryTest.php │ ├── EmailDataFactoryTest.php │ └── FieldDataFactoryTest.php │ ├── FieldHandler │ ├── Custom │ │ ├── CheckboxFieldHandlerTest.php │ │ ├── DateAndTimeFieldHandlerTest.php │ │ ├── DateFieldHandlerTest.php │ │ ├── FloatFieldHandlerTest.php │ │ ├── IntegerFieldHandlerTest.php │ │ └── TimeFieldHandlerTest.php │ └── FieldHandlerRegistryTest.php │ ├── Form │ └── Builder │ │ └── FormBuilderTest.php │ ├── Listener │ └── InformationCollectedListenerTest.php │ ├── Mailer │ ├── MailerTest.php │ └── attachment.txt │ ├── Templating │ └── Twig │ │ └── AdminGlobalVariableTest.php │ └── Value │ ├── EmailDataTest.php │ ├── LegacyDataTest.php │ └── TemplateDataTest.php ├── travis.php.ini └── yarn.lock /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bundle/Resources/public/vendor" 3 | } 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.php diff=php 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | coverage/ 3 | vendor/ 4 | var/ 5 | .tmp/ 6 | node_modules/ 7 | composer.phar 8 | composer.lock 9 | coverage.xml 10 | phpunit.phar 11 | .php_cs.cache 12 | grunt.lock 13 | package-lock.json 14 | .phpunit.result.cache 15 | doc/_build 16 | -------------------------------------------------------------------------------- /.php_cs: -------------------------------------------------------------------------------- 1 | setRiskyAllowed(true) 5 | ->setRules([ 6 | '@PhpCsFixer' => true, 7 | '@PhpCsFixer:risky' => true, 8 | 9 | // Overrides for rules included in PhpCsFixer rule sets 10 | 'concat_space' => ['spacing' => 'one'], 11 | 'method_chaining_indentation' => false, 12 | 'multiline_whitespace_before_semicolons' => false, 13 | 'native_function_invocation' => false, 14 | 'php_unit_internal_class' => false, 15 | 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], 16 | 'php_unit_test_class_requires_covers' => false, 17 | 'phpdoc_align' => false, 18 | 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], 19 | 'single_line_comment_style' => false, 20 | 'visibility_required' => ['elements' => ['property', 'method', 'const']], 21 | 'yoda_style' => false, 22 | 23 | // Additional rules 24 | 'date_time_immutable' => true, 25 | 'declare_strict_types' => true, 26 | 'list_syntax' => ['syntax' => 'short'], 27 | 'mb_str_functions' => true, 28 | 'static_lambda' => true, 29 | 'ternary_to_null_coalescing' => true, 30 | ]) 31 | ->setFinder( 32 | PhpCsFixer\Finder::create() 33 | ->exclude(['vendor', 'node_modules', 'doc', 'bundle', 'tests']) 34 | ->in(__DIR__) 35 | ) 36 | ; 37 | -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | filter: 2 | excluded_paths: [tests/*] 3 | 4 | checks: 5 | php: 6 | remove_extra_empty_lines: true 7 | remove_php_closing_tag: true 8 | remove_trailing_whitespace: true 9 | fix_use_statements: 10 | remove_unused: true 11 | preserve_multiple: false 12 | preserve_blanklines: true 13 | order_alphabetically: true 14 | fix_php_opening_tag: true 15 | fix_linefeed: true 16 | fix_line_ending: true 17 | fix_identation_4spaces: true 18 | fix_doc_comments: true 19 | 20 | tools: 21 | external_code_coverage: 22 | timeout: 600 23 | runs: 3 24 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | # directories to cache 4 | cache: 5 | directories: 6 | - vendor 7 | - $HOME/.composer/cache 8 | 9 | matrix: 10 | # mark as finished before allow_failures are run 11 | fast_finish: true 12 | include: 13 | - php: 7.2 14 | - php: 7.3 15 | 16 | # test only master (+ pull requests) 17 | branches: 18 | only: 19 | - master 20 | 21 | # make sure to update composer to latest available version 22 | before_install: 23 | - phpenv config-add travis.php.ini 24 | 25 | # install dependencies 26 | install: 27 | - travis_wait composer install 28 | 29 | # execute phpunit as the script command 30 | script: 31 | - ./vendor/bin/phpunit -d memory_limit=-1 --colors -c phpunit.xml --coverage-clover=coverage.xml 32 | 33 | # disable mail notifications 34 | notification: 35 | email: false 36 | 37 | # reduce depth (history) of git checkout 38 | git: 39 | depth: 30 40 | 41 | # we don't need sudo 42 | sudo: false 43 | 44 | # enable scrutinizer 45 | after_script: 46 | - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover 47 | 48 | # send coverage to codecov.io 49 | after_success: 50 | - bash <(curl -s https://codecov.io/bash) 51 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "netgen-information-collection", 3 | "homepage": "http://www.netgenlabs.com", 4 | "authors": [ 5 | "Netgen " 6 | ], 7 | "dependencies": { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /bundle/Controller/Admin/Controller.php: -------------------------------------------------------------------------------- 1 | collectInformation($view, []); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bundle/EzPlatform/EzPlatformAdmin/EventListener/SetPageLayoutListener.php: -------------------------------------------------------------------------------- 1 | globalVariable = $adminGlobalVariable; 36 | $this->pageLayoutTemplate = $pageLayoutTemplate; 37 | $this->groupsBySiteAccess = $groupsBySiteAccess; 38 | } 39 | 40 | public static function getSubscribedEvents() 41 | { 42 | return [ 43 | KernelEvents::REQUEST => 'onKernelRequest', 44 | ]; 45 | } 46 | 47 | public function onKernelRequest(RequestEvent $event) 48 | { 49 | if (!$event->isMasterRequest()) { 50 | return; 51 | } 52 | 53 | $siteAccess = $event->getRequest()->attributes->get('siteaccess')->name; 54 | if (!isset($this->groupsBySiteAccess[$siteAccess])) { 55 | return; 56 | } 57 | 58 | if (!in_array(EzPlatformAdminUiBundle::ADMIN_GROUP_NAME, $this->groupsBySiteAccess[$siteAccess], true)) { 59 | return; 60 | } 61 | 62 | $this->globalVariable->setPageLayoutTemplate($this->pageLayoutTemplate); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /bundle/EzPlatform/EzPlatformAdmin/MenuListener.php: -------------------------------------------------------------------------------- 1 | ['onMenuConfigure', 0], 17 | ]; 18 | } 19 | 20 | public function onMenuConfigure(ConfigureMenuEvent $event) 21 | { 22 | $menu = $event->getMenu(); 23 | 24 | if (!isset($menu[MainMenuBuilder::ITEM_ADMIN])) { 25 | return; 26 | } 27 | 28 | $menu[MainMenuBuilder::ITEM_ADMIN]->addChild( 29 | 'information_collection', 30 | [ 31 | 'label' => 'Information collection', 32 | 'route' => 'netgen_information_collection.route.admin.overview', 33 | 'extras' => [ 34 | 'routes' => [ 35 | 'collection_list' => 'netgen_information_collection.route.admin.collection_list', 36 | 'collection_list_search' => 'netgen_information_collection.route.admin.collection_list_search', 37 | 'view' => 'netgen_information_collection.route.admin.view', 38 | 'handle_contents' => 'netgen_information_collection.route.admin.handle_contents', 39 | 'handle_collection_list' => 'netgen_information_collection.route.admin.handle_collection_list', 40 | 'handle_collection' => 'netgen_information_collection.route.admin.handle_collection', 41 | 'tree' => 'netgen_information_collection.route.admin.tree_get_children', 42 | 'export' => 'netgen_information_collection.route.admin.export', 43 | ], 44 | ], 45 | ] 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /bundle/EzPlatform/PolicyProvider/InformationCollectionPolicyProvider.php: -------------------------------------------------------------------------------- 1 | addConfig([ 21 | Permissions::NAME => [ 22 | Permissions::POLICY_READ => [], 23 | Permissions::POLICY_DELETE => [], 24 | Permissions::POLICY_ANONYMIZE => [], 25 | Permissions::POLICY_EXPORT => [], 26 | ], 27 | ]); 28 | 29 | return []; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /bundle/EzPlatform/RepositoryForms/FieldDefinitionTypeExtension.php: -------------------------------------------------------------------------------- 1 | add('isInfoCollector', CheckboxType::class, [ 29 | 'required' => false, 30 | 'label' => 'field_definition.is_infocollector', 31 | 'disabled' => $isTranslation, 32 | ]); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bundle/EzPlatform/RepositoryForms/InformationCollectionMapper.php: -------------------------------------------------------------------------------- 1 | getFieldsByLanguage($content->contentInfo->mainLanguageCode); 30 | 31 | $informationCollectionFields = []; 32 | 33 | /** @var FieldDefinition $fieldDef */ 34 | foreach ($contentType->fieldDefinitions as $fieldDef) { 35 | if ($fieldDef->isInfoCollector) { 36 | $field = $fields[$fieldDef->identifier]; 37 | 38 | $fieldData = new FieldData( 39 | [ 40 | 'fieldDefinition' => $fieldDef, 41 | 'field' => $field, 42 | ] 43 | ); 44 | 45 | $informationCollectionFields[] = $fieldData; 46 | } 47 | } 48 | 49 | return new InformationCollectionStruct( 50 | $content, 51 | $location, 52 | $contentType, 53 | $informationCollectionFields 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /bundle/Form/CaptchaType.php: -------------------------------------------------------------------------------- 1 | validationListener = $validationListener; 22 | } 23 | 24 | public function buildView(FormView $view, FormInterface $form, array $options) 25 | { 26 | $view->vars['type'] = $options['type']; 27 | $view->vars['theme'] = $options['theme']; 28 | $view->vars['size'] = $options['size']; 29 | $view->vars['site_key'] = $options['site_key']; 30 | $view->vars['captcha_action'] = $options['captcha_action']; 31 | } 32 | 33 | public function buildForm(FormBuilderInterface $builder, array $options) 34 | { 35 | $builder->addEventSubscriber($this->validationListener); 36 | } 37 | 38 | public function configureOptions(OptionsResolver $resolver) 39 | { 40 | $resolver->setDefaults( 41 | [ 42 | 'type' => 'checkbox', 43 | 'theme' => 'light', 44 | 'size' => 'normal', 45 | 'captcha_action' => null, 46 | 'site_key' => null, 47 | 'captcha_value' => null, 48 | ] 49 | ); 50 | $resolver 51 | // ->setAllowedTypes('captcha_value', CaptchaValue::class) 52 | ->setDefault('type', 'invisible') 53 | ->setAllowedValues('type', ['checkbox', 'invisible']) 54 | ->setAllowedValues('theme', ['light', 'dark']) 55 | ->setAllowedValues('size', ['compact', 'normal']) 56 | ->setRequired(['captcha_value', 'site_key', 'theme', 'type', 'size']); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /bundle/Listener/CaptchaValidationListener.php: -------------------------------------------------------------------------------- 1 | requestStack = $requestStack; 36 | $this->captchaService = $captchaService; 37 | $this->translator = $translator; 38 | } 39 | 40 | public static function getSubscribedEvents() 41 | { 42 | return [ 43 | FormEvents::POST_SUBMIT => 'onPostSubmit', 44 | ]; 45 | } 46 | 47 | public function onPostSubmit(FormEvent $event) 48 | { 49 | $captchaValue = $event->getForm() 50 | ->getConfig() 51 | ->getOption('captcha_value'); 52 | 53 | // $request = $this->requestStack->getCurrentRequest(); 54 | $request = Request::createFromGlobals(); 55 | 56 | $text = 'The captcha is invalid. Please try again.'; 57 | 58 | if (!$captchaValue->isValid($request)) { 59 | $error = new FormError( 60 | $this->translator->trans('netgen_information_collection.captcha') 61 | ); 62 | 63 | $event->getForm()->addError($error); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /bundle/Listener/InformationCollectedListener.php: -------------------------------------------------------------------------------- 1 | actionAggregate = $actionAggregate; 27 | } 28 | 29 | /** 30 | * {@inheritdoc} 31 | */ 32 | public static function getSubscribedEvents(): array 33 | { 34 | return [ 35 | Events::INFORMATION_COLLECTED => 'onInformationCollected', 36 | ]; 37 | } 38 | 39 | /** 40 | * Run all actions. 41 | * 42 | * @param InformationCollected $event 43 | */ 44 | public function onInformationCollected(InformationCollected $event): void 45 | { 46 | $this->actionAggregate->act($event); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /bundle/NetgenInformationCollectionBundle.php: -------------------------------------------------------------------------------- 1 | getExtension('ezpublish'); 20 | if ($eZExtension instanceof EzPublishCoreExtension) { 21 | $eZExtension->addPolicyProvider(new InformationCollectionPolicyProvider()); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /bundle/ParamConverter/CollectionParamConverter.php: -------------------------------------------------------------------------------- 1 | informationCollection = $informationCollection; 23 | } 24 | 25 | /** 26 | * Stores the object in the request. 27 | * 28 | * @param ParamConverter $configuration Contains the name, class and options of the object 29 | * 30 | * @return bool True if the object has been successfully set, else false 31 | */ 32 | public function apply(Request $request, ParamConverter $configuration) 33 | { 34 | if (!$request->attributes->has('collectionId')) { 35 | return false; 36 | } 37 | 38 | $collectionId = $request->attributes->get('collectionId'); 39 | if (!$collectionId && $configuration->isOptional()) { 40 | return false; 41 | } 42 | 43 | $request->attributes->set( 44 | $configuration->getName(), $this->informationCollection->getCollection(new CollectionId($collectionId)) 45 | ); 46 | 47 | return true; 48 | } 49 | 50 | /** 51 | * Checks if the object is supported. 52 | * 53 | * @return bool True if the object is supported, else false 54 | */ 55 | public function supports(ParamConverter $configuration) 56 | { 57 | return is_a($configuration->getClass(), Collection::class, true); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /bundle/Resources/config/controllers.yml: -------------------------------------------------------------------------------- 1 | services: 2 | netgen_information_collection.controller.collect_information: 3 | class: Netgen\Bundle\InformationCollectionBundle\Controller\CollectInformation 4 | public: true 5 | tags: 6 | - { name: controller.service_arguments } 7 | calls: 8 | - [setContainer, ['@service_container']] 9 | 10 | netgen_information_collection.controller.admin: 11 | class: Netgen\Bundle\InformationCollectionBundle\Controller\Admin\AdminController 12 | parent: ezpublish.controller.base 13 | public: true 14 | arguments: 15 | - "@netgen_information_collection.api.service" 16 | - "@netgen_information_collection.anonymizer.service" 17 | - "@ezpublish.api.service.content" 18 | - "@ezpublish.config.resolver" 19 | - "@translator" 20 | 21 | netgen_information_collection.controller.export.export: 22 | class: Netgen\Bundle\InformationCollectionBundle\Controller\Admin\Export\Export 23 | public: true 24 | arguments: 25 | - "@ezpublish.api.service.content" 26 | - "@netgen_information_collection.service.exporter" 27 | - "@netgen_information_collection.core.export.registry" 28 | tags: 29 | - { name: controller.service_arguments } 30 | calls: 31 | - [setContainer, ["@service_container"]] 32 | 33 | netgen_information_collection.controller.tree: 34 | class: Netgen\Bundle\InformationCollectionBundle\Controller\Admin\TreeController 35 | parent: ezpublish.controller.base 36 | public: true 37 | arguments: 38 | - "@netgen_information_collection.api.service" 39 | - "@translator" 40 | - "@router" 41 | -------------------------------------------------------------------------------- /bundle/Resources/config/services.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: controllers.yml } 3 | 4 | services: 5 | netgen_information_collection.command.anonymize: 6 | class: Netgen\Bundle\InformationCollectionBundle\Command\DataAnonymizerCommand 7 | arguments: 8 | - '@netgen_information_collection.anonymizer_facade.service' 9 | tags: 10 | - { name: console.command } 11 | 12 | netgen_information_collection.command.delete: 13 | class: Netgen\Bundle\InformationCollectionBundle\Command\DeleteOldCollectedInfoCommand 14 | arguments: 15 | - '@netgen_information_collection.api.service' 16 | tags: 17 | - { name: console.command } 18 | 19 | 20 | netgen_information_collection.param_converter.collection: 21 | class: Netgen\Bundle\InformationCollectionBundle\ParamConverter\CollectionParamConverter 22 | arguments: 23 | - '@netgen_information_collection.api.service' 24 | tags: 25 | - { name: request.param_converter } 26 | 27 | netgen_information_collection.collector: 28 | class: Netgen\Bundle\InformationCollectionBundle\DataCollector\InformationCollectionCollector 29 | public: false 30 | arguments: 31 | - '@ezpublish.api.repository' 32 | - '@ezpublish.translation_helper' 33 | tags: 34 | - { name: data_collector, template: '@NetgenInformationCollection/data_collector/template.html.twig', id: 'netgen_information_collection_collector' } 35 | 36 | 37 | netgen_information_collection.listener.captcha_validation: 38 | class: Netgen\Bundle\InformationCollectionBundle\Listener\CaptchaValidationListener 39 | arguments: 40 | - '@request_stack' 41 | - '@netgen_information_collection.captcha.service' 42 | - '@translator' 43 | -------------------------------------------------------------------------------- /bundle/Resources/config/validation.yml: -------------------------------------------------------------------------------- 1 | Netgen\InformationCollection\Integration\RepositoryForms\InformationCollectionData: 2 | properties: 3 | fieldsData: 4 | - Valid: ~ 5 | -------------------------------------------------------------------------------- /bundle/Resources/es6/app.js: -------------------------------------------------------------------------------- 1 | import { NgUiInit } from '@netgen/admin-ui'; 2 | 3 | window.addEventListener('load', () => { 4 | NgUiInit(); 5 | }); 6 | -------------------------------------------------------------------------------- /bundle/Resources/public/admin/css/ezadmin_style.css: -------------------------------------------------------------------------------- 1 | .ic-app { 2 | min-height: calc(100vh - 99px); 3 | } 4 | 5 | .ic-app .ng-ui-container { 6 | max-width: none; 7 | } 8 | -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/MaterialIcons-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/MaterialIcons-Regular.eot -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/MaterialIcons-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/MaterialIcons-Regular.ttf -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/MaterialIcons-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/MaterialIcons-Regular.woff -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/MaterialIcons-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/MaterialIcons-Regular.woff2 -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-300.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-300.eot -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-300.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-300.ttf -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-300.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-300.woff -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-300.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-300.woff2 -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-500.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-500.eot -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-500.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-500.ttf -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-500.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-500.woff -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-500.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-500.woff2 -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-700.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-700.eot -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-700.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-700.ttf -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-700.woff -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-700.woff2 -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-regular.eot -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-regular.ttf -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-regular.woff -------------------------------------------------------------------------------- /bundle/Resources/public/admin/fonts/Roboto/Roboto-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/fonts/Roboto/Roboto-regular.woff2 -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/Document.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/Document.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/additional/ic-icon-color.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/additional/ic-logo-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/additional/ic-logo-color.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/apple-touch-icon-114-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/apple-touch-icon-114-precomposed.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/apple-touch-icon-120-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/apple-touch-icon-120-precomposed.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/apple-touch-icon-144-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/apple-touch-icon-144-precomposed.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/apple-touch-icon-152-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/apple-touch-icon-152-precomposed.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/apple-touch-icon-57-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/apple-touch-icon-57-precomposed.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/apple-touch-icon-72-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/apple-touch-icon-72-precomposed.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/apple-touch-icon-76-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/apple-touch-icon-76-precomposed.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/favicon/favicon.ico -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/ic-logo-silhouette.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 17 | 18 | -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/ic-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/jqmodal/buttons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/jqmodal/buttons.gif -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/jqmodal/corners.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/jqmodal/corners.gif -------------------------------------------------------------------------------- /bundle/Resources/public/admin/images/jqmodal/horizontal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/bundle/Resources/public/admin/images/jqmodal/horizontal.gif -------------------------------------------------------------------------------- /bundle/Resources/sass/admin/_base.scss: -------------------------------------------------------------------------------- 1 | #{$namespace} { 2 | .list-object-divider { 3 | border-bottom: 1px solid rgba(0, 0, 0, .1); 4 | margin: 0 0 20px; 5 | } 6 | input[type='checkbox'] + label, 7 | input[type='radio'] + label { 8 | font-weight: normal; 9 | .attribute-name { 10 | font-weight: bold; 11 | } 12 | } 13 | .ic-content { 14 | padding-left: 15px; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /bundle/Resources/sass/admin/_variables.scss: -------------------------------------------------------------------------------- 1 | $namespace: '.ic-app'; 2 | $baseFont: 'Roboto', Helvetica, Arial, sans-serif; 3 | $mainLogoPath: '../images/ic-logo-white.svg'; 4 | -------------------------------------------------------------------------------- /bundle/Resources/sass/admin/style.scss: -------------------------------------------------------------------------------- 1 | @charset 'UTF-8'; 2 | //IMPORTANT: only add imports to this file 3 | 4 | @import 'variables'; 5 | @import '@netgen/admin-ui/scss/style'; 6 | @import 'fonts'; 7 | @import 'base'; 8 | -------------------------------------------------------------------------------- /bundle/Resources/translations/content_type.en.yml: -------------------------------------------------------------------------------- 1 | field_definition.is_infocollector: 'Collects information' 2 | -------------------------------------------------------------------------------- /bundle/Resources/translations/ezrepoforms_content_type.en.yml: -------------------------------------------------------------------------------- 1 | field_definition.is_infocollector: 'Collects information' 2 | 3 | 4 | -------------------------------------------------------------------------------- /bundle/Resources/translations/forms.en.yml: -------------------------------------------------------------------------------- 1 | role.policy.infocollector: "Information collection" 2 | role.policy.infocollector.all_functions: "Information collection / All functions" 3 | role.policy.infocollector.read: "Information collection / Read" 4 | role.policy.infocollector.delete: "Information collection / Delete" 5 | role.policy.infocollector.anonymize: "Information collection / Anonymize" 6 | role.policy.infocollector.export: "Information collection / Export" 7 | 8 | 9 | -------------------------------------------------------------------------------- /bundle/Resources/translations/netgen_information_collection_fields.en.yml: -------------------------------------------------------------------------------- 1 | field_value.yes: 'Yes' 2 | field_value.no: 'No' 3 | -------------------------------------------------------------------------------- /bundle/Resources/translations/netgen_information_collection_flash.en.yml: -------------------------------------------------------------------------------- 1 | success.field_removed: "Field removed successfully|Fields removed successfully" 2 | success.field_anonymized: "Field anonymized successfully|Fields anonymized successfully" 3 | success.collection_removed: "Collection removed successfully|Collections removed successfully" 4 | success.content_removed: "Content removed successfully|Contents removed successfully" 5 | success.collection_anonymized: "Collection anonymized successfully|Collections anonymized successfully" 6 | 7 | 8 | errors.fields_not_selected_remove: "Please select fields to remove" 9 | errors.collections_not_selected: "Please select collections" 10 | errors.contents_not_selected: "Please select contents" 11 | errors.fields_not_selected_anonymize: "Please select fields to anonymize" 12 | errors.fields_not_selected: "Please select fields" 13 | errors.something_went_wrong: "Something went wrong" 14 | -------------------------------------------------------------------------------- /bundle/Resources/translations/netgen_information_collection_profiler.en.yml: -------------------------------------------------------------------------------- 1 | netgen_information_collection_profiler_items: 'fields' 2 | -------------------------------------------------------------------------------- /bundle/Resources/views/admin/content_fields.html.twig: -------------------------------------------------------------------------------- 1 | {% trans_default_domain "netgen_information_collection_fields" %} 2 | 3 | {% block ezstring_field %} 4 | {% apply spaceless %} 5 | {% set field_value = attribute.value %} 6 | {{ field_value.dataText }} 7 | {% endapply %} 8 | {% endblock %} 9 | 10 | {% block ezboolean_field %} 11 | {% apply spaceless %} 12 | {% set field_value = attribute.value %} 13 | {% if field_value.dataInt == 1 %} 14 | {{ 'field_value.yes'|trans }} 15 | {% else %} 16 | {{ 'field_value.no'|trans }} 17 | {% endif %} 18 | {% endapply %} 19 | {% endblock %} 20 | 21 | {% block default_field %} 22 | {% apply spaceless %} 23 | {{ attribute.value }} 24 | {% endapply %} 25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /bundle/Resources/views/admin/flash_messages.html.twig: -------------------------------------------------------------------------------- 1 | {% for message in app.session.flashBag.get('netgen_information_collection.success') %} 2 |
3 | {{ message }} 4 |
5 | {% endfor %} 6 | 7 | {% for message in app.session.flashBag.get('netgen_information_collection.errors') %} 8 |
9 | {{ message }} 10 |
11 | {% endfor %} 12 | -------------------------------------------------------------------------------- /bundle/Resources/views/admin/header.html.twig: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 | -------------------------------------------------------------------------------- /bundle/Resources/views/admin/javascripts.html.twig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /bundle/Resources/views/admin/main_menu.html.twig: -------------------------------------------------------------------------------- 1 | 2 |
3 | {% include '@NetgenInformationCollection/admin/tree.html.twig' %} 4 |
5 | -------------------------------------------------------------------------------- /bundle/Resources/views/admin/pagelayout.html.twig: -------------------------------------------------------------------------------- 1 | {% trans_default_domain 'netgen_information_collection_admin' %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {##} 11 | 12 | 13 | 14 | 15 | 16 | 17 | {% block title %} 18 | {{ 'pagelayout.title'|trans }} 19 | {% endblock %} 20 | 21 | 22 | {% block stylesheets %} 23 | {% include '@NetgenInformationCollection/admin/stylesheets.html.twig' %} 24 | {% endblock %} 25 | 26 | {% block javascripts %} 27 | {% include '@NetgenInformationCollection/admin/javascripts.html.twig' %} 28 | {% endblock %} 29 | 30 | 31 |
32 | {% include '@NetgenInformationCollection/admin/header.html.twig' %} 33 | 34 |
35 |
36 | 39 |
40 | 41 |
42 |
43 | {% include '@NetgenInformationCollection/admin/path.html.twig' %} 44 |
45 | 46 | {% block content %}{% endblock %} 47 |
48 |
49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /bundle/Resources/views/admin/path.html.twig: -------------------------------------------------------------------------------- 1 | {% trans_default_domain 'netgen_information_collection_admin' %} 2 | 3 |

4 | {{ 'netgen_information_collection_admin_you_are_here'|trans }}: 5 | 6 | {% if app.request.get('contentId') %} 7 | {{ 'netgen_information_collection_admin_path_collected_information'|trans }} 8 | / 9 | {{ ez_content_name(content) }} 10 | {% elseif app.request.get('collectionId') %} 11 | {{ 'netgen_information_collection_admin_path_collected_information'|trans }} 12 | / 13 | {{ ez_content_name(content) }} 14 | / 15 | {{ collection.id }} 16 | {% else %} 17 | {{ 'netgen_information_collection_admin_path_collected_information'|trans }} 18 | {% endif %} 19 |

20 | -------------------------------------------------------------------------------- /bundle/Resources/views/admin/stylesheets.html.twig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /bundle/Resources/views/admin/tree.html.twig: -------------------------------------------------------------------------------- 1 | {% trans_default_domain 'netgen_information_collection_admin' %} 2 | 3 | {% set rootItemId = rootItemId|default(0) %} 4 | {% set showRootItem = showRootItem|default(true) %} 5 | {% set selectedItem = selectedItem|default(null) %} 6 | {% set disableSubtree = disableSubtree|default([]) %} 7 | {% if app.request.attributes.has('contentId') %} 8 | {% set pathString = '/0/' ~ app.request.attributes.get('contentId') %} 9 | {% elseif app.request.query.has('contentId') %} 10 | {% set pathString = '/0/' ~ app.request.query.get('contentId') %} 11 | {% endif %} 12 | 13 | {% block item_tree %} 14 |
22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /bundle/Resources/views/data_collector/ic-icon-color.svg.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /bundle/Resources/views/email/default.html.twig: -------------------------------------------------------------------------------- 1 | {# event \Netgen\Bundle\InformationCollectionBundle\Event\InformationCollected #} 2 | {# content \eZ\Publish\API\Repository\Values\Content\Content #} 3 | 4 | {% block email %} 5 | 6 | {% set content_type = event.contentType %} 7 | 8 | {% for field_name, field_value in collected_fields %} 9 | {% if content.fields[field_name] is defined and content.fields[field_name] is not empty %} 10 |
11 |
12 | {{ ez_field_name(content, field_name) }}: 13 |
14 |
15 | {% if content_type.fieldDefinitionsByIdentifier[field_name].fieldTypeIdentifier == 'ezselection' %} 16 | {% set selectionArray=field_value|split('-') %} 17 | {% if selectionArray|length > 1 %}
    {% endif %} 18 | {% for selected_key, selected_value in selectionArray %} 19 | {% if loop.length == 1 %} 20 | {{ content_type.fieldDefinitionsByIdentifier[field_name].fieldSettings.options[selected_value] }}
    21 | {% else %} 22 |
  • {{ content_type.fieldDefinitionsByIdentifier[field_name].fieldSettings.options[selected_value] }}

  • 23 | {% endif %} 24 | {% endfor %} 25 | {% if selectionArray|length > 1 %}
{% endif %} 26 | {% else %} 27 | {{ field_value }} 28 | {% endif %} 29 |

30 |
31 | {% endif %} 32 | {% endfor %} 33 | 34 | {% endblock %} 35 | -------------------------------------------------------------------------------- /bundle/Resources/views/ezadminui/pagelayout.html.twig: -------------------------------------------------------------------------------- 1 | {% set rendered_content = block('content') %} 2 | 3 | {# 4 | We embed the main layout.html.twig instead of extending it 5 | to be able to inject additional markup before and after its 6 | content block. 7 | #} 8 | {% embed ['@EzPlatformAdminUi/layout.html.twig', '@ezdesign/ui/layout.html.twig'] %} 9 | {% trans_default_domain 'netgen_information_collection_admin' %} 10 | 11 | {% block title %}{{ 'pagelayout.title'|trans }}{% endblock %} 12 | 13 | {% block pageTitle %}{% endblock %} 14 | 15 | {% block stylesheets %} 16 | {{ parent() }} 17 | 18 | {% include '@NetgenInformationCollection/admin/stylesheets.html.twig' %} 19 | {% include '@NetgenInformationCollection/ezadminui/stylesheets.html.twig' %} 20 | {% endblock %} 21 | 22 | {% block javascripts %} 23 | {{ parent() }} 24 | 25 | {% include '@NetgenInformationCollection/admin/javascripts.html.twig' %} 26 | {% endblock %} 27 | 28 | {% block content %} 29 |
30 | {% include '@NetgenInformationCollection/admin/header.html.twig' %} 31 | 32 |
33 |
34 | 37 |
38 | 39 |
40 |
41 | {% include '@NetgenInformationCollection/admin/path.html.twig' %} 42 |
43 | 44 | {{ rendered_content|raw }} 45 |
46 |
47 |
48 | {% endblock %} 49 | {% endembed %} 50 | -------------------------------------------------------------------------------- /bundle/Resources/views/ezadminui/stylesheets.html.twig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bundle/Resources/views/test.html.twig: -------------------------------------------------------------------------------- 1 | {{ form(form) }} -------------------------------------------------------------------------------- /bundle/Templating/Twig/AdminGlobalVariable.php: -------------------------------------------------------------------------------- 1 | configResolver = $configResolver; 24 | } 25 | 26 | public function setPageLayoutTemplate(string $pageLayoutTemplate): void 27 | { 28 | $this->pageLayoutTemplate = $pageLayoutTemplate; 29 | } 30 | 31 | /** 32 | * Returns the pagelayout template. 33 | * 34 | * @return string|null 35 | */ 36 | public function getPageLayoutTemplate(): ?string 37 | { 38 | if ($this->pageLayoutTemplate !== null) { 39 | return $this->pageLayoutTemplate; 40 | } 41 | 42 | return $this->configResolver->getParameter('admin.pagelayout', 'netgen_information_collection'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bundle/Templating/Twig/Extensions/CaptchaExtension.php: -------------------------------------------------------------------------------- 1 | captcha = $captcha; 25 | } 26 | 27 | /** 28 | * Checks if captcha is enabled for given Location. 29 | * 30 | * @param \eZ\Publish\API\Repository\Values\Content\Location $location 31 | * 32 | * @return bool 33 | */ 34 | public function isEnabled(Location $location): bool 35 | { 36 | return $this->captcha->isEnabled($location); 37 | } 38 | 39 | /** 40 | * Return configured site key for given Location. 41 | * 42 | * @param \eZ\Publish\API\Repository\Values\Content\Location $location 43 | * 44 | * @return string 45 | */ 46 | public function getSiteKey(Location $location): string 47 | { 48 | return $this->captcha->getSiteKey($location); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /bundle/Templating/Twig/Extensions/FieldRenderingExtension.php: -------------------------------------------------------------------------------- 1 | ['html']] 22 | ), 23 | ]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /bundle/Templating/Twig/Extensions/FieldRenderingRuntime.php: -------------------------------------------------------------------------------- 1 | environment = $environment; 30 | $this->configResolver = $configResolver; 31 | } 32 | 33 | public function renderField(Collection $collection, Attribute $attribute): string 34 | { 35 | $template = $this->getTemplate(); 36 | $blockName = $this->getRenderFieldBlockName($attribute); 37 | 38 | if (!$template->hasBlock($blockName)) { 39 | return $template->renderBlock($this->getDefaultRenderFieldBlockName(), ['collection' => $collection, 'attribute' => $attribute]); 40 | } 41 | 42 | return $template->renderBlock($blockName, ['collection' => $collection, 'attribute' => $attribute]); 43 | } 44 | 45 | protected function getRenderFieldBlockName(Attribute $attribute): string 46 | { 47 | $fieldTypeIdentifier = $attribute->getFieldDefinition()->fieldTypeIdentifier; 48 | 49 | return $fieldTypeIdentifier . self::FIELD_VIEW_SUFFIX; 50 | } 51 | 52 | protected function getDefaultRenderFieldBlockName(): string 53 | { 54 | return 'default' . self::FIELD_VIEW_SUFFIX; 55 | } 56 | 57 | protected function getTemplate(): TemplateWrapper 58 | { 59 | return $this->environment->load('@NetgenInformationCollection/admin/content_fields.html.twig'); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | patch: false 4 | changes: false 5 | project: 6 | default: 7 | target: auto 8 | comment: off -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = NetgenInformationCollection 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /doc/_static/css/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/doc/_static/css/style.css -------------------------------------------------------------------------------- /doc/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys, os 4 | import sphinx_rtd_theme 5 | 6 | from sphinx.highlighting import lexers 7 | from pygments.lexers.web import PhpLexer 8 | from pygments.lexers.web import HtmlLexer 9 | from pygments.lexers.web import JsonLexer 10 | 11 | from datetime import datetime 12 | 13 | lexers['php'] = PhpLexer(startinline=True) 14 | lexers['php-annotations'] = PhpLexer(startinline=True) 15 | lexers['html'] = HtmlLexer(startinline=True) 16 | lexers['json'] = JsonLexer(startinline=True) 17 | 18 | extensions = ['sphinx.ext.autodoc', 19 | 'sphinx.ext.doctest', 20 | 'sphinx.ext.todo', 21 | 'sphinx.ext.coverage', 22 | 'sphinx.ext.imgmath', 23 | 'sphinx.ext.ifconfig', 24 | 'sensio.sphinx.configurationblock'] 25 | 26 | source_suffix = '.rst' 27 | master_doc = 'index' 28 | 29 | project = 'Netgen Information Collection' 30 | copyright = 'Netgen' 31 | author = 'Mario Blazek' 32 | 33 | version = '' 34 | release = '' 35 | 36 | exclude_patterns = ['_build'] 37 | 38 | html_theme = "sphinx_rtd_theme" 39 | html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] 40 | 41 | html_static_path = ['_static'] 42 | templates_path = ['_templates'] 43 | 44 | html_theme_options = { 45 | 'collapse_navigation': True, 46 | 'display_version': True, 47 | } 48 | 49 | html_context = { 50 | 'copyright_url': 'https://netgen.io', 51 | 'current_year': datetime.utcnow().year 52 | } 53 | 54 | def setup(app): 55 | app.add_stylesheet("css/style.css") 56 | -------------------------------------------------------------------------------- /doc/cookbook/adding_captcha_to_forms.rst: -------------------------------------------------------------------------------- 1 | Adding Captcha to forms 2 | ======================= 3 | 4 | WIP 5 | -------------------------------------------------------------------------------- /doc/cookbook/ajax.rst: -------------------------------------------------------------------------------- 1 | How to handle a form via Ajax 2 | ============================= 3 | 4 | WIP 5 | -------------------------------------------------------------------------------- /doc/cookbook/custom_action.rst: -------------------------------------------------------------------------------- 1 | Creating a custom action 2 | ======================== 3 | 4 | To develop custom action, end developer needs to implement `ActionInterface` 5 | and define custom action as service tagged with `netgen_information_collection.action` and some custom alias which is used as 6 | action identifier (required for configuration). 7 | 8 | Action example: 9 | 10 | .. code-block:: php 11 | 12 | layouts.json 39 | 40 | -------------------------------------------------------------------------------- /doc/reference/container_parameters.rst: -------------------------------------------------------------------------------- 1 | Container parameters 2 | ==================== 3 | 4 | Available Container parameters: 5 | 6 | - `netgen_information_collection.default.admin.max_per_page` - controls how many items will be displayed per page 7 | - `netgen_information_collection.default.form.use_csrf` - controls whenever will CSRF token be used on forms or not 8 | - `netgen_information_collection.ezadminui.pagelayout` - controls which template will be used for admin pagelayout 9 | - `netgen_information_collection.default.admin.tree_limit` - controls which template will be used for admin pagelayout 10 | - `netgen_information_collection.default.admin.pagelayout` - controls which template will be used for admin pagelayout 11 | - `netgen_information_collection.ezadminui.pagelayout` - controls which template will be used for admin pagelayout 12 | -------------------------------------------------------------------------------- /doc/reference/events.rst: -------------------------------------------------------------------------------- 1 | Events 2 | ====== 3 | 4 | Netgen Layouts dispatches some events in a lifecycle of displaying the page with 5 | a resolved layout that you can listen to and act upon. 6 | 7 | The following lists all available events. 8 | 9 | netgen_information_collection.events.information_collected 10 | ---------------------------------------------------------- 11 | 12 | **Event class**: ``Netgen\InformationCollection\API\Value\Event\InformationCollected`` 13 | 14 | This event will be dispatched when the view of a value is being rendered. It can 15 | be used to inject custom variables into the view **before** the view is sent to 16 | Twig for rendering. 17 | 18 | -------------------------------------------------------------------------------- /doc/reference/ez_policies.rst: -------------------------------------------------------------------------------- 1 | eZ Platform Policies 2 | ==================== 3 | 4 | The following is a list of Symfony commands available in Netgen Layouts used for 5 | exporting/importing Netgen Layouts data. 6 | 7 | .. note:: 8 | 9 | This documentation assumes you have a working knowledge of the Symfony 10 | Framework and eZ Platform DXP. If you're not familiar with Symfony, please start with 11 | reading the `Quick Tour`_ from the Symfony documentation and for eZ Platform DXP visit the eZ 12 | Platform `Developer Documentation`_. 13 | 14 | .. _`Quick Tour`: https://symfony.com/doc/current/quick_tour 15 | .. _`Developer Documentation`: https://doc.ezplatform.com/ 16 | 17 | .. rst-class:: responsive 18 | 19 | +----------------------+-------------------------------------------------------------------+ 20 | | Command name | Purpose | 21 | +======================+===================================================================+ 22 | | ``read`` | This script can be used to export one or more layouts or mappings | 23 | | | to a file in JSON format | 24 | +----------------------+-------------------------------------------------------------------+ 25 | | ``delete`` | This script can be used to import one or more layouts from a JSON | 26 | | | format stored in a file | 27 | +----------------------+-------------------------------------------------------------------+ 28 | | ``export`` | This script can be used to import one or more layouts from a JSON | 29 | | | format stored in a file | 30 | +----------------------+-------------------------------------------------------------------+ 31 | | ``anonymize`` | This script can be used to import one or more layouts from a JSON | 32 | | | format stored in a file | 33 | +----------------------+-------------------------------------------------------------------+ 34 | -------------------------------------------------------------------------------- /doc/reference/index.rst: -------------------------------------------------------------------------------- 1 | Reference 2 | ========= 3 | 4 | .. toctree:: 5 | :hidden: 6 | 7 | container_parameters 8 | container_tags 9 | twig 10 | events 11 | configuration 12 | commands 13 | ez_policies 14 | info_collector_actions 15 | 16 | 17 | .. include:: /reference/map.rst.inc 18 | -------------------------------------------------------------------------------- /doc/reference/map.rst.inc: -------------------------------------------------------------------------------- 1 | * :doc:`/reference/container_parameters` 2 | * :doc:`/reference/container_tags` 3 | * :doc:`/reference/twig` 4 | * :doc:`/reference/events` 5 | * :doc:`/reference/configuration` 6 | * :doc:`/reference/commands` 7 | * :doc:`/reference/ez_policies` 8 | * :doc:`/reference/info_collector_actions` 9 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx>=2.4.4,<3.0 2 | sphinx_rtd_theme>=0.5,<1.0 3 | git+https://github.com/fabpot/sphinx-php.git 4 | -------------------------------------------------------------------------------- /doc/upgrades/index.rst: -------------------------------------------------------------------------------- 1 | Upgrades 2 | ======== 3 | 4 | .. toctree:: 5 | :hidden: 6 | 7 | upgrade_to_v2 8 | changelog 9 | 10 | 11 | .. include:: /upgrades/map.rst.inc 12 | -------------------------------------------------------------------------------- /doc/upgrades/map.rst.inc: -------------------------------------------------------------------------------- 1 | * :doc:`/upgrades/upgrade_to_v2` 2 | * :doc:`/upgrades/changelog` 3 | -------------------------------------------------------------------------------- /doc/upgrades/upgrade_to_v2.rst: -------------------------------------------------------------------------------- 1 | Upgrade from 1.x to 2.0 2 | ======================= 3 | 4 | WIP 5 | -------------------------------------------------------------------------------- /lib/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/lib/.gitkeep -------------------------------------------------------------------------------- /lib/API/Action/ActionInterface.php: -------------------------------------------------------------------------------- 1 | 1) { 24 | $verb = 'are'; 25 | } elseif ($blocksCount < 1) { 26 | $blocks = 'none'; 27 | } 28 | 29 | $message = "Missing email block in {$template} template, currently there {$verb} {$blocks} available."; 30 | parent::__construct($message); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/API/Exception/MissingValueException.php: -------------------------------------------------------------------------------- 1 | container->get('netgen_information_collection.handler'); 34 | /** @var RequestStack $requestStack */ 35 | $requestStack = $this->container->get('request_stack'); 36 | 37 | $form = $handler->getForm($view->getContent(), $view->getLocation()); 38 | $request = $requestStack->getCurrentRequest(); 39 | $form->handleRequest($request); 40 | 41 | if ($form->isSubmitted() && $form->isValid()) { 42 | $isValid = true; 43 | 44 | $handler->handle($form->getData(), $options); 45 | } 46 | 47 | if ($view instanceof BaseView) { 48 | $view->addParameters([ 49 | 'is_valid' => $isValid, 50 | 'form' => $form->createView(), 51 | 'collected_fields' => $form->getData()->getFieldsData(), 52 | ]); 53 | } 54 | 55 | if ($view instanceof CachableView) { 56 | $view->setCacheEnabled(false); 57 | } 58 | 59 | return $view; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/API/MailerInterface.php: -------------------------------------------------------------------------------- 1 | id = $id; 40 | $this->field = $field; 41 | $this->fieldDefinition = $fieldDefinition; 42 | $this->value = $value; 43 | } 44 | 45 | public static function createFromAttributeAndValue(Attribute $attribute, AttributeValue $attributeValue) 46 | { 47 | return new self($attribute->getId(), $attribute->getField(), $attribute->getFieldDefinition(), $attributeValue); 48 | } 49 | 50 | /** 51 | * @return Field 52 | */ 53 | public function getField(): Field 54 | { 55 | return $this->field; 56 | } 57 | 58 | /** 59 | * @return FieldDefinition 60 | */ 61 | public function getFieldDefinition(): FieldDefinition 62 | { 63 | return $this->fieldDefinition; 64 | } 65 | 66 | /** 67 | * @return int 68 | */ 69 | public function getId(): int 70 | { 71 | return $this->id; 72 | } 73 | 74 | /** 75 | * @return AttributeValue 76 | */ 77 | public function getValue(): AttributeValue 78 | { 79 | return $this->value; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/API/Value/AttributeValue.php: -------------------------------------------------------------------------------- 1 | dataInt = $dataInt; 27 | $this->dataFloat = $dataFloat; 28 | $this->dataText = $dataText; 29 | } 30 | 31 | public function __toString() 32 | { 33 | if (!empty($this->dataText)) { 34 | return $this->dataText; 35 | } 36 | 37 | if (!empty($this->dataInt)) { 38 | return (string)$this->dataInt; 39 | } 40 | 41 | if (!empty($this->dataFloat)) { 42 | return (string)$this->dataFloat; 43 | } 44 | 45 | return ''; 46 | } 47 | 48 | /** 49 | * @return int 50 | */ 51 | public function getDataInt(): int 52 | { 53 | return $this->dataInt; 54 | } 55 | 56 | /** 57 | * @return float 58 | */ 59 | public function getDataFloat(): float 60 | { 61 | return $this->dataFloat; 62 | } 63 | 64 | /** 65 | * @return string 66 | */ 67 | public function getDataText(): string 68 | { 69 | return $this->dataText; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/API/Value/Captcha/NullObject.php: -------------------------------------------------------------------------------- 1 | reCaptcha = $reCaptcha; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function isValid(Request $request): bool 32 | { 33 | $clientIp = $request->getClientIp() === '::1' ? 'localhost' : $request->getClientIp(); 34 | 35 | $response = $this->reCaptcha->verify( 36 | $request->request->get('g-recaptcha-response'), 37 | $clientIp 38 | ); 39 | 40 | dump($response); 41 | 42 | return $response->isSuccess(); 43 | } 44 | 45 | /** 46 | * Returns aggregated captcha implementation. 47 | * 48 | * @return \ReCaptcha\ReCaptcha 49 | */ 50 | public function getInnerCaptcha(): BaseReCaptcha 51 | { 52 | return $this->reCaptcha; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/API/Value/CollectionCount.php: -------------------------------------------------------------------------------- 1 | collections = $collections; 22 | $this->count = $count; 23 | } 24 | 25 | /** 26 | * @return \Netgen\InformationCollection\API\Value\Collection[] 27 | */ 28 | public function getCollections(): array 29 | { 30 | return $this->collections; 31 | } 32 | 33 | /** 34 | * @return int 35 | */ 36 | public function getCount(): int 37 | { 38 | return $this->count; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/API/Value/ContentsWithCollections.php: -------------------------------------------------------------------------------- 1 | count = $count; 22 | $this->contents = $contents; 23 | } 24 | 25 | /** 26 | * @return \Netgen\InformationCollection\API\Value\Content[] 27 | */ 28 | public function getContents(): array 29 | { 30 | return $this->contents; 31 | } 32 | 33 | /** 34 | * @return int 35 | */ 36 | public function getCount(): int 37 | { 38 | return $this->count; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/API/Value/DataTransfer/AdditionalContent.php: -------------------------------------------------------------------------------- 1 | content = $content; 25 | } 26 | 27 | /** 28 | * @return \eZ\Publish\API\Repository\Values\Content\Content|null 29 | */ 30 | public function getContent(): ?Content 31 | { 32 | return $this->content; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/API/Value/DataTransfer/TemplateContent.php: -------------------------------------------------------------------------------- 1 | event = $event; 33 | $this->templateWrapper = $templateWrapper; 34 | } 35 | 36 | /** 37 | * @return \Netgen\InformationCollection\API\Value\Event\InformationCollected 38 | */ 39 | public function getEvent(): InformationCollected 40 | { 41 | return $this->event; 42 | } 43 | 44 | /** 45 | * @return \eZ\Publish\API\Repository\Values\Content\Content 46 | */ 47 | public function getContent(): Content 48 | { 49 | return $this->event->getContent(); 50 | } 51 | 52 | /** 53 | * @return \Twig\TemplateWrapper 54 | */ 55 | public function getTemplateWrapper(): TemplateWrapper 56 | { 57 | return $this->templateWrapper; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/API/Value/Export/Export.php: -------------------------------------------------------------------------------- 1 | header = $header; 24 | $this->contents = $contents; 25 | } 26 | 27 | /** 28 | * @return array 29 | */ 30 | public function getContents(): array 31 | { 32 | return $this->contents; 33 | } 34 | 35 | /** 36 | * @return array 37 | */ 38 | public function getHeader(): array 39 | { 40 | return $this->header; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/API/Value/Export/ExportCriteria.php: -------------------------------------------------------------------------------- 1 | exportIdentifier = $exportIdentifier; 22 | } 23 | 24 | /** 25 | * @return string 26 | */ 27 | public function getExportIdentifier(): string 28 | { 29 | return $this->exportIdentifier; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/API/Value/Filter/CollectionFields.php: -------------------------------------------------------------------------------- 1 | contentId = $contentId; 27 | $this->collectionId = $collectionId; 28 | $this->fields = $fields; 29 | } 30 | 31 | /** 32 | * @return int 33 | */ 34 | public function getContentId(): int 35 | { 36 | return $this->contentId; 37 | } 38 | 39 | /** 40 | * @return int 41 | */ 42 | public function getCollectionId(): int 43 | { 44 | return $this->collectionId; 45 | } 46 | 47 | /** 48 | * @return array 49 | */ 50 | public function getFields(): array 51 | { 52 | return $this->fields; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/API/Value/Filter/CollectionId.php: -------------------------------------------------------------------------------- 1 | id = $id; 17 | } 18 | 19 | public function getCollectionId(): int 20 | { 21 | return $this->id; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/API/Value/Filter/Collections.php: -------------------------------------------------------------------------------- 1 | 11 | * 12 | * Array of ids of collections. 13 | */ 14 | private $collections; 15 | 16 | /** 17 | * @var int 18 | */ 19 | private $contentId; 20 | 21 | public function __construct(int $contentId, array $collections) 22 | { 23 | $this->collections = $collections; 24 | $this->contentId = $contentId; 25 | } 26 | 27 | public function getCollectionIds(): array 28 | { 29 | return $this->collections; 30 | } 31 | 32 | /** 33 | * @return int 34 | */ 35 | public function getContentId(): int 36 | { 37 | return $this->contentId; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/API/Value/Filter/ContentId.php: -------------------------------------------------------------------------------- 1 | id = $id; 17 | parent::__construct($offset, $limit); 18 | } 19 | 20 | public function getContentId(): int 21 | { 22 | return $this->id; 23 | } 24 | 25 | public static function withContentId(int $contentId): self 26 | { 27 | return new self($contentId, 0, 0); 28 | } 29 | 30 | public static function countWithContentId(int $id): self 31 | { 32 | return new self($id, 0, 0); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/API/Value/Filter/Contents.php: -------------------------------------------------------------------------------- 1 | contents = $contents; 17 | } 18 | 19 | /** 20 | * @return array 21 | */ 22 | public function getContentIds(): array 23 | { 24 | return $this->contents; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/API/Value/Filter/FilterCriteria.php: -------------------------------------------------------------------------------- 1 | contentId = $contentId; 28 | $this->from = $from; 29 | $this->to = $to; 30 | } 31 | 32 | /** 33 | * @return DateTimeInterface 34 | */ 35 | public function getFrom(): DateTimeInterface 36 | { 37 | return $this->from; 38 | } 39 | 40 | /** 41 | * @return DateTimeInterface 42 | */ 43 | public function getTo(): DateTimeInterface 44 | { 45 | return $this->to; 46 | } 47 | 48 | /** 49 | * @return ContentId 50 | */ 51 | public function getContentId(): ContentId 52 | { 53 | return $this->contentId; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/API/Value/Filter/Query.php: -------------------------------------------------------------------------------- 1 | offset = $offset; 28 | $this->limit = $limit; 29 | } 30 | 31 | public static function withLimit(int $limit) 32 | { 33 | return new self(0, $limit); 34 | } 35 | 36 | public static function countQuery() 37 | { 38 | return new self(0, 0); 39 | } 40 | 41 | /** 42 | * @return int 43 | */ 44 | public function getLimit(): int 45 | { 46 | return $this->limit; 47 | } 48 | 49 | /** 50 | * @return int 51 | */ 52 | public function getOffset(): int 53 | { 54 | return $this->offset; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/API/Value/Filter/SearchCountQuery.php: -------------------------------------------------------------------------------- 1 | contentId = $contentId; 22 | $this->searchText = $searchText; 23 | parent::__construct($offset, $limit); 24 | } 25 | 26 | public static function withContentAndSearchText(int $contentId, string $searchText): self 27 | { 28 | return new self($contentId, $searchText, 0, 0); 29 | } 30 | 31 | /** 32 | * @return int 33 | */ 34 | public function getContentId(): int 35 | { 36 | return $this->contentId; 37 | } 38 | 39 | /** 40 | * @return string 41 | */ 42 | public function getSearchText(): string 43 | { 44 | return $this->searchText; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/API/Value/NullUser.php: -------------------------------------------------------------------------------- 1 | count = $count; 14 | } 15 | 16 | /** 17 | * @return int 18 | */ 19 | public function getCount(): int 20 | { 21 | return $this->count; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/API/Value/SearchCount.php: -------------------------------------------------------------------------------- 1 | getMessage()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/Core/Action/BaseEmailAction.php: -------------------------------------------------------------------------------- 1 | mailer = $mailer; 34 | $this->factory = $factory; 35 | } 36 | 37 | /** 38 | * {@inheritdoc} 39 | */ 40 | public function act(InformationCollected $event): void 41 | { 42 | $emailData = $this->factory->build($event); 43 | 44 | try { 45 | $this->mailer->createAndSendMessage($emailData); 46 | } catch (EmailNotSentException $e) { 47 | $this->throwException($e); 48 | } 49 | } 50 | 51 | abstract protected function throwException(EmailNotSentException $exception); 52 | } 53 | -------------------------------------------------------------------------------- /lib/Core/Action/DatabaseAction.php: -------------------------------------------------------------------------------- 1 | informationCollection = $informationCollection; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function act(InformationCollected $event): void 32 | { 33 | $struct = $event->getInformationCollectionStruct(); 34 | 35 | try { 36 | $this->informationCollection 37 | ->createCollection($struct); 38 | } catch (PersistingFailedException $e) { 39 | throw new ActionFailedException(static::$defaultName, $e->getMessage()); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Core/Action/EmailAction.php: -------------------------------------------------------------------------------- 1 | getMessage()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/Core/Action/Identifier.php: -------------------------------------------------------------------------------- 1 | classConstant = get_class($action); 19 | } 20 | 21 | public function getPrimary(): string 22 | { 23 | $class = new ReflectionClass($this->classConstant); 24 | $propertyValue = ''; 25 | 26 | if ($class->hasProperty('defaultName')) { 27 | $defaultName = new ReflectionProperty($this->classConstant, 'defaultName'); 28 | $propertyValue = $defaultName->getValue(); 29 | } 30 | 31 | if (!empty($propertyValue)) { 32 | return $propertyValue; 33 | } 34 | 35 | return $this->getSecondary(); 36 | } 37 | 38 | public function getSecondary(): string 39 | { 40 | return $this->classConstant; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Core/EmailDataProvider/AbstractProvider.php: -------------------------------------------------------------------------------- 1 | configResolver = $configResolver; 49 | $this->config = $this->configResolver->getParameter('action_config', 'netgen_information_collection')[EmailAction::$defaultName]; 50 | $this->translationHelper = $translationHelper; 51 | $this->fieldHelper = $fieldHelper; 52 | $this->twig = $twig; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/Core/EmailDataProvider/AutoResponderProvider.php: -------------------------------------------------------------------------------- 1 | getHeaders(); 17 | 18 | $header = new Header 19 | $headers->add('Content-Type', ''); 20 | 21 | return $email; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Core/Export/ExportResponseFormatterRegistry.php: -------------------------------------------------------------------------------- 1 | exportResponseFormatters = $exportResponseFormatters; 23 | } 24 | 25 | /** 26 | * @param string $identifier 27 | * 28 | * @return \Netgen\InformationCollection\API\Export\ExportResponseFormatter 29 | */ 30 | public function getExportResponseFormatter($identifier): ExportResponseFormatter 31 | { 32 | foreach ($this->exportResponseFormatters as $formatter) { 33 | if ($formatter->getIdentifier() === $identifier) { 34 | return $formatter; 35 | } 36 | } 37 | 38 | throw new RuntimeException( 39 | sprintf('There are no export formatters with %s identifier available.', $identifier) 40 | ); 41 | } 42 | 43 | /** 44 | * @return \Netgen\InformationCollection\API\Export\ExportResponseFormatter[] 45 | */ 46 | public function getExportResponseFormatters(): iterable 47 | { 48 | return $this->exportResponseFormatters; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/Core/Export/JsonExportResponseFormatter.php: -------------------------------------------------------------------------------- 1 | getContents(); 21 | 22 | array_unshift($contents, $export->getHeader()); 23 | 24 | return new JsonResponse($contents); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/Core/Export/XlsExportResponseFormatter.php: -------------------------------------------------------------------------------- 1 | translationHelper = $translationHelper; 28 | } 29 | 30 | public function getIdentifier(): string 31 | { 32 | return 'phpexcel_xls_export'; 33 | } 34 | 35 | public function format(Export $export, Content $content): Response 36 | { 37 | $contentName = $this->translationHelper->getTranslatedContentName($content); 38 | 39 | $spreadsheet = new Spreadsheet(); 40 | $activeSheet = $spreadsheet->getActiveSheet(); 41 | 42 | try { 43 | $activeSheet->setTitle(substr($contentName, 0, 30)); 44 | } catch (\Exception $exception) { 45 | $activeSheet->setTitle('Information collection export'); 46 | } 47 | 48 | $activeSheet->fromArray($export->getHeader(), null, 'A1', true); 49 | $activeSheet->fromArray($export->getContents(), null, 'A2', true); 50 | 51 | 52 | header('Content-Type: application/vnd.ms-excel'); 53 | header('Content-Disposition: attachment;filename="' . $contentName . '.xls"'); 54 | header('Cache-Control: max-age=0'); 55 | 56 | $writer = new Xls($spreadsheet); 57 | $writer->save('php://output'); 58 | 59 | return new Response(''); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/Core/Export/XlsxExportResponseFormatter.php: -------------------------------------------------------------------------------- 1 | translationHelper = $translationHelper; 28 | } 29 | 30 | public function getIdentifier(): string 31 | { 32 | return 'phpexcel_xlsx_export'; 33 | } 34 | 35 | public function format(Export $export, Content $content): Response 36 | { 37 | $contentName = $this->translationHelper->getTranslatedContentName($content); 38 | 39 | $spreadsheet = new Spreadsheet(); 40 | $activeSheet = $spreadsheet->getActiveSheet(); 41 | 42 | try { 43 | $activeSheet->setTitle(substr($contentName, 0, 30)); 44 | } catch (\Exception $exception) { 45 | $activeSheet->setTitle('Information collection export'); 46 | } 47 | 48 | $activeSheet->fromArray($export->getHeader(), null, 'A1', true); 49 | $activeSheet->fromArray($export->getContents(), null, 'A2', true); 50 | 51 | 52 | header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); 53 | header('Content-Disposition: attachment;filename="' . $contentName . '.xlsx"'); 54 | header('Cache-Control: max-age=0'); 55 | 56 | $writer = new Xlsx($spreadsheet); 57 | $writer->save('php://output'); 58 | 59 | return new Response(''); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/Core/Factory/FieldDataFactory.php: -------------------------------------------------------------------------------- 1 | registry = $registry; 30 | } 31 | 32 | /** 33 | * Returns value object that represents legacy value. 34 | * 35 | * @param \eZ\Publish\Core\FieldType\Value $value 36 | * @param \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition 37 | * 38 | * @return \Netgen\InformationCollection\API\Value\Legacy\FieldValue 39 | */ 40 | public function getLegacyValue(Value $value, FieldDefinition $fieldDefinition): FieldValue 41 | { 42 | /** @var CustomFieldHandlerInterface $handler */ 43 | $handler = $this->registry->handle($value); 44 | 45 | if (!$handler instanceof CustomFieldHandlerInterface) { 46 | return new FieldValue($fieldDefinition->id, (string) $value); 47 | } 48 | 49 | if ($handler instanceof CustomLegacyFieldHandlerInterface) { 50 | return $handler->getLegacyValue($value, $fieldDefinition); 51 | } 52 | 53 | return new FieldValue($fieldDefinition->id, $handler->toString($value, $fieldDefinition)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/Core/Mailer/SwiftMailerBasedMailer.php: -------------------------------------------------------------------------------- 1 | internalMailer = $internalMailer; 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function sendEmail(Email $content): void 32 | { 33 | $message = new \Swift_Message(); 34 | 35 | try { 36 | $message->setTo($content->getFrom()); 37 | } catch (\Swift_RfcComplianceException $e) { 38 | throw new EmailNotSentException('recipients', $e->getMessage()); 39 | } 40 | 41 | try { 42 | $message->setFrom($data->getSender()); 43 | } catch (\Swift_RfcComplianceException $e) { 44 | throw new EmailNotSentException('sender', $e->getMessage()); 45 | } 46 | 47 | $message->setSubject($data->getSubject()); 48 | 49 | if ($data->hasAttachments()) { 50 | foreach ($data->getAttachments() as $attachment) { 51 | $message->attach( 52 | \Swift_Attachment::fromPath($attachment->inputUri, $attachment->mimeType) 53 | ->setFilename($attachment->fileName) 54 | ); 55 | } 56 | } 57 | 58 | if (!$this->internalMailer->send($message)) { 59 | throw new EmailNotSentException('send', 'invalid mailer configuration?'); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/Core/Mailer/SymfonyMailerBasedMailer.php: -------------------------------------------------------------------------------- 1 | mailer = $mailer; 19 | } 20 | 21 | public function sendEmail(Email $content): void 22 | { 23 | try { 24 | $this->mailer->send($content); 25 | } catch () { 26 | 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/Core/Pagination/BaseAdapter.php: -------------------------------------------------------------------------------- 1 | informationCollectionService = $informationCollectionService; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/Core/Pagination/InformationCollectionCollectionListAdapter.php: -------------------------------------------------------------------------------- 1 | query = $query; 20 | parent::__construct($informationCollectionService); 21 | } 22 | 23 | public function getNbResults() 24 | { 25 | if (!isset($this->nbResults)) { 26 | $query = ContentId::countWithContentId($this->query->getContentId()); 27 | 28 | $this->nbResults = $this->informationCollectionService 29 | ->getCollectionsCount($query) 30 | ->getCount(); 31 | } 32 | 33 | return $this->nbResults; 34 | } 35 | 36 | public function getSlice($offset, $length) 37 | { 38 | $query = new ContentId($this->query->getContentId(), $offset, $length); 39 | 40 | $objects = $this->informationCollectionService 41 | ->getCollections($query) 42 | ->getCollections(); 43 | 44 | $this->getNbResults(); 45 | 46 | return $objects; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/Core/Pagination/InformationCollectionCollectionListSearchAdapter.php: -------------------------------------------------------------------------------- 1 | query = $query; 21 | parent::__construct($informationCollectionService); 22 | } 23 | 24 | public function getNbResults() 25 | { 26 | if (!isset($this->nbResults)) { 27 | $query = new SearchCountQuery( 28 | $this->query->getContentId(), 29 | $this->query->getSearchText(), 30 | 0, 31 | 0 32 | ); 33 | 34 | $this->nbResults = $this->informationCollectionService 35 | ->searchCount($query) 36 | ->getCount(); 37 | } 38 | 39 | return $this->nbResults; 40 | } 41 | 42 | public function getSlice($offset, $length) 43 | { 44 | $query = new SearchQuery( 45 | $this->query->getContentId(), 46 | $this->query->getSearchText(), 47 | $offset, 48 | $length 49 | ); 50 | 51 | $objects = $this->informationCollectionService 52 | ->search($query) 53 | ->getCollections(); 54 | 55 | $this->getNbResults(); 56 | 57 | return $objects; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/Core/Pagination/InformationCollectionContentsAdapter.php: -------------------------------------------------------------------------------- 1 | query = $query; 20 | parent::__construct($informationCollectionService); 21 | } 22 | 23 | public function getNbResults() 24 | { 25 | if (!isset($this->nbResults)) { 26 | $this->nbResults = $this->informationCollectionService 27 | ->getObjectsWithCollectionsCount() 28 | ->getCount(); 29 | } 30 | 31 | return $this->nbResults; 32 | } 33 | 34 | public function getSlice($offset, $length) 35 | { 36 | $query = new Query($offset, $length); 37 | 38 | $objects = $this->informationCollectionService 39 | ->getObjectsWithCollections($query) 40 | ->getContents(); 41 | 42 | $this->getNbResults(); 43 | 44 | return $objects; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/Core/Persistence/Anonymizer/Visitor/Field/Aggregate.php: -------------------------------------------------------------------------------- 1 | visitors = $visitors; 28 | } 29 | 30 | /** 31 | * @param \Netgen\InformationCollection\API\Persistence\Anonymizer\Visitor\FieldAnonymizerVisitor $visitor 32 | */ 33 | public function addVisitor(FieldAnonymizerVisitor $visitor) 34 | { 35 | $this->visitors[] = $visitor; 36 | } 37 | 38 | /** 39 | * {@inheritdoc} 40 | */ 41 | public function accept(Attribute $attribute, ContentType $contentType): bool 42 | { 43 | return true; 44 | } 45 | 46 | /** 47 | * {@inheritdoc} 48 | */ 49 | public function visit(Attribute $attribute, ContentType $contentType): AttributeValue 50 | { 51 | foreach ($this->visitors as $visitor) { 52 | if ($visitor->accept($attribute, $contentType)) { 53 | return $visitor->visit($attribute, $contentType); 54 | } 55 | } 56 | 57 | throw new OutOfBoundsException( 58 | 'No visitor registered for field anonymization' 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/Core/Persistence/Anonymizer/Visitor/Field/Email.php: -------------------------------------------------------------------------------- 1 | getFieldDefinition()->fieldTypeIdentifier; 20 | } 21 | 22 | /** 23 | * {@inheritdoc} 24 | */ 25 | public function visit(Attribute $attribute, ContentType $contentType): AttributeValue 26 | { 27 | $email = $attribute->getValue()->getDataText(); 28 | 29 | $split = str_split($email); 30 | 31 | $email = []; 32 | foreach ($split as $character) { 33 | if (!in_array($character, $this->allowedCharacters)) { 34 | $email[] = 'X'; 35 | } else { 36 | $email[] = $character; 37 | } 38 | } 39 | 40 | return new AttributeValue(0, 0, implode($email, '')); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Core/Persistence/Anonymizer/Visitor/Field/Simple.php: -------------------------------------------------------------------------------- 1 | id, (int) $value->bool); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/Core/Persistence/FieldHandler/Custom/CountryFieldHandler.php: -------------------------------------------------------------------------------- 1 | id, implode(', ', array_column($value->countries, 'Alpha2'))); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/Core/Persistence/FieldHandler/Custom/DateAndTimeFieldHandler.php: -------------------------------------------------------------------------------- 1 | id, $value->value->getTimestamp()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/Core/Persistence/FieldHandler/Custom/DateFieldHandler.php: -------------------------------------------------------------------------------- 1 | id, $value->date->getTimestamp()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/Core/Persistence/FieldHandler/Custom/FloatFieldHandler.php: -------------------------------------------------------------------------------- 1 | id, $value->value); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/Core/Persistence/FieldHandler/Custom/IntegerFieldHandler.php: -------------------------------------------------------------------------------- 1 | id, $value->value); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/Core/Persistence/FieldHandler/Custom/TimeFieldHandler.php: -------------------------------------------------------------------------------- 1 | id, (int)$value->time); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/Core/Persistence/FieldHandler/FieldHandlerRegistry.php: -------------------------------------------------------------------------------- 1 | handlers = $handlers; 25 | } 26 | 27 | /** 28 | * Adds new handler. 29 | * 30 | * @param CustomFieldHandlerInterface $handler 31 | */ 32 | public function addHandler(CustomFieldHandlerInterface $handler): void 33 | { 34 | $this->handlers[] = $handler; 35 | } 36 | 37 | /** 38 | * @param Value $value 39 | * 40 | * @return CustomFieldHandlerInterface|null 41 | */ 42 | public function handle(Value $value): ?CustomFieldHandlerInterface 43 | { 44 | /** @var CustomFieldHandlerInterface $handler */ 45 | foreach ($this->handlers as $handler) { 46 | if ($handler->supports($value)) { 47 | return $handler; 48 | } 49 | } 50 | 51 | return null; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/Doctrine/mappings/EzInfoCollection.orm.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /lib/Resources/config/actions.yml: -------------------------------------------------------------------------------- 1 | services: 2 | netgen_information_collection.action.registry: 3 | class: Netgen\InformationCollection\Core\Action\ActionRegistry 4 | arguments: 5 | - !tagged_iterator netgen_information_collection.action 6 | - "@netgen_information_collection.action.config_utility" 7 | - "@logger" 8 | - "@event_dispatcher" 9 | calls: 10 | - [setDebug, ['%kernel.debug%']] 11 | 12 | netgen_information_collection.action.config_utility: 13 | class: Netgen\InformationCollection\Core\Action\ConfigurationUtility 14 | arguments: 15 | - "@ezpublish.config.resolver" 16 | 17 | netgen_information_collection.action.db: 18 | class: Netgen\InformationCollection\Core\Action\DatabaseAction 19 | arguments: 20 | - '@netgen_information_collection.api.service' 21 | tags: 22 | - { name: netgen_information_collection.action, priority: 300 } 23 | 24 | netgen_information_collection.action.email: 25 | class: Netgen\InformationCollection\Core\Action\EmailAction 26 | arguments: 27 | - '@netgen_information_collection.mailer' 28 | - '@netgen_information_collection.factory.email_data' 29 | tags: 30 | - { name: netgen_information_collection.action } 31 | 32 | # netgen_information_collection.action.auto_responder: 33 | # class: Netgen\InformationCollection\Core\Action\AutoResponderAction 34 | # arguments: 35 | # - '@netgen_information_collection.factory.auto_responder_data' 36 | # - '@netgen_information_collection.mailer' 37 | # tags: 38 | # - { name: netgen_information_collection.action, alias: auto_responder } 39 | -------------------------------------------------------------------------------- /lib/Resources/config/anonymizers.yml: -------------------------------------------------------------------------------- 1 | services: 2 | netgen_information_collection.anonymizer_facade.service: 3 | class: Netgen\InformationCollection\Core\Persistence\Anonymizer\AnonymizerServiceFacade 4 | arguments: 5 | - "@netgen_information_collection.anonymizer.service" 6 | - "@netgen_information_collection.utils.content_type" 7 | - "@netgen_information_collection.repository.ez_info_collection" 8 | 9 | netgen_information_collection.anonymizer.service: 10 | class: Netgen\InformationCollection\Core\Persistence\Anonymizer\AnonymizerService 11 | arguments: 12 | - "@ezpublish.api.repository" 13 | - "@netgen_information_collection.api.service" 14 | - "@netgen_information_collection.anonymizer.visitor.field.aggregate" 15 | 16 | netgen_information_collection.anonymizer.visitor.field.aggregate: 17 | class: Netgen\InformationCollection\Core\Persistence\Anonymizer\Visitor\Field\Aggregate 18 | arguments: 19 | - !tagged_iterator netgen_information_collection.anonymizer.visitor.field 20 | 21 | netgen_information_collection.anonymizer.visitor.field.simple: 22 | class: Netgen\InformationCollection\Core\Persistence\Anonymizer\Visitor\Field\Simple 23 | tags: 24 | - { name: netgen_information_collection.anonymizer.visitor.field, priority: -255 } 25 | 26 | netgen_information_collection.anonymizer.visitor.field.email: 27 | class: Netgen\InformationCollection\Core\Persistence\Anonymizer\Visitor\Field\Email 28 | tags: 29 | - { name: netgen_information_collection.anonymizer.visitor.field } 30 | -------------------------------------------------------------------------------- /lib/Resources/config/core/persistence.yml: -------------------------------------------------------------------------------- 1 | services: 2 | netgen_information_collection.repository.ez_info_collection: 3 | class: Netgen\InformationCollection\Doctrine\Repository\EzInfoCollectionRepository 4 | factory: ["@doctrine.orm.entity_manager", getRepository] 5 | arguments: [ "Netgen\\InformationCollection\\Doctrine\\Entity\\EzInfoCollection" ] 6 | 7 | netgen_information_collection.repository.ez_info_collection_attribute: 8 | class: Netgen\InformationCollection\Doctrine\Repository\EzInfoCollectionAttributeRepository 9 | factory: ["@doctrine.orm.entity_manager", getRepository] 10 | arguments: [ "Netgen\\InformationCollection\\Doctrine\\Entity\\EzInfoCollectionAttribute" ] 11 | -------------------------------------------------------------------------------- /lib/Resources/config/core/services.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/lib/Resources/config/core/services.yml -------------------------------------------------------------------------------- /lib/Resources/config/default_settings.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | netgen_information_collection.default.admin.max_per_page: 10 3 | netgen_information_collection.default.admin.tree_limit: 10 4 | netgen_information_collection.default.admin.pagelayout: '@@NetgenInformationCollection/admin/pagelayout.html.twig' 5 | -------------------------------------------------------------------------------- /lib/Resources/config/ezplatform_admin.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | netgen_information_collection.ezadminui.pagelayout: '@@NetgenInformationCollection/ezadminui/pagelayout.html.twig' 3 | 4 | services: 5 | netgen_information_collection.ezplatform_admin.menu: 6 | class: Netgen\Bundle\InformationCollectionBundle\EzPlatform\EzPlatformAdmin\MenuListener 7 | public: true 8 | tags: 9 | - { name: kernel.event_subscriber } 10 | 11 | netgen_information_collection.ezadminui.event_listener.set_page_layout: 12 | class: Netgen\Bundle\InformationCollectionBundle\EzPlatform\EzPlatformAdmin\EventListener\SetPageLayoutListener 13 | arguments: 14 | - "@netgen_information_collection.templating.admin_global_variable" 15 | - "%ezpublish.siteaccess.groups_by_siteaccess%" 16 | - "%netgen_information_collection.ezadminui.pagelayout%" 17 | tags: 18 | - { name: kernel.event_subscriber } 19 | -------------------------------------------------------------------------------- /lib/Resources/config/factories.yml: -------------------------------------------------------------------------------- 1 | services: 2 | netgen_information_collection.factory.email_data: 3 | class: Netgen\InformationCollection\Core\Factory\EmailDataFactory 4 | arguments: 5 | - '@ezpublish.config.resolver' 6 | - '@ezpublish.translation_helper' 7 | - '@ezpublish.field_helper' 8 | - '@twig' 9 | 10 | netgen_information_collection.factory.auto_responder_data: 11 | class: Netgen\InformationCollection\Core\Factory\AutoResponderDataFactory 12 | arguments: 13 | - '@ezpublish.config.resolver' 14 | - '@ezpublish.translation_helper' 15 | - '@ezpublish.field_helper' 16 | - '@twig' 17 | 18 | netgen_information_collection.factory.field_data: 19 | class: Netgen\InformationCollection\Core\Factory\FieldDataFactory 20 | arguments: 21 | - '@netgen_information_collection.field_handler.registry' 22 | -------------------------------------------------------------------------------- /lib/Resources/config/legacy_handlers.yml: -------------------------------------------------------------------------------- 1 | services: 2 | netgen_information_collection.field_handler.checkbox: 3 | class: Netgen\InformationCollection\Core\Persistence\FieldHandler\Custom\CheckboxFieldHandler 4 | tags: 5 | - { name: netgen_information_collection.field_handler.custom } 6 | 7 | netgen_information_collection.field_handler.integer: 8 | class: Netgen\InformationCollection\Core\Persistence\FieldHandler\Custom\IntegerFieldHandler 9 | tags: 10 | - { name: netgen_information_collection.field_handler.custom } 11 | 12 | netgen_information_collection.field_handler.float: 13 | class: Netgen\InformationCollection\Core\Persistence\FieldHandler\Custom\FloatFieldHandler 14 | tags: 15 | - { name: netgen_information_collection.field_handler.custom } 16 | 17 | netgen_information_collection.field_handler.date: 18 | class: Netgen\InformationCollection\Core\Persistence\FieldHandler\Custom\DateFieldHandler 19 | tags: 20 | - { name: netgen_information_collection.field_handler.custom } 21 | 22 | netgen_information_collection.field_handler.time: 23 | class: Netgen\InformationCollection\Core\Persistence\FieldHandler\Custom\TimeFieldHandler 24 | tags: 25 | - { name: netgen_information_collection.field_handler.custom } 26 | 27 | netgen_information_collection.field_handler.date_and_time: 28 | class: Netgen\InformationCollection\Core\Persistence\FieldHandler\Custom\DateFieldHandler 29 | tags: 30 | - { name: netgen_information_collection.field_handler.custom } 31 | -------------------------------------------------------------------------------- /lib/Resources/config/parameters.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | netgen.default.information_collection.form.use_csrf: true 3 | netgen_information_collection.default.action_config.auto_responder: [] 4 | -------------------------------------------------------------------------------- /lib/Resources/config/twig.yml: -------------------------------------------------------------------------------- 1 | globals: 2 | netgen_information_collection_admin: "@netgen_information_collection.templating.admin_global_variable" 3 | 4 | form_themes: 5 | - '@NetgenInformationCollection/form/form_fields.html.twig' 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "devDependencies": { 4 | "autoprefixer": "^6.7.6", 5 | "babel-core": "^6.26.3", 6 | "babel-preset-env": "^1.7.0", 7 | "babel-preset-es2015": "^6.24.1", 8 | "babel-preset-stage-0": "^6.24.1", 9 | "babelify": "^8.0.0", 10 | "bundle-collapser": "^1.3.0", 11 | "grunt": "^1.0.1", 12 | "grunt-browserify": "^5.3.0", 13 | "grunt-contrib-cssmin": "^2.2.1", 14 | "grunt-contrib-watch": "^1.0.0", 15 | "grunt-lock": "^0.1.3", 16 | "grunt-newer": "^1.2.0", 17 | "grunt-postcss": "^0.8.0", 18 | "grunt-sass": "^2.1.0", 19 | "grunt-wiredep": "^3.0.1", 20 | "jit-grunt": "^0.10.0", 21 | "node-sass": "^4.9.0", 22 | "time-grunt": "^1.4.0", 23 | "uglifyify": "^5.0.0" 24 | }, 25 | "dependencies": { 26 | "@netgen/admin-ui": "^1.0.5" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /phpstan.neon: -------------------------------------------------------------------------------- 1 | #includes: 2 | # - vendor/phpstan/phpstan-strict-rules/rules.neon 3 | 4 | parameters: 5 | ignoreErrors: 6 | # Symfony 7 | - '#Cannot call method arrayNode\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface\|null#' 8 | - '#Cannot call method end\(\) on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface\|null#' 9 | 10 | # Doctrine DBAL 11 | - '#Cannot call method fetchAll\(\) on Doctrine\\DBAL\\Driver\\Statement\|int#' 12 | - '#Cannot call method fetchColumn\(\) on Doctrine\\DBAL\\Driver\\Statement\|int#' 13 | - '#Parameter \#2 \$y of method Doctrine\\DBAL\\Query\\Expression\\ExpressionBuilder::in\(\) expects array\\|string, array\ given#' 14 | 15 | # eZ Platform related errors 16 | - 17 | message: '#Access to protected property eZ\\Publish\\API\\Repository\\Values\\Content\\Field::\$value#' 18 | path: lib/Core/Factory/EmailDataFactory.php 19 | - 20 | message: '#Access to protected property eZ\\Publish\\Core\\Repository\\Values\\ContentType\\ContentType::\$fieldDefinitionsById#' 21 | path: lib/Core/Mapper/DomainObjectMapper.php 22 | 23 | - '#Access to protected property eZ\\Publish\\API\\Repository\\Values\\Content\\Field::\$value#' 24 | - '#Access to an undefined property EzSystems\\RepositoryForms\\Data\\Content\\FieldData::\$email#' 25 | 26 | # Pagerfanta 27 | - '#Property Netgen\\InformationCollection\\Core\\Pagination\\Pagerfanta\\View\\InformationCollectionAdminView::\$pagerfanta \(Pagerfanta\\Pagerfanta\) does not accept Pagerfanta\\PagerfantaInterface#' 28 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | tests/lib 19 | 20 | 21 | tests/bundle 22 | 23 | 24 | 25 | 26 | bundle 27 | lib 28 | 29 | bundle 30 | lib 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/bundle/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/tests/bundle/.gitkeep -------------------------------------------------------------------------------- /tests/lib/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/tests/lib/.gitkeep -------------------------------------------------------------------------------- /tests/lib/FakeTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/old/API/Value/InformationCollection/QueryTest.php: -------------------------------------------------------------------------------- 1 | assertEquals(12, $query->contentId); 15 | $this->assertEquals(0, $query->offset); 16 | $this->assertEquals(10, $query->limit); 17 | $this->assertEmpty($query->fields); 18 | } 19 | 20 | public function testCount() 21 | { 22 | $query = Query::count(); 23 | 24 | $this->assertEquals(0, $query->limit); 25 | $this->assertEquals(0, $query->offset); 26 | } 27 | 28 | public function testConstructor() 29 | { 30 | $values = [ 31 | 'offset' => 15, 32 | 'limit' => 100, 33 | 'contentId' => 55, 34 | 'collectionId' => 14, 35 | 'searchTest' => 'text', 36 | 'contents' => [ 37 | 12, 34, 34 38 | ], 39 | 'collections' => [ 40 | 56, 78, 45 41 | ], 42 | 'fields' => [ 43 | 86, 324, 54 44 | ], 45 | ]; 46 | 47 | $query = new Query($values); 48 | 49 | foreach ($values as $key => $value) { 50 | 51 | $this->assertEquals($value, $query->$key); 52 | 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/old/ContentViewStub.php: -------------------------------------------------------------------------------- 1 | setDefinition(CustomFieldHandlersPass::FIELD_HANDLER_REGISTRY, $registry); 17 | 18 | $fieldHandler = new Definition(); 19 | $fieldHandler->addTag(CustomFieldHandlersPass::FIELD_HANDLER); 20 | $this->setDefinition('custom_handler', $fieldHandler); 21 | 22 | $this->compile(); 23 | 24 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( 25 | CustomFieldHandlersPass::FIELD_HANDLER_REGISTRY, 26 | 'addHandler', 27 | array( 28 | new Reference('custom_handler'), 29 | ) 30 | ); 31 | } 32 | 33 | protected function registerCompilerPass(ContainerBuilder $container) 34 | { 35 | $container->addCompilerPass(new CustomFieldHandlersPass()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/old/Entity/EzInfoCollectionAttributeTest.php: -------------------------------------------------------------------------------- 1 | entity = new EzInfoCollectionAttribute(); 18 | parent::setUp(); 19 | } 20 | 21 | public function testSetters() 22 | { 23 | $this->entity->setId(2342); 24 | $this->entity->setContentObjectId(24343); 25 | $this->entity->setContentClassAttributeId(2342363); 26 | $this->entity->setContentObjectAttributeId(64634); 27 | $this->entity->setInformationCollectionId(1234); 28 | $this->entity->setDataFloat(12.3); 29 | $this->entity->setDataInt(12); 30 | $this->entity->setDataText('test'); 31 | 32 | $this->assertEquals(2342, $this->entity->getId()); 33 | $this->assertEquals(24343, $this->entity->getContentObjectId()); 34 | $this->assertEquals(2342363, $this->entity->getContentClassAttributeId()); 35 | $this->assertEquals(64634, $this->entity->getContentObjectAttributeId()); 36 | $this->assertEquals(1234, $this->entity->getInformationCollectionId()); 37 | $this->assertEquals(12.3, $this->entity->getDataFloat()); 38 | $this->assertEquals(12, $this->entity->getDataInt()); 39 | $this->assertEquals('test', $this->entity->getDataText()); 40 | $this->assertEquals('test', $this->entity->getValue()); 41 | 42 | 43 | $this->entity->setDataText(''); 44 | $this->assertEquals(12, $this->entity->getValue()); 45 | 46 | $this->entity->setDataInt(0); 47 | $this->assertEquals(12.3, $this->entity->getValue()); 48 | 49 | $this->entity->setDataFloat(0); 50 | $this->assertEquals('', $this->entity->getValue()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/old/Entity/EzInfoCollectionTest.php: -------------------------------------------------------------------------------- 1 | entity = new EzInfoCollection(); 18 | parent::setUp(); 19 | } 20 | 21 | public function testGettersAndSetters() 22 | { 23 | $id = 123; 24 | $this->entity->setId($id); 25 | $this->assertEquals($id, $this->entity->getId()); 26 | 27 | $this->entity->setContentObjectId(4234); 28 | $this->entity->setCreated(4535); 29 | $this->entity->setCreatorId(43432456); 30 | $this->entity->setModified(43432); 31 | $this->entity->setUserIdentifier(546); 32 | 33 | 34 | $this->assertEquals(4234, $this->entity->getContentObjectId()); 35 | $this->assertEquals(4535, $this->entity->getCreated()); 36 | $this->assertEquals(43432456, $this->entity->getCreatorId()); 37 | $this->assertEquals(43432, $this->entity->getModified()); 38 | $this->assertEquals(546, $this->entity->getUserIdentifier()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/old/Event/InformationCollectedTest.php: -------------------------------------------------------------------------------- 1 | event = new InformationCollected($data, 'additional content'); 20 | 21 | parent::setUp(); 22 | } 23 | 24 | public function testGetters() 25 | { 26 | $this->assertEquals('payload', $this->event->getInformationCollectionStruct()); 27 | $this->assertEquals('definition', $this->event->getContentType()); 28 | $this->assertEquals('target', $this->event->getLocation()); 29 | $this->assertEquals('additional content', $this->event->getAdditionalContent()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/old/Exception/ActionFailedExceptionTest.php: -------------------------------------------------------------------------------- 1 | registry = $this->getMockBuilder(ActionRegistry::class) 27 | ->disableOriginalConstructor() 28 | ->setMethods(array('act')) 29 | ->getMock(); 30 | 31 | $this->listener = new InformationCollectedListener($this->registry); 32 | 33 | parent::setUp(); 34 | } 35 | 36 | public function testListenerConfiguration() 37 | { 38 | $this->assertEquals( 39 | array(Events::INFORMATION_COLLECTED => 'onInformationCollected'), 40 | InformationCollectedListener::getSubscribedEvents() 41 | ); 42 | } 43 | 44 | public function testItRunsActions() 45 | { 46 | $event = new InformationCollected(new DataWrapper('payload')); 47 | 48 | $this->registry->expects($this->once()) 49 | ->method('act') 50 | ->with($event); 51 | 52 | $this->listener->onInformationCollected($event); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/old/Mailer/attachment.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netgen/NetgenInformationCollectionBundle/50a0a242acd3a57edd1fa475b4a288066d946576/tests/old/Mailer/attachment.txt -------------------------------------------------------------------------------- /tests/old/Templating/Twig/AdminGlobalVariableTest.php: -------------------------------------------------------------------------------- 1 | assertNull($admin->getPageLayoutTemplate()); 15 | 16 | $admin->setPageLayoutTemplate('this_is_my_page_layout'); 17 | $this->assertEquals('this_is_my_page_layout', $admin->getPageLayoutTemplate()); 18 | 19 | $admin->setPageLayoutTemplate(); 20 | $this->assertNull($admin->getPageLayoutTemplate()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/old/Value/EmailDataTest.php: -------------------------------------------------------------------------------- 1 | assertEquals($recipient, $emailData->getRecipient()); 23 | $this->assertEquals($sender, $emailData->getSender()); 24 | $this->assertEquals($subject, $emailData->getSubject()); 25 | $this->assertEquals($body, $emailData->getBody()); 26 | $this->assertNull($emailData->getAttachments()); 27 | } 28 | 29 | public function emailDataProvider() 30 | { 31 | return array( 32 | array('recipient@example.com', 'sender@example.com', 'Test subject', 'Email body'), 33 | array('recipient1@example.com', 'sender1@example.com', 'Test subject 1', 'Email body 1'), 34 | array('recipient2@example.com', 'sender1@example.com', 'Test subject 2', 'Email body 2'), 35 | array('recipient3@example.com', 'sender1@example.com', 'Test subject 3', 'Email body 3'), 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/old/Value/LegacyDataTest.php: -------------------------------------------------------------------------------- 1 | assertEquals($contentClassAttributeId, $legacyData->getContentClassAttributeId()); 23 | $this->assertEquals($dataFloat, $legacyData->getDataFloat()); 24 | $this->assertEquals($dataInt, $legacyData->getDataInt()); 25 | $this->assertEquals($dataText, $legacyData->getDataText()); 26 | } 27 | 28 | public function legacyDataProvider() 29 | { 30 | return array( 31 | array(123456, 2.67, 34, 'text'), 32 | array(31221312, 3.14, null, 'some text'), 33 | array(4234234, null, 12, ''), 34 | array(4234324, null, 35, 'weee'), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/old/Value/TemplateDataTest.php: -------------------------------------------------------------------------------- 1 | '{% block foo %}{% endblock %}', 42 | ) 43 | ) 44 | ); 45 | 46 | $this->event = new InformationCollected(new DataWrapper('test', null, null)); 47 | $this->content = new Content(); 48 | $this->templateWrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index')); 49 | 50 | $this->templateData = new TemplateData($this->event, $this->content, $this->templateWrapper); 51 | } 52 | 53 | public function testGetters() 54 | { 55 | $this->assertEquals($this->event, $this->templateData->getEvent()); 56 | $this->assertEquals($this->content, $this->templateData->getContent()); 57 | $this->assertEquals($this->templateWrapper, $this->templateData->getTemplateWrapper()); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /travis.php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | 3 | memory_limit = 4G 4 | --------------------------------------------------------------------------------