|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace flightlog\form; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* FlightForm class |
|
10
|
|
|
* |
|
11
|
|
|
* @author Laurent De Coninck <[email protected]> |
|
12
|
|
|
*/ |
|
13
|
|
|
class FlightForm extends Form |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @param \ValidatorInterface $validator |
|
17
|
|
|
* @param \Bbcvols $baseObject |
|
18
|
|
|
* @param \DoliDB $db |
|
19
|
|
|
*/ |
|
20
|
|
|
public function __construct(\ValidatorInterface $validator, $baseObject, \DoliDB $db, $options) |
|
21
|
|
|
{ |
|
22
|
|
|
|
|
23
|
|
|
parent::__construct('flight_form', FormInterface::METHOD_POST, $this->buildOptionsfromConfiguration($options)); |
|
24
|
|
|
|
|
25
|
|
|
$this->setValidator($validator) |
|
26
|
|
|
->bind($baseObject); |
|
27
|
|
|
|
|
28
|
|
|
$this |
|
29
|
|
|
->add(new Hidden('idBBC_vols')) |
|
30
|
|
|
->add(new Input('lieuD')) |
|
31
|
|
|
->add(new Input('lieuA')) |
|
32
|
|
|
->add(new Select('BBC_ballons_idBBC_ballons')) |
|
33
|
|
|
->add(new Number('nbrPax')) |
|
34
|
|
|
->add(new InputTextarea('remarque')) |
|
35
|
|
|
->add(new InputTextarea('incidents')) |
|
36
|
|
|
->add(new InputTextarea('passengerNames')) |
|
37
|
|
|
->add((new FlightTypeSelect('fk_type', [], $db))) |
|
38
|
|
|
->add(new UserSelect('fk_pilot', $this->getOptions(), $db)) |
|
39
|
|
|
->add(new UserSelect('fk_organisateur', $this->getOptions(), $db)) |
|
40
|
|
|
->add(new UserSelect('fk_receiver', $this->getOptions(), $db)) |
|
41
|
|
|
->add(new Number('kilometers')) |
|
42
|
|
|
->add(new Number('cost')) |
|
43
|
|
|
->add(new InputTextarea('justif_kilometers')); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @param \stdClass $options |
|
48
|
|
|
* |
|
49
|
|
|
* @return array |
|
50
|
|
|
*/ |
|
51
|
|
|
private function buildOptionsfromConfiguration($options) |
|
52
|
|
|
{ |
|
53
|
|
|
$values = []; |
|
54
|
|
|
|
|
55
|
|
|
foreach ($options as $value){ |
|
|
|
|
|
|
56
|
|
|
$values[] = $value; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
return $values; |
|
60
|
|
|
|
|
61
|
|
|
} |
|
62
|
|
|
} |