Overview

Namespaces

  • Mapbender
    • Component
      • HTTP
    • CoreBundle
      • Command
      • Component
        • Exception
      • Controller
      • DataFixtures
        • ORM
      • DependencyInjection
      • Element
        • Type
      • Entity
      • EventListener
      • Extension
      • Form
        • DataTransformer
        • EventListener
        • Type
      • Security
      • Template
    • DrupalIntegrationBundle
      • DependencyInjection
      • Security
        • Authentication
          • Provider
          • Token
        • Authorization
          • Voter
        • Factory
        • Firewall
        • User
      • Session
    • KmlBundle
      • Element
    • ManagerBundle
      • Controller
      • Form
        • DataTransformer
        • Type
    • MonitoringBundle
      • Command
      • Component
      • Controller
      • DependencyInjection
      • Entity
      • EventListener
      • Form
    • PrintBundle
      • Component
      • Controller
    • WmcBundle
      • Component
        • Exception
      • Element
        • Type
      • Entity
      • Form
        • EventListener
        • Type
    • WmsBundle
      • Component
        • Exception
      • Controller
      • DependencyInjection
      • Element
        • Type
      • Entity
      • Event
      • Form
        • EventListener
        • Type
    • WmtsBundle
      • Component
        • Exception
      • Controller
      • Entity
      • Form
        • Type
  • None
  • PHP

Classes

  • LegendUrlType
  • OnlineResourceType
  • WmsInstanceInstanceLayersType
  • WmsInstanceLayerType
  • WmsSourceSimpleType
  • WmsSourceType
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
  1: <?php
  2: 
  3: namespace Mapbender\WmsBundle\Form\Type;
  4: 
  5: use Symfony\Component\Form\AbstractType;
  6: use Symfony\Component\Form\FormInterface;
  7: use Symfony\Component\Form\FormBuilderInterface;
  8: use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  9: 
 10: /**
 11:  * WmsInstanceInstanceLayersType class
 12:  */
 13: class WmsInstanceInstanceLayersType extends AbstractType
 14: {
 15: 
 16:     /**
 17:      * @inheritdoc
 18:      */
 19:     public function getName()
 20:     {
 21:         return 'wmsinstanceinstancelayers';
 22:     }
 23: 
 24:     /**
 25:      * @inheritdoc
 26:      */
 27:     public function setDefaultOptions(OptionsResolverInterface $resolver)
 28:     {
 29:         $resolver->setDefaults(array(
 30:             'available_templates' => array(),
 31:             'gfg' => function(FormInterface $form)
 32:             {
 33:                 $data = $form->getData()->getWmssourcelayer();
 34:                 return true;
 35:             }));
 36:     }
 37: 
 38:     /**
 39:      * @inheritdoc
 40:      */
 41:     public function buildForm(FormBuilderInterface $builder, array $options)
 42:     {
 43:         $wmsinstance = $options["data"];
 44:         $arr = $wmsinstance->getSource()->getGetMap()->getFormats() !== null ?
 45:                 $wmsinstance->getSource()->getGetMap()->getFormats() : array();
 46:         $formats = array();
 47:         foreach($arr as $value)
 48:         {
 49:             $formats[$value] = $value;
 50:         }
 51:         $builder->add('format', 'choice',
 52:                       array(
 53:             'choices' => $formats,
 54:             'required' => true));
 55:         $gfi = $wmsinstance->getSource()->getGetFeatureInfo();
 56:         $arr = $gfi && $gfi->getFormats() !== null ? $gfi->getFormats() : array();
 57:         $formats_gfi = array();
 58:         foreach($arr as $value)
 59:         {
 60:             $formats_gfi[$value] = $value;
 61:         }
 62:         $builder->add('infoformat', 'choice',
 63:                       array(
 64:             'choices' => $formats_gfi,
 65:             'required' => false));
 66:         $arr = $wmsinstance->getSource()->getExceptionFormats() !== null ?
 67:                 $wmsinstance->getSource()->getExceptionFormats() : array();
 68:         $formats_exc = array();
 69:         foreach($arr as $value)
 70:         {
 71:             $formats_exc[$value] = $value;
 72:         }
 73:         $opacity = array();
 74:         foreach(range(0, 100, 10) as $value)
 75:         {
 76:             $opacity[$value] = $value;
 77:         }
 78:         $builder->add('exceptionformat', 'choice',
 79:                       array(
 80:                     'choices' => $formats_exc,
 81:                     'required' => false))
 82:                 ->add('visible', 'checkbox',
 83:                       array(
 84:                     'required' => false))
 85:                 ->add('proxy', 'checkbox',
 86:                       array(
 87:                     'required' => false))
 88:                 ->add('opacity', 'choice',
 89:                       array(
 90:                     'choices' => $opacity, //range(0, 100),
 91:                     'required' => true))
 92:                 ->add('transparency', 'checkbox',
 93:                       array(
 94:                     'required' => false))
 95:                 ->add('tiled', 'checkbox',
 96:                       array(
 97:                     'required' => false))
 98:                 ->add('layers', 'collection',
 99:                       array(
100:                     'type' => new WmsInstanceLayerType(),
101:                     'options' => array(
102:                         'data_class' => 'Mapbender\WmsBundle\Entity\WmsInstanceLayer',
103:                         'num_layers' => count($wmsinstance->getLayers()))
104:                 ));
105:     }
106: 
107: }
108: 
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0