1
|
<?php
|
2
|
|
3
|
namespace App\Form\Type;
|
4
|
|
5
|
use App\Entity\DataSet;
|
6
|
use Symfony\Component\Form\AbstractType;
|
7
|
use Symfony\Component\Form\FormBuilderInterface;
|
8
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
9
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
10
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
11
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
12
|
|
13
|
class DataSetType extends AbstractType {
|
14
|
public function buildForm(FormBuilderInterface $builder, array $options) {
|
15
|
$builder
|
16
|
->add('date', TextType::class)
|
17
|
->add('time', ChoiceType::class, [
|
18
|
'choices' => [
|
19
|
'0:00-1:00' => 0,
|
20
|
'1:00-2:00' => 1,
|
21
|
'2:00-3:00' => 2,
|
22
|
'3:00-4:00' => 3,
|
23
|
'4:00-5:00' => 4,
|
24
|
'5:00-6:00' => 5,
|
25
|
'6:00-7:00' => 6,
|
26
|
'7:00-8:00' => 7,
|
27
|
'8:00-9:00' => 8,
|
28
|
'9:00-10:00' => 9,
|
29
|
'10:00-11:00' => 10,
|
30
|
'11:00-12:00' => 11,
|
31
|
'12:00-13:00' => 12,
|
32
|
'13:00-14:00' => 13,
|
33
|
'14:00-15:00' => 14,
|
34
|
'15:00-16:00' => 15,
|
35
|
'16:00-17:00' => 16,
|
36
|
'17:00-18:00' => 17,
|
37
|
'18:00-19:00' => 18,
|
38
|
'19:00-20:00' => 19,
|
39
|
'20:00-21:00' => 20,
|
40
|
'21:00-22:00' => 21,
|
41
|
'22:00-23:00' => 22,
|
42
|
'23:00-0:00' => 23,
|
43
|
],
|
44
|
])
|
45
|
->add('type', ChoiceType::class, [
|
46
|
'choices' => [
|
47
|
'Wi-Fi a drátové připojení' => 0,
|
48
|
'JIS snímače' => 1,
|
49
|
'Koloběžky' => 2,
|
50
|
],
|
51
|
])
|
52
|
->add('submit', SubmitType::class);
|
53
|
}
|
54
|
|
55
|
public function configureOptions(OptionsResolver $resolver) {
|
56
|
$resolver->setDefaults([
|
57
|
'data_class' => DataSet::class,
|
58
|
]);
|
59
|
}
|
60
|
}
|