Example #1
0
 /**
  * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
  *
  * @return void
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $container = $this->getConfigurationPool()->getContainer();
     $entityManager = $container->get('doctrine.orm.default_entity_manager');
     $datagridMapper->add('locale', 'doctrine_orm_callback', ['label' => 'Langue', 'callback' => function (ProxyQuery $queryBuilder, $alias, $field, $value) {
         if (!$value['value']) {
             return false;
         }
         $queryBuilder->andWhere($alias . '.locale = :locale')->setParameter('locale', $value['value']);
         return true;
     }], 'choice', ['choices' => $this->getRealLocales()])->add('title', null, ['label' => 'Page'])->add('published', null, ['label' => 'Publié'])->add('node', 'doctrine_orm_callback', ['label' => 'Type de contenu', 'callback' => function (ProxyQuery $queryBuilder, $alias, $field, $value) use($entityManager) {
         if (!$value['value']) {
             return false;
         }
         // We can't query the type from the AlpixelCMSBundle:Node repository (InheritanceType) because of that
         // we try to get the repository in AppBundle with the value which is the class name of entity. :pig:
         try {
             $repository = $entityManager->getRepository(sprintf('AppBundle:%s', ucfirst($value['value'])));
         } catch (\Doctrine\Common\Persistence\Mapping\MappingException $e) {
             return false;
         }
         $data = $repository->findAll();
         if (empty($data)) {
             return false;
         }
         $queryBuilder->andWhere($alias . '.id IN (:ids)')->setParameter('ids', $data);
         return true;
     }], 'choice', ['choices' => $this->getCMSEntityTypes()]);
 }
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $container = $this->getConfigurationPool()->getContainer();
     $roles = $container->getParameter('security.role_hierarchy.roles');
     $rolesChoices = self::flattenRoles($roles);
     $datagridMapper->add('username')->add('firstname')->add('lastname');
 }
 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $filter)
 {
     $filter->add('current')->add('type', null, array(), 'sonata_customer_address_types', array('translation_domain' => 'SonataCustomerBundle'));
     if (!$this->isChild()) {
         $filter->add('customer');
     }
 }
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper
         ->add('title', 'doctrine_phpcr_string')
         ->add('name',  'doctrine_phpcr_nodename')
     ;
 }
Example #5
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('id', null, array('label' => 'order_id'));
     if (!$this->isChild()) {
         $datagridMapper->add('partner', null, array('label' => 'customer'));
     }
 }
Example #6
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     // Getting the container parameters set in the config file that exist
     $commentSettings = $this->getConfigurationPool()->getContainer()->getParameter('comment_settings');
     $commentTypeChoice = $commentSettings['commenttypes'];
     $datagridMapper->add('title')->add('commentType', 'doctrine_orm_string', array(), 'choice', array('choices' => $commentTypeChoice))->add('blogPost')->add('created', 'doctrine_orm_date_range', array('input_type' => 'date'), 'sonata_type_date_range')->add('username')->add('approved', 'doctrine_orm_string', array(), 'choice', array('choices' => array('0' => 'Hide', '1' => 'Show')));
 }
Example #7
0
 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper, $context = '')
 {
     $datagridMapper->add('name', 'networking_init_cms_simple_string')->add('enabled', null, array('hidden' => true));
     if ($context) {
         $datagridMapper->add('context', null, array('hidden' => true));
     }
 }
Example #8
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $em = $this->modelManager->getEntityManager('Vidal\\MainBundle\\Entity\\User');
     $cityChoices = $em->getRepository('VidalMainBundle:City')->getChoices();
     $regionChoices = $em->getRepository('VidalMainBundle:Region')->getChoices();
     $countryChoices = $em->getRepository('VidalMainBundle:Country')->getChoices();
     $datagridMapper->add('id')->add('username', null, array('label' => 'E-mail'))->add('lastName', null, array('label' => 'Фамилия'))->add('primarySpecialty', null, array('label' => 'Основная специальность'))->add('city', 'doctrine_orm_choice', array('label' => 'Город'), 'choice', array('choices' => $cityChoices))->add('region', 'doctrine_orm_choice', array('label' => 'Область'), 'choice', array('choices' => $regionChoices))->add('country', 'doctrine_orm_choice', array('label' => 'Страна'), 'choice', array('choices' => $countryChoices))->add('emailConfirmed', null, array('label' => 'e-mail подтвержден'))->add('oldUser', null, array('label' => 'Со старого сайта'))->add('confirmationHas', null, array('label' => 'Со сканами'));
 }
Example #9
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     // Getting the container parameters set in the config file that exist
     $tagSettings = $this->getConfigurationPool()->getContainer()->getParameter('tag_settings');
     // Setting up the available tag categories and preffered choice
     $tagcategoriesChoices = $tagSettings['tagcategories'];
     $datagridMapper->add('title')->add('tagCategory', 'doctrine_orm_string', array(), 'choice', array('choices' => $tagcategoriesChoices));
 }
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('quizset')->add('content')->add('type');
     //    ->add('quizset','many_to_one', array())
     //    ->add('dateStart','doctrine_orm_datetime', array('label' => 'Data startu'))
     //    ->add('dateEnd', 'doctrine_orm_datetime', array('label' => 'Data końca'))
     //;
 }
Example #11
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     // Getting the container parameters set in the config file that exist
     $contentblockSettings = $this->getConfigurationPool()->getContainer()->getParameter('contentblock_settings');
     // Setting up the available content types and preffered choice
     $contentTypeChoices = $contentblockSettings['contenttypes'];
     $datagridMapper->add('title')->add('availability', 'doctrine_orm_string', array(), 'choice', array('choices' => array('page' => 'Page Only', 'global' => 'Global')))->add('publishState', 'doctrine_orm_string', array(), 'choice', array('choices' => array('0' => 'Unpublished', '1' => 'Published')))->add('contentType', 'doctrine_orm_string', array(), 'choice', array('choices' => $contentTypeChoices))->add('className');
 }
Example #12
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     // Getting the container parameters set in the config file that exist
     $skeletonSettings = $this->getConfigurationPool()->getContainer()->getParameter('skeleton_settings');
     // Setting up the available page types and preffered choice
     $pagetypeChoices = $skeletonSettings['pagetypes'];
     $datagridMapper->add('title')->add('publishState', 'doctrine_orm_string', array(), 'choice', array('choices' => array('0' => 'Unpublished', '1' => 'Published', '2' => 'Preview')))->add('pagetype', 'doctrine_orm_string', array(), 'choice', array('choices' => $pagetypeChoices))->add('categories')->add('tags')->add('author')->add('date', 'doctrine_orm_date_range', array('input_type' => 'date'), 'sonata_type_date_range');
 }
 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('id');
     if (interface_exists('Sonata\\ClassificationBundle\\Model\\CategoryInterface')) {
         $datagridMapper->add('category');
     }
     $datagridMapper->add('permalink')->add('isCommentable');
 }
Example #14
0
 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $options = array();
     if (1 === $this->getPersistentParameter('hide_context')) {
         $options['disabled'] = true;
     }
     $datagridMapper->add('context', null, array(), null, $options);
 }
Example #15
0
 /**
  * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
  * @return void
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('name')->add('providerReference')->add('enabled')->add('context');
     $providers = array();
     foreach ($this->pool->getProviderNamesByContext('default') as $name) {
         $providers[$name] = $name;
     }
     $datagridMapper->add('providerName', 'doctrine_orm_choice', array('field_options' => array('choices' => $providers, 'required' => false, 'multiple' => false, 'expanded' => false), 'field_type' => 'choice'));
 }
Example #16
0
 /**
  * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
  * @return void
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('name')->add('hybrid', 'doctrine_orm_callback', array('callback' => function ($queryBuilder, $alias, $field, $data) {
         if (in_array($data['value'], array('hybrid', 'cms'))) {
             $queryBuilder->andWhere(sprintf('%s.routeName %s :routeName', $alias, $data['value'] == 'cms' ? '=' : '!='));
             $queryBuilder->setParameter('routeName', PageInterface::PAGE_ROUTE_CMS_NAME);
         }
     }, 'field_options' => array('required' => false, 'choices' => array('hybrid' => $this->trans('hybrid'), 'cms' => $this->trans('cms'))), 'field_type' => 'choice'));
 }
Example #17
0
 /**
  * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('name')->add('title')->add('subtitle')->add('location')->add('keywords')->add('providerReference')->add('enabled')->add('context');
     $providers = array();
     $providerNames = (array) $this->pool->getProviderNamesByContext($this->getPersistentParameter('context', $this->pool->getDefaultContext()));
     foreach ($providerNames as $name) {
         $providers[$name] = $name;
     }
     $datagridMapper->add('providerName', 'doctrine_orm_choice', array('field_options' => array('choices' => $providers, 'required' => false, 'multiple' => false, 'expanded' => false), 'field_type' => 'choice'));
 }
Example #18
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     // Getting the container parameters set in the config file that exist
     $menuSettings = $this->getConfigurationPool()->getContainer()->getParameter('menu_settings');
     $menuTypeChoice = $menuSettings['menutypes'];
     $menuGroupsChoice = $menuSettings['menugroups'];
     $accessLevelChoices = $menuSettings['accessLevel'];
     $publishStateChoices = $menuSettings['publishState'];
     $datagridMapper->add('title')->add('menuGroup', 'doctrine_orm_string', array(), 'choice', array('choices' => $menuGroupsChoice))->add('menuType', 'doctrine_orm_string', array(), 'choice', array('choices' => $menuTypeChoice))->add('page')->add('blog')->add('publishState', 'doctrine_orm_string', array(), 'choice', array('choices' => $publishStateChoices))->add('accessLevel', 'doctrine_orm_string', array(), 'choice', array('choices' => $accessLevelChoices));
 }
Example #19
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('name')->add('checker')->add('supplierName')->add('status');
     /*
      * ->add('campaignName')
      * ->add('supplier')
      * ->add('date')
      * //->add('campaign', 'entity', array('class' => 'Admin\AdminBundle\Entity\campaign'))
      * ;
      */
 }
 /**
  * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
  *
  * @return void
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('title')->add('enabled')->add('tags', null, array('field_options' => array('expanded' => true, 'multiple' => true)))->add('author')->add('with_open_comments', 'doctrine_orm_callback', array('callback' => function ($queryBuilder, $alias, $field, $value) {
         if (!$value) {
             return;
         }
         $queryBuilder->leftJoin(sprintf('%s.comments', $alias), 'c');
         $queryBuilder->andWhere('c.status = :status');
         $queryBuilder->setParameter('status', Comment::STATUS_MODERATE);
     }, 'field_type' => 'checkbox'));
 }
Example #21
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('firstname', null, array('label' => 'First name'))->add('lastname', null, array('label' => 'Last name'))->add('year', 'doctrine_orm_choice', array('label' => 'Year'), 'choice', array('choices' => self::getYearChoices()));
     if ($this->isGranted('EDIT')) {
         $datagridMapper->add('payment', 'doctrine_orm_choice', array('label' => 'Payment type'), 'choice', array('choices' => self::getPaymentChoices()));
     }
     $datagridMapper->add('deposit', null, array('label' => 'Deposit'));
     if ($this->isGranted('EDIT')) {
         $datagridMapper->add('mailing', null, array('label' => 'Mailing list'));
     }
 }
Example #22
0
 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $options = [];
     if ($this->getPersistentParameter('hide_context') === 1) {
         $options['disabled'] = true;
     }
     $filterParam = [];
     if ($this->hasRequest() && !$this->getRequest()->get('filter') && !$this->getRequest()->get('filters')) {
         $filterParam = array('show_filter' => false);
     }
     $datagridMapper->add('name')->add('context', null, $filterParam, null, $options)->add('enabled');
 }
Example #23
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('id')->add('type', null, array('label' => 'Тип'))->add('lastName', null, array('label' => 'Фамилия'))->add('date', 'doctrine_orm_callback', array('label' => 'Отмечается', 'callback' => function ($queryBuilder, $alias, $field, $value) {
         if (empty($value) || !$value['value']) {
             return;
         }
         $queryBuilder->orWhere('o.date LIKE :date')->orWhere('o.birthdate LIKE :date')->orWhere('o.gone LIKE :date')->setParameter('date', $value['value'] . '%');
         if (isset($_GET['filter']['type']['value']) && $_GET['filter']['type']['value']) {
             $queryBuilder->andWhere('o.type = :type')->setParameter('type', $_GET['filter']['type']['value']);
         }
     }));
 }
 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $options = array('choices' => array());
     foreach ($this->pool->getContexts() as $name => $context) {
         $options['choices'][$name] = $name;
     }
     $datagridMapper->add('name')->add('providerReference')->add('enabled')->add('context', null, array('show_filter' => $this->getPersistentParameter('hide_context') !== true), 'choice', $options)->add('category', null, array('show_filter' => false))->add('width')->add('height')->add('contentType');
     $providers = array();
     $providerNames = (array) $this->pool->getProviderNamesByContext($this->getPersistentParameter('context', $this->pool->getDefaultContext()));
     foreach ($providerNames as $name) {
         $providers[$name] = $name;
     }
     $datagridMapper->add('providerName', 'doctrine_orm_choice', array('field_options' => array('choices' => $providers, 'required' => false, 'multiple' => false, 'expanded' => false), 'field_type' => 'choice'));
 }
 protected function configureDatagridFilters(DatagridMapper $filter)
 {
     $filter->add('objectClass', 'doctrine_orm_callback', array('callback' => function ($queryBuilder, $alias, $field, $value) {
         if (!$value['value']) {
             return;
         }
         // get some extra slashes for "double" escaping
         $value = addcslashes($value['value'], '\\');
         var_dump($value);
         $queryBuilder->andWhere("{$alias}.objectClass like :objectClass");
         $queryBuilder->setParameter('objectClass', $value);
         return true;
     }, 'field_type' => 'text'));
     $filter->add('objectId', 'doctrine_orm_number', array(), 'text', array());
     $filter->add('username');
     $filter->add('sourceUsername');
 }
Example #26
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('title');
     $datagridMapper->add('description');
     $datagridMapper->add('content');
     $datagridMapper->add('createdAt', 'doctrine_orm_date_range', array('field_type' => 'sonata_type_date_range_picker'));
     $datagridMapper->add('updatedAt', 'doctrine_orm_date_range', array('field_type' => 'sonata_type_date_range_picker'));
     $datagridMapper->add('category');
     $datagridMapper->add('slug');
 }
Example #27
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('gate', 'doctrine_orm_choice', array(), 'choice', array('choices' => array('interkassa' => 'interkassa', 'admin' => 'admin'), 'required' => false))->add('events', 'doctrine_orm_callback', array('label' => 'Events', 'callback' => function ($queryBuilder, $alias, $field, $value) {
         $eventsId = array();
         /** @var $event \Stfalcon\Bundle\EventBundle\Entity\Event */
         foreach ($value['value'] as $event) {
             $eventsId[] = $event->getId();
         }
         if (empty($eventsId)) {
             return;
         }
         /** @var $queryBuilder QueryBuilder */
         $queryBuilder->join(sprintf('%s.tickets', $alias), 't');
         $queryBuilder->join('t.event', 'e');
         $queryBuilder->andWhere($queryBuilder->expr()->in('e.id', $eventsId));
         return true;
     }, 'field_type' => 'entity', 'field_options' => array('class' => 'StfalconEventBundle:Event', 'choice_label' => 'name', 'multiple' => true, 'required' => false)));
 }
 protected function configureDatagridFilters(DatagridMapper $filter)
 {
     /** @var \Doctrine\ORM\EntityManager $em */
     $em = $this->getContainer()->get('doctrine')->getManagerForClass('Lexik\\Bundle\\TranslationBundle\\Entity\\File');
     $domains = array();
     $domainsQueryResult = $em->createQueryBuilder()->select('DISTINCT t.domain')->from('\\Lexik\\Bundle\\TranslationBundle\\Entity\\File', 't')->getQuery()->getResult(Query::HYDRATE_ARRAY);
     array_walk_recursive($domainsQueryResult, function ($domain) use(&$domains) {
         $domains[$domain] = $domain;
     });
     ksort($domains);
     $filter->add('locale', 'doctrine_orm_callback', array('callback' => function (ProxyQuery $queryBuilder, $alias, $field, $options) {
         /* @var $queryBuilder \Doctrine\ORM\QueryBuilder */
         if (!isset($options['value']) || empty($options['value'])) {
             return;
         }
         // use on to filter locales
         $this->joinTranslations($queryBuilder, $alias, $options['value']);
     }, 'field_options' => array('choices' => $this->formatLocales($this->managedLocales), 'required' => false, 'multiple' => true, 'expanded' => false), 'field_type' => 'choice'))->add('show_non_translated_only', 'doctrine_orm_callback', array('callback' => function (ProxyQuery $queryBuilder, $alias, $field, $options) {
         /* @var $queryBuilder \Doctrine\ORM\QueryBuilder */
         if (!isset($options['value']) || empty($options['value']) || false === $options['value']) {
             return;
         }
         $this->joinTranslations($queryBuilder, $alias);
         foreach ($this->getEmptyFieldPrefixes() as $prefix) {
             if (empty($prefix)) {
                 $queryBuilder->orWhere('translations.content IS NULL');
             } else {
                 $queryBuilder->orWhere('translations.content LIKE :content')->setParameter('content', $prefix . '%');
             }
         }
     }, 'field_options' => array('required' => true, 'value' => $this->getNonTranslatedOnly()), 'field_type' => 'checkbox'))->add('key', 'doctrine_orm_string')->add('domain', 'doctrine_orm_choice', array('field_options' => array('choices' => $domains, 'required' => true, 'multiple' => false, 'expanded' => false, 'empty_value' => 'all', 'empty_data' => 'all'), 'field_type' => 'choice'))->add('content', 'doctrine_orm_callback', array('callback' => function (ProxyQuery $queryBuilder, $alias, $field, $options) {
         /* @var $queryBuilder \Doctrine\ORM\QueryBuilder */
         if (!isset($options['value']) || empty($options['value'])) {
             return;
         }
         $this->joinTranslations($queryBuilder, $alias);
         $queryBuilder->andWhere('translations.content LIKE :content')->setParameter('content', '%' . $options['value'] . '%');
     }, 'field_type' => 'text', 'label' => 'content'));
 }
Example #29
0
 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $options = array('choices' => array());
     foreach ($this->pool->getContexts() as $name => $context) {
         $options['choices'][$name] = $name;
     }
     $datagridMapper->add('collection', 'doctrine_orm_model_autocomplete', array('show_filter' => false), null, array('property' => 'name', 'callback' => function ($admin, $property, $value) {
         $datagrid = $admin->getDatagrid();
         $queryBuilder = $datagrid->getQuery();
         $queryBuilder->andWhere(sprintf('%s.context = :context', $queryBuilder->getRootAlias()));
         $queryBuilder->setParameter('context', $this->getDefaultContext());
     }))->add('context', null, array('show_filter' => $this->getPersistentParameter('hide_context') !== true), 'choice', $options)->add('name')->add('enabled');
 }
Example #30
0
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('title');
     $datagridMapper->add('description');
     $datagridMapper->add('content');
     $datagridMapper->add('createdAt');
     $datagridMapper->add('updatedAt');
 }