File: /var/www/dvpis2025/dvpis.kaunokolegija.lt/src/Form/MeovLecturerNewType.php
<?php
namespace App\Form;
use App\Entity\FiveYearLecturerPlan;
use App\Repository\FiveYearLecturerPlanRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
class MeovLecturerNewType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('meov', null, ['label' => 'Veikla', 'attr' => ['class' => 'select2'],])
->add('lecturer', null, ['label' => 'Dėstytojas', 'attr' => ['class' => 'select2'],])
->add('semester', ChoiceType::class, [
'label' => 'Semestras',
'choices' => [
'Pavasario' => '2',
'Rudens' => '1',
]
])
->add('hoursFact', null, ['label' => 'Faktinės valandos'])
->add('descriptionFact', null, [
'label' => 'Aprašymas',
'required' => true,
'empty_data' => '',
])
->add('fiveYearLecturerPlan', EntityType::class, [
'class' => FiveYearLecturerPlan::class,
'query_builder' => function (FiveYearLecturerPlanRepository $repository) {
return $repository->findFiveYearActivityPlans();
},
'label' => '5 metų plano veikla',
'placeholder' => '-',
'required' => false,
'attr' => [
'class' => 'select2',
],
])
;
if ($options['isEnabledDepartmentHeadComment']) {
$builder->add('departmentHeadDescriptionFact', null, [
'label' => 'Katedros vedėjo / akademijos vadovo / centro vadovo pastabos',
'required' => false,
'empty_data' => '',
]);
}
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'App\Entity\MeovLecturer',
'isEnabledDepartmentHeadComment' => false,
));
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'App_meovlecturer';
}
}