本文整理汇总了PHP中Sonata\AdminBundle\Form\FormMapper::tab方法的典型用法代码示例。如果您正苦于以下问题:PHP FormMapper::tab方法的具体用法?PHP FormMapper::tab怎么用?PHP FormMapper::tab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Form\FormMapper
的用法示例。
在下文中一共展示了FormMapper::tab方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->tab('form.menunode.tab.General')->with('form.menunode.general')->end()->with('form.menunode.parameters', ['class' => 'col-md-8'])->end()->with('form.menunode.position', ['class' => 'col-md-4'])->end()->end()->tab('form.menunode.tab.Rules')->with('form.menunode.rules')->end()->end()->tab('form.menunode.tab.Customization')->with('form.menunode.customization')->end()->end();
$formMapper->tab('form.menunode.tab.General')->with('form.menunode.general')->add('name', 'text', ['label' => $this->trans('form.menunode.name', [], 'admin'), 'help' => $this->trans('help.menunode.name', [], 'admin')])->add('label', 'text', ['label' => $this->trans('form.menunode.label', [], 'admin'), 'help' => $this->trans('help.menunode.label', [], 'admin')])->end()->with('form.menunode.parameters')->add('linkType', 'sonata_type_choice_field_mask', ['choices' => ['uri' => $this->trans('form.menunode.uri', [], 'admin'), 'route' => $this->trans('form.menunode.route', [], 'admin')], 'map' => ['route' => ['route', 'routeParameters'], 'uri' => ['uri']], 'empty_value' => 'form.linkType.empty_value', 'required' => false])->add('route', 'text', ['required' => false])->add('uri', 'text', ['required' => false])->add('routeParameters', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->end()->with('form.menunode.position')->add('parent', null, ['class' => 'ZapoyokMenuBundle:MenuNode', 'property' => 'nameWithLevel', 'empty_value' => 'Choose a parent', 'empty_data' => null, 'query_builder' => $this->menuNodeManager->getNodesHierarchyQueryBuilder($this->getParent()->getSubject())])->add('reorder', 'zapoyok_menu_reorder', ['mapped' => false, 'current_node' => $this->getSubject()])->end()->end();
$formMapper->tab('form.menunode.tab.Customization')->with('form.menunode.customization')->add('attributes', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->add('childrenAttributes', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->add('linkAttributes', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->add('labelAttributes', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->end()->end();
//parent::configureFormFields($formMapper);
}
示例2: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
// 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'];
reset($pagetypeChoices);
$prefPagetypeChoice = key($pagetypeChoices);
// Setting up the available media sizes and preffered choice
$introMediaSizeChoices = $skeletonSettings['mediasizes'];
reset($introMediaSizeChoices);
$prefIntroMediaSizeChoice = key($introMediaSizeChoices);
// Getting the user from container services that exist
$loggedUser = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser();
// Using sonata admin to generate the edit page form and its fields
$formMapper->tab('Skeleton Page Essential Details')->with('Skeleton Page Essential Details', array('collapsed' => true))->add('title', null, array('attr' => array('class' => 'pageTitleField'), 'label' => 'Skeleton Page Title', 'required' => true))->add('publishState', 'choice', array('choices' => array('0' => 'Unpublished', '1' => 'Published', '2' => 'Preview'), 'preferred_choices' => array('2'), 'label' => 'Publish Status', 'required' => true))->add('date', 'date', array('widget' => 'single_text', 'format' => 'dd-MM-yyyy', 'attr' => array('class' => 'datepicker'), 'label' => 'Publish Date', 'required' => true))->add('author', 'entity', array('class' => 'Application\\Sonata\\UserBundle\\Entity\\User', 'property' => 'username', 'expanded' => false, 'multiple' => false, 'label' => 'Author', 'data' => $loggedUser->getUsername(), 'required' => true))->add('alias', null, array('attr' => array('class' => 'pageAliasField'), 'label' => 'Skeleton Page Alias', 'required' => false))->add('pagetype', 'choice', array('choices' => $pagetypeChoices, 'preferred_choices' => array($prefPagetypeChoice), 'label' => 'Skeleton Page Type', 'required' => true))->add('showPageTitle', 'choice', array('choices' => array('0' => 'Hide Title', '1' => 'Show Title'), 'preferred_choices' => array('1'), 'label' => 'Title Display', 'required' => true))->add('pageclass', null, array('label' => 'Skeleton Page CSS Class', 'required' => false))->setHelps(array('title' => 'Set the title of the Skeleton Page', 'publishState' => 'Set the publish status of the Skeleton Page', 'date' => 'Set the publishing date of the Skeleton Page', 'author' => 'The Author of the skeleton page', 'alias' => 'Set the URL alias of the Skeleton Page', 'pagetype' => 'Select the type of the Skeleton Page (Skeleton Page template)', 'pageclass' => 'Set the CSS class that wraps Skeleton Page'))->end()->end()->tab('Categories & Tags')->with('Categories & Tags', array('collapsed' => true))->add('categories', 'entity', array('class' => 'BardisCMS\\CategoryBundle\\Entity\\Category', 'property' => 'title', 'expanded' => true, 'multiple' => true, 'label' => 'Associated Categories', 'required' => false))->add('tags', 'entity', array('class' => 'BardisCMS\\TagBundle\\Entity\\Tag', 'property' => 'title', 'expanded' => true, 'multiple' => true, 'label' => 'Associated Tags', 'required' => false))->setHelps(array('tags' => 'Select the associated tags', 'categories' => 'Select the associated categories'))->end()->end()->tab('Skeleton Listing Page Intro')->with('Skeleton Listing Page Intro', array('collapsed' => true))->add('introtext', 'textarea', array('attr' => array('class' => 'tinymce', 'data-theme' => 'advanced'), 'label' => 'Intro Text/HTML', 'required' => false))->add('introimage', 'sonata_media_type', array('provider' => 'sonata.media.provider.image', 'context' => 'intro', 'attr' => array('class' => 'imagefield'), 'label' => 'Intro Image', 'required' => false))->add('introvideo', 'sonata_media_type', array('provider' => 'sonata.media.provider.vimeo', 'context' => 'intro', 'attr' => array('class' => 'videofield'), 'label' => 'Vimeo Video Id', 'required' => false))->add('pageOrder', null, array('label' => 'Intro Item Ordering in Homepage', 'required' => true))->add('introclass', null, array('label' => 'Intro Item CSS Class', 'required' => false))->setHelps(array('introtext' => 'Set the Text/HTML content to display for intro listing items', 'introimage' => 'Set the Image content to display for intro listing items', 'introvideo' => 'Set the video content to display for intro listing items', 'pageOrder' => 'Set the order of this Skeleton page intro for the homepage', 'introclass' => 'Set the CSS class that wraps content to display for intro listing items'))->end()->end()->tab('Skeleton Page Metatags Manual Override')->with('Skeleton Page Metatags Manual Override', array('collapsed' => true))->add('keywords', null, array('label' => 'Meta Keywords', 'required' => false))->add('description', null, array('label' => 'Meta Description', 'required' => false))->setHelps(array('keywords' => 'Set the keyword metadata of the page of leave empty to autogenerate', 'description' => 'Set the description metadata of the page of leave empty to autogenerate'))->end()->end();
// Check if it is a new entry. If it is hide the content block management
if (!is_null($this->getSubject()->getId())) {
// Setting up the available content block holders for each pagetype
switch ($this->subject->getPagetype()) {
case 'skeleton_article':
$formMapper->tab('Skeleton Page Contents')->with('Skeleton Page Contents', array('collapsed' => true))->add('bannercontentblocks', 'contentblockcollection', array('attr' => array('class' => 'bannercontentblocks'), 'label' => 'Top Contents'))->add('maincontentblocks', 'contentblockcollection', array('attr' => array('class' => 'maincontentblocks'), 'label' => 'Main Contents'))->add('modalcontentblocks', 'contentblockcollection', array('attr' => array('class' => 'modalcontentblocks'), 'label' => 'Modal Windows Contents'))->setHelps(array('bannercontentblocks' => 'Select the top contents in the order you want them to appear in the Skeleton Page', 'maincontentblocks' => 'Select the main contents in the order you want them to appear in the Skeleton Page', 'modalcontentblocks' => 'Select the contents in the order you want them to appear in the modal windows'))->end()->end();
break;
default:
$formMapper->tab('Skeleton Page Contents')->with('Skeleton Page Contents', array('collapsed' => true))->add('maincontentblocks', 'contentblockcollection', array('attr' => array('class' => 'maincontentblocks'), 'label' => 'Main Contents'))->add('modalcontentblocks', 'contentblockcollection', array('attr' => array('class' => 'modalcontentblocks'), 'label' => 'Modal Windows Contents'))->setHelps(array('maincontentblocks' => 'Select the contents in the order you want them to appear in the Skeleton Page', 'modalcontentblocks' => 'Select the contents in the order you want them to appear in the modal windows'))->end()->end();
}
}
}
示例3: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->tab('User')->with('Profile', array('class' => 'col-md-6'))->end()->with('General', array('class' => 'col-md-6'))->end()->with('Social', array('class' => 'col-md-6'))->end()->end()->tab('Security')->with('Status', array('class' => 'col-md-4'))->end()->with('Groups', array('class' => 'col-md-4'))->end()->with('Keys', array('class' => 'col-md-4'))->end()->with('Roles', array('class' => 'col-md-12'))->end()->end();
$now = new \DateTime();
$formMapper->tab('User')->with('General')->add('username')->add('email')->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->end()->with('Profile')->add('image', 'sonata_type_model_list', array(), array('placeholder' => 'No image selected', 'link_parameters' => array('context' => 'user')))->add('dateOfBirth', 'sonata_type_date_picker', array('years' => range(1900, $now->format('Y')), 'dp_min_date' => '1-1-1900', 'dp_max_date' => $now->format('c'), 'required' => false))->add('firstname', null, array('required' => false))->add('lastname', null, array('required' => false))->add('website', 'url', array('required' => false))->add('biography', 'text', array('required' => false))->add('gender', 'sonata_user_gender', array('required' => true, 'translation_domain' => $this->getTranslationDomain()))->add('locale', 'locale', array('required' => false))->add('timezone', 'timezone', array('required' => false))->add('phone', null, array('required' => false))->end()->with('Social')->add('facebookUid', null, array('required' => false))->add('facebookName', null, array('required' => false))->add('twitterUid', null, array('required' => false))->add('twitterName', null, array('required' => false))->add('gplusUid', null, array('required' => false))->add('gplusName', null, array('required' => false))->end()->end();
$formMapper->tab('Security')->with('Status')->add('locked', null, array('required' => false))->add('expired', null, array('required' => false))->add('enabled', null, array('required' => false))->add('credentialsExpired', null, array('required' => false))->end()->with('Groups')->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->with('Roles')->add('realRoles', 'sonata_security_roles', array('label' => 'form.label_roles', 'expanded' => true, 'multiple' => true, 'required' => false))->end()->end();
$formMapper->tab('Security')->with('Keys')->add('token', null, array('required' => false))->add('twoStepVerificationCode', null, array('required' => false))->end()->end();
}
示例4: configureFormFields
/**
* {@inheritdoc}
*/
public function configureFormFields(FormMapper $formMapper)
{
$formMapper->tab('General')->with('General', array('collapsed' => false))->add('username')->add('email')->add('plainPassword', 'text', array('required' => false))->end()->end()->tab('Profile')->with('Profile', array('collapsed' => true))->add('firstname', null, array('label' => 'First Name', 'required' => false))->add('lastname', null, array('label' => 'Surname', 'required' => false))->add('sex', 'choice', array('choices' => array('male' => 'Male', 'female' => 'Female'), 'label' => 'Sex', 'required' => false, 'expanded' => true, 'multiple' => false))->add('bakeFrequency', 'choice', array('choices' => array('year' => 'Once a year', 'month' => 'Once a year', 'week' => 'Every Week'), 'label' => 'How often do you bake?', 'required' => false))->add('bakeChoises', 'choice', array('choices' => array('biscuits' => 'biscuits', 'breads' => 'breads', 'brownies' => 'brownies', 'cakes' => 'cakes', 'cupcakes' => 'cupcakes', 'desserts' => 'desserts', 'muffins' => 'muffins', 'pancakes' => 'pancakes', 'pies' => 'pies'), 'label' => 'Which of the following do you bake?', 'required' => false, 'expanded' => true, 'multiple' => true))->add('children', 'choice', array('choices' => array('no' => 'No', 'yes' => 'Yes'), 'label' => 'Do you have children?', 'required' => false, 'expanded' => true, 'multiple' => false))->add('campaign', null, array('label' => 'Campaign Name', 'required' => false))->end()->end();
if (!$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
$formMapper->with('Management', array('collapsed' => true))->add('roles', 'sonata_security_roles', array('expanded' => true, 'multiple' => true, 'required' => false))->add('locked', null, array('required' => false))->add('expired', null, array('required' => false))->add('enabled', null, array('required' => false))->add('credentialsExpired', null, array('required' => false))->end();
}
$formMapper->tab('Security')->with('Security', array('collapsed' => true))->add('token', null, array('required' => false))->add('twoStepVerificationCode', null, array('required' => false))->end()->end()->tab('Groups')->with('Groups', array('collapsed' => true))->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->end();
}
示例5: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$esFusionado = $this->getSubject()->getEsFusionado();
$formMapper->tab($this->getTranslator()->trans('datos_generales'))->with('', array('class' => 'col-md-12'))->end()->end()->tab($this->getTranslator()->trans('_origen_datos_'))->with($this->getTranslator()->trans('origen_datos_sql'), array('class' => 'col-md-8'))->end()->with($this->getTranslator()->trans('origen_datos_archivo'), array('class' => 'col-md-4'))->end()->end();
$formMapper->tab($this->getTranslator()->trans('datos_generales'), array('collapsed' => false))->with('', array('class' => 'col-md-12'))->add('nombre', null, array('label' => $this->getTranslator()->trans('nombre')))->add('descripcion', null, array('label' => $this->getTranslator()->trans('descripcion'), 'required' => false))->end()->end();
if ($esFusionado == false) {
$formMapper->tab($this->getTranslator()->trans('datos_generales'), array('collapsed' => false))->with('', array('class' => 'col-md-12'))->add('esCatalogo', null, array('label' => $this->getTranslator()->trans('es_catalogo')))->add('areaCosteo', 'choice', array('label' => $this->getTranslator()->trans('_area_costeo_'), 'choices' => array('rrhh' => $this->getTranslator()->trans('_rrhh_'), 'ga_af' => $this->getTranslator()->trans('_ga_af_')), 'required' => false))->end()->end()->tab($this->getTranslator()->trans('_origen_datos_'), array('collapsed' => true))->with($this->getTranslator()->trans('origen_datos_sql'))->add('conexiones', null, array('label' => $this->getTranslator()->trans('nombre_conexion'), 'required' => false, 'expanded' => false))->add('sentenciaSql', null, array('label' => $this->getTranslator()->trans('sentencia_sql'), 'required' => false, 'attr' => array('rows' => 7, 'cols' => 50)))->end()->with($this->getTranslator()->trans('origen_datos_archivo'))->add('archivoNombre', null, array('label' => $this->getTranslator()->trans('archivo_asociado'), 'required' => false, 'read_only' => true))->add('file', 'file', array('label' => $this->getTranslator()->trans('subir_nuevo_archivo'), 'required' => false))->end()->end();
}
}
示例6: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
// define group zoning
$formMapper->tab('Usuario')->with('Perfil', array('class' => 'col-md-12'))->end()->end()->tab('Seguridad')->with('Estado', array('class' => 'col-md-4'))->end()->with('Groups', array('class' => 'col-md-4'))->end()->end();
$now = new \DateTime();
$formMapper->tab('Usuario')->with('Perfil')->add('firstname', null, array('required' => false, 'label' => 'Nombre'))->add('lastname', null, array('required' => false, 'label' => 'Apellido'))->add('username', 'text', array('label' => 'Nombre de Usuario'))->add('email', 'text', array('label' => 'Email'))->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId()), 'label' => 'contraseña'))->end()->end();
if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
$formMapper->tab('Seguridad')->with('Estado')->add('locked', null, array('required' => false, 'label' => 'Bloqueado'))->add('enabled', null, array('required' => false, 'label' => 'Habilitado'))->add('credentialsExpired', null, array('required' => false, 'label' => 'credenciales vencidas'))->end()->with('Groups')->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->end();
}
}
示例7: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->tab('General')->with('Basic Info')->add('username')->add('email')->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->end()->end();
$formMapper->tab('Groups & Roles')->with('Groups')->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end();
if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
$formMapper->with('Roles')->add('realRoles', 'sonata_security_roles', array('label' => 'form.label_roles', 'expanded' => true, 'multiple' => true, 'required' => false))->add('locked', null, array('required' => false))->add('expired', null, array('required' => false))->add('enabled', null, array('required' => false))->add('credentialsExpired', null, array('required' => false))->end();
}
$formMapper->end()->tab('Info')->with('Profile')->add('dateOfBirth', 'birthday', array('required' => false))->add('firstname', null, array('required' => false))->add('lastname', null, array('required' => false))->add('website', 'url', array('required' => false))->add('biography', 'text', array('required' => false))->add('gender', 'sonata_user_gender', array('required' => true, 'translation_domain' => $this->getTranslationDomain()))->add('locale', 'locale', array('required' => false))->add('timezone', 'timezone', array('required' => false))->add('phone', null, array('required' => false))->end()->with('Social')->add('facebookUid', null, array('required' => false))->add('facebookName', null, array('required' => false))->add('twitterUid', null, array('required' => false))->add('twitterName', null, array('required' => false))->add('gplusUid', null, array('required' => false))->add('gplusName', null, array('required' => false))->end()->end();
$formMapper->tab('Security')->with('Two Step Verification')->add('token', null, array('required' => false))->add('twoStepVerificationCode', null, array('required' => false))->end()->end();
$formMapper->tab('Venues')->add('venues', 'sonata_type_collection', ['label' => 'Venues'])->end();
}
示例8: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
// define group zoning
$formMapper->tab('User')->with('Profile', array('class' => 'col-md-6'))->end()->with('General', array('class' => 'col-md-6'))->end()->end()->tab('Addresses')->with('Addresses', array('class' => 'col-md-6'))->end()->end()->tab('Company')->with('Info', array('class' => 'col-md-6'))->end()->end()->tab('Orders')->with('Orders', array('class' => 'col-md-12'))->end()->end()->tab('Security')->with('Status', array('class' => 'col-md-4'))->end()->with('Groups', array('class' => 'col-md-4'))->end()->with('Keys', array('class' => 'col-md-4'))->end()->with('Roles', array('class' => 'col-md-12'))->end()->end();
$now = new \DateTime();
$formMapper->tab('User')->with('General')->add('username')->add('email')->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->end()->with('Profile')->add('firstname', null, array('required' => false))->add('lastname', null, array('required' => false))->add('phone', null, array('required' => false))->add('locale', 'locale', array('required' => false))->end()->end()->tab('Company')->with('Info')->add('company', null, array('required' => false))->add('nip', null, array('required' => false))->add('regon', null, array('required' => false))->end()->end()->tab('Orders')->with('Orders')->add('customerOrders', 'sonata_type_collection', array('label' => 'Orders', 'required' => false, 'by_reference' => false), array('edit' => 'inline', 'inline' => 'standard'))->end()->end()->tab('Addresses')->with('Addresses')->add('addresses', 'sonata_type_collection', array('label' => 'Address', 'required' => false, 'by_reference' => false), array('edit' => 'inline', 'inline' => 'standard'))->end()->end();
if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
$formMapper->tab('Security')->with('Status')->add('locked', null, array('required' => false))->add('expired', null, array('required' => false))->add('enabled', null, array('required' => false))->add('credentialsExpired', null, array('required' => false))->end()->with('Groups')->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->with('Roles')->add('realRoles', 'sonata_security_roles', array('label' => 'form.label_roles', 'expanded' => true, 'multiple' => true, 'required' => false))->end()->end();
}
$formMapper->tab('Security')->with('Keys')->add('token', null, array('required' => false))->add('twoStepVerificationCode', null, array('required' => false))->end()->end();
}
示例9: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$normalUser = $this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN');
$formMapper->tab('Général')->with('Utilisateur', array('class' => 'col-md-6'))->add('username')->add('email')->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->add('firstname')->add('lastname')->add('company', null, array('label' => 'Société'))->add('legalSituation', 'choice', array('choices' => array('ei' => 'Entreprises individuelles', 'sc' => 'Sociétés civiles', 'eurl' => 'EURL', 'sarl' => 'SARL', 'sas' => 'SAS', 'sa' => 'SA'), 'label' => 'Statut juridique :'))->add('phoneNumber', 'text', array('label' => 'Téléphone :'))->add('url', 'url', array('label' => 'Url de votre site :'))->end()->with('Groups', array('class' => 'col-md-6'))->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end();
if ($normalUser) {
$formMapper->with('Management', array('class' => 'col-md-6'))->add('locked', null, array('required' => false))->add('expired', null, array('required' => false))->add('enabled', null, array('required' => false))->add('credentialsExpired', null, array('required' => false))->end();
}
$formMapper->end();
if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
$formMapper->tab('Rôles')->add('realRoles', 'sonata_security_roles', array('label' => false, 'expanded' => true, 'multiple' => true, 'required' => false))->end();
}
}
示例10: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->tab($this->getTranslator()->trans('_general_'))->add('name')->add('roles', 'sonata_security_roles', array('expanded' => true, 'multiple' => true, 'required' => false))->end()->end();
if ($this->getSubject() and !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
$acciones = explode('/', $this->getRequest()->server->get("REQUEST_URI"));
$accion = array_pop($acciones);
$accion = explode('?', $accion);
if ($accion[0] == 'edit') {
$formMapper->tab($this->getTranslator()->trans('_indicadores_y_salas_'))->add('indicadores', null, array('label' => $this->getTranslator()->trans('indicadores'), 'expanded' => true))->add('salas', null, array('label' => $this->getTranslator()->trans('_salas_situacionales_'), 'expanded' => true))->end();
}
}
}
示例11: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->tab($this->getTranslator()->trans('ficha_tecnica'))->with($this->getTranslator()->trans('_datos_generales_'), array('class' => 'col-md-8'))->end()->with($this->getTranslator()->trans('_clasificacion_'), array('class' => 'col-md-4'))->end()->end()->tab($this->getTranslator()->trans('_configuracion_'))->with($this->getTranslator()->trans('_dimensiones_'), array('class' => 'col-md-4'))->end()->with($this->getTranslator()->trans('alertas'), array('class' => 'col-md-8'))->end()->end();
$formMapper->tab($this->getTranslator()->trans('ficha_tecnica'))->with($this->getTranslator()->trans('_datos_generales_'))->add('nombre', null, array('label' => $this->getTranslator()->trans('nombre_indicador')))->add('tema', null, array('label' => $this->getTranslator()->trans('_interpretacion_')))->add('concepto', null, array('label' => $this->getTranslator()->trans('concepto')))->add('unidadMedida', null, array('label' => $this->getTranslator()->trans('unidad_medida')))->add('esAcumulado', null, array('label' => $this->getTranslator()->trans('es_acumulado')))->add('variables', null, array('label' => $this->getTranslator()->trans('variables'), 'expanded' => false, 'class' => 'IndicadoresBundle:VariableDato', 'query_builder' => function ($repository) {
return $repository->createQueryBuilder('vd')->orderBy('vd.nombre');
}))->add('formula', null, array('label' => $this->getTranslator()->trans('formula'), 'help' => $this->getTranslator()->trans('ayuda_ingreso_formula')))->add('periodo', null, array('label' => $this->getTranslator()->trans('periodicidad')))->add('confiabilidad', null, array('label' => $this->getTranslator()->trans('confiabilidad'), 'required' => false))->add('reporte', null, array('label' => $this->getTranslator()->trans('_reporte_'), 'required' => false))->add('observacion', 'textarea', array('label' => $this->getTranslator()->trans('_observacion_'), 'required' => false))->end()->with($this->getTranslator()->trans('_clasificacion_'))->add('clasificacionTecnica', null, array('label' => $this->getTranslator()->trans('clasificacion_tecnica'), 'required' => true, 'expanded' => true, 'class' => 'IndicadoresBundle:ClasificacionTecnica', 'query_builder' => function ($repository) {
return $repository->createQueryBuilder('ct')->orderBy('ct.clasificacionUso');
}))->add('clasificacionPrivacidad', null, array('label' => $this->getTranslator()->trans('_nivel_de_usuario_'), 'expanded' => true))->end()->end()->tab($this->getTranslator()->trans('_configuracion_'))->with($this->getTranslator()->trans('alertas'))->add('alertas', 'sonata_type_collection', array('label' => $this->getTranslator()->trans('alertas'), 'required' => true), array('edit' => 'inline', 'inline' => 'table', 'sortable' => 'position'))->end()->with($this->getTranslator()->trans('_dimensiones_'))->add('camposIndicador', null, array('label' => $this->getTranslator()->trans('campos_indicador')))->end()->end();
$acciones = explode('/', $this->getRequest()->server->get("REQUEST_URI"));
$accion = array_pop($acciones);
if ($accion == 'create') {
$formMapper->setHelps(array('camposIndicador' => $this->getTranslator()->trans('_debe_guardar_para_ver_dimensiones_')));
}
}
示例12: configureFormFields
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$user = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser();
$conn = $this->getConfigurationPool()->getContainer()->get('database_connection');
$cates = $conn->fetchAll("select id, name from map2u_core__layer_category where user_uuid='" . $user->getId() . "'");
$categorylist = array();
foreach ($cates as $cate) {
$categorylist[$cate['id']] = $cate['name'];
}
$sldFiles = array();
$path = $this->container->get('kernel')->getRootDir() . '/../Data';
$user = $this->container->get('security.context')->getToken()->getUser();
if (file_exists($path . '/sld/' . $user->getId())) {
foreach (glob($path . '/sld/' . $user->getId() . '/*.sld') as $file) {
$file1 = substr($file, 0, strrpos($file, '/', -1));
$file2 = substr($file, 0, strrpos($file1, '/', -1));
$sldFiles[substr($file, strlen($file2) + 1)] = substr($file, strlen($file2) + 1);
}
}
foreach (glob($path . '/sld/*.sld') as $file) {
$sldFiles[substr($file, strrpos($file, '/', -1) + 1)] = substr($file, strrpos($file, '/', -1) + 1);
}
$spatialfile_class = $this->getConfigurationPool()->getContainer()->getParameter('map2u.core.spatialfile.class');
$layercategory_class = $this->getConfigurationPool()->getContainer()->getParameter('map2u.core.layercategory.class');
$category_class = $this->getConfigurationPool()->getContainer()->getParameter('map2u.core.category.class');
$formMapper->tab('General')->with('Layer', array('class' => 'col-md-6'))->add('id', 'hidden')->add('name')->add('user')->add('spatialfile', 'entity', array('class' => $spatialfile_class, 'required' => false, 'multiple' => false, 'expanded' => false))->add('layerCategory', 'entity', array('class' => "Map2u\\CoreBundle\\Entity\\LayerCategory", 'required' => false, 'multiple' => false, 'expanded' => false))->add('category', 'entity', array('class' => "Map2u\\CoreBundle\\Entity\\Category", 'required' => false, 'multiple' => false, 'expanded' => false))->add('enabled')->add('public')->add('position')->end()->with('Layer Translation', array('class' => 'col-md-6'))->add('translations', 'a2lix_translations', array('by_reference' => false, 'required' => false))->end()->end()->tab('WMS and WFS Layer')->with('WMS and WFS Layer Settings', array('class' => 'col-md-6'))->add('hostName', 'text', array('mapped' => false, 'required' => false))->add('layerName', 'text', array('mapped' => false, 'required' => false))->add('srs', 'text', array('mapped' => false, 'required' => false))->add('layerType', 'choice', array('mapped' => false, 'choices' => array('wms' => 'WMS', 'wfs' => 'WFS')))->end()->end()->tab('Heat Map Layer')->with('Heat Map Layer Settings', array('class' => 'col-md-6'))->add('fieldname', 'text', array('mapped' => false, 'required' => false))->add('radius', 'text', array('mapped' => false, 'required' => false))->add('opacity', 'number', array('mapped' => false, 'required' => false))->add('gradient', 'text', array('mapped' => false, 'required' => false))->end()->end()->tab('Cluster Layer')->with('Cluster Settings', array('class' => 'col-md-6'))->add('showCoverageOnHover', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('zoomToBoundsOnClick', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('spiderfyOnMaxZoom', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('removeOutsideVisibleBounds', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('animateAddingMarkers', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('disableClusteringAtZoom', 'integer', array('mapped' => false, 'required' => false))->add('maxClusterRadius', 'number', array('mapped' => false, 'required' => false, 'data' => 80))->add('polygonOptions', 'text', array('mapped' => false, 'required' => false))->add('singleMarkerMode', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('spiderfyDistanceMultiplier', 'integer', array('mapped' => false, 'required' => false, 'data' => 1))->add('iconCreateFunction', 'text', array('mapped' => false, 'required' => false))->end()->end()->tab('Style and Settings')->with('Layer Style', array('class' => 'col-md-6'))->add('shared')->add('layerProperty')->add('showLabel')->add('defaultShowOnMap')->add('layerShowInSwitcher')->add('zoomLevel')->add('defaultSldName', 'choice', array('mapped' => false, 'choices' => $sldFiles, 'label' => 'Default SLD File'))->add('uploadSldName', 'file', array('mapped' => false, 'required' => false, 'label' => 'Upload SLD File', 'attr' => array('style' => 'border: none')))->end()->with('Layer Settings', array('class' => 'col-md-6'))->add('lat')->add('lng')->add('type')->add('valueField')->add('sld')->add('sqltext')->end()->end();
}
示例13: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$subscriber = new AddMenuTypeFieldSubscriber($formMapper->getFormBuilder()->getFormFactory());
$formMapper->getFormBuilder()->addEventSubscriber($subscriber);
// Getting the container parameters set in the config file that exist
$menuSettings = $this->getConfigurationPool()->getContainer()->getParameter('menu_settings');
// Setting up the available actions
$actionsChoice = $menuSettings['actions'];
reset($actionsChoice);
$prefActionsChoice = key($actionsChoice);
// Setting up the available menu types
$menuTypeChoice = $menuSettings['menutypes'];
reset($menuTypeChoice);
$prefMenuTypeChoice = key($menuTypeChoice);
// Setting up the available menu groups
$menuGroupsChoice = $menuSettings['menugroups'];
reset($menuGroupsChoice);
$prefMenuGroupsChoice = key($menuGroupsChoice);
// Setting up the available page types and preffered choice
$accessLevelChoices = $menuSettings['accessLevel'];
reset($accessLevelChoices);
$prefAccessLevelChoices = key($accessLevelChoices);
// Setting up the available publish states and preffered choice
$publishStateChoices = $menuSettings['publishState'];
reset($publishStateChoices);
$prefPublishStateChoices = key($publishStateChoices);
$menus = $this->getConfigurationPool()->getContainer()->get('doctrine.orm.entity_manager')->getRepository('MenuBundle:Menu')->findAll();
$menusChoice['-'] = 'Hide From Menu';
$menusChoice['0'] = 'Menu Root';
foreach ($menus as $menu) {
$menusChoice[$menu->getId()] = $menu->getTitle() . ' (' . $menu->getMenuGroup() . ')';
}
$formMapper->tab('Menu Item Essential Details')->with('Menu Item Essential Details', array('collapsed' => true))->add('title', null, array('label' => 'Title', 'required' => true))->add('menuType', 'choice', array('choices' => $menuTypeChoice, 'preferred_choices' => array($prefMenuTypeChoice), 'label' => 'Menu Item Type', 'required' => true))->add('route', 'choice', array('choices' => $actionsChoice, 'preferred_choices' => array($prefActionsChoice), 'label' => 'Link Action', 'required' => true))->setHelps(array('title' => 'Set the title of the menu item (link copy text)', 'menuType' => 'Set the type of the menu item linked page', 'route' => 'Select the action of the menu item'))->end()->end()->tab('Menu Item Taxonomy')->with('Menu Item Taxonomy', array('collapsed' => true))->add('menuGroup', 'choice', array('choices' => $menuGroupsChoice, 'preferred_choices' => array($prefMenuGroupsChoice), 'label' => 'Menu Group', 'required' => true))->add('parent', 'choice', array('choices' => $menusChoice, 'attr' => array('class' => 'autoCompleteItems autoCompleteMenus', 'data-sonata-select2' => 'false'), 'label' => 'Parent Menu Item', 'required' => false))->add('ordering', null, array('label' => 'Menu Item Order', 'required' => true))->setHelps(array('menuGroup' => 'Set the menu group this menu item belongs to', 'parent' => 'Select the parent menu item', 'ordering' => 'Set the order of the menu item in accordance to the other menu items of the same menu level'))->end()->end()->tab('Menu Item Access Control')->with('Menu Item Access Control', array('collapsed' => true))->add('accessLevel', 'choice', array('choices' => $accessLevelChoices, 'preferred_choices' => array($prefAccessLevelChoices), 'label' => 'Access Level', 'required' => true))->add('publishState', 'choice', array('choices' => $publishStateChoices, 'preferred_choices' => array($prefPublishStateChoices), 'label' => 'Publish State', 'required' => true))->setHelps(array('accessLevel' => 'Set the minimum access level the item is visible to', 'publishState' => 'Set the publish state of this menu item'))->end()->end()->tab('Menu Item Optional Details')->with('Menu Item Optional Details', array('collapsed' => true))->add('menuImage', 'sonata_media_type', array('provider' => 'sonata.media.provider.image', 'context' => 'icons', 'attr' => array('class' => 'imagefield'), 'label' => 'Menu Icon Image', 'required' => false))->setHelps(array('menuImage' => 'Set an image as Menu Icon'))->end();
}
示例14: configureFormFields
/**
* @param FormMapper $formMapper
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->tab('Text')->with('Text')->add('author')->add('shortText')->add('text')->add('createdDate')->add('status', 'choice', array('choices' => array(UserPost::STATUS_PUBLISH => 'PUBLISH', UserPost::STATUS_HIDDEN => 'HIDDEN')))->add('title')->add('isPopular', 'choice', array('choices' => array(UserPost::STATUS_POPULAR => 'POPULAR', UserPost::STATUS_NOT_POPULAR => 'NOT POPULAR')))->end()->end();
// ->tab('Text2')
//// ->add('author', 'text', array('label' => 'Post Title'))
// ->end();
}
示例15: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$query = $this->modelManager->getEntityManager('DN\\TMBundle\\Entity\\Category')->createQuery('SELECT c FROM DN\\TMBundle\\Entity\\Category c WHERE c.isMain = false');
// $arrayType = $query->getArrayResult();
// var_dump($arrayType);die;
$formMapper->tab('General')->with('Category')->add('id', 'text', array('label' => 'label.id', 'required' => false, 'read_only' => true, 'disabled' => true))->add('kvsId', 'text', array('label' => 'label.kvsId', 'required' => false, 'read_only' => true, 'disabled' => true))->add('title', 'text', array('label' => 'label.title'))->add('slug', 'text', array('label' => 'page url'))->add('kvsName', 'text', array('label' => 'kvs name', 'read_only' => true, 'disabled' => true, 'required' => false))->add('active', null, array('label' => 'active', 'required' => false))->add('isMain', null, array('label' => 'is main?', 'required' => false))->add('isShownInLists', null, array('label' => 'is shown in menu lists?', 'required' => false))->add('parent', 'sonata_type_model', array('label' => 'label.parent', 'required' => false, 'btn_add' => false, 'property' => 'detailedName'))->end()->end()->tab('SEO')->with('SEO data')->add('seoFields', 'collection', array('label' => 'label.seoFields', 'by_reference' => false, 'type' => $this->container->get('dn.tm.form.type.category_seo'), 'required' => false, 'allow_add' => true, 'allow_delete' => true))->end()->end();
}