1 | 2 | simandl | <?php |
2 | | | |
3 | | | namespace Phem\Libraries\Forms\Model; |
4 | | | |
5 | | | /** |
6 | | | * @Entity(readOnly=true) @Table(name="povruc_form") |
7 | | | * |
8 | | | */ |
9 | | | class Form |
10 | | | { |
11 | | | |
12 | | | /** @Id @Column(type="integer") */ |
13 | | | private $id; |
14 | | | |
15 | | | /** @Column(type="string") */ |
16 | | | private $name; |
17 | | | |
18 | | | /** @Column(type="string") */ |
19 | | | private $method; |
20 | | | |
21 | | | /** @Column(type="string") */ |
22 | | | private $action; |
23 | | | |
24 | | | /** @Column(type="integer") */ |
25 | | | private $highlightPrefilled; |
26 | | | |
27 | | | /** |
28 | | | * |
29 | | | * @OneToMany(targetEntity="FormGroup", mappedBy="form",cascade={"all"}) |
30 | | | * @OrderBy({"order" = "ASC"}) |
31 | | | * @var \Phem\Core\Collection Description |
32 | | | */ |
33 | | | private $groups; |
34 | | | private $showErrors; |
35 | | | private $ajax; |
36 | | | protected $submittedButton; |
37 | | | protected $defaultGroup; |
38 | | | protected $criticalFields; |
39 | | | |
40 | | | public function getId() |
41 | | | { |
42 | | | return $this->id; |
43 | | | } |
44 | | | |
45 | | | public function setId($id) |
46 | | | { |
47 | | | $this->id = $id; |
48 | | | } |
49 | | | |
50 | | | public function getName() |
51 | | | { |
52 | | | return $this->name; |
53 | | | } |
54 | | | |
55 | | | public function setName($name) |
56 | | | { |
57 | | | $this->name = $name; |
58 | | | } |
59 | | | |
60 | | | public function getMethod() |
61 | | | { |
62 | | | return $this->method; |
63 | | | } |
64 | | | |
65 | | | public function setMethod($method) |
66 | | | { |
67 | | | $this->method = $method; |
68 | | | } |
69 | | | |
70 | | | public function getAction() |
71 | | | { |
72 | | | return $this->action; |
73 | | | } |
74 | | | |
75 | | | public function setAction($action) |
76 | | | { |
77 | | | $this->action = $action; |
78 | | | } |
79 | | | |
80 | | | public function getGroups() |
81 | | | { |
82 | | | return $this->groups; |
83 | | | } |
84 | | | |
85 | | | public function setGroups($groups) |
86 | | | { |
87 | | | $this->groups = $groups; |
88 | | | } |
89 | | | |
90 | | | public function getShowErrors() |
91 | | | { |
92 | | | return $this->showErrors; |
93 | | | } |
94 | | | |
95 | | | public function setShowErrors($showErrors) |
96 | | | { |
97 | | | $this->showErrors = $showErrors; |
98 | | | } |
99 | | | |
100 | | | public function getHighlightPrefilled() |
101 | | | { |
102 | | | return $this->highlightPrefilled; |
103 | | | } |
104 | | | |
105 | | | public function setHighlightPrefilled($highlightPrefilled) |
106 | | | { |
107 | | | $this->highlightPrefilled = $highlightPrefilled; |
108 | | | } |
109 | | | |
110 | | | public function getDefaultGroup() |
111 | | | { |
112 | | | return $this->defaultGroup; |
113 | | | } |
114 | | | |
115 | | | public function setDefaultGroup($defaultGroup) |
116 | | | { |
117 | | | $this->defaultGroup = $defaultGroup; |
118 | | | } |
119 | | | |
120 | | | public function getCriticalFields() |
121 | | | { |
122 | | | return $this->criticalFields; |
123 | | | } |
124 | | | |
125 | | | public function setCriticalFields($criticalFields) |
126 | | | { |
127 | | | $this->criticalFields = $criticalFields; |
128 | | | } |
129 | | | |
130 | | | public function getAjax() |
131 | | | { |
132 | | | return $this->ajax; |
133 | | | } |
134 | | | |
135 | | | public function setAjax($ajax) |
136 | | | { |
137 | | | $this->ajax = $ajax; |
138 | | | } |
139 | | | |
140 | | | public function getSubmittedButton() |
141 | | | { |
142 | | | return $this->submittedButton; |
143 | | | } |
144 | | | |
145 | | | public function setSubmittedButton($submittedButton) |
146 | | | { |
147 | | | $this->submittedButton = $submittedButton; |
148 | | | } |
149 | | | |
150 | | | public function getGroup($id) |
151 | | | { |
152 | | | foreach ($this->getGroups() as $group) |
153 | | | { |
154 | | | if ($group->getId() == $id) |
155 | | | return $group; |
156 | | | } |
157 | | | } |
158 | | | |
159 | | | public function getField($id) |
160 | | | { |
161 | | | foreach ($this->getGroups() as $group) |
162 | | | { |
163 | | | foreach ($group->getFields() as $field) |
164 | | | { |
165 | | | if ($field->getId() == $id) |
166 | | | return $field; |
167 | | | } |
168 | | | } |
169 | | | } |
170 | | | |
171 | | | } |