Passed
Push — master ( e93494...c85701 )
by Robin
04:03
created
programs/link.class.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function joinSource($sourceClass)
79 79
 	{
80
-	    if (get_class($this->sourceId) !== $sourceClass . 'Set') {
81
-    	    $this->hasOne('sourceId', $sourceClass . 'Set');
80
+	    if (get_class($this->sourceId) !== $sourceClass.'Set') {
81
+    	    $this->hasOne('sourceId', $sourceClass.'Set');
82 82
     		$this->join('sourceId');
83 83
 	    }
84 84
 	}
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function joinTarget($targetClass = null)
91 91
 	{
92
-	    if (get_class($this->targetId) !== $targetClass . 'Set') {
93
-    		$this->hasOne('targetId', $targetClass . 'Set');
92
+	    if (get_class($this->targetId) !== $targetClass.'Set') {
93
+    		$this->hasOne('targetId', $targetClass.'Set');
94 94
     		$this->join('targetId');
95 95
 	    }
96 96
 	}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		}
257 257
 
258 258
 		if ($deleteTarget) {
259
-			foreach($set->select($criteria) as $link) {
259
+			foreach ($set->select($criteria) as $link) {
260 260
 
261 261
 				$className = $link->targetClass.'Set';
262 262
 
Please login to merge, or discard this 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/define.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@
 block discarded – undo
21 21
  * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr})
22 22
  */
23 23
 
24
-define('APP_PHP_PATH', dirname(__FILE__) . '/');
25
-define('APP_SET_PATH', dirname(__FILE__) . '/');
26
-define('APP_UI_PATH', dirname(__FILE__) . '/ui/');
27
-define('APP_WIDGETS_PATH', APP_UI_PATH . 'widgets/');
28
-define('APP_CTRL_PATH', dirname(__FILE__) . '/');
24
+define('APP_PHP_PATH', dirname(__FILE__).'/');
25
+define('APP_SET_PATH', dirname(__FILE__).'/');
26
+define('APP_UI_PATH', dirname(__FILE__).'/ui/');
27
+define('APP_WIDGETS_PATH', APP_UI_PATH.'widgets/');
28
+define('APP_CTRL_PATH', dirname(__FILE__).'/');
29 29
 
30
-require_once APP_PHP_PATH . 'base.class.php';
31
-require_once APP_UI_PATH . 'base.ui.php';
30
+require_once APP_PHP_PATH.'base.class.php';
31
+require_once APP_UI_PATH.'base.ui.php';
32 32
 
33
-require_once $GLOBALS['babInstallPath'] . 'utilit/dateTime.php';
33
+require_once $GLOBALS['babInstallPath'].'utilit/dateTime.php';
34 34
 
35 35
 
36 36
 
Please login to merge, or discard this patch.
programs/component.class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @copyright Copyright (c) 2019 by CapWelton ({@link http://www.capwelton.com})
22 22
  */
23 23
 
24
-require_once dirname(__FILE__). '/record.ctrl.php';
24
+require_once dirname(__FILE__).'/record.ctrl.php';
25 25
 
26 26
 class app_Component 
27 27
 {
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $main = new ReflectionClass($this->set);
58 58
         $dependencies = array();
59
-        if($main->hasMethod('getRequiredComponents')){
59
+        if ($main->hasMethod('getRequiredComponents')) {
60 60
             $requiredComponents = $this->recordSet()->getRequiredComponents();
61
-            foreach ($requiredComponents as $requiredComponent){
61
+            foreach ($requiredComponents as $requiredComponent) {
62 62
                 $dependencies['requiredComponents'][] = $requiredComponent;
63 63
             }
64 64
         }
65
-        if($main->hasMethod('getOptionalComponents')){
65
+        if ($main->hasMethod('getOptionalComponents')) {
66 66
             $optionalComponents = $this->recordSet()->getOptionalComponents();
67
-            foreach ($optionalComponents as $optionalComponent){
67
+            foreach ($optionalComponents as $optionalComponent) {
68 68
                 $dependencies['optionalComponents'][] = $optionalComponent;
69 69
             }
70 70
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public function onUpdate()
80 80
     {
81 81
         $main = new ReflectionClass($this->set);
82
-        if($main->hasMethod('onUpdate')){
82
+        if ($main->hasMethod('onUpdate')) {
83 83
             $this->recordSet()->onUpdate();
84 84
         }
85 85
     }
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function controller($proxy = true)
91 91
     {
92
-        if(!isset($this->controllerObject)){
92
+        if (!isset($this->controllerObject)) {
93 93
             $this->app->includeRecordController();
94 94
             $ctrl = $this->controller;
95 95
             $this->controllerObject = new $ctrl($this->app, $this);
96 96
         }
97
-        if($proxy){
97
+        if ($proxy) {
98 98
             return $this->controllerObject->proxy();
99 99
         }
100 100
         return $this->controllerObject;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function ui()
115 115
     {
116
-        if(!isset($this->uiObject)){
116
+        if (!isset($this->uiObject)) {
117 117
             $ui = $this->ui;
118 118
             $this->uiObject = new $ui($this->app);
119 119
         }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     public function getSetClassName()
130 130
     {
131 131
         $reflectionClass = new ReflectionClass($this->set);
132
-        return $this->app->classPrefix . $reflectionClass->getShortName();
132
+        return $this->app->classPrefix.$reflectionClass->getShortName();
133 133
     }
134 134
     
135 135
     public function getRecordClassName()
Please login to merge, or discard this patch.
programs/ui/ui.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function includeBase()
36 36
     {
37
-        require_once APP_UI_PATH . 'base.ui.php';
38
-        require_once APP_UI_PATH . 'ui.helpers.php';
37
+        require_once APP_UI_PATH.'base.ui.php';
38
+        require_once APP_UI_PATH.'ui.helpers.php';
39 39
     }
40 40
 
41 41
     public function includePage()
42 42
     {
43
-        require_once APP_UI_PATH . 'page.class.php';
43
+        require_once APP_UI_PATH.'page.class.php';
44 44
     }
45 45
 
46 46
     /**
@@ -77,25 +77,25 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function ExportSelectEditor($id, app_TableModelView $tableview, $filter = null)
79 79
     {
80
-        require_once dirname(__FILE__) . '/exportselect.ui.php';
80
+        require_once dirname(__FILE__).'/exportselect.ui.php';
81 81
         return new app_ExportSelectEditor($this->App(), $id, $tableview, $filter);
82 82
     }
83 83
     
84 84
     public function Chip($label, $labelIcon = null, $action = null, $actionIcon = null, $id = null)
85 85
     {
86
-        require_once APP_WIDGETS_PATH . 'chip.class.php';
86
+        require_once APP_WIDGETS_PATH.'chip.class.php';
87 87
         return new app_Chip($this->App(), $label, $labelIcon, $action, $actionIcon, $id);
88 88
     }
89 89
     
90 90
     public function CustomFieldTableView($id = null)
91 91
     {
92
-        require_once APP_UI_PATH . 'customfield.ui.php';
92
+        require_once APP_UI_PATH.'customfield.ui.php';
93 93
         return new app_CustomFieldTableView($this->App(), $id);
94 94
     }
95 95
     
96 96
     public function CustomFieldEditor(app_CustomField $customField = null, $id = null, $layout = null)
97 97
     {
98
-        require_once APP_UI_PATH . 'customfield.ui.php';
98
+        require_once APP_UI_PATH.'customfield.ui.php';
99 99
         return new app_CustomFieldEditor($this->App(), $customField, $id, $layout);
100 100
     }
101 101
 }
102 102
\ No newline at end of file
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/ui/widgets/chip.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,14 +70,14 @@
 block discarded – undo
70 70
         
71 71
         $html = "<div class='chip'>";
72 72
         
73
-        if(isset($this->labelIcon)){
73
+        if (isset($this->labelIcon)) {
74 74
             $icon = $W->Label('')->setIconFormat(16, 'left')->setIcon($this->labelIcon);
75 75
             $html .= $icon->display($W->HtmlCanvas());
76 76
         }
77 77
         
78 78
         $html .= $this->label;
79 79
         
80
-        if(isset($this->action)){
80
+        if (isset($this->action)) {
81 81
             $icon = $W->Link('', $this->action)->setIconFormat(16, 'left')->setOpenMode(Widget_Link::OPEN_DIALOG_AND_RELOAD);
82 82
             $icon->setIcon(isset($this->actionIcon) ? $this->actionIcon : Func_Icons::ACTIONS_DIALOG_CANCEL);
83 83
             $icon->addClass('chip-right-action');
Please login to merge, or discard this patch.
programs/app.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -355,8 +355,7 @@
 block discarded – undo
355 355
                 $sql .= $mysqlbackend->setToSql($set) . "\n";
356 356
                 
357 357
                 $component->onUpdate();
358
-            }
359
-            catch (Exception $e){
358
+            } catch (Exception $e){
360 359
                 
361 360
             }
362 361
         }
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
  * @copyright Copyright (c) 2018 by CANTICO ({@link http://www.cantico.fr})
22 22
  */
23 23
 
24
-require_once dirname(__FILE__) . '/define.php';
25
-require_once dirname(__FILE__) . '/functions.php';
26
-require_once dirname(__FILE__) . '/component.class.php';
24
+require_once dirname(__FILE__).'/define.php';
25
+require_once dirname(__FILE__).'/functions.php';
26
+require_once dirname(__FILE__).'/component.class.php';
27 27
 
28 28
 
29 29
 
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
         $this->addonName = 'libapp';
60 60
         $this->addonPrefix = 'app';
61 61
 
62
-        $this->classPrefix = $this->addonPrefix . '_';
63
-        $this->controllerTg = 'addon/' . $this->addonName . '/main';
62
+        $this->classPrefix = $this->addonPrefix.'_';
63
+        $this->controllerTg = 'addon/'.$this->addonName.'/main';
64 64
 
65 65
         $addon = bab_getAddonInfosInstance($this->addonName);
66 66
         $this->phpPath = $addon->getPhpPath();
67 67
         $this->recordSetPath = $this->phpPath;
68 68
         $this->ctrlPath = $this->phpPath;
69
-        $this->uiPath = $this->phpPath . 'ui/';
69
+        $this->uiPath = $this->phpPath.'ui/';
70 70
 
71 71
         $babDB = bab_getDB();
72 72
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function getComponentByName($componentName)
94 94
     {
95
-        if(isset($this->components[$componentName])){
95
+        if (isset($this->components[$componentName])) {
96 96
             return $this->components[$componentName];
97 97
         }
98 98
         return null;
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
         
132 132
         $messages = array();
133 133
         
134
-        foreach ($components as $componentName => $component){
134
+        foreach ($components as $componentName => $component) {
135 135
             $dependencies = $component->checkDependencies();
136
-            foreach($dependencies['requiredComponents'] as $requiredComponent){
136
+            foreach ($dependencies['requiredComponents'] as $requiredComponent) {
137 137
                 $messages['requiredComponents'][$componentName][] = $requiredComponent;
138 138
             }
139
-            foreach($dependencies['optionalComponents'] as $optionalComponent){
139
+            foreach ($dependencies['optionalComponents'] as $optionalComponent) {
140 140
                 $messages['optionalComponents'][$componentName][] = $optionalComponent;
141 141
             }
142 142
         }
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
     public function getRecordSetPathname($class)
180 180
     {
181 181
         // $App->MyRecordSet() -> myrecord.class.php
182
-        $file = strtolower(substr($class, strlen($this->classPrefix), -3)) . '.class.php';
183
-        return $this->recordSetPath . $file;
182
+        $file = strtolower(substr($class, strlen($this->classPrefix), -3)).'.class.php';
183
+        return $this->recordSetPath.$file;
184 184
     }
185 185
 
186 186
     /**
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
     public function getRecordPathname($class)
193 193
     {
194 194
         // $App->MyRecord() -> myrecord.class.php
195
-        $file = strtolower(substr($class, strlen($this->classPrefix))) . '.class.php';
196
-        return $this->recordSetPath . $file;
195
+        $file = strtolower(substr($class, strlen($this->classPrefix))).'.class.php';
196
+        return $this->recordSetPath.$file;
197 197
     }
198 198
 
199 199
     /**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
             if (substr($method, 0, 7) === 'include' && substr($method, -3) === 'Set') {
296 296
                 $incl = $method;
297
-                $classNameMethod = substr($method, strlen('include')) . 'ClassName';
297
+                $classNameMethod = substr($method, strlen('include')).'ClassName';
298 298
 
299 299
 
300 300
                 $classname = $this->$classNameMethod();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                                 // We need to revert to multilang fields before synchronizing.
317 317
                                 $set->useLang(false);
318 318
                             }
319
-                            $sql .= $mysqlbackend->setToSql($set) . "\n";
319
+                            $sql .= $mysqlbackend->setToSql($set)."\n";
320 320
                         }
321 321
                     }
322 322
                 }
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
         $sql = 'SET FOREIGN_KEY_CHECKS=0;
343 343
             ';
344 344
 
345
-        foreach ($this->components as $component){
345
+        foreach ($this->components as $component) {
346 346
             /* @var $component app_Component */
347
-            try{
347
+            try {
348 348
                 /* @var $set ORM_RecordSet */
349 349
                 $set = $component->recordSet();
350 350
                 if (method_exists($set, 'useLang')) {
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
                     // We need to revert to multilang fields before synchronizing.
353 353
                     $set->useLang(false);
354 354
                 }
355
-                $sql .= $mysqlbackend->setToSql($set) . "\n";
355
+                $sql .= $mysqlbackend->setToSql($set)."\n";
356 356
                 
357 357
                 $component->onUpdate();
358 358
             }
359
-            catch (Exception $e){
359
+            catch (Exception $e) {
360 360
                 
361 361
             }
362 362
         }
@@ -367,18 +367,18 @@  discard block
 block discarded – undo
367 367
         $synchronize->fromSqlString($sql);
368 368
         
369 369
         $dependencies = $this->checkComponentsDependencies();
370
-        foreach ($dependencies['requiredComponents'] as $componentName => $requiredComponents){
371
-            foreach ($requiredComponents as $requiredComponent){
370
+        foreach ($dependencies['requiredComponents'] as $componentName => $requiredComponents) {
371
+            foreach ($requiredComponents as $requiredComponent) {
372 372
                 $hasComponent = $this->getComponentByName($requiredComponent);
373
-                if(!$hasComponent){
373
+                if (!$hasComponent) {
374 374
                     bab_installWindow::message(sprintf($this->translate('The component %s is required for the component %s to work. You will encounter fatal errors'), $requiredComponent, $componentName));
375 375
                 }
376 376
             }
377 377
         }
378
-        foreach ($dependencies['optionalComponents'] as $componentName => $optionalComponents){
379
-            foreach ($optionalComponents as $optionalComponent){
378
+        foreach ($dependencies['optionalComponents'] as $componentName => $optionalComponents) {
379
+            foreach ($optionalComponents as $optionalComponent) {
380 380
                 $hasComponent = $this->getComponentByName($optionalComponent);
381
-                if(!$hasComponent){
381
+                if (!$hasComponent) {
382 382
                     bab_installWindow::message(sprintf($this->translate('The optional component %s has not been added. The component %s may have reduced functionalities'), $optionalComponent, $componentName));
383 383
                 }
384 384
             }
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
             if (substr($method, 0, strlen('include')) === 'include' && substr($method, -strlen('Set')) === 'Set') {
405 405
                 $incl = $method;
406
-                $classNameMethod = substr($method, strlen('include')) . 'ClassName';
406
+                $classNameMethod = substr($method, strlen('include')).'ClassName';
407 407
 
408 408
                 $classname = $this->$classNameMethod();
409 409
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
                             if (class_exists($classname) && method_exists($this, $call)) {
419 419
                                 $set = $this->$call();
420
-                                $sql .= $mysqlbackend->setToSql($set) . "\n";
420
+                                $sql .= $mysqlbackend->setToSql($set)."\n";
421 421
                             }
422 422
                         }
423 423
                     }
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 
432 432
     public function includeBase()
433 433
     {
434
-        require_once APP_PHP_PATH . 'base.class.php';
434
+        require_once APP_PHP_PATH.'base.class.php';
435 435
     }
436 436
 
437 437
     /**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function includeRecordSet()
441 441
     {
442
-        require_once APP_SET_PATH . 'record.class.php';
442
+        require_once APP_SET_PATH.'record.class.php';
443 443
     }
444 444
 
445 445
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
      */
449 449
     public function includeTraceableRecordSet()
450 450
     {
451
-        require_once APP_SET_PATH . 'traceablerecord.class.php';
451
+        require_once APP_SET_PATH.'traceablerecord.class.php';
452 452
     }
453 453
 
454 454
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
     {
461 461
         static $accessManager = null;
462 462
         if (!isset($accessManager)) {
463
-            require_once APP_SET_PATH . 'accessmanager.class.php';
463
+            require_once APP_SET_PATH.'accessmanager.class.php';
464 464
             $accessManager = new app_AccessManager($this);
465 465
         }
466 466
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
      */
479 479
     public function includeLogSet()
480 480
     {
481
-        require_once APP_SET_PATH . 'log.class.php';
481
+        require_once APP_SET_PATH.'log.class.php';
482 482
     }
483 483
 
484 484
     /**
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
      */
495 495
     public function LogSetClassName()
496 496
     {
497
-        return $this->LogClassName() . 'Set';
497
+        return $this->LogClassName().'Set';
498 498
     }
499 499
 
500 500
     /**
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
      */
517 517
     public function includeLinkSet()
518 518
     {
519
-        require_once APP_SET_PATH . 'link.class.php';
519
+        require_once APP_SET_PATH.'link.class.php';
520 520
     }
521 521
 
522 522
     /**
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
      */
533 533
     public function LinkSetClassName()
534 534
     {
535
-        return $this->LinkClassName() . 'Set';
535
+        return $this->LinkClassName().'Set';
536 536
     }
537 537
 
538 538
     /**
@@ -556,10 +556,10 @@  discard block
 block discarded – undo
556 556
     public function getRecordSetByRef($recordClassname)
557 557
     {
558 558
         $component = $this->getComponentByName(str_replace($this->classPrefix, '', $recordClassname));
559
-        if(isset($component)){
559
+        if (isset($component)) {
560 560
             return $component->recordSet();
561 561
         }
562
-        $classSet = $recordClassname . 'Set';
562
+        $classSet = $recordClassname.'Set';
563 563
         $set = $this->$classSet();
564 564
         return $set;
565 565
     }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
     {
597 597
         $fullClassName = get_class($record);
598 598
         list(, $className) = explode('_', $fullClassName);
599
-        return $className . ':' . $record->id;
599
+        return $className.':'.$record->id;
600 600
     }
601 601
 
602 602
 
@@ -687,16 +687,16 @@  discard block
 block discarded – undo
687 687
      */
688 688
     public function mailTo($addr, $subject = null, $body = null)
689 689
     {
690
-        $mailTo = 'mailto:' . $addr;
690
+        $mailTo = 'mailto:'.$addr;
691 691
         $parameters = array();
692 692
         if (isset($subject)) {
693
-            $parameters[] = 'subject=' . $subject;
693
+            $parameters[] = 'subject='.$subject;
694 694
         }
695 695
         if (isset($body)) {
696
-            $parameters[] = 'body=' . $body;
696
+            $parameters[] = 'body='.$body;
697 697
         }
698 698
         if (!empty($parameters)) {
699
-            $mailTo .= '?' . implode('&', $parameters);
699
+            $mailTo .= '?'.implode('&', $parameters);
700 700
         }
701 701
 
702 702
         return $mailTo;
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
         }
748 748
 
749 749
         $number = number_format($number, $decimals, ',', ' ');
750
-        return str_replace(' ', bab_nbsp(), $number . ' ' . $prefix . $unitSymbol);
750
+        return str_replace(' ', bab_nbsp(), $number.' '.$prefix.$unitSymbol);
751 751
     }
752 752
 
753 753
 
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
         }
768 768
 
769 769
         if (!isset($format)) {
770
-            $format = bab_registry::get('/' . $this->addonName . '/numberFormat', $PhoneNumber->getDefaultFormat());
770
+            $format = bab_registry::get('/'.$this->addonName.'/numberFormat', $PhoneNumber->getDefaultFormat());
771 771
         }
772 772
         $phoneNumberUtil = $PhoneNumber->PhoneNumberUtil();
773 773
 
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
      */
789 789
     public function includeController()
790 790
     {
791
-        require_once APP_PHP_PATH . '/controller.class.php';
791
+        require_once APP_PHP_PATH.'/controller.class.php';
792 792
     }
793 793
 
794 794
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
      */
798 798
     public function includeRecordController()
799 799
     {
800
-        require_once APP_CTRL_PATH . '/record.ctrl.php';
800
+        require_once APP_CTRL_PATH.'/record.ctrl.php';
801 801
     }
802 802
 
803 803
 
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
      */
838 838
     public function includeUi()
839 839
     {
840
-        require_once APP_UI_PATH . 'ui.class.php';
840
+        require_once APP_UI_PATH.'ui.class.php';
841 841
     }
842 842
 
843 843
 
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
     public function Ui()
850 850
     {
851 851
         $this->includeUi();
852
-        return bab_getInstance($this->classPrefix . 'Ui');//->setApp($this);
852
+        return bab_getInstance($this->classPrefix.'Ui'); //->setApp($this);
853 853
     }
854 854
 
855 855
     /**
@@ -877,34 +877,34 @@  discard block
 block discarded – undo
877 877
 
878 878
             case substr($name, -strlen('SetClassName')) === 'SetClassName':
879 879
                 $className = substr($name, 0, strlen($name) - strlen('SetClassName'));
880
-                if($component = $this->getComponentByName(ucfirst($className))){
880
+                if ($component = $this->getComponentByName(ucfirst($className))) {
881 881
                     return $component->getSetClassName();
882 882
                 }
883 883
                 $setName = $className.'Set';
884
-                return $this->classPrefix . $setName;
884
+                return $this->classPrefix.$setName;
885 885
 
886 886
             case substr($name, -strlen('ClassName')) === 'ClassName':
887 887
                 $recordName = substr($name, 0, strlen($name) - strlen('ClassName'));
888
-                if($component = $this->getComponentByName(ucfirst($recordName))){
888
+                if ($component = $this->getComponentByName(ucfirst($recordName))) {
889 889
                     return $component->getRecordClassName();
890 890
                 }
891
-                return $this->classPrefix . $recordName;
891
+                return $this->classPrefix.$recordName;
892 892
 
893 893
             case substr($name, 0, strlen('include')) === 'include' && substr($name, -strlen('Set')) === 'Set':
894 894
                 $fileNameBase = strtolower(substr(substr($name, 0, strlen($name) - strlen('Set')), strlen('include')));
895
-                if($this->getComponentByName(ucfirst($fileNameBase))){
895
+                if ($this->getComponentByName(ucfirst($fileNameBase))) {
896 896
                     return;
897 897
                 }
898
-                require_once APP_SET_PATH . $fileNameBase . '.class.php';
898
+                require_once APP_SET_PATH.$fileNameBase.'.class.php';
899 899
                 return;
900 900
 
901 901
             case substr($name, -strlen('Set')) === 'Set':
902
-                if($component = $this->getComponentByName(ucfirst(substr($name, 0, strlen($name) -strlen('Set'))))){
902
+                if ($component = $this->getComponentByName(ucfirst(substr($name, 0, strlen($name) - strlen('Set'))))) {
903 903
                     return $component->recordSet();
904 904
                 }
905
-                $includeMethod = 'include' . $name;
905
+                $includeMethod = 'include'.$name;
906 906
                 $this->$includeMethod();
907
-                $setClassNameMethod = $name . 'ClassName';
907
+                $setClassNameMethod = $name.'ClassName';
908 908
                 $className = $this->$setClassNameMethod();
909 909
                 $set = new $className($this);
910 910
                 return $set;
@@ -912,8 +912,8 @@  discard block
 block discarded – undo
912 912
             case ($component = $this->getComponentByName(ucfirst($name))) != false:
913 913
                 return $component;
914 914
             default:
915
-                $setName = $name . 'Set';
916
-                $recordClassNameMethod = $name . 'ClassName';
915
+                $setName = $name.'Set';
916
+                $recordClassNameMethod = $name.'ClassName';
917 917
                 $recordClassName = $this->$recordClassNameMethod();
918 918
                 if (isset($arguments[0])) {
919 919
                     if ($arguments[0] instanceof $recordClassName) {
Please login to merge, or discard this patch.
programs/record.ctrl.php 3 patches
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.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr})
22 22
  */
23 23
 
24
-require_once dirname(__FILE__) . '/controller.class.php';
24
+require_once dirname(__FILE__).'/controller.class.php';
25 25
 
26 26
 
27 27
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     protected function getRecordClassName()
38 38
     {
39 39
         $App = $this->App();
40
-        if($currentComponent = $App->getCurrentComponent()){
40
+        if ($currentComponent = $App->getCurrentComponent()) {
41 41
             return $currentComponent->getRecordClassName();
42 42
         }
43 43
         list(, $recordClassname) = explode('_Ctrl', $this->getClass());
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
     protected function getRecordSet()
56 56
     {
57 57
         $App = $this->App();
58
-        if($currentComponent = $App->getCurrentComponent()){
58
+        if ($currentComponent = $App->getCurrentComponent()) {
59 59
             return $currentComponent->recordSet();
60 60
         }
61 61
         $recordClassname = $this->getRecordClassName();
62
-        $recordSetClassname = $recordClassname . 'Set';
62
+        $recordSetClassname = $recordClassname.'Set';
63 63
 
64 64
         $recordSet = $App->$recordSetClassname();
65 65
         return $recordSet;
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
             if ($showLabel) {
112 112
                 $text = $actions->getTitle();
113 113
             }
114
-            $html = '<li><a class="icon ' . $actions->getIcon() .  '" href="' . $actions->url() . '">' . $text . '</a></li>';
114
+            $html = '<li><a class="icon '.$actions->getIcon().'" href="'.$actions->url().'">'.$text.'</a></li>';
115 115
         } elseif ($actions instanceof Widget_Link) {
116
-            $html = '<li>' . $actions->display($canvas) . '</li>';
116
+            $html = '<li>'.$actions->display($canvas).'</li>';
117 117
         } elseif (is_array($actions)) {
118 118
             if (isset($actions['items'])) {
119 119
                 $items = $actions['items'];
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
             if (isset($actions['icon'])) {
127 127
 
128 128
                 $html = '<li class="dropdown">'
129
-                    . '<a href="#" class="' . $actions['icon'] . ' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'
129
+                    . '<a href="#" class="'.$actions['icon'].' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'
130 130
                     . ($actions['icon'] === 'actions-context-menu'/*Func_Icons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>')
131 131
                     . '</a>'
132
-                    . '<ul class="dropdown-menu dropdown-menu-right ' . Func_Icons::ICON_LEFT_SYMBOLIC . '">'
132
+                    . '<ul class="dropdown-menu dropdown-menu-right '.Func_Icons::ICON_LEFT_SYMBOLIC.'">'
133 133
                     . $html
134 134
                     . '</ul>';
135 135
             }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
         $recordClassname = $this->getRecordClassName();
154 154
 
155
-        $viewClassname =  $recordClassname . 'TableView';
155
+        $viewClassname = $recordClassname.'TableView';
156 156
         if (method_exists($Ui, $viewClassname)) {
157 157
             $types['table'] = array(
158 158
                 'classname' => $viewClassname,
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             );
162 162
         }
163 163
 
164
-        $viewClassname =  $recordClassname . 'CardsView';
164
+        $viewClassname = $recordClassname.'CardsView';
165 165
         if (method_exists($Ui, $viewClassname)) {
166 166
             $types['cards'] = array(
167 167
                 'classname' => $viewClassname,
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             );
171 171
         }
172 172
 
173
-        $viewClassname =  $recordClassname . 'MapView';
173
+        $viewClassname = $recordClassname.'MapView';
174 174
         if (method_exists($Ui, $viewClassname)) {
175 175
             $types['map'] = array(
176 176
                 'classname' => $viewClassname,
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             );
180 180
         }
181 181
 
182
-        $viewClassname =  $recordClassname . 'CalendarView';
182
+        $viewClassname = $recordClassname.'CalendarView';
183 183
         if (method_exists($Ui, $viewClassname)) {
184 184
             $types['calendar'] = array(
185 185
                 'classname' => $viewClassname,
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
         $recordSet = $this->getEditRecordSet();
259 259
 
260 260
         $recordClassname = $this->getRecordClassName();
261
-        $editorClassname =  $recordClassname . 'SectionEditor';
261
+        $editorClassname = $recordClassname.'SectionEditor';
262 262
         /* @var $editor app_RecordEditor */
263 263
         $editor = $Ui->$editorClassname();
264 264
         if (!isset($itemId)) {
265
-            $itemId = $this->getClass() . '_' . __FUNCTION__;
265
+            $itemId = $this->getClass().'_'.__FUNCTION__;
266 266
         }
267 267
         $editor->setId($itemId);
268 268
         $editor->setHiddenValue('tg', $App->controllerTg);
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     public function getModelViewDefaultId($itemId = null)
306 306
     {
307 307
         if (!isset($itemId)) {
308
-            $itemId = $this->getClass() . '_modelView';
308
+            $itemId = $this->getClass().'_modelView';
309 309
         }
310 310
 
311 311
         return $itemId;
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
     protected function modelView($filter = null, $type = null, $columns = null, $itemId = null)
324 324
     {
325 325
         $App = $this->App();
326
-        if($currentComponent = $App->getCurrentComponent()){
326
+        if ($currentComponent = $App->getCurrentComponent()) {
327 327
             $Ui = $currentComponent->ui();
328 328
         }
329
-        else{
329
+        else {
330 330
             $Ui = $App->Ui();
331 331
         }
332 332
 
@@ -344,20 +344,20 @@  discard block
 block discarded – undo
344 344
 
345 345
         switch ($type) {
346 346
             case 'cards':
347
-                $tableviewClassname =  $currentComponent ? 'cardsView' : $recordClassname . 'CardsView';
347
+                $tableviewClassname = $currentComponent ? 'cardsView' : $recordClassname.'CardsView';
348 348
                 break;
349 349
 
350 350
             case 'map':
351
-                $tableviewClassname =  $currentComponent ? 'mapView' : $recordClassname . 'MapView';
351
+                $tableviewClassname = $currentComponent ? 'mapView' : $recordClassname.'MapView';
352 352
                 break;
353 353
 
354 354
             case 'calendar':
355
-                $tableviewClassname =  $currentComponent ? 'calendarView' : $recordClassname . 'CalendarView';
355
+                $tableviewClassname = $currentComponent ? 'calendarView' : $recordClassname.'CalendarView';
356 356
                 break;
357 357
 
358 358
             case 'table':
359 359
             default:
360
-                $tableviewClassname =  $currentComponent ? 'tableView' : $recordClassname . 'TableView';
360
+                $tableviewClassname = $currentComponent ? 'tableView' : $recordClassname.'TableView';
361 361
                 break;
362 362
         }
363 363
 
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
     {
423 423
         $App = $this->App();
424 424
         $Ui = $App->Ui();
425
-        if($currentComponent = $App->getCurrentComponent()){
425
+        if ($currentComponent = $App->getCurrentComponent()) {
426 426
             $editor = $currentComponent->ui()->editor();
427 427
         }
428
-        else{
428
+        else {
429 429
 
430 430
             $recordClassname = $this->getRecordClassName();
431
-            $editorClassname =  $recordClassname . 'Editor';
431
+            $editorClassname = $recordClassname.'Editor';
432 432
             $editor = $Ui->$editorClassname();
433 433
         }
434 434
 
435 435
         if (!isset($itemId)) {
436
-            $itemId = $this->getClass() . '_' . __FUNCTION__;
436
+            $itemId = $this->getClass().'_'.__FUNCTION__;
437 437
         }
438 438
         $editor->setId($itemId);
439 439
         $editor->setHiddenValue('tg', $App->controllerTg);
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
                     $W->Link(
479 479
                         '',
480 480
                         $proxy->setFilteredViewType($tableView->getId(), $viewTypeId)
481
-                    )->addClass('icon', $viewType['icon'] . ($filteredViewType=== $viewTypeId ? ' active' : ''))
481
+                    )->addClass('icon', $viewType['icon'].($filteredViewType === $viewTypeId ? ' active' : ''))
482 482
 //                    ->setSizePolicy('btn btn-xs btn-default ' . ($filteredViewType === $viewTypeId ? 'active' : ''))
483 483
                     ->setTitle($viewType['label'])
484 484
                     ->setAjaxAction()
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 
523 523
         $filterVisibility = $this->getFilterVisibility($itemId);
524 524
         $filterVisibility = !$filterVisibility;
525
-        $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);
525
+        $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);
526 526
 
527 527
         return true;
528 528
     }
@@ -535,10 +535,10 @@  discard block
 block discarded – undo
535 535
     protected function getFilterVisibility($itemId)
536 536
     {
537 537
         $W = bab_Widgets();
538
-        $filterVisibility = $W->getUserConfiguration($itemId . '/filterVisibility');
538
+        $filterVisibility = $W->getUserConfiguration($itemId.'/filterVisibility');
539 539
         if (!isset($filterVisibility)) {
540 540
             $filterVisibility = false;
541
-            $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);
541
+            $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);
542 542
         }
543 543
         return $filterVisibility;
544 544
     }
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
     protected function getFilteredViewType($itemId)
553 553
     {
554 554
         $W = bab_Widgets();
555
-        $type = $W->getUserConfiguration($itemId . '/viewType');
555
+        $type = $W->getUserConfiguration($itemId.'/viewType');
556 556
         if (!isset($type)) {
557 557
             $type = 'table';
558 558
         }
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
     public function setFilteredViewType($itemId, $type = null)
569 569
     {
570 570
         $W = bab_Widgets();
571
-        $W->setUserConfiguration($itemId . '/viewType', $type);
571
+        $W->setUserConfiguration($itemId.'/viewType', $type);
572 572
 
573 573
         return true;
574 574
     }
@@ -716,17 +716,17 @@  discard block
 block discarded – undo
716 716
 
717 717
         switch ($format) {
718 718
             case 'xlsx':
719
-                $tableview->downloadXlsx($filename . '.xlsx');
719
+                $tableview->downloadXlsx($filename.'.xlsx');
720 720
                 break;
721 721
             case 'xls':
722
-                $tableview->downloadExcel($filename . '.xls');
722
+                $tableview->downloadExcel($filename.'.xls');
723 723
                 break;
724 724
             case 'ssv':
725
-                $tableview->downloadCsv($filename . '.csv', ';', $inline, 'Windows-1252');
725
+                $tableview->downloadCsv($filename.'.csv', ';', $inline, 'Windows-1252');
726 726
                 break;
727 727
             case 'csv':
728 728
             default:
729
-                $tableview->downloadCsv($filename . '.csv', ',', $inline, bab_charset::getIso());
729
+                $tableview->downloadCsv($filename.'.csv', ',', $inline, bab_charset::getIso());
730 730
                 break;
731 731
         }
732 732
     }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
         $Ui = $App->Ui();
756 756
 
757 757
         $recordClassname = $this->getRecordClassName();
758
-        $fullFrameClassname =  $recordClassname . 'FullFrame';
758
+        $fullFrameClassname = $recordClassname.'FullFrame';
759 759
         $fullFrame = $Ui->$fullFrameClassname($record, $view);
760 760
 
761 761
 
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 
919 919
         $recordTitle = $record->getRecordTitle();
920 920
 
921
-        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"');
921
+        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"');
922 922
         return $message;
923 923
     }
924 924
 
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
                 $this->addMessage($message);
1017 1017
             }
1018 1018
 
1019
-            $this->addReloadSelector('.depends-' . $this->getRecordClassName());
1019
+            $this->addReloadSelector('.depends-'.$this->getRecordClassName());
1020 1020
             return true;
1021 1021
         }
1022 1022
 
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
             $this->addMessage($deletedMessage);
1049 1049
         }
1050 1050
 
1051
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1051
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1052 1052
 
1053 1053
         return true;
1054 1054
     }
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 
1089 1089
         $recordTitle = $record->getRecordTitle();
1090 1090
 
1091
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1091
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1092 1092
         $form->addItem($W->Title($subTitle, 5));
1093 1093
 
1094 1094
         $form->addItem($W->Title($App->translate('Confirm delete?'), 6));
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
             }
1148 1148
         }
1149 1149
 
1150
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1150
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1151 1151
 
1152 1152
         return true;
1153 1153
     }
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 
1177 1177
         $recordTitle = $record->getRecordTitle();
1178 1178
 
1179
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1179
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1180 1180
         $form->addItem($W->Title($subTitle, 5));
1181 1181
 
1182 1182
         $form->addItem($W->Title($App->translate('Confirm delete?'), 6));
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
         $record = null;
1221 1221
         foreach ($records as $record) {
1222 1222
         }
1223
-        if (! isset($record)) {
1223
+        if (!isset($record)) {
1224 1224
             throw new app_AccessException('Sorry, You are not allowed to perform this operation');
1225 1225
         }
1226 1226
         if (!$record->isRestorable()) {
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
         $record->save();
1235 1235
         $this->addMessage($deletedMessage);
1236 1236
 
1237
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1237
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1238 1238
 
1239 1239
         return true;
1240 1240
     }
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
         $record = null;
1257 1257
         foreach ($records as $record) {
1258 1258
         }
1259
-        if (! isset($record)) {
1259
+        if (!isset($record)) {
1260 1260
             throw new app_AccessException('Sorry, You are not allowed to perform this operation');
1261 1261
         }
1262 1262
 
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 
1270 1270
         $recordTitle = $record->getRecordTitle();
1271 1271
 
1272
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1272
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1273 1273
         $form->addItem($W->Title($subTitle, 5));
1274 1274
 
1275 1275
         $confirmedAction = $this->proxy()->restore($id);
@@ -1385,14 +1385,14 @@  discard block
 block discarded – undo
1385 1385
         $registry = bab_getRegistryInstance();
1386 1386
 
1387 1387
         $userId = '0';
1388
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id. '/filters');
1388
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters');
1389 1389
 
1390 1390
         while ($filterName = $registry->fetchChildKey()) {
1391 1391
             $filters[] = $filterName;
1392 1392
         }
1393 1393
 
1394 1394
         $userId = bab_getUserId();
1395
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id. '/filters');
1395
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters');
1396 1396
 
1397 1397
         while ($filterName = $registry->fetchChildKey()) {
1398 1398
             $filters[] = $filterName;
@@ -1413,15 +1413,15 @@  discard block
 block discarded – undo
1413 1413
     {
1414 1414
         $W = bab_Widgets();
1415 1415
         $tableview = $this->modelView(null, 'table');
1416
-        $W->setUserConfiguration($tableview->getId(). '/currentFilterName', $filterName, 'widgets', false);
1416
+        $W->setUserConfiguration($tableview->getId().'/currentFilterName', $filterName, 'widgets', false);
1417 1417
 
1418 1418
         $registry = bab_getRegistryInstance();
1419 1419
         $userId = '0';
1420
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $tableview->getId() . '/filters');
1420
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$tableview->getId().'/filters');
1421 1421
         $filterValues = $registry->getValue($filterName);
1422 1422
 
1423 1423
         if (!$filterValues) {
1424
-            $filterValues = $W->getUserConfiguration($tableview->getId() . '/filters/' . $filterName, 'widgets', false);
1424
+            $filterValues = $W->getUserConfiguration($tableview->getId().'/filters/'.$filterName, 'widgets', false);
1425 1425
         }
1426 1426
 
1427 1427
         $tableview = $this->modelView($filterValues, 'table');
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
     {
1441 1441
         $W = bab_Widgets();
1442 1442
         $id = $this->getModelViewDefaultId();
1443
-        $filter = $W->getUserConfiguration($id. '/currentFilterName', 'widgets', false);
1443
+        $filter = $W->getUserConfiguration($id.'/currentFilterName', 'widgets', false);
1444 1444
 
1445 1445
         return $filter;
1446 1446
     }
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
     {
1455 1455
         if (isset($name)) {
1456 1456
             $W = bab_Widgets();
1457
-            $filter = $W->getUserConfiguration($tableview->getId(). '/filters/' . $name, 'widgets', false);
1457
+            $filter = $W->getUserConfiguration($tableview->getId().'/filters/'.$name, 'widgets', false);
1458 1458
             $filterValues = $filter['values'];
1459 1459
         } else {
1460 1460
             $filterValues = null;
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
             'values' => $filterValues,
1486 1486
         );
1487 1487
 
1488
-        $W->setUserConfiguration($tableview->getId(). '/filters/' . $name, $data, 'widgets', false);
1488
+        $W->setUserConfiguration($tableview->getId().'/filters/'.$name, $data, 'widgets', false);
1489 1489
 
1490 1490
         return true;
1491 1491
     }
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
         $Ui = $App->Ui();
1504 1504
 
1505 1505
         $currentFilterName = $this->getCurrentFilterName();
1506
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $currentFilterName, 'widgets', false);
1506
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$currentFilterName, 'widgets', false);
1507 1507
 
1508 1508
         $page = $Ui->Page();
1509 1509
 
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
         $App = $this->App();
1557 1557
         $Ui = $App->Ui();
1558 1558
 
1559
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
1559
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
1560 1560
 
1561 1561
         $page = $Ui->Page();
1562 1562
 
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 
1609 1609
         $filterNames = $this->getFilterNames();
1610 1610
         foreach ($filterNames as $filterName) {
1611
-            $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false);
1611
+            $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false);
1612 1612
 
1613 1613
             $filterBox = $W->FlowItems()
1614 1614
                 ->setVerticalAlign('top')
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
         $App = $this->App();
1654 1654
         $Ui = $App->Ui();
1655 1655
 
1656
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
1656
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
1657 1657
 
1658 1658
         $page = $Ui->Page();
1659 1659
 
@@ -1690,7 +1690,7 @@  discard block
 block discarded – undo
1690 1690
         $this->requireDeleteMethod();
1691 1691
 
1692 1692
         $W = bab_Widgets();
1693
-        $W->deleteUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
1693
+        $W->deleteUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
1694 1694
 
1695 1695
         return true;
1696 1696
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -325,8 +325,7 @@  discard block
 block discarded – undo
325 325
         $App = $this->App();
326 326
         if($currentComponent = $App->getCurrentComponent()){
327 327
             $Ui = $currentComponent->ui();
328
-        }
329
-        else{
328
+        } else{
330 329
             $Ui = $App->Ui();
331 330
         }
332 331
 
@@ -424,8 +423,7 @@  discard block
 block discarded – undo
424 423
         $Ui = $App->Ui();
425 424
         if($currentComponent = $App->getCurrentComponent()){
426 425
             $editor = $currentComponent->ui()->editor();
427
-        }
428
-        else{
426
+        } else{
429 427
 
430 428
             $recordClassname = $this->getRecordClassName();
431 429
             $editorClassname =  $recordClassname . 'Editor';
Please login to merge, or discard this patch.
programs/customfield.ctrl.php 2 patches
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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @copyright Copyright (c) 2008 by CANTICO ({@link http://www.cantico.fr})
22 22
  */
23 23
 
24
-require_once APP_CTRL_PATH . '/record.ctrl.php';
24
+require_once APP_CTRL_PATH.'/record.ctrl.php';
25 25
 
26 26
 /**
27 27
  * This controller manages actions that can be performed on custom fields
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             $W->Link(
40 40
                 $App->translate('Add a custom field'),
41 41
                 $this->proxy()->edit()
42
-            )->addClass('icon',  Func_Icons::ACTIONS_LIST_ADD)
42
+            )->addClass('icon', Func_Icons::ACTIONS_LIST_ADD)
43 43
             ->setOpenMode(Widget_Link::OPEN_DIALOG_AND_RELOAD)
44 44
         );
45 45
 
Please login to merge, or discard this patch.