Passed
Push — master ( e93494...c85701 )
by Robin
04:03
created
programs/controller.class.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@
 block discarded – undo
30 30
 
31 31
 class app_UnknownActionException extends Exception
32 32
 {
33
-	public function __construct($action, $code = 0)
34
-	{
35
-		$message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"';
36
-		parent::__construct($message, $code);
37
-	}
33
+    public function __construct($action, $code = 0)
34
+    {
35
+        $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"';
36
+        parent::__construct($message, $code);
37
+    }
38 38
 }
39 39
 
40 40
 
Please login to merge, or discard this patch.
programs/ui/ui.helpers.php 1 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/base.ui.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     public function __construct(Func_App $app, $id = null, Widget_Layout $layout = null)
116 116
     {
117 117
         parent::__construct($app);
118
-         // We simulate inheritance from Widget_VBoxLayout.
118
+            // We simulate inheritance from Widget_VBoxLayout.
119 119
         $W = $this->widgets = bab_Widgets();
120 120
 
121 121
         $this->buttonsLayout = $this->buttonsLayout();
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
             $cancelLabel = isset($this->cancelLabel) ? $this->cancelLabel : $App->translate('Cancel');
323 323
             $this->addButton(
324 324
                 $W->SubmitButton(/*'cancel'*/)
325
-                     ->addClass('widget-close-dialog')
325
+                        ->addClass('widget-close-dialog')
326 326
                     ->setAction($this->cancelAction)
327
-                      ->setLabel($cancelLabel)
327
+                        ->setLabel($cancelLabel)
328 328
             );
329 329
         }
330 330
     }
@@ -1170,21 +1170,21 @@  discard block
 block discarded – undo
1170 1170
 
1171 1171
 
1172 1172
 
1173
-	protected function addCustomFields(app_RecordSet $recordSet)
1174
-	{
1175
-		$customFields = $recordSet->getCustomFields();
1173
+    protected function addCustomFields(app_RecordSet $recordSet)
1174
+    {
1175
+        $customFields = $recordSet->getCustomFields();
1176 1176
 
1177 1177
         foreach ($customFields as $customField) {
1178 1178
             $fieldname = $customField->fieldname;
1179 1179
             $this->addColumn(
1180 1180
                 widget_TableModelViewColumn($recordSet->$fieldname, $customField->name)
1181
-                  ->setSortable(true)
1182
-                  ->setExportable(true)
1183
-                  ->setSearchable($customField->searchable)
1184
-				  ->setVisible($customField->visible)
1181
+                    ->setSortable(true)
1182
+                    ->setExportable(true)
1183
+                    ->setSearchable($customField->searchable)
1184
+                    ->setVisible($customField->visible)
1185 1185
             );
1186 1186
         }
1187
-	}
1187
+    }
1188 1188
 
1189 1189
 
1190 1190
     /**
Please login to merge, or discard this patch.
programs/traceablerecord.class.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -540,10 +540,10 @@
 block discarded – undo
540 540
     /**
541 541
      * Match records created by the specified user or the current connected user if none specified.
542 542
      *
543
-	 * @param int|null $userId
544
-	 *
545
-	 * @return ORM_IsCriterion
546
-	 */
543
+     * @param int|null $userId
544
+     *
545
+     * @return ORM_IsCriterion
546
+     */
547 547
     public function isOwn($userId = null)
548 548
     {
549 549
         if (!isset($userId)) {
Please login to merge, or discard this patch.
programs/link.class.php 1 patch
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -104,243 +104,243 @@
 block discarded – undo
104 104
     }
105 105
 
106 106
 
107
-	/**
108
-	 * @param	string	$sourceClass
109
-	 */
110
-	public function joinSource($sourceClass)
111
-	{
112
-	    if (get_class($this->sourceId) !== $sourceClass . 'Set') {
113
-    	    $this->hasOne('sourceId', $sourceClass . 'Set');
114
-    		$this->join('sourceId');
115
-	    }
116
-	}
117
-
118
-
119
-	/**
120
-	 * @param	string	$targetClass
121
-	 */
122
-	public function joinTarget($targetClass = null)
123
-	{
124
-	    if (get_class($this->targetId) !== $targetClass . 'Set') {
125
-    		$this->hasOne('targetId', $targetClass . 'Set');
126
-    		$this->join('targetId');
127
-	    }
128
-	}
107
+    /**
108
+     * @param	string	$sourceClass
109
+     */
110
+    public function joinSource($sourceClass)
111
+    {
112
+        if (get_class($this->sourceId) !== $sourceClass . 'Set') {
113
+            $this->hasOne('sourceId', $sourceClass . 'Set');
114
+            $this->join('sourceId');
115
+        }
116
+    }
117
+
118
+
119
+    /**
120
+     * @param	string	$targetClass
121
+     */
122
+    public function joinTarget($targetClass = null)
123
+    {
124
+        if (get_class($this->targetId) !== $targetClass . 'Set') {
125
+            $this->hasOne('targetId', $targetClass . 'Set');
126
+            $this->join('targetId');
127
+        }
128
+    }
129
+
130
+
131
+    /**
132
+     * @param string $recordClass
133
+     * @return ORM_IsCriterion
134
+     */
135
+    public function sourceIsA($recordClass)
136
+    {
137
+        return $this->sourceClass->is($recordClass);
138
+    }
139
+
140
+
141
+    /**
142
+     * @param app_Record $record
143
+     * @return ORM_Criteria
144
+     */
145
+    public function sourceIs(app_Record $record)
146
+    {
147
+        return $this->all(
148
+            $this->sourceId->is($record->id),
149
+            $this->sourceIsA(get_class($record))
150
+        );
151
+    }
129 152
 
130 153
 
131 154
     /**
132 155
      * @param string $recordClass
133 156
      * @return ORM_IsCriterion
134 157
      */
135
-	public function sourceIsA($recordClass)
136
-	{
137
-		return $this->sourceClass->is($recordClass);
138
-	}
139
-
140
-
141
-	/**
142
-	 * @param app_Record $record
143
-	 * @return ORM_Criteria
144
-	 */
145
-	public function sourceIs(app_Record $record)
146
-	{
147
-	    return $this->all(
148
-	        $this->sourceId->is($record->id),
149
-	       $this->sourceIsA(get_class($record))
150
-	    );
151
-	}
152
-
153
-
154
-	/**
155
-	 * @param string $recordClass
156
-	 * @return ORM_IsCriterion
157
-	 */
158
-	public function targetIsA($recordClass)
159
-	{
160
-	    return $this->targetClass->is($recordClass);
161
-	}
162
-
163
-
164
-	/**
165
-	 * @param app_Record $record
166
-	 * @return ORM_Criteria
167
-	 */
168
-	public function targetIs(app_Record $record)
169
-	{
170
-	    return $this->all(
171
-	        $this->targetId->is($record->id),
172
-	        $this->targetIsA(get_class($record))
158
+    public function targetIsA($recordClass)
159
+    {
160
+        return $this->targetClass->is($recordClass);
161
+    }
162
+
163
+
164
+    /**
165
+     * @param app_Record $record
166
+     * @return ORM_Criteria
167
+     */
168
+    public function targetIs(app_Record $record)
169
+    {
170
+        return $this->all(
171
+            $this->targetId->is($record->id),
172
+            $this->targetIsA(get_class($record))
173 173
         );
174
-	}
175
-
176
-
177
-	/**
178
-	 *
179
-	 * @return ORM_Iterator
180
-	 */
181
-	public function selectForSource(app_Record $object, $targetClass = null, $linkType = null)
182
-	{
183
-	    $criteria = $this->sourceIs($object);
184
-
185
-		if (isset($targetClass)) {
186
-		    $this->joinTarget($targetClass);
187
-		    $criteria = $criteria->_AND_($this->targetClass->is($targetClass));
188
-		}
189
-
190
-		if (isset($linkType)) {
191
-			if (is_array($linkType)) {
192
-				$criteria = $criteria->_AND_($this->type->in($linkType));
193
-			} else {
194
-				$criteria = $criteria->_AND_($this->type->is($linkType));
195
-			}
196
-		}
197
-
198
-		if (is_a($this->targetId, 'app_TraceableRecordSet')) {
199
-			$criteria = $criteria->_AND_($this->targetId->deleted->is(false));
200
-		}
201
-
202
-		return $this->select($criteria);
203
-	}
204
-
205
-
206
-	/**
207
-	 *
208
-	 * @return ORM_Iterator
209
-	 */
210
-	public function selectForSources($objects, $targetClass, $linkType = null)
211
-	{
212
-		$sourceClass = null;
213
-		$sourceIds = array();
214
-
215
-		foreach ($objects as $obj) {
216
-			if (is_null($sourceClass)) {
217
-				$sourceClass = get_class($obj);
218
-			}
219
-			$sourceIds[] = $obj->id;
220
-		}
221
-		$criteria = $this->sourceId->in($sourceIds)
222
-			->_AND_($this->sourceClass->is($sourceClass));
223
-
224
-		if (isset($targetClass)) {
225
-		    $this->joinTarget($targetClass);
226
-		    $criteria = $criteria->_AND_($this->targetClass->is($targetClass));
227
-		}
228
-
229
-		if (isset($linkType)) {
230
-			if (is_array($linkType)) {
231
-				$criteria = $criteria->_AND_($this->type->in($linkType));
232
-			} else {
233
-				$criteria = $criteria->_AND_($this->type->is($linkType));
234
-			}
235
-		}
236
-		return $this->select($criteria);
237
-	}
238
-
239
-
240
-	/**
241
-	 *
242
-	 * @return ORM_Iterator
243
-	 */
244
-	public function selectForTarget(app_Record $object, $sourceClass = null, $linkType = null)
245
-	{
246
-	    $criteria = $this->targetIs($object);
247
-
248
-		if (isset($sourceClass)) {
249
-		    $this->joinSource($sourceClass);
250
-			$criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));
251
-		}
252
-
253
-		if (isset($linkType)) {
254
-			if (is_array($linkType)) {
255
-				$criteria = $criteria->_AND_($this->type->in($linkType));
256
-			} else {
257
-				$criteria = $criteria->_AND_($this->type->is($linkType));
258
-			}
259
-		}
260
-
261
-		return $this->select($criteria);
262
-	}
263
-
264
-
265
-	/**
266
-	 *
267
-	 * @return ORM_Iterator
268
-	 */
269
-	public function selectForTargets($objects, $sourceClass = null, $linkType = null)
270
-	{
271
-		$targetClass = null;
272
-		$targetIds = array();
273
-
274
-		foreach ($objects as $obj) {
275
-			if (is_null($targetClass)) {
276
-				$targetClass = get_class($obj);
277
-			}
278
-			$targetIds[] = $obj->id;
279
-		}
280
-		$criteria = $this->targetId->in($targetIds)
281
-			->_AND_($this->targetClass->is($targetClass));
282
-
283
-		if (isset($sourceClass)) {
284
-		    $this->joinSource($sourceClass);
285
-			$criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));
286
-		}
287
-
288
-		if (isset($linkType)) {
289
-			if (is_array($linkType)) {
290
-				$criteria = $criteria->_AND_($this->type->in($linkType));
291
-			} else {
292
-				$criteria = $criteria->_AND_($this->type->is($linkType));
293
-			}
294
-		}
295
-
296
-		return $this->select($criteria);
297
-	}
298
-
299
-
300
-
301
-	/**
302
-	 * delete all links to an object
303
-	 *
304
-	 * @param	app_Record		$object
305
-	 * @param	string			$targetClass 	if target class is set, links will be deleted only for target classes
306
-	 * @param	bool			$deleteTarget	if set to true, the target will be deleted to
307
-	 */
308
-	public function deleteForSource(app_Record $object, $targetClass = null, $deleteTarget = false, $linkType = null)
309
-	{
310
-		$set = clone $this;
311
-		$App = $object->App();
312
-
313
-		$criteria = $set->sourceId->is($object->id)->_AND_(
314
-			$set->sourceClass->is(get_class($object))
315
-		);
316
-
317
-		if (null !== $targetClass) {
318
-			$criteria = $criteria->_AND_(
319
-				$set->targetClass->is($targetClass)
320
-			);
321
-		}
322
-		if (null !== $linkType) {
323
-			$criteria = $criteria->_AND_(
324
-				$set->type->is($linkType)
325
-			);
326
-		}
327
-
328
-		if ($deleteTarget) {
329
-			foreach($set->select($criteria) as $link) {
330
-
331
-				$className = $link->targetClass.'Set';
332
-
333
-				// remove prefix
334
-
335
-				$className = mb_substr($className, 1 + mb_strpos($className, '_'));
336
-				$targetSet = $App->$className();
337
-
338
-				$targetSet->delete($targetSet->id->is($link->targetId));
339
-			}
340
-		}
341
-
342
-		return $set->delete($criteria);
343
-	}
174
+    }
175
+
176
+
177
+    /**
178
+     *
179
+     * @return ORM_Iterator
180
+     */
181
+    public function selectForSource(app_Record $object, $targetClass = null, $linkType = null)
182
+    {
183
+        $criteria = $this->sourceIs($object);
184
+
185
+        if (isset($targetClass)) {
186
+            $this->joinTarget($targetClass);
187
+            $criteria = $criteria->_AND_($this->targetClass->is($targetClass));
188
+        }
189
+
190
+        if (isset($linkType)) {
191
+            if (is_array($linkType)) {
192
+                $criteria = $criteria->_AND_($this->type->in($linkType));
193
+            } else {
194
+                $criteria = $criteria->_AND_($this->type->is($linkType));
195
+            }
196
+        }
197
+
198
+        if (is_a($this->targetId, 'app_TraceableRecordSet')) {
199
+            $criteria = $criteria->_AND_($this->targetId->deleted->is(false));
200
+        }
201
+
202
+        return $this->select($criteria);
203
+    }
204
+
205
+
206
+    /**
207
+     *
208
+     * @return ORM_Iterator
209
+     */
210
+    public function selectForSources($objects, $targetClass, $linkType = null)
211
+    {
212
+        $sourceClass = null;
213
+        $sourceIds = array();
214
+
215
+        foreach ($objects as $obj) {
216
+            if (is_null($sourceClass)) {
217
+                $sourceClass = get_class($obj);
218
+            }
219
+            $sourceIds[] = $obj->id;
220
+        }
221
+        $criteria = $this->sourceId->in($sourceIds)
222
+            ->_AND_($this->sourceClass->is($sourceClass));
223
+
224
+        if (isset($targetClass)) {
225
+            $this->joinTarget($targetClass);
226
+            $criteria = $criteria->_AND_($this->targetClass->is($targetClass));
227
+        }
228
+
229
+        if (isset($linkType)) {
230
+            if (is_array($linkType)) {
231
+                $criteria = $criteria->_AND_($this->type->in($linkType));
232
+            } else {
233
+                $criteria = $criteria->_AND_($this->type->is($linkType));
234
+            }
235
+        }
236
+        return $this->select($criteria);
237
+    }
238
+
239
+
240
+    /**
241
+     *
242
+     * @return ORM_Iterator
243
+     */
244
+    public function selectForTarget(app_Record $object, $sourceClass = null, $linkType = null)
245
+    {
246
+        $criteria = $this->targetIs($object);
247
+
248
+        if (isset($sourceClass)) {
249
+            $this->joinSource($sourceClass);
250
+            $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));
251
+        }
252
+
253
+        if (isset($linkType)) {
254
+            if (is_array($linkType)) {
255
+                $criteria = $criteria->_AND_($this->type->in($linkType));
256
+            } else {
257
+                $criteria = $criteria->_AND_($this->type->is($linkType));
258
+            }
259
+        }
260
+
261
+        return $this->select($criteria);
262
+    }
263
+
264
+
265
+    /**
266
+     *
267
+     * @return ORM_Iterator
268
+     */
269
+    public function selectForTargets($objects, $sourceClass = null, $linkType = null)
270
+    {
271
+        $targetClass = null;
272
+        $targetIds = array();
273
+
274
+        foreach ($objects as $obj) {
275
+            if (is_null($targetClass)) {
276
+                $targetClass = get_class($obj);
277
+            }
278
+            $targetIds[] = $obj->id;
279
+        }
280
+        $criteria = $this->targetId->in($targetIds)
281
+            ->_AND_($this->targetClass->is($targetClass));
282
+
283
+        if (isset($sourceClass)) {
284
+            $this->joinSource($sourceClass);
285
+            $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass));
286
+        }
287
+
288
+        if (isset($linkType)) {
289
+            if (is_array($linkType)) {
290
+                $criteria = $criteria->_AND_($this->type->in($linkType));
291
+            } else {
292
+                $criteria = $criteria->_AND_($this->type->is($linkType));
293
+            }
294
+        }
295
+
296
+        return $this->select($criteria);
297
+    }
298
+
299
+
300
+
301
+    /**
302
+     * delete all links to an object
303
+     *
304
+     * @param	app_Record		$object
305
+     * @param	string			$targetClass 	if target class is set, links will be deleted only for target classes
306
+     * @param	bool			$deleteTarget	if set to true, the target will be deleted to
307
+     */
308
+    public function deleteForSource(app_Record $object, $targetClass = null, $deleteTarget = false, $linkType = null)
309
+    {
310
+        $set = clone $this;
311
+        $App = $object->App();
312
+
313
+        $criteria = $set->sourceId->is($object->id)->_AND_(
314
+            $set->sourceClass->is(get_class($object))
315
+        );
316
+
317
+        if (null !== $targetClass) {
318
+            $criteria = $criteria->_AND_(
319
+                $set->targetClass->is($targetClass)
320
+            );
321
+        }
322
+        if (null !== $linkType) {
323
+            $criteria = $criteria->_AND_(
324
+                $set->type->is($linkType)
325
+            );
326
+        }
327
+
328
+        if ($deleteTarget) {
329
+            foreach($set->select($criteria) as $link) {
330
+
331
+                $className = $link->targetClass.'Set';
332
+
333
+                // remove prefix
334
+
335
+                $className = mb_substr($className, 1 + mb_strpos($className, '_'));
336
+                $targetSet = $App->$className();
337
+
338
+                $targetSet->delete($targetSet->id->is($link->targetId));
339
+            }
340
+        }
341
+
342
+        return $set->delete($criteria);
343
+    }
344 344
 
345 345
 
346 346
     /**
Please login to merge, or discard this patch.
programs/ui/customfield.ui.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class app_CustomFieldTableView extends app_TableModelView
32 32
 {
33
-	/**
34
-	 * @param ORM_Record	$record
35
-	 * @param string		$fieldPath
36
-	 * @return Widget_Item
37
-	 */
38
-	protected function computeCellContent(ORM_Record $record, $fieldPath)
39
-	{
40
-		$W = bab_Widgets();
41
-		$App = $record->App();
33
+    /**
34
+     * @param ORM_Record	$record
35
+     * @param string		$fieldPath
36
+     * @return Widget_Item
37
+     */
38
+    protected function computeCellContent(ORM_Record $record, $fieldPath)
39
+    {
40
+        $W = bab_Widgets();
41
+        $App = $record->App();
42 42
 
43
-		$editAction = $App->Controller()->CustomField()->edit($record->id);
43
+        $editAction = $App->Controller()->CustomField()->edit($record->id);
44 44
 
45
-		switch ($fieldPath) {
45
+        switch ($fieldPath) {
46 46
 
47 47
             case '_actions_':
48 48
                 $box = $W->FlowItems();
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
                 }
63 63
                 return $box;
64 64
 
65
-			case 'mandatory':
66
-			case 'visible_in_shop':
67
-				if (self::getRecordFieldValue($record, $fieldPath))
68
-				{
69
-					return $W->Label($App->translate('Yes'));
70
-				} else {
71
-					return $W->Label($App->translate('No'));
72
-				}
73
-				break;
74
-		}
65
+            case 'mandatory':
66
+            case 'visible_in_shop':
67
+                if (self::getRecordFieldValue($record, $fieldPath))
68
+                {
69
+                    return $W->Label($App->translate('Yes'));
70
+                } else {
71
+                    return $W->Label($App->translate('No'));
72
+                }
73
+                break;
74
+        }
75 75
 
76
-		return parent::computeCellContent($record, $fieldPath);
77
-	}
76
+        return parent::computeCellContent($record, $fieldPath);
77
+    }
78 78
 
79 79
 
80 80
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
                 ->addClass('widget-close-dialog')
215 215
                 ->setLabel($App->translate('Cancel'))
216 216
         );
217
-	}
217
+    }
218 218
 
219 219
 
220 220
     protected function section()
@@ -371,27 +371,27 @@  discard block
 block discarded – undo
371 371
 
372 372
 
373 373
 
374
-	public function mandatory()
375
-	{
376
-		$App = $this->App();
377
-		$W = $this->widgets;
374
+    public function mandatory()
375
+    {
376
+        $App = $this->App();
377
+        $W = $this->widgets;
378 378
 
379
-		return $this->labelledField(
380
-			$App->translate('Mandatory field'),
381
-			$W->Checkbox(),
382
-			__FUNCTION__
383
-		);
384
-	}
379
+        return $this->labelledField(
380
+            $App->translate('Mandatory field'),
381
+            $W->Checkbox(),
382
+            __FUNCTION__
383
+        );
384
+    }
385 385
 
386
-	public function visible_in_shop()
387
-	{
388
-		$App = $this->App();
389
-		$W = $this->widgets;
386
+    public function visible_in_shop()
387
+    {
388
+        $App = $this->App();
389
+        $W = $this->widgets;
390 390
 
391
-		return $this->labelledField(
392
-			$App->translate('Visible in online shop'),
393
-			$W->Checkbox(),
394
-			__FUNCTION__
395
-		);
396
-	}
391
+        return $this->labelledField(
392
+            $App->translate('Visible in online shop'),
393
+            $W->Checkbox(),
394
+            __FUNCTION__
395
+        );
396
+    }
397 397
 }
Please login to merge, or discard this patch.
programs/record.ctrl.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
             $W->SubmitButton()
1105 1105
                 ->setAjaxAction($confirmedAction)
1106 1106
                 ->setLabel($App->translate('Delete'))
1107
-         );
1107
+            );
1108 1108
         $form->addButton($W->SubmitButton()->setLabel($App->translate('Cancel'))->addClass('widget-close-dialog'));
1109 1109
         $page->addItem($form);
1110 1110
 
@@ -1374,8 +1374,8 @@  discard block
 block discarded – undo
1374 1374
 
1375 1375
 
1376 1376
         /**
1377
-     * @return string[]
1378
-     */
1377
+         * @return string[]
1378
+         */
1379 1379
     public function getFilterNames()
1380 1380
     {
1381 1381
         $id = $this->getModelViewDefaultId();
Please login to merge, or discard this patch.
programs/customfield.ctrl.php 1 patch
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -86,122 +86,122 @@
 block discarded – undo
86 86
 
87 87
 
88 88
 
89
-	/**
90
-	 * @return Widget_Page
91
-	 */
92
-	public function edit($customfield = null)
93
-	{
94
-		$W = bab_Widgets();
95
-		$App = $this->App();
96
-		$Ui = $App->Ui();
97
-		$page = $Ui->Page();
89
+    /**
90
+     * @return Widget_Page
91
+     */
92
+    public function edit($customfield = null)
93
+    {
94
+        $W = bab_Widgets();
95
+        $App = $this->App();
96
+        $Ui = $App->Ui();
97
+        $page = $Ui->Page();
98 98
 
99
-		$page->addClass('app-page-editor');
100
-		$page->setTitle($App->translate('Edit custom field'));
99
+        $page->addClass('app-page-editor');
100
+        $page->setTitle($App->translate('Edit custom field'));
101 101
 
102
-		if (null !== $customfield) {
103
-		    $set = $App->CustomFieldSet();
104
-			$customfield = $set->request($customfield);
105
-		}
102
+        if (null !== $customfield) {
103
+            $set = $App->CustomFieldSet();
104
+            $customfield = $set->request($customfield);
105
+        }
106 106
 
107
-		$form = $Ui->CustomFieldEditor($customfield);
107
+        $form = $Ui->CustomFieldEditor($customfield);
108 108
 
109
-		$page->addItem($form);
109
+        $page->addItem($form);
110 110
 
111
-		if ($customfield instanceof app_CustomField) {
112
-			$actionsFrame = $page->ActionsFrame();
113
-			$page->addContextItem($actionsFrame);
111
+        if ($customfield instanceof app_CustomField) {
112
+            $actionsFrame = $page->ActionsFrame();
113
+            $page->addContextItem($actionsFrame);
114 114
 
115
-			$actionsFrame->addItem($W->Link($W->Icon($App->translate('Delete'), Func_Icons::ACTIONS_EDIT_DELETE), $this->proxy()->delete($customfield->id)));
116
-		}
115
+            $actionsFrame->addItem($W->Link($W->Icon($App->translate('Delete'), Func_Icons::ACTIONS_EDIT_DELETE), $this->proxy()->delete($customfield->id)));
116
+        }
117 117
 
118
-		return $page;
119
-	}
118
+        return $page;
119
+    }
120 120
 
121 121
 
122
-	/**
123
-	 * @return bool
124
-	 */
125
-	public function save($customfield = null)
126
-	{
127
-	    $App = $this->App();
122
+    /**
123
+     * @return bool
124
+     */
125
+    public function save($customfield = null)
126
+    {
127
+        $App = $this->App();
128 128
 
129
-	    $set = $App->CustomFieldSet();
129
+        $set = $App->CustomFieldSet();
130 130
 
131
-		if (empty($customfield['id'])) {
132
-			$record = $set->newRecord();
133
-		} else {
134
-			$record = $set->get($customfield['id']);
135
-		}
131
+        if (empty($customfield['id'])) {
132
+            $record = $set->newRecord();
133
+        } else {
134
+            $record = $set->get($customfield['id']);
135
+        }
136 136
 
137
-		if ('Enum' === $customfield['fieldtype'] || 'Set' === $customfield['fieldtype']) {
138
-		    $enumvalues = array();
139
-		    foreach ($customfield['enumvalues'] as $enumkey => $enumvalue) {
140
-		        $enumvalues[$enumkey] = $set->enumvalues->input($enumvalue);
141
-		    }
142
-			$record->enumvalues = serialize($enumvalues);
143
-		} else {
144
-			$record->enumvalues = '';
145
-		}
137
+        if ('Enum' === $customfield['fieldtype'] || 'Set' === $customfield['fieldtype']) {
138
+            $enumvalues = array();
139
+            foreach ($customfield['enumvalues'] as $enumkey => $enumvalue) {
140
+                $enumvalues[$enumkey] = $set->enumvalues->input($enumvalue);
141
+            }
142
+            $record->enumvalues = serialize($enumvalues);
143
+        } else {
144
+            $record->enumvalues = '';
145
+        }
146 146
 
147
-		unset($customfield['enumvalues']);
148
-		$record->setFormInputValues($customfield);
147
+        unset($customfield['enumvalues']);
148
+        $record->setFormInputValues($customfield);
149 149
 
150
-		$record->save();
150
+        $record->save();
151 151
 
152
-		// refresh target table structure
152
+        // refresh target table structure
153 153
 
154
-		$object = $record->object.'Set';
155
-		$mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']);
154
+        $object = $record->object.'Set';
155
+        $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']);
156 156
 
157
-		$recordSet = $App->$object();
158
-		if (method_exists($recordSet, 'useLang')) {
159
-		    // This is necessary if the recordSet constructor uses a setLang().
160
-		    // We need to revert to multilang fields before synchronizing.
161
-		    $recordSet->useLang(false);
162
-		}
157
+        $recordSet = $App->$object();
158
+        if (method_exists($recordSet, 'useLang')) {
159
+            // This is necessary if the recordSet constructor uses a setLang().
160
+            // We need to revert to multilang fields before synchronizing.
161
+            $recordSet->useLang(false);
162
+        }
163 163
 
164
-		$sql = $mysqlbackend->setToSql($recordSet);
164
+        $sql = $mysqlbackend->setToSql($recordSet);
165 165
 
166
-		require_once $GLOBALS['babInstallPath'].'utilit/devtools.php';
167
-		$synchronize = new bab_synchronizeSql();
168
-		$synchronize->fromSqlString($sql);
166
+        require_once $GLOBALS['babInstallPath'].'utilit/devtools.php';
167
+        $synchronize = new bab_synchronizeSql();
168
+        $synchronize->fromSqlString($sql);
169 169
 
170
-		return true;
171
-	}
170
+        return true;
171
+    }
172 172
 
173 173
 
174 174
     /**
175 175
      * {@inheritDoc}
176 176
      * @see app_CtrlRecord::delete()
177 177
      */
178
-	public function delete($customfield)
179
-	{
180
-	    $App = $this->App();
181
-
182
-	    if (!$customfield) {
183
-		    throw new app_AccessException($App->translate('Access denied'));
184
-		}
185
-
186
-		$set = $App->CustomFieldSet();
187
-		$record = $set->request($customfield);
188
-		$object = $record->object.'Set';
189
-		$set->delete($set->id->is($customfield));
190
-
191
-		$recordSet = $App->$object();
192
-		if (method_exists($recordSet, 'useLang')) {
193
-		    // This is necessary if the recordSet constructor uses a setLang().
194
-		    // We need to revert to multilang fields before synchronizing.
195
-		    $recordSet->useLang(false);
196
-		}
197
-
198
-		$mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']);
199
-		$sql = $mysqlbackend->setToSql($recordSet);
200
-
201
-		require_once $GLOBALS['babInstallPath'].'utilit/devtools.php';
202
-		$synchronize = new bab_synchronizeSql();
203
-		$synchronize->fromSqlString($sql);
204
-
205
-		return true;
206
-	}
178
+    public function delete($customfield)
179
+    {
180
+        $App = $this->App();
181
+
182
+        if (!$customfield) {
183
+            throw new app_AccessException($App->translate('Access denied'));
184
+        }
185
+
186
+        $set = $App->CustomFieldSet();
187
+        $record = $set->request($customfield);
188
+        $object = $record->object.'Set';
189
+        $set->delete($set->id->is($customfield));
190
+
191
+        $recordSet = $App->$object();
192
+        if (method_exists($recordSet, 'useLang')) {
193
+            // This is necessary if the recordSet constructor uses a setLang().
194
+            // We need to revert to multilang fields before synchronizing.
195
+            $recordSet->useLang(false);
196
+        }
197
+
198
+        $mysqlbackend = new ORM_MySqlBackend($GLOBALS['babDB']);
199
+        $sql = $mysqlbackend->setToSql($recordSet);
200
+
201
+        require_once $GLOBALS['babInstallPath'].'utilit/devtools.php';
202
+        $synchronize = new bab_synchronizeSql();
203
+        $synchronize->fromSqlString($sql);
204
+
205
+        return true;
206
+    }
207 207
 }
Please login to merge, or discard this patch.