Passed
Push — master ( 7cea35...9f4668 )
by Laurent
01:50
created
programs/ui/ui.helpers.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		if (empty($description)) {
48 48
 			$description = $field->getName();
49 49
 		}
50
-		$fieldLabel = $W->Label($description . ':');
50
+		$fieldLabel = $W->Label($description.':');
51 51
 
52 52
 		if ($field instanceof ORM_DateField) {
53 53
 			$widget = $W->DatePicker();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		if (empty($description)) {
104 104
 			$description = $field->getName();
105 105
 		}
106
-		$fieldLabel = $W->Label($description . ':');
106
+		$fieldLabel = $W->Label($description.':');
107 107
 
108 108
 		if ($field instanceof ORM_DateField) {
109 109
 			$widget = $W->PeriodPicker();
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	$nbOptions = 0;
207 207
 	foreach ($iterator as $record) {
208 208
 		if (isset($record->code)) {
209
-			$optionText = $record->code . ' - ' . $record->$fieldName;
209
+			$optionText = $record->code.' - '.$record->$fieldName;
210 210
 		} else {
211 211
 			$optionText = $record->$fieldName;
212 212
 		}
Please login to merge, or discard this patch.
Indentation   +260 added lines, -260 removed lines patch added patch discarded remove patch
@@ -33,50 +33,50 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function app_genericSetEditor(ORM_RecordSet $set)
35 35
 {
36
-	$O = bab_functionality::get('LibOrm');
37
-	$O->init();
38
-	$W = bab_Widgets();
39
-	$layout = $W->VBoxLayout();
40
-	$layout->setVerticalSpacing(1, 'em');
41
-
42
-
43
-	$fields = $set->getFields();
44
-
45
-	foreach ($fields as $field) {
46
-		$description = $field->getDescription();
47
-		if (empty($description)) {
48
-			$description = $field->getName();
49
-		}
50
-		$fieldLabel = $W->Label($description . ':');
51
-
52
-		if ($field instanceof ORM_DateField) {
53
-			$widget = $W->DatePicker();
54
-		} else if ($field instanceof ORM_TimeField) {
55
-			$widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
56
-		} else if ($field instanceof ORM_StringField) {
57
-			$widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength())));
58
-		} else if ($field instanceof ORM_EnumField) {
59
-			$widget = $W->Select();
60
-			$widget->addOption('', '');
61
-			foreach ($field->getValues() as $key => $text) {
62
-				$widget->addOption($key, $text);
63
-			}
64
-		} else if ($field instanceof ORM_IntField) {
65
-			$widget = $W->LineEdit()->setSize(9);
66
-		} else if ($field instanceof ORM_TextField) {
67
-			$widget = $W->TextEdit()->setColumns(80)->setLines(5);
68
-		} else if ($field instanceof ORM_RecordSet) {
69
-				$widget = app_genericSetEditor($field);
70
-				$widget->addClass('sub-form');
71
-		} else {
72
-			$widget = null;
73
-		}
74
-		if (isset($widget)) {
75
-			$layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
76
-		}
77
-	}
78
-
79
-	return $layout;
36
+    $O = bab_functionality::get('LibOrm');
37
+    $O->init();
38
+    $W = bab_Widgets();
39
+    $layout = $W->VBoxLayout();
40
+    $layout->setVerticalSpacing(1, 'em');
41
+
42
+
43
+    $fields = $set->getFields();
44
+
45
+    foreach ($fields as $field) {
46
+        $description = $field->getDescription();
47
+        if (empty($description)) {
48
+            $description = $field->getName();
49
+        }
50
+        $fieldLabel = $W->Label($description . ':');
51
+
52
+        if ($field instanceof ORM_DateField) {
53
+            $widget = $W->DatePicker();
54
+        } else if ($field instanceof ORM_TimeField) {
55
+            $widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
56
+        } else if ($field instanceof ORM_StringField) {
57
+            $widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength())));
58
+        } else if ($field instanceof ORM_EnumField) {
59
+            $widget = $W->Select();
60
+            $widget->addOption('', '');
61
+            foreach ($field->getValues() as $key => $text) {
62
+                $widget->addOption($key, $text);
63
+            }
64
+        } else if ($field instanceof ORM_IntField) {
65
+            $widget = $W->LineEdit()->setSize(9);
66
+        } else if ($field instanceof ORM_TextField) {
67
+            $widget = $W->TextEdit()->setColumns(80)->setLines(5);
68
+        } else if ($field instanceof ORM_RecordSet) {
69
+                $widget = app_genericSetEditor($field);
70
+                $widget->addClass('sub-form');
71
+        } else {
72
+            $widget = null;
73
+        }
74
+        if (isset($widget)) {
75
+            $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
76
+        }
77
+    }
78
+
79
+    return $layout;
80 80
 }
81 81
 
82 82
 
@@ -89,50 +89,50 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function app_genericSetFilterForm(ORM_RecordSet $set)
91 91
 {
92
-	$O = bab_functionality::get('LibOrm');
93
-	$O->init();
94
-	$W = bab_Widgets();
95
-	$layout = $W->FlowLayout();
96
-	$layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em');
97
-
98
-
99
-	$fields = $set->getFields();
100
-
101
-	foreach ($fields as $field) {
102
-		$description = $field->getDescription();
103
-		if (empty($description)) {
104
-			$description = $field->getName();
105
-		}
106
-		$fieldLabel = $W->Label($description . ':');
107
-
108
-		if ($field instanceof ORM_DateField) {
109
-			$widget = $W->PeriodPicker();
110
-		} else if ($field instanceof ORM_TimeField) {
111
-			$widget = $W->TimePicker();
112
-		} else if ($field instanceof ORM_StringField) {
113
-			$widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength())));
114
-		} else if ($field instanceof ORM_EnumField) {
115
-			$widget = $W->Select();
116
-			$widget->addOption('', '');
117
-			foreach ($field->getValues() as $key => $text) {
118
-				$widget->addOption($key, $text);
119
-			}
120
-		} else if ($field instanceof ORM_IntField) {
121
-			$widget = $W->LineEdit()->setSize(9);
122
-		} else if ($field instanceof ORM_TextField) {
123
-			$widget = $widget = $W->LineEdit()->setSize(15);
124
-		} else if ($field instanceof ORM_RecordSet) {
125
-			$widget = app_genericSetFilterForm($field);
126
-			$widget->addClass('sub-form');
127
-		} else {
128
-			$widget = null;
129
-		}
130
-		if (isset($widget)) {
131
-			$layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
132
-		}
133
-	}
134
-
135
-	return $layout;
92
+    $O = bab_functionality::get('LibOrm');
93
+    $O->init();
94
+    $W = bab_Widgets();
95
+    $layout = $W->FlowLayout();
96
+    $layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em');
97
+
98
+
99
+    $fields = $set->getFields();
100
+
101
+    foreach ($fields as $field) {
102
+        $description = $field->getDescription();
103
+        if (empty($description)) {
104
+            $description = $field->getName();
105
+        }
106
+        $fieldLabel = $W->Label($description . ':');
107
+
108
+        if ($field instanceof ORM_DateField) {
109
+            $widget = $W->PeriodPicker();
110
+        } else if ($field instanceof ORM_TimeField) {
111
+            $widget = $W->TimePicker();
112
+        } else if ($field instanceof ORM_StringField) {
113
+            $widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength())));
114
+        } else if ($field instanceof ORM_EnumField) {
115
+            $widget = $W->Select();
116
+            $widget->addOption('', '');
117
+            foreach ($field->getValues() as $key => $text) {
118
+                $widget->addOption($key, $text);
119
+            }
120
+        } else if ($field instanceof ORM_IntField) {
121
+            $widget = $W->LineEdit()->setSize(9);
122
+        } else if ($field instanceof ORM_TextField) {
123
+            $widget = $widget = $W->LineEdit()->setSize(15);
124
+        } else if ($field instanceof ORM_RecordSet) {
125
+            $widget = app_genericSetFilterForm($field);
126
+            $widget->addClass('sub-form');
127
+        } else {
128
+            $widget = null;
129
+        }
130
+        if (isset($widget)) {
131
+            $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
132
+        }
133
+    }
134
+
135
+    return $layout;
136 136
 }
137 137
 
138 138
 
@@ -145,47 +145,47 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function app_LabelledWidget($labelText, Widget_Displayable_Interface $widget)
147 147
 {
148
-	$W = bab_Widgets();
149
-
150
-	$label = $W->Label($labelText);
151
-	if ($widget instanceof Widget_InputWidget) {
152
-		$label->setAssociatedWidget($widget);
153
-	}
154
-
155
-	if ($widget instanceof Widget_CheckBox) {
156
-		$layout = $W->HBoxItems(
157
-			$widget->setSizePolicy(Widget_SizePolicy::MINIMUM),
158
-			$label
159
-		)->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
160
-	} else {
161
-		$layout = $W->VBoxItems(
162
-			$label,
163
-			$widget
164
-		)->setVerticalSpacing(0.5, 'em');
165
-	}
166
-
167
-	return $layout;
148
+    $W = bab_Widgets();
149
+
150
+    $label = $W->Label($labelText);
151
+    if ($widget instanceof Widget_InputWidget) {
152
+        $label->setAssociatedWidget($widget);
153
+    }
154
+
155
+    if ($widget instanceof Widget_CheckBox) {
156
+        $layout = $W->HBoxItems(
157
+            $widget->setSizePolicy(Widget_SizePolicy::MINIMUM),
158
+            $label
159
+        )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
160
+    } else {
161
+        $layout = $W->VBoxItems(
162
+            $label,
163
+            $widget
164
+        )->setVerticalSpacing(0.5, 'em');
165
+    }
166
+
167
+    return $layout;
168 168
 }
169 169
 
170 170
 
171 171
 
172 172
 function app_LabelledCheckbox($labelText, $checkboxName, $options = null)
173 173
 {
174
-	$W = bab_Widgets();
174
+    $W = bab_Widgets();
175 175
 
176
-	$label = $W->Label($labelText)->colon(false);
177
-	$checkbox = $W->Checkbox()->setName($checkboxName);
178
-	$label->setAssociatedWidget($checkbox);
179
-	if (isset($options)) {
180
-		$label->setSizePolicy(Widget_SizePolicy::FIXED)->setCanvasOptions($options);
181
-	}
176
+    $label = $W->Label($labelText)->colon(false);
177
+    $checkbox = $W->Checkbox()->setName($checkboxName);
178
+    $label->setAssociatedWidget($checkbox);
179
+    if (isset($options)) {
180
+        $label->setSizePolicy(Widget_SizePolicy::FIXED)->setCanvasOptions($options);
181
+    }
182 182
 
183
-	$layout = $W->HBoxItems(
184
-					$checkbox->setSizePolicy(Widget_SizePolicy::MINIMUM),
185
-					$label
186
-				)->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
183
+    $layout = $W->HBoxItems(
184
+                    $checkbox->setSizePolicy(Widget_SizePolicy::MINIMUM),
185
+                    $label
186
+                )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
187 187
 
188
-	return $layout;
188
+    return $layout;
189 189
 }
190 190
 
191 191
 
@@ -193,42 +193,42 @@  discard block
 block discarded – undo
193 193
 
194 194
 function app_LabelledOrmSelect(ORM_MysqlIterator $iterator, $fieldName, $selectName, $label, $hidden = false, $groupFieldName = null)
195 195
 {
196
-	$W = bab_Widgets();
197
-
198
-	if (isset($groupFieldName)) {
199
-		$groupPathElements = explode('/', $groupFieldName);
200
-	}
201
-
202
-	$select = $W->Select()->setName($selectName);
203
-
204
-	$select->addOption('', '');
205
-
206
-	$nbOptions = 0;
207
-	foreach ($iterator as $record) {
208
-		if (isset($record->code)) {
209
-			$optionText = $record->code . ' - ' . $record->$fieldName;
210
-		} else {
211
-			$optionText = $record->$fieldName;
212
-		}
213
-		if (isset($groupFieldName)) {
214
-			$group = $record;
215
-			foreach ($groupPathElements as $groupPathElement) {
216
-				$group = $group->$groupPathElement;
217
-			}
218
-			$select->addOption($record->id, $optionText, $group);
219
-		} else {
220
-			$select->addOption($record->id, $optionText);
221
-		}
222
-		$nbOptions++;
223
-		$lastId = $record->id;
224
-	}
225
-
226
-	if ($nbOptions == 1) {
227
-		$select->setValue($lastId);
228
-	}
229
-
230
-
231
-	return app_LabelledWidget($label, $select);
196
+    $W = bab_Widgets();
197
+
198
+    if (isset($groupFieldName)) {
199
+        $groupPathElements = explode('/', $groupFieldName);
200
+    }
201
+
202
+    $select = $W->Select()->setName($selectName);
203
+
204
+    $select->addOption('', '');
205
+
206
+    $nbOptions = 0;
207
+    foreach ($iterator as $record) {
208
+        if (isset($record->code)) {
209
+            $optionText = $record->code . ' - ' . $record->$fieldName;
210
+        } else {
211
+            $optionText = $record->$fieldName;
212
+        }
213
+        if (isset($groupFieldName)) {
214
+            $group = $record;
215
+            foreach ($groupPathElements as $groupPathElement) {
216
+                $group = $group->$groupPathElement;
217
+            }
218
+            $select->addOption($record->id, $optionText, $group);
219
+        } else {
220
+            $select->addOption($record->id, $optionText);
221
+        }
222
+        $nbOptions++;
223
+        $lastId = $record->id;
224
+    }
225
+
226
+    if ($nbOptions == 1) {
227
+        $select->setValue($lastId);
228
+    }
229
+
230
+
231
+    return app_LabelledWidget($label, $select);
232 232
 }
233 233
 
234 234
 
@@ -236,108 +236,108 @@  discard block
 block discarded – undo
236 236
 
237 237
 function app_OrmWidget(ORM_Field $field)
238 238
 {
239
-	$W = bab_Widgets();
239
+    $W = bab_Widgets();
240 240
 
241 241
 
242
-	if ($field instanceof ORM_DateField) {
243
-		$widget = $W->DatePicker();
244
-	} else if ($field instanceof ORM_TimeField) {
245
-		$widget = $W->TimeEdit(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
246
-	} else if ($field instanceof ORM_DatetimeField) {
247
-	    $widget = $W->DateTimePicker(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
248
-	} else if ($field instanceof ORM_EnumField) {
249
-		$widget = $W->Select();
242
+    if ($field instanceof ORM_DateField) {
243
+        $widget = $W->DatePicker();
244
+    } else if ($field instanceof ORM_TimeField) {
245
+        $widget = $W->TimeEdit(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
246
+    } else if ($field instanceof ORM_DatetimeField) {
247
+        $widget = $W->DateTimePicker(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
248
+    } else if ($field instanceof ORM_EnumField) {
249
+        $widget = $W->Select();
250 250
 ////		$widget = $W->MultiSelect()->setSingleSelect();
251
-		$widget->addOption('', '');
252
-		$values = $field->getValues();
253
-		foreach ($values as $key => $value) {
254
-			$widget->addOption($key, $value);
255
-		}
256
-	} else if ($field instanceof ORM_SetField) {
257
-		$widget = $W->MultiSelect()->setSelectedList(2);
258
-		$values = $field->getValues();
259
-		foreach ($values as $key => $value) {
260
-			$widget->addOption($key, $value);
261
-		}
262
-	} else if ($field instanceof ORM_UserField) {
263
-	    $widget = $W->SuggestUser()
264
-    	    ->setMinChars(0)
265
-    	    ->setSizePolicy(Func_Icons::ICON_LEFT_16);
266
-	} else if ($field instanceof ORM_CurrencyField) {
267
-		$widget = $W->LineEdit()->setSize(6)->addClass('widget-input-currency');
268
-	} else if ($field instanceof ORM_BoolField) {
269
-		$widget = $W->CheckBox()->setCheckedValue('1');
270
-	} else if ($field instanceof ORM_IntField) {
271
-		$widget = $W->LineEdit()
272
-						->setSize(6)->addClass('widget-input-numeric');
273
-	} else if ($field instanceof ORM_EmailField) {
274
-		$widget = $W->EmailLineEdit()
275
-						->setMaxSize($field->getMaxLength());
276
-	} else if ($field instanceof ORM_FileField) {
277
-	    $widget = $W->FilePicker();
278
-	} else if ($field instanceof ORM_StringField) {
279
-		$widget = $W->LineEdit()
280
-			->setMaxSize($field->getMaxLength());
281
-	} else if ($field instanceof ORM_TextField) {
282
-		$widget = $W->TextEdit()
283
-		  ->addClass('widget-autoresize');
284
-	} else if ($field instanceof ORM_PkField) {
285
-	    $widget = $W->Hidden();
286
-	} else if ($field instanceof ORM_FkField) {
287
-		$widget = $W->Select();
288
-		$fieldName = $field->getName();
289
-		$parentSet = clone $field->getParentSet();
290
-		$parentSet->join($fieldName);
291
-		$set = $parentSet->$fieldName;
292
-		$records = $set->select();
293
-		$records->orderAsc($set->name);
294
-		$pkName = $set->getPrimaryKey();
295
-		$widget->addOption('', '');
296
-		foreach ($records as $record) {
297
-			$widget->addOption($record->$pkName, $record->name);
298
-		}
299
-	} else if ($field instanceof ORM_RecordSet) {
300
-		$widget = $W->Select();
251
+        $widget->addOption('', '');
252
+        $values = $field->getValues();
253
+        foreach ($values as $key => $value) {
254
+            $widget->addOption($key, $value);
255
+        }
256
+    } else if ($field instanceof ORM_SetField) {
257
+        $widget = $W->MultiSelect()->setSelectedList(2);
258
+        $values = $field->getValues();
259
+        foreach ($values as $key => $value) {
260
+            $widget->addOption($key, $value);
261
+        }
262
+    } else if ($field instanceof ORM_UserField) {
263
+        $widget = $W->SuggestUser()
264
+            ->setMinChars(0)
265
+            ->setSizePolicy(Func_Icons::ICON_LEFT_16);
266
+    } else if ($field instanceof ORM_CurrencyField) {
267
+        $widget = $W->LineEdit()->setSize(6)->addClass('widget-input-currency');
268
+    } else if ($field instanceof ORM_BoolField) {
269
+        $widget = $W->CheckBox()->setCheckedValue('1');
270
+    } else if ($field instanceof ORM_IntField) {
271
+        $widget = $W->LineEdit()
272
+                        ->setSize(6)->addClass('widget-input-numeric');
273
+    } else if ($field instanceof ORM_EmailField) {
274
+        $widget = $W->EmailLineEdit()
275
+                        ->setMaxSize($field->getMaxLength());
276
+    } else if ($field instanceof ORM_FileField) {
277
+        $widget = $W->FilePicker();
278
+    } else if ($field instanceof ORM_StringField) {
279
+        $widget = $W->LineEdit()
280
+            ->setMaxSize($field->getMaxLength());
281
+    } else if ($field instanceof ORM_TextField) {
282
+        $widget = $W->TextEdit()
283
+            ->addClass('widget-autoresize');
284
+    } else if ($field instanceof ORM_PkField) {
285
+        $widget = $W->Hidden();
286
+    } else if ($field instanceof ORM_FkField) {
287
+        $widget = $W->Select();
288
+        $fieldName = $field->getName();
289
+        $parentSet = clone $field->getParentSet();
290
+        $parentSet->join($fieldName);
291
+        $set = $parentSet->$fieldName;
292
+        $records = $set->select();
293
+        $records->orderAsc($set->name);
294
+        $pkName = $set->getPrimaryKey();
295
+        $widget->addOption('', '');
296
+        foreach ($records as $record) {
297
+            $widget->addOption($record->$pkName, $record->name);
298
+        }
299
+    } else if ($field instanceof ORM_RecordSet) {
300
+        $widget = $W->Select();
301 301
 ////		$widget = $W->MultiSelect()->setSingleSelect();
302 302
 //		$fieldName = $field->getName();
303 303
 //		$parentSet = $field->getParentSet();
304 304
 //		$parentSet->join($fieldName);
305 305
 //		$set = $parentSet->$fieldName;
306
-		$records = $field->select();
307
-		$records->orderAsc($field->name);
308
-		$pkName = $field->getPrimaryKey();
309
-		$widget->addOption('', '');
310
-		foreach ($records as $record) {
311
-			$widget->addOption($record->$pkName, $record->name);
312
-		}
313
-	} else {
314
-		$widget = $W->LineEdit();
315
-	}
316
-
317
-	$widget->setName($field->getName());
318
-
319
-	return $widget;
306
+        $records = $field->select();
307
+        $records->orderAsc($field->name);
308
+        $pkName = $field->getPrimaryKey();
309
+        $widget->addOption('', '');
310
+        foreach ($records as $record) {
311
+            $widget->addOption($record->$pkName, $record->name);
312
+        }
313
+    } else {
314
+        $widget = $W->LineEdit();
315
+    }
316
+
317
+    $widget->setName($field->getName());
318
+
319
+    return $widget;
320 320
 }
321 321
 
322 322
 
323 323
 
324 324
 function app_LabelledOrmWidget(ORM_Field $field, $label = null, $hidden = false)
325 325
 {
326
-	$W = bab_Widgets();
326
+    $W = bab_Widgets();
327 327
 
328
-	if ($hidden) {
329
-		$widget = $W->Hidden();
330
-		$widget->setName($field->getName());
331
-		return $widget;
332
-	}
328
+    if ($hidden) {
329
+        $widget = $W->Hidden();
330
+        $widget->setName($field->getName());
331
+        return $widget;
332
+    }
333 333
 
334
-	if (is_null($label)) {
335
-		$label = $field->getDescription();
336
-	}
334
+    if (is_null($label)) {
335
+        $label = $field->getDescription();
336
+    }
337 337
 
338
-	$widget = app_OrmWidget($field);
338
+    $widget = app_OrmWidget($field);
339 339
 
340
-	return app_LabelledWidget($label, $widget);
340
+    return app_LabelledWidget($label, $widget);
341 341
 }
342 342
 
343 343
 
@@ -353,16 +353,16 @@  discard block
 block discarded – undo
353 353
  */
354 354
 function app_dateTime(ORM_Field $field, $value) {
355 355
 
356
-	$W = bab_functionality::get('Widgets');
357
-	$name = $field->getName();
358
-	$label = $W->Label($field->getDescription());
356
+    $W = bab_functionality::get('Widgets');
357
+    $name = $field->getName();
358
+    $label = $W->Label($field->getDescription());
359 359
 
360
-	$frame = app_dateTimeField($name, $label, $value);
360
+    $frame = app_dateTimeField($name, $label, $value);
361 361
 
362
-	return $W->VBoxItems(
363
-		$label,
364
-		$frame
365
-	);
362
+    return $W->VBoxItems(
363
+        $label,
364
+        $frame
365
+    );
366 366
 
367 367
 }
368 368
 
@@ -376,24 +376,24 @@  discard block
 block discarded – undo
376 376
  */
377 377
 function app_dateTimeField($fieldName, Widget_Label $label, $value = null)
378 378
 {
379
-	$W = bab_functionality::get('Widgets');
379
+    $W = bab_functionality::get('Widgets');
380 380
 
381
-	$datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date');
382
-	$timepart = $W->TimePicker()->setName('time');
381
+    $datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date');
382
+    $timepart = $W->TimePicker()->setName('time');
383 383
 
384
-	if (isset($value)) {
384
+    if (isset($value)) {
385 385
 
386
-		$value = explode(' ', $value);
386
+        $value = explode(' ', $value);
387 387
 
388
-		$datepart->setValue($value[0]);
389
-		$timepart->setValue($value[1]);
390
-	}
388
+        $datepart->setValue($value[0]);
389
+        $timepart->setValue($value[1]);
390
+    }
391 391
 
392
-	$datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName)
393
-			->addItem($datepart)
394
-			->addItem($timepart);
392
+    $datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName)
393
+            ->addItem($datepart)
394
+            ->addItem($timepart);
395 395
 
396
-	return $datetime;
396
+    return $datetime;
397 397
 }
398 398
 
399 399
 
Please login to merge, or discard this patch.
programs/ui/ui.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function includeBase()
36 36
     {
37
-        require_once APP_UI_PATH . 'base.ui.php';
38
-        require_once APP_UI_PATH . 'ui.helpers.php';
37
+        require_once APP_UI_PATH.'base.ui.php';
38
+        require_once APP_UI_PATH.'ui.helpers.php';
39 39
     }
40 40
 
41 41
     public function includePage()
42 42
     {
43
-        require_once APP_UI_PATH . 'page.class.php';
43
+        require_once APP_UI_PATH.'page.class.php';
44 44
     }
45 45
 
46 46
     /**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function ExportSelectEditor($id, app_TableModelView $tableview, $filter = null)
79 79
     {
80
-        require_once dirname(__FILE__) . '/exportselect.ui.php';
80
+        require_once dirname(__FILE__).'/exportselect.ui.php';
81 81
         return new app_ExportSelectEditor($this->App(), $id, $tableview, $filter);
82 82
     }
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
programs/init.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@
 block discarded – undo
23 23
 
24 24
 
25 25
 
26
-require_once dirname(__FILE__). '/functions.php';
26
+require_once dirname(__FILE__).'/functions.php';
27 27
 
28 28
 
29 29
 function LibApp_upgrade($sVersionBase, $sVersionIni)
30 30
 {
31
-    require_once dirname(__FILE__) . '/app.php';
31
+    require_once dirname(__FILE__).'/app.php';
32 32
     Func_App::register();
33 33
 
34 34
     $App = app_App();
Please login to merge, or discard this patch.
programs/customsection.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 
25
-require_once APP_SET_PATH . 'traceablerecord.class.php';
25
+require_once APP_SET_PATH.'traceablerecord.class.php';
26 26
 
27 27
 
28 28
 /**
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
         if (is_array($parameters)) {
318 318
             $params = array();
319 319
             foreach ($parameters as $key => $value) {
320
-                $params[] = $key . '=' . $value;
320
+                $params[] = $key.'='.$value;
321 321
             }
322
-            $rawField .= ':' . implode(';', $params);
322
+            $rawField .= ':'.implode(';', $params);
323 323
         }
324 324
         array_push($rawFields, $rawField);
325 325
         $this->fields = implode(',', $rawFields);
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
             if (empty($rawField)) {
339 339
                 continue;
340 340
             }
341
-            list($fieldName, ) = explode(':', $rawField);
341
+            list($fieldName,) = explode(':', $rawField);
342 342
 
343 343
             if ($removedFieldName == $fieldName) {
344 344
                 continue;
Please login to merge, or discard this patch.
programs/record.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     {
176 176
         $App = $this->App();
177 177
 
178
-        $customFieldSet= $App->CustomFieldSet();
178
+        $customFieldSet = $App->CustomFieldSet();
179 179
         $object = mb_substr(get_class($this), mb_strlen($App->classPrefix), -mb_strlen('Set'));
180 180
 
181 181
         $customFields = $customFieldSet->select($customFieldSet->object->is($object));
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
             throw new app_Exception('Trying to get the reference string of a record without an id.');
391 391
         }
392 392
         $classname = $this->getClassName();
393
-        return $classname . ':' . $this->id;
393
+        return $classname.':'.$this->id;
394 394
     }
395 395
 
396 396
 
@@ -650,13 +650,13 @@  discard block
 block discarded – undo
650 650
      */
651 651
     protected function importDate($name, $value)
652 652
     {
653
-        if (preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/',$value)) {
653
+        if (preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)) {
654 654
             return $this->importProperty($name, $value);
655 655
         }
656 656
 
657 657
         // try in DD/MM/YYYY format
658 658
 
659
-        if (preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/',$value, $matches)) {
659
+        if (preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)) {
660 660
 
661 661
             $value = sprintf('%04d-%02d-%02d', (int) $matches['year'], (int) $matches['month'], (int) $matches['day']);
662 662
 
Please login to merge, or discard this patch.
programs/functions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     if (null === $url) {
113 113
         $script = '<script type="text/javascript">';
114 114
         if (isset($message)) {
115
-            $script .= 'alert("' . bab_toHtml($message, BAB_HTML_JS) . '");';
115
+            $script .= 'alert("'.bab_toHtml($message, BAB_HTML_JS).'");';
116 116
         }
117 117
         $script .= 'history.back();';
118 118
         $script .= '</script>';
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $url = $url->url();
125 125
     }
126 126
     if (!empty($babBody->msgerror)) {
127
-        $url .=  '&msgerror=' . urlencode($babBody->msgerror);
127
+        $url .= '&msgerror='.urlencode($babBody->msgerror);
128 128
     }
129 129
     if (isset($message)) {
130 130
         $lines = explode("\n", $message);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         }
134 134
     }
135 135
 
136
-    header('Location: ' . $url);
136
+    header('Location: '.$url);
137 137
     die;
138 138
 }
139 139
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
  */
166 166
 function app_fileUploadError($error)
167 167
 {
168
-    switch($error) {
168
+    switch ($error) {
169 169
         case UPLOAD_ERR_OK:
170 170
             return null;
171 171
 
Please login to merge, or discard this patch.
programs/app.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  * @copyright Copyright (c) 2018 by CANTICO ({@link http://www.cantico.fr})
22 22
  */
23 23
 
24
-require_once dirname(__FILE__) . '/define.php';
25
-require_once dirname(__FILE__) . '/functions.php';
24
+require_once dirname(__FILE__).'/define.php';
25
+require_once dirname(__FILE__).'/functions.php';
26 26
 
27 27
 
28 28
 
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
         $this->addonName = 'libapp';
56 56
         $this->addonPrefix = 'app';
57 57
 
58
-        $this->classPrefix = $this->addonPrefix . '_';
59
-        $this->controllerTg = 'addon/' . $this->addonName . '/main';
58
+        $this->classPrefix = $this->addonPrefix.'_';
59
+        $this->controllerTg = 'addon/'.$this->addonName.'/main';
60 60
 
61 61
         $addon = bab_getAddonInfosInstance($this->addonName);
62 62
         $this->phpPath = $addon->getPhpPath();
63 63
         $this->recordSetPath = $this->phpPath;
64 64
         $this->ctrlPath = $this->phpPath;
65
-        $this->uiPath = $this->phpPath . 'ui/';
65
+        $this->uiPath = $this->phpPath.'ui/';
66 66
 
67 67
         $babDB = bab_getDB();
68 68
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
     public function getRecordSetPathname($class)
110 110
     {
111 111
         // $App->MyRecordSet() -> myrecord.class.php
112
-        $file = strtolower(substr($class, strlen($this->classPrefix), -3)) . '.class.php';
113
-        return $this->recordSetPath . $file;
112
+        $file = strtolower(substr($class, strlen($this->classPrefix), -3)).'.class.php';
113
+        return $this->recordSetPath.$file;
114 114
     }
115 115
 
116 116
     /**
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
     public function getRecordPathname($class)
123 123
     {
124 124
         // $App->MyRecord() -> myrecord.class.php
125
-        $file = strtolower(substr($class, strlen($this->classPrefix))) . '.class.php';
126
-        return $this->recordSetPath . $file;
125
+        $file = strtolower(substr($class, strlen($this->classPrefix))).'.class.php';
126
+        return $this->recordSetPath.$file;
127 127
     }
128 128
 
129 129
     /**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
             if (substr($method, 0, 7) === 'include' && substr($method, -3) === 'Set') {
229 229
                 $incl = $method;
230
-                $classNameMethod = substr($method, strlen('include')) . 'ClassName';
230
+                $classNameMethod = substr($method, strlen('include')).'ClassName';
231 231
 
232 232
 
233 233
                 $classname = $this->$classNameMethod();
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                                 // We need to revert to multilang fields before synchronizing.
250 250
                                 $set->useLang(false);
251 251
                             }
252
-                            $sql .= $mysqlbackend->setToSql($set) . "\n";
252
+                            $sql .= $mysqlbackend->setToSql($set)."\n";
253 253
                         }
254 254
                     }
255 255
                 }
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 
281 281
             if (substr($method, 0, strlen('include')) === 'include' && substr($method, -strlen('Set')) === 'Set') {
282 282
                 $incl = $method;
283
-                $classNameMethod = substr($method, strlen('include')) . 'ClassName';
283
+                $classNameMethod = substr($method, strlen('include')).'ClassName';
284 284
 
285 285
                 $classname = $this->$classNameMethod();
286 286
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
                             if (class_exists($classname) && method_exists($this, $call)) {
296 296
                                 $set = $this->$call();
297
-                                $sql .= $mysqlbackend->setToSql($set) . "\n";
297
+                                $sql .= $mysqlbackend->setToSql($set)."\n";
298 298
                             }
299 299
                         }
300 300
                     }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
     public function includeBase()
310 310
     {
311
-        require_once APP_PHP_PATH . 'base.class.php';
311
+        require_once APP_PHP_PATH.'base.class.php';
312 312
     }
313 313
 
314 314
     /**
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      */
317 317
     public function includeRecordSet()
318 318
     {
319
-        require_once APP_SET_PATH . 'record.class.php';
319
+        require_once APP_SET_PATH.'record.class.php';
320 320
     }
321 321
 
322 322
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
      */
326 326
     public function includeTraceableRecordSet()
327 327
     {
328
-        require_once APP_SET_PATH . 'traceablerecord.class.php';
328
+        require_once APP_SET_PATH.'traceablerecord.class.php';
329 329
     }
330 330
 
331 331
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      */
342 342
     public function includeLogSet()
343 343
     {
344
-        require_once APP_SET_PATH . 'log.class.php';
344
+        require_once APP_SET_PATH.'log.class.php';
345 345
     }
346 346
 
347 347
     /**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      */
358 358
     public function LogSetClassName()
359 359
     {
360
-        return $this->LogClassName() . 'Set';
360
+        return $this->LogClassName().'Set';
361 361
     }
362 362
 
363 363
     /**
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
      */
380 380
     public function includeLinkSet()
381 381
     {
382
-        require_once APP_SET_PATH . 'link.class.php';
382
+        require_once APP_SET_PATH.'link.class.php';
383 383
     }
384 384
 
385 385
     /**
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
      */
396 396
     public function LinkSetClassName()
397 397
     {
398
-        return $this->LinkClassName() . 'Set';
398
+        return $this->LinkClassName().'Set';
399 399
     }
400 400
 
401 401
     /**
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
             return null;
430 430
         }
431 431
         list($classname, $id) = $refParts;
432
-        $classSet = $classname . 'Set';
432
+        $classSet = $classname.'Set';
433 433
         $set = $this->$classSet();
434 434
         if (isset($set)) {
435 435
             return $set->get($id);
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     {
449 449
         $fullClassName = get_class($record);
450 450
         list(, $className) = explode('_', $fullClassName);
451
-        return $className . ':' . $record->id;
451
+        return $className.':'.$record->id;
452 452
     }
453 453
 
454 454
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
      */
476 476
     public function translate($str, $str_plurals = null, $number = null)
477 477
     {
478
-        require_once APP_PHP_PATH . 'functions.php';
478
+        require_once APP_PHP_PATH.'functions.php';
479 479
         $translation = $str;
480 480
         if ($translate = bab_functionality::get('Translate/Gettext')) {
481 481
             /* @var $translate Func_Translate_Gettext */
@@ -526,16 +526,16 @@  discard block
 block discarded – undo
526 526
      */
527 527
     public function mailTo($addr, $subject = null, $body = null)
528 528
     {
529
-        $mailTo = 'mailto:' . $addr;
529
+        $mailTo = 'mailto:'.$addr;
530 530
         $parameters = array();
531 531
         if (isset($subject)) {
532
-            $parameters[] = 'subject=' . $subject;
532
+            $parameters[] = 'subject='.$subject;
533 533
         }
534 534
         if (isset($body)) {
535
-            $parameters[] = 'body=' . $body;
535
+            $parameters[] = 'body='.$body;
536 536
         }
537 537
         if (!empty($parameters)) {
538
-            $mailTo .= '?' . implode('&', $parameters);
538
+            $mailTo .= '?'.implode('&', $parameters);
539 539
         }
540 540
 
541 541
         return $mailTo;
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
         }
587 587
 
588 588
         $number = number_format($number, $decimals, ',', ' ');
589
-        return str_replace(' ', bab_nbsp(), $number . ' ' . $prefix . $unitSymbol);
589
+        return str_replace(' ', bab_nbsp(), $number.' '.$prefix.$unitSymbol);
590 590
     }
591 591
 
592 592
 
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
         }
607 607
 
608 608
         if (!isset($format)) {
609
-            $format = bab_registry::get('/' . $this->addonName . '/numberFormat', $PhoneNumber->getDefaultFormat());
609
+            $format = bab_registry::get('/'.$this->addonName.'/numberFormat', $PhoneNumber->getDefaultFormat());
610 610
         }
611 611
         $phoneNumberUtil = $PhoneNumber->PhoneNumberUtil();
612 612
 
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
      */
628 628
     public function includeController()
629 629
     {
630
-        require_once APP_PHP_PATH . '/controller.class.php';
630
+        require_once APP_PHP_PATH.'/controller.class.php';
631 631
     }
632 632
 
633 633
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
      */
637 637
     public function includeRecordController()
638 638
     {
639
-        require_once APP_CTRL_PATH . '/record.ctrl.php';
639
+        require_once APP_CTRL_PATH.'/record.ctrl.php';
640 640
     }
641 641
 
642 642
 
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
      */
677 677
     public function includeUi()
678 678
     {
679
-        require_once APP_UI_PATH . 'ui.class.php';
679
+        require_once APP_UI_PATH.'ui.class.php';
680 680
     }
681 681
 
682 682
 
@@ -688,14 +688,14 @@  discard block
 block discarded – undo
688 688
     public function Ui()
689 689
     {
690 690
         $this->includeUi();
691
-        return bab_getInstance($this->classPrefix . 'Ui');//->setApp($this);
691
+        return bab_getInstance($this->classPrefix.'Ui'); //->setApp($this);
692 692
     }
693 693
 
694 694
 
695 695
 
696 696
     protected function includeAccess()
697 697
     {
698
-        require_once WORKSPACE_PHP_PATH . '/access.class.php';
698
+        require_once WORKSPACE_PHP_PATH.'/access.class.php';
699 699
     }
700 700
 
701 701
 
@@ -727,29 +727,29 @@  discard block
 block discarded – undo
727 727
 
728 728
             case substr($name, -strlen('SetClassName')) === 'SetClassName':
729 729
                 $setName = substr($name, 0, strlen($name) - strlen('ClassName'));
730
-                return $this->classPrefix . $setName;
730
+                return $this->classPrefix.$setName;
731 731
 
732 732
             case substr($name, -strlen('ClassName')) === 'ClassName':
733 733
                 $recordName = substr($name, 0, strlen($name) - strlen('ClassName'));
734
-                return $this->classPrefix . $recordName;
734
+                return $this->classPrefix.$recordName;
735 735
 
736 736
             case substr($name, 0, strlen('include')) === 'include' && substr($name, -strlen('Set')) === 'Set':
737 737
                 $fileNameBase = strtolower(substr(substr($name, 0, strlen($name) - strlen('Set')), strlen('include')));
738
-                require_once PHP_SET_PATH . $fileNameBase . '.class.php';
738
+                require_once PHP_SET_PATH.$fileNameBase.'.class.php';
739 739
                 return;
740 740
 
741 741
             case substr($name, -strlen('Set')) === 'Set':
742
-                $includeMethod = 'include' . $name;
742
+                $includeMethod = 'include'.$name;
743 743
                 $this->$includeMethod();
744
-                $setClassNameMethod = $name . 'ClassName';
744
+                $setClassNameMethod = $name.'ClassName';
745 745
                 $className = $this->$setClassNameMethod();
746 746
                 $set = new $className($this);
747 747
                 return $set;
748 748
 
749 749
                 //case method_exists($this, $name . 'Set'):
750 750
             default:
751
-                $setName = $name . 'Set';
752
-                $recordClassNameMethod = $name . 'ClassName';
751
+                $setName = $name.'Set';
752
+                $recordClassNameMethod = $name.'ClassName';
753 753
                 $recordClassName = $this->$recordClassNameMethod();
754 754
                 if (isset($arguments[0])) {
755 755
                     if ($arguments[0] instanceof $recordClassName) {
Please login to merge, or discard this patch.