mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
75 lines
2.7 KiB
PHP
75 lines
2.7 KiB
PHP
<?php
|
|
/*
|
|
* Copyright (C) 2018 Champs Libres Cooperative <info@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/>.
|
|
*/
|
|
namespace Chill\TaskBundle\Form;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
|
use Chill\MainBundle\Form\Type\UserPickerType;
|
|
use Chill\MainBundle\Form\Type\ScopePickerType;
|
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Security\Core\Role\Role;
|
|
|
|
/**
|
|
*
|
|
*
|
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
*/
|
|
class SingleTaskType extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
$builder
|
|
->add('title', TextType::class)
|
|
->add('description', TextareaType::class, [
|
|
'required' => false
|
|
])
|
|
->add('assignee', UserPickerType::class, [
|
|
'required' => false,
|
|
'center' => $options['center'],
|
|
'role' => new Role(\Chill\PersonBundle\Security\Authorization\PersonVoter::UPDATE)
|
|
])
|
|
->add('circle', ScopePickerType::class, [
|
|
'center' => $options['center'],
|
|
'role' => new Role(\Chill\ActivityBundle\Security\Authorization\ActivityVoter::SEE)
|
|
])
|
|
->add('startDate', ChillDateType::class, [
|
|
'required' => false
|
|
])
|
|
->add('endDate', ChillDateType::class, [
|
|
'required' => false
|
|
])
|
|
->add('warningInterval', TextType::class, [
|
|
'required' => false
|
|
])
|
|
;
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
{
|
|
$resolver
|
|
->setRequired('center')
|
|
->setAllowedTypes('center', [ \Chill\MainBundle\Entity\Center::class ])
|
|
;
|
|
}
|
|
}
|