@@ 161-198 (lines=38) @@ | ||
158 | $output .= $this->fieldHelper->formCreate($fields); |
|
159 | break; |
|
160 | case 'form-edit': |
|
161 | foreach ($fields as $f) { |
|
162 | $ucF = ucfirst($f); |
|
163 | ||
164 | $input_attr = [ |
|
165 | 'class' => 'form-control', |
|
166 | 'id' => 'editItem'.$ucF, |
|
167 | 'name' => $f, |
|
168 | ]; |
|
169 | ||
170 | $output .= '<fieldset class="form-group">'; |
|
171 | ||
172 | $output .= '<label for="'.$input_attr['id'].'">'.$ucF.'</label>'; |
|
173 | ||
174 | if ($this->fieldHelper->isIdField($f)) { |
|
175 | $input_attr['type'] = 'select'; |
|
176 | ||
177 | $output .= '<select '; |
|
178 | foreach ($input_attr as $attr => $value) { |
|
179 | $output .= "{$attr}='{$value}'"; |
|
180 | } |
|
181 | ||
182 | $relation = $this->getRelatedModel($f); |
|
183 | $output .= '>'; |
|
184 | ||
185 | $output .= $this->getRelatedOptions($relation); |
|
186 | $output .= '</select>'; |
|
187 | } else { |
|
188 | $input_attr['type'] = 'text'; |
|
189 | ||
190 | $output .= '<input '; |
|
191 | foreach ($input_attr as $attr => $value) { |
|
192 | $output .= "{$attr}='{$value}'"; |
|
193 | } |
|
194 | $output .= '>'; |
|
195 | } |
|
196 | ||
197 | $output .= '</fieldset>'; |
|
198 | } |
|
199 | break; |
|
200 | case 'table-headings': |
|
201 | $output .= $this->fieldHelper->tableHeadings($fields); |
@@ 97-135 (lines=39) @@ | ||
94 | { |
|
95 | $output = ''; |
|
96 | ||
97 | foreach ($fields as $f) { |
|
98 | $ucF = ucfirst($f); |
|
99 | ||
100 | $input_attr = [ |
|
101 | 'class' => 'form-control', |
|
102 | 'id' => 'createItem'.$f, |
|
103 | 'name' => $f, |
|
104 | ]; |
|
105 | ||
106 | $output .= '<fieldset class="form-group">'; |
|
107 | ||
108 | $output .= '<label for="'.$input_attr['id'].'">'.$ucF.'</label>'; |
|
109 | ||
110 | if ($this->isIdField($f)) { |
|
111 | $input_attr['type'] = 'select'; |
|
112 | ||
113 | $output .= '<select '; |
|
114 | foreach ($input_attr as $attr => $value) { |
|
115 | $output .= "{$attr}='{$value}'"; |
|
116 | } |
|
117 | ||
118 | $relation = $this->crudApi->getRelatedModel($f); |
|
119 | $output .= '>'; |
|
120 | ||
121 | $output .= $this->crudApi->getRelatedOptions($relation); |
|
122 | ||
123 | $output .= '</select>'; |
|
124 | } else { |
|
125 | $input_attr['type'] = 'text'; |
|
126 | ||
127 | $output .= '<input '; |
|
128 | foreach ($input_attr as $attr => $value) { |
|
129 | $output .= "{$attr}='{$value}'"; |
|
130 | } |
|
131 | $output .= '>'; |
|
132 | } |
|
133 | ||
134 | $output .= '</fieldset>'; |
|
135 | } |
|
136 | return $output; |
|
137 | } |
|
138 |