@@ -96,6 +96,7 @@ public function setFormFieldsComponent(DataForm $form,$fieldTypes){
96
96
$ form ->fieldAsInput ( $ property , [ "inputType " => "email " ,"rules " =>[["email " ]]] );
97
97
break ;
98
98
}
99
+
99
100
switch ($ type ) {
100
101
case "tinyint(1) " :
101
102
$ form ->fieldAsCheckbox ( $ property );
@@ -114,6 +115,14 @@ public function setFormFieldsComponent(DataForm $form,$fieldTypes){
114
115
}
115
116
}
116
117
118
+ /**
119
+ * Returns a DataElement object for displaying the instance
120
+ * Used in the display method of the CrudController
121
+ * @param object $instance
122
+ * @param string $model The model class name (long name)
123
+ * @param boolean $modal
124
+ * @return \Ajax\semantic\widgets\dataelement\DataElement
125
+ */
117
126
public function getModelDataElement ($ instance ,$ model ,$ modal ){
118
127
$ adminRoute = $ this ->controller ->_getBaseRoute ();
119
128
$ semantic = $ this ->jquery ->semantic ();
@@ -181,14 +190,19 @@ public function getModelDataTable($instances, $model,$totalCount,$page=1) {
181
190
return $ dataTable ;
182
191
}
183
192
193
+ /**
194
+ * @param string $model The model class name (long name)
195
+ * @param number $totalCount The total count of objects
196
+ * @return void|number default : 6
197
+ */
184
198
public function recordsPerPage ($ model ,$ totalCount =0 ){
185
199
if ($ totalCount >6 )
186
200
return 6 ;
187
201
return ;
188
202
}
189
203
190
204
/**
191
- *
205
+ * Returns the fields on which a grouping is performed
192
206
*/
193
207
public function getGroupByFields (){
194
208
return ;
@@ -203,22 +217,28 @@ public function onGenerateFormField($field){
203
217
}
204
218
205
219
220
+ /**
221
+ * Returns the dataTable instance for dispaying a list of object
222
+ * @param array $instances
223
+ * @param string $model
224
+ * @param number $totalCount
225
+ * @param number $page
226
+ * @return DataTable
227
+ */
206
228
protected function getDataTableInstance ($ instances ,$ model ,$ totalCount ,$ page =1 ):DataTable {
207
229
$ semantic = $ this ->jquery ->semantic ();
208
230
$ recordsPerPage =$ this ->recordsPerPage ($ model ,$ totalCount );
231
+ $ grpByFields =$ this ->getGroupByFields ();
232
+ if (is_array ($ grpByFields )){
233
+ $ dataTable = $ semantic ->dataTable ( "lv " , $ model , $ instances );
234
+ $ dataTable ->setGroupByFields ($ grpByFields );
235
+ }else {
236
+ $ dataTable = $ semantic ->jsonDataTable ( "lv " , $ model , $ instances );
237
+ }
209
238
if (is_numeric ($ recordsPerPage )){
210
- $ grpByFields =$ this ->getGroupByFields ();
211
- if (is_array ($ grpByFields )){
212
- $ dataTable = $ semantic ->dataTable ( "lv " , $ model , $ instances );
213
- $ dataTable ->setGroupByFields ($ grpByFields );
214
- }else {
215
- $ dataTable = $ semantic ->jsonDataTable ( "lv " , $ model , $ instances );
216
- }
217
239
$ dataTable ->paginate ($ page ,$ totalCount ,$ recordsPerPage ,5 );
218
240
$ dataTable ->onActiveRowChange ('$("#table-details").html(""); ' );
219
241
$ dataTable ->onSearchTerminate ('$("#search-query-content").html(data);$("#search-query").show();$("#table-details").html(""); ' );
220
- }else {
221
- $ dataTable = $ semantic ->dataTable ( "lv " , $ model , $ instances );
222
242
}
223
243
return $ dataTable ;
224
244
}
@@ -256,6 +276,11 @@ public function dataTableRowButton(HtmlButton $bt){
256
276
257
277
}
258
278
279
+ /**
280
+ * To override for modifying the showConfMessage dialog buttons
281
+ * @param HtmlButton $confirmBtn The confirmation button
282
+ * @param HtmlButton $cancelBtn The cancellation button
283
+ */
259
284
public function confirmButtons (HtmlButton $ confirmBtn ,HtmlButton $ cancelBtn ){
260
285
261
286
}
0 commit comments