blob: 145be5ba53f6735ea3d25c16e7ca3cdf71b22faf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<?php
namespace Icinga\Module\Director\Web\Form;
use Icinga\Application\Icinga;
use Icinga\Module\Director\Db;
abstract class DirectorForm extends QuickForm
{
/** @var Db */
protected $db;
/**
* @param Db $db
* @return $this
*/
public function setDb(Db $db)
{
$this->db = $db;
return $this;
}
/**
* @return Db
*/
public function getDb()
{
return $this->db;
}
/**
* @return static
*/
public static function load()
{
return new static([
'icingaModule' => Icinga::App()->getModuleManager()->getModule('director')
]);
}
public function addBoolean($key, $options, $default = null)
{
if ($default === null) {
return $this->addElement('OptionalYesNo', $key, $options);
} else {
$this->addElement('YesNo', $key, $options);
return $this->getElement($key)->setValue($default);
}
}
protected function optionalBoolean($key, $label, $description)
{
return $this->addBoolean($key, array(
'label' => $label,
'description' => $description
));
}
}
|