mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 11:33:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,69 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\ReportBundle\Form;
|
||||
|
||||
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
|
||||
use Chill\MainBundle\Form\Type\AppendScopeChoiceTypeTrait;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Chill\MainBundle\Form\Type\AppendScopeChoiceTypeTrait;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
|
||||
|
||||
class ReportType extends AbstractType
|
||||
{
|
||||
use AppendScopeChoiceTypeTrait;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $authorizationHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var \Doctrine\Persistence\ObjectManager
|
||||
*/
|
||||
protected $om;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TranslatableStringHelper
|
||||
*/
|
||||
protected $translatableStringHelper;
|
||||
|
||||
/**
|
||||
* @var \Chill\MainBundle\Entity\User
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
public function __construct(AuthorizationHelper $helper,
|
||||
public function __construct(
|
||||
AuthorizationHelper $helper,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
TranslatableStringHelper $translatableStringHelper,
|
||||
ObjectManager $om)
|
||||
ObjectManager $om
|
||||
)
|
||||
{
|
||||
$this->authorizationHelper = $helper;
|
||||
$this->user = $tokenStorage->getToken()->getUser();
|
||||
@@ -71,40 +57,42 @@ class ReportType extends AbstractType
|
||||
$this->om = $om;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('user')
|
||||
->add('date', ChillDateType::class,
|
||||
array('required' => true)
|
||||
->add(
|
||||
'date',
|
||||
ChillDateType::class,
|
||||
['required' => true]
|
||||
)
|
||||
->add('cFData', CustomFieldType::class,
|
||||
array('attr' => array('class' => 'cf-fields'),
|
||||
'group' => $options['cFGroup']))
|
||||
;
|
||||
->add(
|
||||
'cFData',
|
||||
CustomFieldType::class,
|
||||
['attr' => ['class' => 'cf-fields'],
|
||||
'group' => $options['cFGroup'], ]
|
||||
);
|
||||
|
||||
$this->appendScopeChoices($builder, $options['role'], $options['center'],
|
||||
$this->user, $this->authorizationHelper,
|
||||
$this->translatableStringHelper,
|
||||
$this->om);
|
||||
$this->appendScopeChoices(
|
||||
$builder,
|
||||
$options['role'],
|
||||
$options['center'],
|
||||
$this->user,
|
||||
$this->authorizationHelper,
|
||||
$this->translatableStringHelper,
|
||||
$this->om
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsResolver $resolver
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Chill\ReportBundle\Entity\Report'
|
||||
));
|
||||
$resolver->setDefaults([
|
||||
'data_class' => 'Chill\ReportBundle\Entity\Report',
|
||||
]);
|
||||
|
||||
$resolver->setRequired(array(
|
||||
$resolver->setRequired([
|
||||
'cFGroup',
|
||||
));
|
||||
]);
|
||||
|
||||
$resolver->setAllowedTypes('cFGroup', 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup');
|
||||
|
||||
|
Reference in New Issue
Block a user