1 | 2 | simandl | <?php |
2 | | | |
3 | | | namespace Phem\Libraries\Security\Model\Common; |
4 | | | |
5 | | | use Phem\Core\Object; |
6 | | | use Phem\Libraries\Forms\Annotations\GeneratedValue; |
7 | | | use Phem\Libraries\Forms\Annotations\Input; |
8 | | | use Phem\Libraries\Forms\Annotations\Form; |
9 | | | use Phem\Libraries\Forms\Annotations\SignGroup; |
10 | | | use Phem\Libraries\Forms\Annotations\Group as AnnotationGroup; |
11 | | | use Phem\Environment\EnvironmentManager; |
12 | | | |
13 | | | /** |
14 | | | * @Form(defaultGroup="newTask") |
15 | | | * @AnnotationGroup(name="newTask", caption="NovĂ˝ Task", order="3") |
16 | | | */ |
17 | | | class Task extends Object |
18 | | | { |
19 | | | |
20 | | | /** |
21 | | | * @GeneratedValue |
22 | | | */ |
23 | | | protected $id; |
24 | | | /** |
25 | | | * @Phem\Libraries\Forms\Annotations\Select(caption="Kontroler", options="getControllers", required=true, order=2) |
26 | | | */ |
27 | | | protected $controller; |
28 | | | /** |
29 | | | * @Input(type="text", caption="Nazev", required=true, order=1) |
30 | | | */ |
31 | | | protected $name; |
32 | | | /** |
33 | | | * @Input(type="text", caption="Popisek") |
34 | | | */ |
35 | | | protected $description; |
36 | | | |
37 | | | public function getId() |
38 | | | { |
39 | | | return $this->id; |
40 | | | } |
41 | | | |
42 | | | public function setId($id) |
43 | | | { |
44 | | | $this->id = $id; |
45 | | | } |
46 | | | |
47 | | | public function getController() |
48 | | | { |
49 | | | return $this->controller; |
50 | | | } |
51 | | | |
52 | | | public function setController($controller) |
53 | | | { |
54 | | | $this->controller = $controller; |
55 | | | } |
56 | | | |
57 | | | public function getName() |
58 | | | { |
59 | | | return $this->name; |
60 | | | } |
61 | | | |
62 | | | public function setName($name) |
63 | | | { |
64 | | | $this->name = $name; |
65 | | | } |
66 | | | |
67 | | | public function getDescription() |
68 | | | { |
69 | | | return $this->description; |
70 | | | } |
71 | | | |
72 | | | public function setDescription($description) |
73 | | | { |
74 | | | $this->description = $description; |
75 | | | } |
76 | | | |
77 | | | public static function getControllers() |
78 | | | { |
79 | | | $opt = new \Phem\Core\Collection(); |
80 | | | $em = EnvironmentManager::getEntityManager(); |
81 | | | $controllers = $em->getRepository('Phem\Libraries\Security\Model\MySQL\Controller')->findAll(); |
82 | | | foreach($controllers as $c) |
83 | | | { |
84 | | | $value = $c->getName(); |
85 | | | $value.= ($c->getDescription() == null ? "" : " - ".$c->getDescription()); |
86 | | | $opt->put($c->getId(), $value); |
87 | | | } |
88 | | | return $opt; |
89 | | | } |
90 | | | |
91 | | | } |