mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-02 22:44:33 +02:00
Used PHP_CS_Fixer with symfony preset on codebase.
This commit is contained in:
parent
0f3ba9b6a8
commit
e2f7aafa2d
43 changed files with 971 additions and 1068 deletions
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
* http://www.cl-projects.de/.
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
|
@ -26,12 +25,10 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\Category;
|
||||
use App\Entity\Manufacturer;
|
||||
use App\Entity\Part;
|
||||
|
@ -39,7 +36,6 @@ use App\Entity\Storelocation;
|
|||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
|
@ -58,39 +54,38 @@ class PartType extends AbstractType
|
|||
$this->security = $security;
|
||||
}
|
||||
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$part = $options['data'];
|
||||
|
||||
$builder
|
||||
->add('name', TextType::class, ['empty_data'=>'', 'label'=> 'name.label',
|
||||
->add('name', TextType::class, ['empty_data' => '', 'label' => 'name.label',
|
||||
'attr' => ['placeholder' => 'part.name.placeholder'],
|
||||
'disabled' => !$this->security->isGranted('name.edit', $part)])
|
||||
->add('description', TextType::class, ['required'=>false, 'empty_data'=>'',
|
||||
'label'=> 'description.label', 'help' => 'bbcode.hint', 'attr' => ['placeholder' => 'part.description.placeholder'],
|
||||
'disabled' => !$this->security->isGranted('description.edit', $part)])
|
||||
'disabled' => !$this->security->isGranted('name.edit', $part), ])
|
||||
->add('description', TextType::class, ['required' => false, 'empty_data' => '',
|
||||
'label' => 'description.label', 'help' => 'bbcode.hint', 'attr' => ['placeholder' => 'part.description.placeholder'],
|
||||
'disabled' => !$this->security->isGranted('description.edit', $part), ])
|
||||
->add('instock', IntegerType::class,
|
||||
['attr' => ['min'=>0, 'placeholder' => 'part.instock.placeholder'], 'label'=> 'instock.label',
|
||||
'disabled' => !$this->security->isGranted('instock.edit', $part)])
|
||||
['attr' => ['min' => 0, 'placeholder' => 'part.instock.placeholder'], 'label' => 'instock.label',
|
||||
'disabled' => !$this->security->isGranted('instock.edit', $part), ])
|
||||
->add('mininstock', IntegerType::class,
|
||||
['attr' => ['min'=>0, 'placeholder' => 'part.mininstock.placeholder'], 'label'=> 'mininstock.label',
|
||||
'disabled' => !$this->security->isGranted('mininstock.edit', $part)])
|
||||
['attr' => ['min' => 0, 'placeholder' => 'part.mininstock.placeholder'], 'label' => 'mininstock.label',
|
||||
'disabled' => !$this->security->isGranted('mininstock.edit', $part), ])
|
||||
->add('category', EntityType::class, ['class' => Category::class, 'choice_label' => 'full_path',
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true], 'label'=> 'category.label',
|
||||
'disabled' => !$this->security->isGranted('move', $part)])
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true], 'label' => 'category.label',
|
||||
'disabled' => !$this->security->isGranted('move', $part), ])
|
||||
->add('storelocation', EntityType::class, ['class' => Storelocation::class, 'choice_label' => 'full_path',
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true], 'required' => false, 'label'=> 'storelocation.label',
|
||||
'disabled' => !$this->security->isGranted('storelocation.edit', $part)])
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true], 'required' => false, 'label' => 'storelocation.label',
|
||||
'disabled' => !$this->security->isGranted('storelocation.edit', $part), ])
|
||||
->add('manufacturer', EntityType::class, ['class' => Manufacturer::class, 'choice_label' => 'full_path',
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true], 'required' => false, 'label'=> 'manufacturer.label',
|
||||
'disabled' => !$this->security->isGranted('manufacturer.edit', $part)])
|
||||
->add('manufacturer_product_url', UrlType::class, ['required'=>false, 'empty_data' => '',
|
||||
'label'=> 'manufacturer_url.label',
|
||||
'disabled' => !$this->security->isGranted('manufacturer.edit', $part)])
|
||||
->add('comment', CKEditorType::class, ['required'=>false,
|
||||
'label'=> 'comment.label', 'attr' => ['rows'=> 4], 'help' => 'bbcode.hint',
|
||||
'disabled' => !$this->security->isGranted('comment.edit', $part)])
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true], 'required' => false, 'label' => 'manufacturer.label',
|
||||
'disabled' => !$this->security->isGranted('manufacturer.edit', $part), ])
|
||||
->add('manufacturer_product_url', UrlType::class, ['required' => false, 'empty_data' => '',
|
||||
'label' => 'manufacturer_url.label',
|
||||
'disabled' => !$this->security->isGranted('manufacturer.edit', $part), ])
|
||||
->add('comment', CKEditorType::class, ['required' => false,
|
||||
'label' => 'comment.label', 'attr' => ['rows' => 4], 'help' => 'bbcode.hint',
|
||||
'disabled' => !$this->security->isGranted('comment.edit', $part), ])
|
||||
|
||||
//Buttons
|
||||
->add('save', SubmitType::class, ['label' => 'part.edit.save'])
|
||||
|
@ -100,7 +95,7 @@ class PartType extends AbstractType
|
|||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Part::class
|
||||
'data_class' => Part::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ use App\Entity\User;
|
|||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\LanguageType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\LocaleType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ResetType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
@ -25,37 +24,34 @@ class UserSettingsType extends AbstractType
|
|||
$this->security = $security;
|
||||
}
|
||||
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('name', TextType::class, ['label'=>'user.username.label',
|
||||
'disabled' => !$this->security->isGranted('edit_username', $options['data'])])
|
||||
->add('name', TextType::class, ['label' => 'user.username.label',
|
||||
'disabled' => !$this->security->isGranted('edit_username', $options['data']), ])
|
||||
->add('first_name', TextType::class, ['required' => false,
|
||||
'label'=>'user.firstName.label',
|
||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data'])])
|
||||
'label' => 'user.firstName.label',
|
||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data']), ])
|
||||
->add('last_name', TextType::class, ['required' => false,
|
||||
'label'=>'user.lastName.label',
|
||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data'])])
|
||||
'label' => 'user.lastName.label',
|
||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data']), ])
|
||||
->add('department', TextType::class, ['required' => false,
|
||||
'label'=>'user.department.label',
|
||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data'])])
|
||||
'label' => 'user.department.label',
|
||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data']), ])
|
||||
->add('email', EmailType::class, ['required' => false,
|
||||
'label'=>'user.email.label',
|
||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data'])])
|
||||
'label' => 'user.email.label',
|
||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data']), ])
|
||||
->add('language', LocaleType::class, ['required' => false,
|
||||
'attr'=>['class'=> 'selectpicker', 'data-live-search' => true]
|
||||
, 'placeholder' => 'user_settings.language.placeholder', 'label'=>'user.language_select'])
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true], 'placeholder' => 'user_settings.language.placeholder', 'label' => 'user.language_select', ])
|
||||
->add('timezone', TimezoneType::class, ['required' => false,
|
||||
'attr'=>['class'=> 'selectpicker', 'data-live-search' => true],
|
||||
'placeholder' => 'user_settings.timezone.placeholder', 'label'=>'user.timezone.label'])
|
||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
||||
'placeholder' => 'user_settings.timezone.placeholder', 'label' => 'user.timezone.label', ])
|
||||
->add('theme', ChoiceType::class, ['required' => false,
|
||||
'placeholder' => 'user_settings.theme.placeholder', 'label'=>'user.theme.label'])
|
||||
'placeholder' => 'user_settings.theme.placeholder', 'label' => 'user.theme.label', ])
|
||||
|
||||
//Buttons
|
||||
->add('save', SubmitType::class, ['label' => 'save'])
|
||||
->add('reset', ResetType::class, ['label' => 'reset']);
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue