Passed
Branchdevelop (be7e3f)
by Robin
11:00 queued 14s
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/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/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/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.
programs/ui/base.ui.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     public function __construct(Func_App $app, $id = null, Widget_Layout $layout = null)
120 120
     {
121 121
         parent::__construct($app);
122
-         // We simulate inheritance from Widget_VBoxLayout.
122
+            // We simulate inheritance from Widget_VBoxLayout.
123 123
         $W = $this->widgets = bab_Widgets();
124 124
 
125 125
         $this->buttonsLayout = $this->buttonsLayout();
@@ -1453,21 +1453,21 @@  discard block
 block discarded – undo
1453 1453
 
1454 1454
 
1455 1455
 
1456
-	protected function addCustomFields(app_RecordSet $recordSet)
1457
-	{
1458
-		$customFields = $recordSet->getCustomFields();
1456
+    protected function addCustomFields(app_RecordSet $recordSet)
1457
+    {
1458
+        $customFields = $recordSet->getCustomFields();
1459 1459
 
1460 1460
         foreach ($customFields as $customField) {
1461 1461
             $fieldname = $customField->fieldname;
1462 1462
             $this->addColumn(
1463 1463
                 widget_TableModelViewColumn($recordSet->$fieldname, $customField->name)
1464
-                  ->setSortable(true)
1465
-                  ->setExportable(true)
1466
-                  ->setSearchable($customField->searchable)
1467
-				  ->setVisible($customField->visible)
1464
+                    ->setSortable(true)
1465
+                    ->setExportable(true)
1466
+                    ->setSearchable($customField->searchable)
1467
+                    ->setVisible($customField->visible)
1468 1468
             );
1469 1469
         }
1470
-	}
1470
+    }
1471 1471
 
1472 1472
 
1473 1473
     /**
Please login to merge, or discard this patch.
programs/portlet/base.portlet.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -66,63 +66,63 @@  discard block
 block discarded – undo
66 66
         return $this->addon->getIconPath();
67 67
     }
68 68
 
69
-	/**
70
-	 * Portlet definition ID
71
-	 *
72
-	 * @example lcrm/MyTasks
73
-	 * @return string
74
-	 */
75
-	public function getId()
76
-	{
77
-	    $App = $this->App();
78
-	    $app_path = explode('_', get_class($App));
79
-	    unset($app_path[0]); // remove Func
69
+    /**
70
+     * Portlet definition ID
71
+     *
72
+     * @example lcrm/MyTasks
73
+     * @return string
74
+     */
75
+    public function getId()
76
+    {
77
+        $App = $this->App();
78
+        $app_path = explode('_', get_class($App));
79
+        unset($app_path[0]); // remove Func
80 80
 
81
-		$portlet_path = explode('_',get_class($this));
81
+        $portlet_path = explode('_',get_class($this));
82 82
 
83
-		return implode('/', $app_path).'/'.$portlet_path[count($portlet_path) - 1];
84
-	}
83
+        return implode('/', $app_path).'/'.$portlet_path[count($portlet_path) - 1];
84
+    }
85 85
 
86 86
 
87
-	/**
88
-	 * @return App_PortletUi
89
-	 */
90
-	public function getPortlet()
91
-	{
92
-		$classname = get_class($this);
93
-		$suffix = mb_substr($classname, mb_strlen('App_PortletDefinition_'));
94
-		$classname = 'App_PortletUi_'.$suffix;
87
+    /**
88
+     * @return App_PortletUi
89
+     */
90
+    public function getPortlet()
91
+    {
92
+        $classname = get_class($this);
93
+        $suffix = mb_substr($classname, mb_strlen('App_PortletDefinition_'));
94
+        $classname = 'App_PortletUi_'.$suffix;
95 95
 
96
-		return new $classname($this->App());
97
-	}
96
+        return new $classname($this->App());
97
+    }
98 98
 
99 99
 
100
-	/**
101
-	 * @return array
102
-	 */
103
-	public function getPreferenceFields()
104
-	{
105
-		return array();
106
-	}
100
+    /**
101
+     * @return array
102
+     */
103
+    public function getPreferenceFields()
104
+    {
105
+        return array();
106
+    }
107 107
 
108 108
 
109 109
 
110
-	public function getConfigurationActions()
111
-	{
112
-		return array();
113
-	}
110
+    public function getConfigurationActions()
111
+    {
112
+        return array();
113
+    }
114 114
 
115 115
 
116 116
 
117 117
 
118
-	/**
119
-	 * Get thumbnail URL
120
-	 * max 120x60
121
-	 */
122
-	public function getThumbnail()
123
-	{
124
-		return '';
125
-	}
118
+    /**
119
+     * Get thumbnail URL
120
+     * max 120x60
121
+     */
122
+    public function getThumbnail()
123
+    {
124
+        return '';
125
+    }
126 126
 }
127 127
 
128 128
 
@@ -131,44 +131,44 @@  discard block
 block discarded – undo
131 131
 
132 132
 class App_PortletUi extends app_UiObject
133 133
 {
134
-	protected $options = array();
135
-
136
-
137
-	/**
138
-	 * @return string
139
-	 */
140
-	public function getName()
141
-	{
142
-		$classname = get_class($this);
143
-		return mb_substr($classname, 1 + mb_strlen(__CLASS__));
144
-	}
145
-
146
-
147
-	/**
148
-	 * @return App_PortletDefinition
149
-	 */
150
-	public function getPortletDefinition()
151
-	{
152
-	    $App = $this->App();
153
-	    $portlet = $App->Portlet();
154
-		$classname = get_class($this);
155
-		$method = mb_substr($classname, 1 + mb_strlen(__CLASS__));
156
-		return $portlet->$method();
157
-	}
158
-
159
-
160
-	public function setPreferences(array $configuration)
161
-	{
162
-		$this->options = $configuration;
163
-	}
164
-
165
-	public function setPreference($name, $value)
166
-	{
167
-		$this->options[$name] = $value;
168
-	}
169
-
170
-	public function setPortletId($id)
171
-	{
134
+    protected $options = array();
135
+
136
+
137
+    /**
138
+     * @return string
139
+     */
140
+    public function getName()
141
+    {
142
+        $classname = get_class($this);
143
+        return mb_substr($classname, 1 + mb_strlen(__CLASS__));
144
+    }
145
+
146
+
147
+    /**
148
+     * @return App_PortletDefinition
149
+     */
150
+    public function getPortletDefinition()
151
+    {
152
+        $App = $this->App();
153
+        $portlet = $App->Portlet();
154
+        $classname = get_class($this);
155
+        $method = mb_substr($classname, 1 + mb_strlen(__CLASS__));
156
+        return $portlet->$method();
157
+    }
158
+
159
+
160
+    public function setPreferences(array $configuration)
161
+    {
162
+        $this->options = $configuration;
163
+    }
164
+
165
+    public function setPreference($name, $value)
166
+    {
167
+        $this->options[$name] = $value;
168
+    }
169
+
170
+    public function setPortletId($id)
171
+    {
172 172
         $this->portletId = $id;
173
-	}
173
+    }
174 174
 }
175 175
\ No newline at end of file
Please login to merge, or discard this patch.
programs/configuration.ctrl.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@
 block discarded – undo
191 191
         foreach ($definitions as $packageName => $definition){
192 192
             /* @var $definition app_ComponentDefinition */
193 193
             if(!method_exists($definition, 'getConfiguration')){
194
-               continue; 
194
+                continue; 
195 195
             }
196 196
             $configurationItems[$packageName] = array(
197 197
                 'tabTitle' => $packageName,
Please login to merge, or discard this patch.
programs/sse.ctrl.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,19 +55,19 @@
 block discarded – undo
55 55
             ob_end_flush();
56 56
             flush();
57 57
             sleep($refreshFrequency);
58
-    	}
59
-	}
58
+        }
59
+    }
60 60
 	
61
-	private function getRefreshFrequency()
62
-	{
63
-	    if(!isset($this->refreshFrequency)){
64
-	        $registry = app_getRegistry();
65
-	        $registry->changeDirectory('configuration');
66
-	        $registry->changeDirectory('SSE');
67
-	        $this->refreshFrequency = $registry->getValue('refreshFrequency', 3);
68
-	    }
69
-	    return $this->refreshFrequency;
70
-	}
61
+    private function getRefreshFrequency()
62
+    {
63
+        if(!isset($this->refreshFrequency)){
64
+            $registry = app_getRegistry();
65
+            $registry->changeDirectory('configuration');
66
+            $registry->changeDirectory('SSE');
67
+            $this->refreshFrequency = $registry->getValue('refreshFrequency', 3);
68
+        }
69
+        return $this->refreshFrequency;
70
+    }
71 71
         
72 72
     private function getSSEData()
73 73
     {
Please login to merge, or discard this patch.