Passed
Branchfeature/useWidgetsNamespaces_c... (264d4b)
by Robin
04:22
created
programs/Ui/AppCriteriaEditor.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function getRecordSet()
73 73
     {
74
-        if(isset($this->recordSet)){
74
+        if (isset($this->recordSet)) {
75 75
             return $this->recordSet;
76 76
         }
77 77
         
78 78
         $parentField = $this->criteria->getField();
79 79
         
80
-        if(! isset($parentField)){
80
+        if (!isset($parentField)) {
81 81
             return null;
82 82
         }
83 83
         
84
-        do{
84
+        do {
85 85
             $field = $parentField;
86 86
             $parentField = $field->getParentSet();
87 87
         }
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
         
135 135
         $classPrefix = $App->classPrefix;
136 136
         
137
-        foreach ($recordSetFields as $fieldName => $recordSetField){
138
-            if($recordSetField instanceof ORMManyRelation){
137
+        foreach ($recordSetFields as $fieldName => $recordSetField) {
138
+            if ($recordSetField instanceof ORMManyRelation) {
139 139
                 /* @var $recordSetField ORMManyRelation */
140 140
                 $fieldDescription = $fieldName;
141 141
                 $path = $fieldName;
@@ -144,28 +144,28 @@  discard block
 block discarded – undo
144 144
                 $foreignRecordSet = $App->$foreignSetName();
145 145
                 $foreignRecordSetFields = $foreignRecordSet->getVisibilityCriteriaFields();
146 146
                 
147
-                foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField){
147
+                foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField) {
148 148
                     $foreignFieldName = $foreignRecordSetField->getName();
149 149
                     $foreignFieldDescription = $foreignRecordSetField->getDescription();
150
-                    if(substr($foreignFieldName, 0, 1) !== '_'){
150
+                    if (substr($foreignFieldName, 0, 1) !== '_') {
151 151
                         $foreignFieldDescription = $App->translate($foreignFieldDescription);
152 152
                     }
153
-                    if(empty($foreignFieldDescription)){
153
+                    if (empty($foreignFieldDescription)) {
154 154
                         $foreignFieldDescription = $foreignFieldName;
155 155
                     }
156
-                    $foreignPath = $path . '/' . $foreignRecordSetField->getPath();
156
+                    $foreignPath = $path.'/'.$foreignRecordSetField->getPath();
157 157
                     
158 158
                     $recordSetFieldSelect->addOption($foreignPath, $foreignFieldDescription, $fieldName);
159 159
                     
160
-                    if($foreignRecordSetField instanceof ORMBoolInterface){
160
+                    if ($foreignRecordSetField instanceof ORMBoolInterface) {
161 161
                         $booleanFieldPathes[] = $foreignPath;
162 162
                     }
163
-                    else{
163
+                    else {
164 164
                         $defaultFieldPathes[] = $foreignPath;
165 165
                     }
166 166
                 }
167 167
             }
168
-            elseif($recordSetField instanceof ORMFkField){
168
+            elseif ($recordSetField instanceof ORMFkField) {
169 169
                 /* @var $recordSetField ORMFkField */
170 170
                 $fieldDescription = $fieldName;
171 171
                 $path = $fieldName;
@@ -174,38 +174,38 @@  discard block
 block discarded – undo
174 174
                 $foreignRecordSet = $App->$foreignSetName();
175 175
                 $foreignRecordSetFields = $foreignRecordSet->getVisibilityCriteriaFields();
176 176
                 
177
-                foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField){
177
+                foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField) {
178 178
                     $foreignFieldDescription = $foreignFieldName;
179
-                    $foreignPath = $path . '/' . $foreignFieldName;
179
+                    $foreignPath = $path.'/'.$foreignFieldName;
180 180
                     
181 181
                     $recordSetFieldSelect->addOption($foreignPath, $foreignFieldDescription, $fieldName);
182 182
                     
183
-                    if($foreignRecordSetField instanceof ORMBoolInterface){
183
+                    if ($foreignRecordSetField instanceof ORMBoolInterface) {
184 184
                         $booleanFieldPathes[] = $foreignPath;
185 185
                     }
186
-                    else{
186
+                    else {
187 187
                         $defaultFieldPathes[] = $foreignPath;
188 188
                     }
189 189
                 }
190 190
             }
191
-            else{
191
+            else {
192 192
                 /* @var $recordSetField ORMField */
193 193
                 $fieldName = $recordSetField->getName();
194 194
                 $fieldDescription = $recordSetField->getDescription();
195
-                if(substr($fieldName, 0, 1) !== '_'){
195
+                if (substr($fieldName, 0, 1) !== '_') {
196 196
                     $fieldDescription = $App->translate($fieldDescription);
197 197
                 }
198
-                if(empty($fieldDescription)){
198
+                if (empty($fieldDescription)) {
199 199
                     $fieldDescription = $fieldName;
200 200
                 }
201 201
                 $path = $recordSetField->getPath();
202 202
                 
203 203
                 $recordSetFieldSelect->addOption($path, $fieldDescription);
204 204
                 
205
-                if($recordSetField instanceof ORMBoolInterface){
205
+                if ($recordSetField instanceof ORMBoolInterface) {
206 206
                     $booleanFieldPathes[] = $path;
207 207
                 }
208
-                else{
208
+                else {
209 209
                     $defaultFieldPathes[] = $path;
210 210
                 }
211 211
             }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -159,13 +159,11 @@  discard block
 block discarded – undo
159 159
                     
160 160
                     if($foreignRecordSetField instanceof ORMBoolInterface){
161 161
                         $booleanFieldPathes[] = $foreignPath;
162
-                    }
163
-                    else{
162
+                    } else{
164 163
                         $defaultFieldPathes[] = $foreignPath;
165 164
                     }
166 165
                 }
167
-            }
168
-            elseif($recordSetField instanceof ORMFkField){
166
+            } elseif($recordSetField instanceof ORMFkField){
169 167
                 /* @var $recordSetField ORMFkField */
170 168
                 $fieldDescription = $fieldName;
171 169
                 $path = $fieldName;
@@ -182,13 +180,11 @@  discard block
 block discarded – undo
182 180
                     
183 181
                     if($foreignRecordSetField instanceof ORMBoolInterface){
184 182
                         $booleanFieldPathes[] = $foreignPath;
185
-                    }
186
-                    else{
183
+                    } else{
187 184
                         $defaultFieldPathes[] = $foreignPath;
188 185
                     }
189 186
                 }
190
-            }
191
-            else{
187
+            } else{
192 188
                 /* @var $recordSetField ORMField */
193 189
                 $fieldName = $recordSetField->getName();
194 190
                 $fieldDescription = $recordSetField->getDescription();
@@ -204,8 +200,7 @@  discard block
 block discarded – undo
204 200
                 
205 201
                 if($recordSetField instanceof ORMBoolInterface){
206 202
                     $booleanFieldPathes[] = $path;
207
-                }
208
-                else{
203
+                } else{
209 204
                     $defaultFieldPathes[] = $path;
210 205
                 }
211 206
             }
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlCustomContainer.php 2 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -264,8 +264,7 @@  discard block
 block discarded – undo
264 264
         $customSectionSet = $App->CustomContainerSet();
265 265
         if(isset($id)){
266 266
             $record = $customSectionSet->request($id);
267
-        }
268
-        else{
267
+        } else{
269 268
             $record = $customSectionSet->newRecord();
270 269
             $record->object = $object;
271 270
         }
@@ -522,8 +521,7 @@  discard block
 block discarded – undo
522 521
                     
523 522
                     if($selectedManyField instanceof ORMBoolInterface){
524 523
                         $condition = $condition['bool'];
525
-                    }
526
-                    else{
524
+                    } else{
527 525
                         $condition = $condition['default'];
528 526
                     }
529 527
                     
@@ -551,8 +549,7 @@  discard block
 block discarded – undo
551 549
                     
552 550
                     if($selectedOneField instanceof ORMBoolInterface){
553 551
                         $condition = $condition['bool'];
554
-                    }
555
-                    else{
552
+                    } else{
556 553
                         $condition = $condition['default'];
557 554
                     }
558 555
                     
@@ -561,15 +558,13 @@  discard block
 block discarded – undo
561 558
                 }
562 559
                 break;
563 560
             }
564
-        }
565
-        else{
561
+        } else{
566 562
             
567 563
             $field = $objectRecordSet->$field;
568 564
             
569 565
             if($field instanceof ORMBoolInterface){
570 566
                 $condition = $condition['bool'];
571
-            }
572
-            else{
567
+            } else{
573 568
                 $condition = $condition['default'];
574 569
             }
575 570
             
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
             ->_AND_($customSectionSet->object->is($customSection->object)));
74 74
         
75 75
         $allViewFieldNames = array();
76
-        foreach ($allViewSections as $viewSection){
76
+        foreach ($allViewSections as $viewSection) {
77 77
             $fields = $viewSection->getFields();
78
-            foreach ($fields as $field){
79
-                $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id;
78
+            foreach ($fields as $field) {
79
+                $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id;
80 80
             }
81 81
         }
82 82
         
83 83
         $box = $W->VBoxItems();
84
-        if(isset($itemId)){
84
+        if (isset($itemId)) {
85 85
             $box->setId($itemId);
86 86
         }
87 87
         
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         
97 97
         BabSort::asort($availableFields, 'description', BabSort::CASE_INSENSITIVE);
98 98
         
99
-        foreach ($availableFields as $field){
99
+        foreach ($availableFields as $field) {
100 100
             $fieldName = $field['name'];
101 101
             $fieldDescription = $field['description'];
102 102
             
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         
151 151
         $field = $customSection->getField($fieldName);
152 152
         
153
-        if(! isset($field)){
153
+        if (!isset($field)) {
154 154
             return null;
155 155
         }
156 156
         
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
         
167 167
         $field = $availableFields[$fieldName];
168 168
         $fieldDescription = $field['description'];
169
-        if(substr($fieldName, 0, 1) !== '_'){
169
+        if (substr($fieldName, 0, 1) !== '_') {
170 170
             $fieldDescription = $App->translate($fieldDescription);
171 171
         }
172 172
         
173
-        if(empty($field)){
173
+        if (empty($field)) {
174 174
             // continue;
175 175
         }
176 176
         
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
         $W = bab_Widgets();
272 272
         
273 273
         $customSectionSet = $App->CustomContainerSet();
274
-        if(isset($id)){
274
+        if (isset($id)) {
275 275
             $record = $customSectionSet->request($id);
276 276
         }
277
-        else{
277
+        else {
278 278
             $record = $customSectionSet->newRecord();
279 279
             $record->object = $object;
280 280
         }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         $editor = new AppEditor($App);
288 288
         $editor->setHiddenValue('tg', $App->controllerTg);
289 289
         $editor->setHiddenValue('data[view]', $view);
290
-        if($record->id){
290
+        if ($record->id) {
291 291
             $editor->setHiddenValue('data[id]', $record->id);
292 292
         }
293 293
         $editor->setName('data');
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
         $record = $recordSet->request($id);
366 366
         
367 367
         $object = $record->object;
368
-        if(empty($object)){
368
+        if (empty($object)) {
369 369
             $object = $record->container()->object;
370 370
         }
371
-        if(strpos($object, $App->classPrefix) !== false){
371
+        if (strpos($object, $App->classPrefix) !== false) {
372 372
             $object = str_replace($App->classPrefix, '', $object);
373 373
         }
374 374
         $object .= 'Set';
@@ -383,25 +383,25 @@  discard block
 block discarded – undo
383 383
         $manySets = $objectRecordSet->getHasManyRelations();
384 384
         $oneSets = $objectRecordSet->getHasOneRelations();
385 385
         
386
-        if(! empty($record->visibilityCriteria)){
386
+        if (!empty($record->visibilityCriteria)) {
387 387
             $arrCriteria = json_decode($record->visibilityCriteria, true);
388 388
             
389 389
             $data = array();
390
-            foreach ($arrCriteria as $fieldName => $operation){
390
+            foreach ($arrCriteria as $fieldName => $operation) {
391 391
                 $data['field'] = $fieldName;
392
-                foreach ($operation as $condition => $value){
392
+                foreach ($operation as $condition => $value) {
393 393
                     $data['condition']['default'] = $condition;
394 394
                     $data['condition']['bool'] = $condition;
395
-                    if(is_array($value)){
396
-                        foreach ($value as $key => $subValue){
397
-                            foreach ($manySets as $manyFieldName => $manyRelation){
398
-                                if($key . 'Set' == $manyRelation->getForeignSetClassName()){
399
-                                    foreach ($subValue as $subFieldName => $subConditions){
400
-                                        if($subFieldName === '_foreignField'){
395
+                    if (is_array($value)) {
396
+                        foreach ($value as $key => $subValue) {
397
+                            foreach ($manySets as $manyFieldName => $manyRelation) {
398
+                                if ($key.'Set' == $manyRelation->getForeignSetClassName()) {
399
+                                    foreach ($subValue as $subFieldName => $subConditions) {
400
+                                        if ($subFieldName === '_foreignField') {
401 401
                                             continue;
402 402
                                         }
403 403
                                         $data['field'] = "{$manyFieldName}/{$subFieldName}";
404
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
404
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
405 405
                                             $data['condition']['default'] = $subCondition;
406 406
                                             $data['condition']['bool'] = $subCondition;
407 407
                                             $value = $subConditionValue;
@@ -410,14 +410,14 @@  discard block
 block discarded – undo
410 410
                                     break;
411 411
                                 }
412 412
                             }
413
-                            foreach ($oneSets as $oneFieldName => $oneRelation){
414
-                                if($key . 'Set' == $oneRelation->getForeignSetClassName()){
415
-                                    foreach ($subValue as $subFieldName => $subConditions){
416
-                                        if($subFieldName === '_foreignField'){
413
+                            foreach ($oneSets as $oneFieldName => $oneRelation) {
414
+                                if ($key.'Set' == $oneRelation->getForeignSetClassName()) {
415
+                                    foreach ($subValue as $subFieldName => $subConditions) {
416
+                                        if ($subFieldName === '_foreignField') {
417 417
                                             continue;
418 418
                                         }
419 419
                                         $data['field'] = "{$oneFieldName}/{$subFieldName}";
420
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
420
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
421 421
                                             $data['condition']['default'] = $subCondition;
422 422
                                             $data['condition']['bool'] = $subCondition;
423 423
                                             $value = $subConditionValue;
@@ -459,10 +459,10 @@  discard block
 block discarded – undo
459 459
         return true;
460 460
     }
461 461
     
462
-    protected function preSave(ORMRecord  &$record, $data)
462
+    protected function preSave(ORMRecord & $record, $data)
463 463
     {
464 464
         parent::preSave($record, $data);
465
-        if(! isset($record->id) || empty($record->id)){
465
+        if (!isset($record->id) || empty($record->id)) {
466 466
             $set = $record->getParentSet();
467 467
             $nbContainers = $set->select($set->all(array(
468 468
                 $set->object->is($record->object),
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
         $record = $recordSet->request($data['id']);
498 498
         
499 499
         $object = $record->object;
500
-        if(empty($object)){
500
+        if (empty($object)) {
501 501
             $object = $record->container()->object;
502 502
         }
503
-        if(strpos($object, $App->classPrefix) !== false){
503
+        if (strpos($object, $App->classPrefix) !== false) {
504 504
             $object = str_replace($App->classPrefix, '', $object);
505 505
         }
506 506
         $object .= 'Set';
@@ -511,14 +511,14 @@  discard block
 block discarded – undo
511 511
         $field = $data['field'];
512 512
         $condition = $data['condition'];
513 513
         
514
-        if(strpos($field, '/') !== false){
514
+        if (strpos($field, '/') !== false) {
515 515
             // The selected field is a hasMany or a hasOne relation
516 516
             list ($selectedRelation, $selectedField) = explode('/', $field);
517 517
             $classPrefix = $App->classPrefix;
518 518
             
519 519
             $manyRelations = $objectRecordSet->getHasManyRelations();
520
-            foreach ($manyRelations as $manyRelation){
521
-                if($selectedRelation != $manyRelation->getOwnerSetFieldName()){
520
+            foreach ($manyRelations as $manyRelation) {
521
+                if ($selectedRelation != $manyRelation->getOwnerSetFieldName()) {
522 522
                     continue;
523 523
                 }
524 524
                 $foreignSetName = str_replace($classPrefix, '', $manyRelation->getForeignSetClassName());
@@ -526,13 +526,13 @@  discard block
 block discarded – undo
526 526
                 
527 527
                 $visibilityCriteria = '';
528 528
                 
529
-                if($foreignSet){
529
+                if ($foreignSet) {
530 530
                     $selectedManyField = $foreignSet->$selectedField;
531 531
                     
532
-                    if($selectedManyField instanceof ORMBoolInterface){
532
+                    if ($selectedManyField instanceof ORMBoolInterface) {
533 533
                         $condition = $condition['bool'];
534 534
                     }
535
-                    else{
535
+                    else {
536 536
                         $condition = $condition['default'];
537 537
                     }
538 538
                     
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
             }
545 545
             
546 546
             $oneRelations = $objectRecordSet->getHasOneRelations();
547
-            foreach ($oneRelations as $oneRelation){
547
+            foreach ($oneRelations as $oneRelation) {
548 548
                 /* @var $oneRelation ORMOneRelation*/
549
-                if($selectedRelation != $oneRelation->getOwnerSetFieldName()){
549
+                if ($selectedRelation != $oneRelation->getOwnerSetFieldName()) {
550 550
                     continue;
551 551
                 }
552 552
                 $foreignSetClassName = $oneRelation->getForeignSetClassName();
@@ -555,13 +555,13 @@  discard block
 block discarded – undo
555 555
                 
556 556
                 $visibilityCriteria = '';
557 557
                 
558
-                if($foreignSet){
558
+                if ($foreignSet) {
559 559
                     $selectedOneField = $foreignSet->$selectedField;
560 560
                     
561
-                    if($selectedOneField instanceof ORMBoolInterface){
561
+                    if ($selectedOneField instanceof ORMBoolInterface) {
562 562
                         $condition = $condition['bool'];
563 563
                     }
564
-                    else{
564
+                    else {
565 565
                         $condition = $condition['default'];
566 566
                     }
567 567
                     
@@ -571,20 +571,20 @@  discard block
 block discarded – undo
571 571
                 break;
572 572
             }
573 573
         }
574
-        else{
574
+        else {
575 575
             
576 576
             $field = $objectRecordSet->$field;
577 577
             
578
-            if($field instanceof ORMBoolInterface){
578
+            if ($field instanceof ORMBoolInterface) {
579 579
                 $condition = $condition['bool'];
580 580
             }
581
-            else{
581
+            else {
582 582
                 $condition = $condition['default'];
583 583
             }
584 584
             
585 585
             $visibilityCriteria = '';
586 586
             
587
-            if(! empty($condition)){
587
+            if (!empty($condition)) {
588 588
                 $criteria = $field->{$condition}($data['value']);
589 589
                 $visibilityCriteria = $criteria->toJson();
590 590
             }
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
         
620 620
         $containerBoxes = $W->Items();
621 621
         
622
-        foreach ($customContainers as $customContainer){
622
+        foreach ($customContainers as $customContainer) {
623 623
             
624 624
             $menu = $W->HBoxItems($W->Link('', $customSectionCtrl->edit($customContainer->id))
625 625
                 ->addClass('icon', FuncIcons::ACTIONS_LIST_ADD)
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
             $menu->setSizePolicy(FuncIcons::ICON_LEFT_16);
635 635
             
636 636
             $hasVisibilityBox = $W->FlowItems()->addClass('widget-100');
637
-            if(! empty($customContainer->visibilityCriteria)){
637
+            if (!empty($customContainer->visibilityCriteria)) {
638 638
                 $hasVisibilityBox->addItem($W->HBoxItems($W->Label($App->translate('This container has a visibility condition')))
639 639
                     ->setSizePolicy('alert alert-warning widget-100pc'));
640 640
             }
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
                 ->addClass($customContainer->classname));
646 646
         }
647 647
         
648
-        if(isset($itemId)){
648
+        if (isset($itemId)) {
649 649
             $containerBoxes->setId($itemId);
650 650
         }
651 651
         
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
         $customSectionSet = $App->CustomSectionSet();
672 672
         
673 673
         $containersValues = array();
674
-        foreach ($customContainers as $customContainer){
674
+        foreach ($customContainers as $customContainer) {
675 675
             $values = $customContainer->getValues();
676 676
             unset($values['id']);
677 677
             unset($values['uuid']);
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
             unset($values['deleted']);
685 685
             $values['customSections'] = array();
686 686
             $customSections = $customSectionSet->select($customSectionSet->container->is($customContainer->id));
687
-            foreach ($customSections as $customSection){
687
+            foreach ($customSections as $customSection) {
688 688
                 $customSectionValues = $customSection->getValues();
689 689
                 unset($customSectionValues['id']);
690 690
                 unset($customSectionValues['uuid']);
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
         }
704 704
         
705 705
         header('Content-type: application/json');
706
-        header('Content-Disposition: attachment; filename="' . $object . '.' . ($view === '' ? 'default' : $view) . '.json"' . "\n");
707
-        if(BabCharset::getIso() != BabCharset::UTF_8){
706
+        header('Content-Disposition: attachment; filename="'.$object.'.'.($view === '' ? 'default' : $view).'.json"'."\n");
707
+        if (BabCharset::getIso() != BabCharset::UTF_8) {
708 708
             $containersValues = app_utf8Encode($containersValues);
709 709
         }
710 710
         $json = bab_json_encode($containersValues);
@@ -763,12 +763,12 @@  discard block
 block discarded – undo
763 763
         $files->push($containersfile['uid']);
764 764
         
765 765
         $data = null;
766
-        foreach ($files as $f){
766
+        foreach ($files as $f) {
767 767
             $data = file_get_contents($f->toString());
768 768
             break;
769 769
         }
770 770
         
771
-        if(! isset($data)){
771
+        if (!isset($data)) {
772 772
             $this->addError($App->translate('Unable to get file content'));
773 773
             return true;
774 774
         }
@@ -784,13 +784,13 @@  discard block
 block discarded – undo
784 784
         $customContainerSet->delete($customContainerSet->view->is($view)
785 785
             ->_AND_($customContainerSet->object->is($object)));
786 786
         
787
-        foreach ($containersValues as $containerValues){
787
+        foreach ($containersValues as $containerValues) {
788 788
             $customContainer = $customContainerSet->newRecord();
789 789
             $customContainer->setValues($containerValues);
790 790
             $customContainer->object = $object;
791 791
             $customContainer->view = $view;
792 792
             $customContainer->save();
793
-            foreach ($containerValues['customSections'] as $sectionValues){
793
+            foreach ($containerValues['customSections'] as $sectionValues) {
794 794
                 $customSection = $customSectionSet->newRecord();
795 795
                 $sectionValues['fields'] = json_encode($sectionValues['fields']);
796 796
                 $customSection->setValues($sectionValues);
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
         
925 925
         $rank = 0;
926 926
         $currentContainerId = 0;
927
-        foreach (array_keys($containers) as $containerFieldId){
927
+        foreach (array_keys($containers) as $containerFieldId) {
928 928
             
929
-            if(substr($containerFieldId, 0, 1) === '#'){
929
+            if (substr($containerFieldId, 0, 1) === '#') {
930 930
                 $currentContainerId = substr($containerFieldId, 1);
931 931
                 
932 932
                 $customContainer = $customContainerSet->request($customContainerSet->id->is($currentContainerId));
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                 $containersRawFields[$currentContainerId] = $customContainer->getRawFields();
936 936
                 
937 937
                 $customContainer->rank = $rank;
938
-                $rank ++;
938
+                $rank++;
939 939
                 $customContainer->save();
940 940
                 continue;
941 941
             }
@@ -943,18 +943,18 @@  discard block
 block discarded – undo
943 943
             $containersFields[$currentContainerId][] = $containerFieldId;
944 944
         }
945 945
         
946
-        foreach ($containersFields as $containerId => $containerFieldIds){
947
-            foreach ($containerFieldIds as $containerFieldId){
946
+        foreach ($containersFields as $containerId => $containerFieldIds) {
947
+            foreach ($containerFieldIds as $containerFieldId) {
948 948
                 list ($srcContainerId, $srcfieldId) = explode('.', $containerFieldId);
949
-                if(! isset($containersRawFields[$srcContainerId][$srcfieldId])){
949
+                if (!isset($containersRawFields[$srcContainerId][$srcfieldId])) {
950 950
                     return true;
951 951
                 }
952 952
             }
953 953
         }
954 954
         
955
-        foreach ($containersFields as $containerId => $containerFieldIds){
955
+        foreach ($containersFields as $containerId => $containerFieldIds) {
956 956
             $newRawFields = array();
957
-            foreach ($containerFieldIds as $containerFieldId){
957
+            foreach ($containerFieldIds as $containerFieldId) {
958 958
                 list ($srcContainerId, $srcfieldId) = explode('.', $containerFieldId);
959 959
                 $newRawFields[] = $containersRawFields[$srcContainerId][$srcfieldId];
960 960
             }
Please login to merge, or discard this patch.
programs/AppAccessManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
     public function hasNoAccess(AppRecordSet $recordSet, $accessType, $user = null)
94 94
     {
95 95
         $criterion = $this->getAccessCriterion($recordSet, $accessType, $user);
96
-        if(! $criterion instanceof ORMFalseCriterion){
96
+        if (!$criterion instanceof ORMFalseCriterion) {
97 97
             return false;
98 98
         }
99 99
         return true;
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlSSE.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
         
48 48
         $refreshFrequency = $this->getRefreshFrequency();
49 49
         
50
-        while (1){
51
-            if(connection_aborted()){
50
+        while (1) {
51
+            if (connection_aborted()) {
52 52
                 exit();
53 53
             }
54 54
             $data = $this->getSSEData();
55
-            if($data != '{}'){
55
+            if ($data != '{}') {
56 56
                 echo "event: ping\n";
57 57
                 echo "\n\n";
58
-                echo 'data: ' . $this->getSSEData() . "\n\n";
58
+                echo 'data: '.$this->getSSEData()."\n\n";
59 59
             }
60 60
             ob_end_flush();
61 61
             flush();
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     
80 80
     private function getRefreshFrequency()
81 81
     {
82
-        if(! isset($this->refreshFrequency)){
82
+        if (!isset($this->refreshFrequency)) {
83 83
             $registry = app_getRegistry();
84 84
             $registry->changeDirectory('configuration');
85 85
             $registry->changeDirectory('SSE');
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     
99 99
     private function getCurrentUser()
100 100
     {
101
-        if(isset($this->currentUser)){
101
+        if (isset($this->currentUser)) {
102 102
             return $this->currentUser;
103 103
         }
104 104
         
Please login to merge, or discard this patch.
programs/functions.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     if (null === $url) {
111 111
         $script = '<script type="text/javascript">';
112 112
         if (isset($message)) {
113
-            $script .= 'alert("' . bab_toHtml($message, BAB_HTML_JS) . '");';
113
+            $script .= 'alert("'.bab_toHtml($message, BAB_HTML_JS).'");';
114 114
         }
115 115
         $script .= 'history.back();';
116 116
         $script .= '</script>';
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $url = $url->url();
123 123
     }
124 124
     if (!empty($babBody->msgerror)) {
125
-        $url .=  '&msgerror=' . urlencode($babBody->msgerror);
125
+        $url .= '&msgerror='.urlencode($babBody->msgerror);
126 126
     }
127 127
     if (isset($message)) {
128 128
         $lines = explode("\n", $message);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         }
132 132
     }
133 133
 
134
-    header('Location: ' . $url);
134
+    header('Location: '.$url);
135 135
     die;
136 136
 }
137 137
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  */
164 164
 function app_fileUploadError($error)
165 165
 {
166
-    switch($error) {
166
+    switch ($error) {
167 167
         case UPLOAD_ERR_OK:
168 168
             return null;
169 169
 
@@ -274,25 +274,25 @@  discard block
 block discarded – undo
274 274
     return $imageUrl;
275 275
 }
276 276
 
277
-function app_utf8Decode($input){
278
-    if(is_array($input)){
277
+function app_utf8Decode($input) {
278
+    if (is_array($input)) {
279 279
         $return = array();
280
-        foreach($input as $k=>$v){
280
+        foreach ($input as $k=>$v) {
281 281
             $return[utf8_decode($k)] = app_utf8Decode($v);
282 282
         }
283
-    }else{
283
+    } else {
284 284
         return utf8_decode($input);
285 285
     }
286 286
     return $return;
287 287
 }
288 288
 
289
-function app_utf8Encode($input){
290
-    if(is_array($input)){
289
+function app_utf8Encode($input) {
290
+    if (is_array($input)) {
291 291
         $return = array();
292
-        foreach($input as $k=>$v){
292
+        foreach ($input as $k=>$v) {
293 293
             $return[app_utf8Encode($k)] = app_utf8Encode($v);
294 294
         }
295
-    }else{
295
+    } else {
296 296
         return utf8_encode($input);
297 297
     }
298 298
     return $return;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         foreach($input as $k=>$v){
281 281
             $return[utf8_decode($k)] = app_utf8Decode($v);
282 282
         }
283
-    }else{
283
+    } else{
284 284
         return utf8_decode($input);
285 285
     }
286 286
     return $return;
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         foreach($input as $k=>$v){
293 293
             $return[app_utf8Encode($k)] = app_utf8Encode($v);
294 294
         }
295
-    }else{
295
+    } else{
296 296
         return utf8_encode($input);
297 297
     }
298 298
     return $return;
Please login to merge, or discard this patch.
programs/Set/AppRecordSet.php 2 patches
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
      */
104 104
     protected function trimSetName($setName)
105 105
     {
106
-        if(strpos($setName, '_') === false){
106
+        if (strpos($setName, '_') === false) {
107 107
             return $setName;
108 108
         }
109 109
         $pos = strrpos($setName, '\\');
110
-        if($pos === false){
110
+        if ($pos === false) {
111 111
             return explode('_', $setName)[1];
112 112
         }
113 113
         return substr($setName, $pos + 1);
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
     public function join($fkFieldName)
123 123
     {
124 124
         $fkField = $this->getField($fkFieldName);
125
-        if(! ($fkField instanceof ORMFkField)){
125
+        if (!($fkField instanceof ORMFkField)) {
126 126
             return $this;
127 127
         }
128 128
         $setName = $fkField->getForeignSetName();
129 129
         
130
-        if(! $setName || 'Set' === $setName){
131
-            throw new \Exception('The set name is missing on foreign key field ' . $fkFieldName);
130
+        if (!$setName || 'Set' === $setName) {
131
+            throw new \Exception('The set name is missing on foreign key field '.$fkFieldName);
132 132
         }
133 133
         
134 134
         $appSetName = $this->trimSetName($setName);
@@ -166,22 +166,22 @@  discard block
 block discarded – undo
166 166
     {
167 167
         $App = $this->App();
168 168
         
169
-        if(null === $this->customFields){
169
+        if (null === $this->customFields) {
170 170
             $this->customFields = array();
171 171
             
172
-            if(isset($App->CustomField)){
172
+            if (isset($App->CustomField)) {
173 173
                 $customFieldSet = $App->CustomFieldSet();
174 174
                 $object = mb_substr(get_class($this), mb_strlen($App->classPrefix), - mb_strlen('Set'));
175
-                try{
175
+                try {
176 176
                     $customFields = $customFieldSet->select($customFieldSet->object->is($object));
177 177
                     
178
-                    foreach ($customFields as $customfield){
178
+                    foreach ($customFields as $customfield) {
179 179
                         $this->customFields[] = $customfield;
180 180
                         
181 181
                         /*@var $customfield AppCustomField */
182 182
                     }
183 183
                 }
184
-                catch (ORMBackEndSelectException $e){
184
+                catch (ORMBackEndSelectException $e) {
185 185
                     // table does not exist, this error is thrown by the install program while creating the sets
186 186
                 }
187 187
             }
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
     public function addCustomFields()
212 212
     {
213 213
         $customFields = $this->selectCustomFields();
214
-        foreach ($customFields as $customField){
214
+        foreach ($customFields as $customField) {
215 215
             /*@var $customField AppCustomField */
216 216
             $description = $customField->name;
217 217
             $ormField = $customField->getORMField()->setDescription($description);
218
-            if($ormField instanceof ORMFkField){
218
+            if ($ormField instanceof ORMFkField) {
219 219
                 $this->hasOne($customField->fieldname, $ormField->getForeignSetName())
220 220
                     ->setDescription($description);
221 221
             }
222
-            else{
222
+            else {
223 223
                 $this->addFields($ormField);
224 224
             }
225 225
         }
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
     public function request($mixedParam = null, $sPropertyName = null)
249 249
     {
250 250
         $record = $this->get($mixedParam, $sPropertyName);
251
-        if(! isset($record)){
251
+        if (!isset($record)) {
252 252
             // This will remove the default criteria for TraceableRecords and
253 253
             // fetch even 'deleted' ones.
254 254
             $this->setDefaultCriteria(null);
255 255
             $record = $this->get($mixedParam, $sPropertyName);
256
-            if(isset($record)){
256
+            if (isset($record)) {
257 257
                 throw new AppDeletedRecordException($record, $mixedParam);
258 258
             }
259 259
             throw new AppNotFoundException($this, $mixedParam);
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
         $linkSet = $this->App()->LinkSet();
277 277
         
278 278
         $targetClass = $this->getRecordClassName();
279
-        if(strpos($targetClass, '\\')){
279
+        if (strpos($targetClass, '\\')) {
280 280
             $targetClass = (new \ReflectionClass($targetClass))->getShortName();
281 281
         }
282 282
         
283
-        if(is_array($source) || ($source instanceof \Iterator)){
283
+        if (is_array($source) || ($source instanceof \Iterator)) {
284 284
             return $linkSet->selectForSources($source, $targetClass, $linkType);
285 285
         }
286
-        else{
286
+        else {
287 287
             return $linkSet->selectForSource($source, $targetClass, $linkType);
288 288
         }
289 289
     }
@@ -303,14 +303,14 @@  discard block
 block discarded – undo
303 303
         $linkSet = $this->App()->LinkSet();
304 304
         
305 305
         $sourceClass = $this->getRecordClassName();
306
-        if(strpos($sourceClass, '\\')){
306
+        if (strpos($sourceClass, '\\')) {
307 307
             $sourceClass = (new \ReflectionClass($sourceClass))->getShortName();
308 308
         }
309 309
         
310
-        if(is_array($target) || ($target instanceof \Iterator)){
310
+        if (is_array($target) || ($target instanceof \Iterator)) {
311 311
             return $linkSet->selectForTargets($target, $sourceClass, $linkType);
312 312
         }
313
-        else{
313
+        else {
314 314
             return $linkSet->selectForTarget($target, $sourceClass, $linkType);
315 315
         }
316 316
     }
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
         $linkSet = $App->LinkSet();
329 329
         
330 330
         $recordClassName = $this->getRecordClassName();
331
-        if(strpos($recordClassName, '\\')){
331
+        if (strpos($recordClassName, '\\')) {
332 332
             $recordClassName = (new \ReflectionClass($recordClassName))->getShortName();
333 333
         }
334 334
         $linkSet->hasOne('sourceId', $recordClassName);
335 335
         
336 336
         $targetClass = $target->getClassName();
337
-        if(strpos($targetClass, '\\')){
337
+        if (strpos($targetClass, '\\')) {
338 338
             $targetClass = (new \ReflectionClass($targetClass))->getShortName();
339 339
         }
340 340
         
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
             ->_AND_($linkSet->targetId->is($target->id))
343 343
             ->_AND_($linkSet->sourceClass->is($this->newRecord()
344 344
             ->getClassName()));
345
-        if(isset($linkType)){
346
-            if(is_array($linkType)){
345
+        if (isset($linkType)) {
346
+            if (is_array($linkType)) {
347 347
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
348 348
             }
349
-            else{
349
+            else {
350 350
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
351 351
             }
352 352
         }
@@ -368,29 +368,29 @@  discard block
 block discarded – undo
368 368
         $linkSet = $App->LinkSet();
369 369
         
370 370
         $recordClassName = $this->getRecordClassName();
371
-        if(strpos($recordClassName, '\\')){
371
+        if (strpos($recordClassName, '\\')) {
372 372
             $recordClassName = (new \ReflectionClass($recordClassName))->getShortName();
373 373
         }
374 374
         $linkSet->hasOne('targetId', $recordClassName);
375 375
         
376 376
         $sourceClass = $source->getClassName();
377
-        if(strpos($sourceClass, '\\')){
377
+        if (strpos($sourceClass, '\\')) {
378 378
             $sourceClass = new \ReflectionClass($sourceClass);
379 379
         }
380 380
         
381 381
         $targetClass = $this->newRecord()->getClassName();
382
-        if(strpos($targetClass, '\\')){
382
+        if (strpos($targetClass, '\\')) {
383 383
             $targetClass = new \ReflectionClass($targetClass);
384 384
         }
385 385
         
386 386
         $criteria = $linkSet->sourceClass->is($sourceClass)
387 387
             ->_AND_($linkSet->sourceId->is($source->id))
388 388
             ->_AND_($linkSet->targetClass->is($targetClass));
389
-        if(isset($linkType)){
390
-            if(is_array($linkType)){
389
+        if (isset($linkType)) {
390
+            if (is_array($linkType)) {
391 391
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
392 392
             }
393
-            else{
393
+            else {
394 394
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
395 395
             }
396 396
         }
@@ -412,39 +412,39 @@  discard block
 block discarded – undo
412 412
         $App = $this->App();
413 413
         $linkSet = $App->LinkSet();
414 414
         $recordClassName = $linkSet->getRecordClassName();
415
-        if(strpos($recordClassName, '\\')){
415
+        if (strpos($recordClassName, '\\')) {
416 416
             $recordClassName = (new \ReflectionClass($recordClassName))->getShortName();
417 417
         }
418 418
         $linkSet->hasOne('targetId', $recordClassName);
419 419
         
420 420
         $sourceIdsByClasses = array();
421
-        foreach ($sources as $source){
421
+        foreach ($sources as $source) {
422 422
             $sourceClass = $source->getClassName();
423
-            if(strpos($sourceClass, '\\')){
423
+            if (strpos($sourceClass, '\\')) {
424 424
                 $sourceClass = (new \ReflectionClass($sourceClass))->getShortName();
425 425
             }
426
-            if(! isset($sourceIdsByClasses[$sourceClass])){
426
+            if (!isset($sourceIdsByClasses[$sourceClass])) {
427 427
                 $sourceIdsByClasses[$sourceClass] = array();
428 428
             }
429 429
             $sourceIdsByClasses[$sourceClass][] = $source->id;
430 430
         }
431 431
         
432 432
         $sourcesCriteria = array();
433
-        foreach ($sourceIdsByClasses as $sourceClass => $sourceIds){
433
+        foreach ($sourceIdsByClasses as $sourceClass => $sourceIds) {
434 434
             $sourcesCriteria[] = $linkSet->sourceClass->is($sourceClass)->_AND_($linkSet->sourceId->in($sourceIds));
435 435
         }
436 436
         
437 437
         $targetClass = $this->newRecord()->getClassName();
438
-        if(strpos($targetClass, '\\')){
438
+        if (strpos($targetClass, '\\')) {
439 439
             $targetClass = (new \ReflectionClass($targetClass))->getShortName();
440 440
         }
441 441
         
442 442
         $criteria = $linkSet->all($linkSet->targetClass->is($targetClass), $linkSet->any($sourcesCriteria));
443
-        if(isset($linkType)){
444
-            if(is_array($linkType)){
443
+        if (isset($linkType)) {
444
+            if (is_array($linkType)) {
445 445
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
446 446
             }
447
-            else{
447
+            else {
448 448
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
449 449
             }
450 450
         }
@@ -466,39 +466,39 @@  discard block
 block discarded – undo
466 466
         $App = $this->App();
467 467
         $linkSet = $App->LinkSet();
468 468
         $recordClassName = $this->getRecordClassName();
469
-        if(strpos($recordClassName, '\\')){
469
+        if (strpos($recordClassName, '\\')) {
470 470
             $recordClassName = (new \ReflectionClass($recordClassName))->getShortName();
471 471
         }
472 472
         $linkSet->hasOne('sourceId', $recordClassName);
473 473
         
474 474
         $targetIdsByClasses = array();
475
-        foreach ($targets as $target){
475
+        foreach ($targets as $target) {
476 476
             $targetClass = $target->getClassName();
477
-            if(strpos($targetClass, '\\')){
477
+            if (strpos($targetClass, '\\')) {
478 478
                 $targetClass = (new \ReflectionClass($targetClass))->getShortName();
479 479
             }
480
-            if(! isset($targetIdsByClasses[$targetClass])){
480
+            if (!isset($targetIdsByClasses[$targetClass])) {
481 481
                 $targetIdsByClasses[$targetClass] = array();
482 482
             }
483 483
             $targetIdsByClasses[$targetClass][] = $target->id;
484 484
         }
485 485
         
486 486
         $targetsCriteria = array();
487
-        foreach ($targetIdsByClasses as $targetClass => $targetIds){
487
+        foreach ($targetIdsByClasses as $targetClass => $targetIds) {
488 488
             $targetsCriteria[] = $linkSet->targetClass->is($targetClass)->_AND_($linkSet->targetId->in($targetIds));
489 489
         }
490 490
         
491 491
         $sourceClass = $this->newRecord()->getClassName();
492
-        if(strpos($sourceClass, '\\')){
492
+        if (strpos($sourceClass, '\\')) {
493 493
             $sourceClass = (new \ReflectionClass($sourceClass))->getShortName();
494 494
         }
495 495
         
496 496
         $criteria = $linkSet->all($linkSet->sourceClass->is($sourceClass), $linkSet->any($targetsCriteria));
497
-        if(isset($linkType)){
498
-            if(is_array($linkType)){
497
+        if (isset($linkType)) {
498
+            if (is_array($linkType)) {
499 499
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
500 500
             }
501
-            else{
501
+            else {
502 502
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
503 503
             }
504 504
         }
@@ -613,19 +613,19 @@  discard block
 block discarded – undo
613 613
         $criteria = $linkSet->sourceClass->is((new \ReflectionClass($this->getRecordClassName()))->getShortName())
614 614
             ->_AND_($linkSet->targetClass->is($tagClassName));
615 615
         
616
-        if(is_array($tagLabels)){
616
+        if (is_array($tagLabels)) {
617 617
             $criteria = $criteria->_AND_($linkSet->targetId->label->in($tagLabels));
618 618
         }
619
-        else{
619
+        else {
620 620
             $criteria = $criteria->_AND_($linkSet->targetId->label->is($tagLabels));
621 621
         }
622
-        if(isset($linkType)){
622
+        if (isset($linkType)) {
623 623
             $criteria = $criteria->_AND_($linkSet->type->is($linkType));
624 624
         }
625 625
         $links = $linkSet->select($criteria);
626 626
         
627 627
         $ids = array();
628
-        foreach ($links as $link){
628
+        foreach ($links as $link) {
629 629
             $ids[$link->sourceId] = $link->sourceId;
630 630
         }
631 631
         
@@ -636,23 +636,23 @@  discard block
 block discarded – undo
636 636
     {
637 637
         $fields = $this->getFields();
638 638
         $manyRelations = $this->getHasManyRelations();
639
-        foreach ($manyRelations as $fieldName => $manyRelation){
639
+        foreach ($manyRelations as $fieldName => $manyRelation) {
640 640
             $fields[$fieldName] = $manyRelation;
641 641
         }
642 642
         return $fields;
643 643
     }
644 644
 
645
-    public function getController($proxy = true){
645
+    public function getController($proxy = true) {
646 646
         $name = $this->getRecordClassName();
647 647
         $reflection = new ReflectionClass($name);
648 648
         $name = $reflection->getShortName();
649 649
         return $this->App()->Controller()->$name($proxy);
650 650
     }
651 651
 
652
-    public function getDisplayNameField(){
653
-        if($this->fieldExist("name")){
652
+    public function getDisplayNameField() {
653
+        if ($this->fieldExist("name")) {
654 654
             return $this->name;
655
-        }else{
655
+        } else {
656 656
             return $this->id;
657 657
         }
658 658
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -19 removed lines patch added patch discarded remove patch
@@ -180,8 +180,7 @@  discard block
 block discarded – undo
180 180
                         
181 181
                         /*@var $customfield AppCustomField */
182 182
                     }
183
-                }
184
-                catch (ORMBackEndSelectException $e){
183
+                } catch (ORMBackEndSelectException $e){
185 184
                     // table does not exist, this error is thrown by the install program while creating the sets
186 185
                 }
187 186
             }
@@ -218,8 +217,7 @@  discard block
 block discarded – undo
218 217
             if($ormField instanceof ORMFkField){
219 218
                 $this->hasOne($customField->fieldname, $ormField->getForeignSetName())
220 219
                     ->setDescription($description);
221
-            }
222
-            else{
220
+            } else{
223 221
                 $this->addFields($ormField);
224 222
             }
225 223
         }
@@ -282,8 +280,7 @@  discard block
 block discarded – undo
282 280
         
283 281
         if(is_array($source) || ($source instanceof \Iterator)){
284 282
             return $linkSet->selectForSources($source, $targetClass, $linkType);
285
-        }
286
-        else{
283
+        } else{
287 284
             return $linkSet->selectForSource($source, $targetClass, $linkType);
288 285
         }
289 286
     }
@@ -309,8 +306,7 @@  discard block
 block discarded – undo
309 306
         
310 307
         if(is_array($target) || ($target instanceof \Iterator)){
311 308
             return $linkSet->selectForTargets($target, $sourceClass, $linkType);
312
-        }
313
-        else{
309
+        } else{
314 310
             return $linkSet->selectForTarget($target, $sourceClass, $linkType);
315 311
         }
316 312
     }
@@ -345,8 +341,7 @@  discard block
 block discarded – undo
345 341
         if(isset($linkType)){
346 342
             if(is_array($linkType)){
347 343
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
348
-            }
349
-            else{
344
+            } else{
350 345
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
351 346
             }
352 347
         }
@@ -389,8 +384,7 @@  discard block
 block discarded – undo
389 384
         if(isset($linkType)){
390 385
             if(is_array($linkType)){
391 386
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
392
-            }
393
-            else{
387
+            } else{
394 388
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
395 389
             }
396 390
         }
@@ -443,8 +437,7 @@  discard block
 block discarded – undo
443 437
         if(isset($linkType)){
444 438
             if(is_array($linkType)){
445 439
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
446
-            }
447
-            else{
440
+            } else{
448 441
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
449 442
             }
450 443
         }
@@ -497,8 +490,7 @@  discard block
 block discarded – undo
497 490
         if(isset($linkType)){
498 491
             if(is_array($linkType)){
499 492
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
500
-            }
501
-            else{
493
+            } else{
502 494
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
503 495
             }
504 496
         }
@@ -615,8 +607,7 @@  discard block
 block discarded – undo
615 607
         
616 608
         if(is_array($tagLabels)){
617 609
             $criteria = $criteria->_AND_($linkSet->targetId->label->in($tagLabels));
618
-        }
619
-        else{
610
+        } else{
620 611
             $criteria = $criteria->_AND_($linkSet->targetId->label->is($tagLabels));
621 612
         }
622 613
         if(isset($linkType)){
@@ -652,7 +643,7 @@  discard block
 block discarded – undo
652 643
     public function getDisplayNameField(){
653 644
         if($this->fieldExist("name")){
654 645
             return $this->name;
655
-        }else{
646
+        } else{
656 647
             return $this->id;
657 648
         }
658 649
     }
Please login to merge, or discard this patch.
programs/Set/AppTraceableRecordSet.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -352,7 +352,7 @@
 block discarded – undo
352 352
     public function getDisplayNameField(){
353 353
         if($this->fieldExist("name")){
354 354
             return $this->name;
355
-        }else{
355
+        } else{
356 356
             return $this->uuid;
357 357
         }
358 358
     }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     protected function logSave(AppTraceableRecord $record, $noTrace)
138 138
     {
139
-        if(! $this->isLoggable()){
139
+        if (!$this->isLoggable()) {
140 140
             return;
141 141
         }
142 142
         $App = $this->App();
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
      */
160 160
     protected function logDelete(ORMCriteria $criteria, $noTrace)
161 161
     {
162
-        if(! $this->isLoggable()){
162
+        if (!$this->isLoggable()) {
163 163
             return;
164 164
         }
165 165
         $App = $this->App();
166 166
         $userId = bab_getUserId();
167 167
         $logSet = $App->LogSet();
168 168
         $deletedRecords = $this->select($criteria);
169
-        foreach ($deletedRecords as $record){
169
+        foreach ($deletedRecords as $record) {
170 170
             $log = $logSet->newRecord();
171 171
             $log->noTrace = $noTrace;
172 172
             $log->objectClass = get_class($record);
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     public function select(ORMCriteria $criteria = null, $includeDeleted = false)
194 194
     {
195
-        if($includeDeleted){
195
+        if ($includeDeleted) {
196 196
             $this->setDefaultCriteria(null);
197 197
         }
198 198
         return parent::select($criteria);
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function delete(ORMCriteria $criteria = null, $deletedStatus = AppTraceableRecord::DELETED_STATUS_DELETED)
237 237
     {
238
-        $definitive = ($deletedStatus === true) || ! $this->isTraceable();
238
+        $definitive = ($deletedStatus === true) || !$this->isTraceable();
239 239
         $this->logDelete($criteria, $definitive);
240
-        if($definitive){
240
+        if ($definitive) {
241 241
             return parent::delete($criteria);
242 242
         }
243 243
         
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
         
246 246
         $records = $this->select($criteria);
247 247
         
248
-        foreach ($records as $record){
248
+        foreach ($records as $record) {
249 249
             /* @var $record AppTraceableRecord */
250 250
             // Could be optimized at ORM level
251 251
             $record->deleted = $deletedStatus;
252 252
             $record->deletedOn = $now;
253 253
             $record->deletedBy = bab_getUserId();
254 254
             
255
-            if(! parent::save($record)){
255
+            if (!parent::save($record)) {
256 256
                 return false;
257 257
             }
258 258
         }
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
      */
271 271
     public function save(ORMRecord $record, $noTrace = false)
272 272
     {
273
-        $noTrace = $noTrace || ! $this->isTraceable();
273
+        $noTrace = $noTrace || !$this->isTraceable();
274 274
         $this->logSave($record, $noTrace);
275
-        if($noTrace){
275
+        if ($noTrace) {
276 276
             return parent::save($record);
277 277
         }
278 278
         
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         $set = $record->getParentSet();
283 283
         $primaryKey = $set->getPrimaryKey();
284 284
         
285
-        if(empty($record->{$primaryKey})){
285
+        if (empty($record->{$primaryKey})) {
286 286
             $record->initValue('createdBy', bab_getUserId());
287 287
             $record->initValue('createdOn', $now);
288 288
             $record->initValue('uuid', $this->uuid());
@@ -313,21 +313,21 @@  discard block
 block discarded – undo
313 313
      */
314 314
     public function getRecordByUuid($uuid)
315 315
     {
316
-        if('' === (string) $uuid){
316
+        if ('' === (string) $uuid) {
317 317
             return null;
318 318
         }
319 319
         
320 320
         $record = $this->get($this->uuid->is($uuid));
321 321
         
322
-        if(! isset($record)){
322
+        if (!isset($record)) {
323 323
             return null;
324 324
         }
325 325
         
326
-        if(! ($record instanceof AppTraceableRecord)){
326
+        if (!($record instanceof AppTraceableRecord)) {
327 327
             return null;
328 328
         }
329 329
         
330
-        if($record->deleted){
330
+        if ($record->deleted) {
331 331
             return null;
332 332
         }
333 333
         
@@ -343,21 +343,21 @@  discard block
 block discarded – undo
343 343
      */
344 344
     public function isOwn($userId = null)
345 345
     {
346
-        if(! isset($userId)){
346
+        if (!isset($userId)) {
347 347
             $userId = bab_getUserId();
348 348
         }
349 349
         return $this->createdBy->is($userId);
350 350
     }
351 351
 
352
-    public function getDisplayNameField(){
353
-        if($this->fieldExist("name")){
352
+    public function getDisplayNameField() {
353
+        if ($this->fieldExist("name")) {
354 354
             return $this->name;
355
-        }else{
355
+        } else {
356 356
             return $this->uuid;
357 357
         }
358 358
     }
359 359
 
360
-    public function allowDraftCreation(){
360
+    public function allowDraftCreation() {
361 361
         return false;
362 362
     }
363 363
 }
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlRecord.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2141,7 +2141,7 @@
 block discarded – undo
2141 2141
         }
2142 2142
     
2143 2143
         header("Content-type: application/json; charset=utf-8");
2144
-	    echo $collection->output();
2145
-	    die();
2144
+        echo $collection->output();
2145
+        die();
2146 2146
     }
2147 2147
 }
Please login to merge, or discard this patch.
Spacing   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
     protected function getRecordClassName()
69 69
     {
70 70
         $class = $this->getClass();
71
-        if(strpos($class, 'Controller') !== false){
71
+        if (strpos($class, 'Controller') !== false) {
72 72
             $App = $this->App();
73 73
             $componentName = strtoupper(str_replace('Controller', '', $class));
74 74
             $component = $App->getComponentByName($componentName);
75
-            if($component){
75
+            if ($component) {
76 76
                 return $component->getRecordClassName();
77 77
             }
78 78
         }
79
-        if(strpos($class, '_Ctrl')){
79
+        if (strpos($class, '_Ctrl')) {
80 80
             list (, $recordClassname) = explode('_Ctrl', $class);
81 81
             return $recordClassname;
82 82
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         
98 98
         
99 99
         $recordClassname = $this->getRecordClassName();
100
-        $recordSetClassname = $recordClassname . 'Set';
100
+        $recordSetClassname = $recordClassname.'Set';
101 101
         
102 102
         $recordSet = $App->$recordSetClassname();
103 103
         return $recordSet;
@@ -140,29 +140,29 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $canvas = bab_Widgets()->HtmlCanvas();
142 142
         $html = '';
143
-        if($actions instanceof WidgetAction){
143
+        if ($actions instanceof WidgetAction) {
144 144
             $text = '';
145
-            if($showLabel){
145
+            if ($showLabel) {
146 146
                 $text = $actions->getTitle();
147 147
             }
148
-            $html = '<li><a class="icon ' . $actions->getIcon() . '" href="' . $actions->url() . '">' . $text . '</a></li>';
148
+            $html = '<li><a class="icon '.$actions->getIcon().'" href="'.$actions->url().'">'.$text.'</a></li>';
149 149
         }
150
-        elseif($actions instanceof WidgetDisplayableInterface){
151
-            $html = '<li>' . $actions->display($canvas) . '</li>';
150
+        elseif ($actions instanceof WidgetDisplayableInterface) {
151
+            $html = '<li>'.$actions->display($canvas).'</li>';
152 152
         }
153
-        elseif(is_array($actions)){
154
-            if(isset($actions['items'])){
153
+        elseif (is_array($actions)) {
154
+            if (isset($actions['items'])) {
155 155
                 $items = $actions['items'];
156 156
             }
157
-            else{
157
+            else {
158 158
                 $items = $actions;
159 159
             }
160
-            foreach ($items as $action){
160
+            foreach ($items as $action) {
161 161
                 $html .= $this->createMenu($action, true, true);
162 162
             }
163
-            if(isset($actions['icon'])){
163
+            if (isset($actions['icon'])) {
164 164
                 
165
-                $html = '<li class="dropdown">' . '<a href="#" class="' . $actions['icon'] . ' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' . ($actions['icon'] === 'actions-context-menu'/*FuncIcons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>') . '</a>' . '<ul class="dropdown-menu dropdown-menu-right ' . FuncIcons::ICON_LEFT_SYMBOLIC . '">' . $html . '</ul>';
165
+                $html = '<li class="dropdown">'.'<a href="#" class="'.$actions['icon'].' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.($actions['icon'] === 'actions-context-menu'/*FuncIcons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>').'</a>'.'<ul class="dropdown-menu dropdown-menu-right '.FuncIcons::ICON_LEFT_SYMBOLIC.'">'.$html.'</ul>';
166 166
             }
167 167
         }
168 168
         
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
             'label' => $App->translate('Statistics')
209 209
         );
210 210
         
211
-        foreach ($methods as $index => $method){
212
-            try{
213
-                $methodName = $recordClassname . $method['method'];
214
-                if($Ui->$methodName()){
211
+        foreach ($methods as $index => $method) {
212
+            try {
213
+                $methodName = $recordClassname.$method['method'];
214
+                if ($Ui->$methodName()) {
215 215
                     $types[$index] = array(
216 216
                         'classname' => $methodName,
217 217
                         'icon' => $method['icon'],
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                     );
220 220
                 }
221 221
             }
222
-            catch (\Exception $e){
222
+            catch (\Exception $e) {
223 223
                 unset($types[$index]);
224 224
                 continue;
225 225
             }
@@ -240,13 +240,13 @@  discard block
 block discarded – undo
240 240
         
241 241
         $availableFields = array();
242 242
         
243
-        foreach ($recordSet->getFields() as $name => $field){
243
+        foreach ($recordSet->getFields() as $name => $field) {
244 244
             $fieldName = $field->getName();
245 245
             $fieldDescription = $field->getDescription();
246
-            if(substr($fieldName, 0, 1) !== '_'){
246
+            if (substr($fieldName, 0, 1) !== '_') {
247 247
                 $fieldDescription = $App->translate($fieldDescription);
248 248
             }
249
-            if(empty($fieldDescription)){
249
+            if (empty($fieldDescription)) {
250 250
                 $fieldDescription = $fieldName;
251 251
             }
252 252
             $availableFields[$name] = array(
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
         
296 296
         $recordSet = $this->getEditRecordSet();
297 297
         
298
-        if(isset($id)){
298
+        if (isset($id)) {
299 299
             $record = $recordSet->request($id);
300
-            if(! $record->isUpdatable()){
300
+            if (!$record->isUpdatable()) {
301 301
                 throw new AppAccessException($App->translate('You do not have access to this page'));
302 302
             }
303 303
         }
304
-        else{
305
-            if(! $recordSet->isCreatable()){
304
+        else {
305
+            if (!$recordSet->isCreatable()) {
306 306
                 throw new AppAccessException($App->translate('You do not have access to this page'));
307 307
             }
308 308
             $record = $recordSet->newRecord();
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
         $W = bab_Widgets();
331 331
         
332 332
         $recordClassname = $this->getRecordClassName();
333
-        $editorClassname = $recordClassname . 'SectionEditor';
333
+        $editorClassname = $recordClassname.'SectionEditor';
334 334
         
335 335
         /* @var $editor AppRecordEditor */
336 336
         $editor = $Ui->$editorClassname($record);
337
-        if(! isset($itemId)){
338
-            $itemId = $this->getClass() . '_' . __FUNCTION__;
337
+        if (!isset($itemId)) {
338
+            $itemId = $this->getClass().'_'.__FUNCTION__;
339 339
         }
340 340
         $editor->setId($itemId);
341 341
         $editor->setController($this);
@@ -364,8 +364,8 @@  discard block
 block discarded – undo
364 364
      */
365 365
     public function getModelViewDefaultId($itemId = null)
366 366
     {
367
-        if(! isset($itemId)){
368
-            $itemId = $this->getClass() . '_modelView';
367
+        if (!isset($itemId)) {
368
+            $itemId = $this->getClass().'_modelView';
369 369
         }
370 370
         
371 371
         return $itemId;
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
         
394 394
         $itemId = $this->getModelViewDefaultId($itemId);
395 395
         
396
-        if(! isset($type)){
396
+        if (!isset($type)) {
397 397
             $type = $this->getFilteredViewType($itemId);
398 398
         }
399 399
         
@@ -401,24 +401,24 @@  discard block
 block discarded – undo
401 401
         
402 402
         switch ($type) {
403 403
             case 'cards':
404
-                $tableviewClassname = $recordClassname . 'CardsView';
404
+                $tableviewClassname = $recordClassname.'CardsView';
405 405
                 break;
406 406
             
407 407
             case 'map':
408
-                $tableviewClassname = $recordClassname . 'MapView';
408
+                $tableviewClassname = $recordClassname.'MapView';
409 409
                 break;
410 410
             
411 411
             case 'calendar':
412
-                $tableviewClassname = $recordClassname . 'CalendarView';
412
+                $tableviewClassname = $recordClassname.'CalendarView';
413 413
                 break;
414 414
             
415 415
             case 'statistics':
416
-                $tableviewClassname = $recordClassname . 'StatisticsView';
416
+                $tableviewClassname = $recordClassname.'StatisticsView';
417 417
                 break;
418 418
             
419 419
             case 'table':
420 420
             default:
421
-                $tableviewClassname = $recordClassname . 'TableView';
421
+                $tableviewClassname = $recordClassname.'TableView';
422 422
                 break;
423 423
         }
424 424
         
@@ -431,12 +431,12 @@  discard block
 block discarded – undo
431 431
         
432 432
         $tableview->setRecordSet($recordSet);
433 433
         $tableview->addDefaultColumns($recordSet);
434
-        if(isset($filter)){
434
+        if (isset($filter)) {
435 435
             $tableview->setFilterValues($filter);
436 436
         }
437 437
         $filter = $tableview->getFilterValues();
438 438
         
439
-        if(isset($filter['showTotal']) && $filter['showTotal']){
439
+        if (isset($filter['showTotal']) && $filter['showTotal']) {
440 440
             $tableview->displaySubTotalRow(true);
441 441
         }
442 442
         
@@ -450,13 +450,13 @@  discard block
 block discarded – undo
450 450
         
451 451
         $tableview->setDataSource($records);
452 452
         
453
-        if(isset($columns)){
453
+        if (isset($columns)) {
454 454
             $availableColumns = $tableview->getVisibleColumns();
455 455
             
456 456
             $remainingColumns = array();
457
-            foreach ($availableColumns as $availableColumn){
457
+            foreach ($availableColumns as $availableColumn) {
458 458
                 $colPath = $availableColumn->getFieldPath();
459
-                if(isset($columns[$colPath]) && $columns[$colPath] == '1'){
459
+                if (isset($columns[$colPath]) && $columns[$colPath] == '1') {
460 460
                     $remainingColumns[] = $availableColumn;
461 461
                 }
462 462
             }
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
         $App = $this->App();
477 477
         $Ui = $App->Ui();
478 478
         $recordClassname = $this->getRecordClassName();
479
-        $editorClassname = $recordClassname . 'Editor';
479
+        $editorClassname = $recordClassname.'Editor';
480 480
         $editor = $Ui->$editorClassname();
481 481
         
482
-        if(! isset($itemId)){
483
-            $itemId = $this->getClass() . '_' . __FUNCTION__;
482
+        if (!isset($itemId)) {
483
+            $itemId = $this->getClass().'_'.__FUNCTION__;
484 484
         }
485 485
         $editor->setId($itemId);
486 486
         $editor->setHiddenValue('tg', $App->controllerTg);
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
         
524 524
         $viewTypes = $this->getAvailableModelViewTypes();
525 525
         
526
-        if(count($viewTypes) > 1){
526
+        if (count($viewTypes) > 1) {
527 527
             $viewsBox = $W->Items();
528 528
             $viewsBox->setSizePolicy('pull-right');
529 529
             // $viewsBox->addClass('btn-group', FuncIcons::ICON_LEFT_16);
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
             
532 532
             $filteredViewType = $this->getFilteredViewType($tableView->getId());
533 533
             
534
-            foreach ($viewTypes as $viewTypeId => $viewType){
534
+            foreach ($viewTypes as $viewTypeId => $viewType) {
535 535
                 $viewsBox->addItem($W->Link('', $proxy->setFilteredViewType($tableView->getId(), $viewTypeId))
536
-                    ->addClass('icon', $viewType['icon'] . ($filteredViewType === $viewTypeId ? ' active' : ''))
536
+                    ->addClass('icon', $viewType['icon'].($filteredViewType === $viewTypeId ? ' active' : ''))
537 537
                     ->
538 538
                 // ->setSizePolicy('btn btn-xs btn-default ' . ($filteredViewType === $viewTypeId ? 'active' : ''))
539 539
                 setTitle($viewType['label'])
@@ -541,14 +541,14 @@  discard block
 block discarded – undo
541 541
             }
542 542
         }
543 543
         
544
-        if(method_exists($proxy, 'exportSelect')){
544
+        if (method_exists($proxy, 'exportSelect')) {
545 545
             $toolbar->addItem($W->Link($App->translate('Export'), $proxy->exportSelect($filter))
546 546
                 ->addClass('icon', FuncIcons::ACTIONS_DOCUMENT_DOWNLOAD)
547 547
                 ->setOpenMode(WidgetLink::OPEN_DIALOG)
548 548
                 ->setDialogClass('box gradient blue halfSizeDialog'));
549 549
         }
550 550
         
551
-        if(method_exists($proxy, 'printList')){
551
+        if (method_exists($proxy, 'printList')) {
552 552
             $toolbar->addItem($W->Link($App->translate('Print'), $proxy->printList($filter))
553 553
                 ->addClass('icon', FuncIcons::ACTIONS_DOCUMENT_PRINT)
554 554
                 ->setOpenMode(WidgetLink::OPEN_POPUP));
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
         $W = bab_Widgets();
567 567
         
568 568
         $filterVisibility = $this->getFilterVisibility($itemId);
569
-        $filterVisibility = ! $filterVisibility;
570
-        $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);
569
+        $filterVisibility = !$filterVisibility;
570
+        $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);
571 571
         
572 572
         return true;
573 573
     }
@@ -579,10 +579,10 @@  discard block
 block discarded – undo
579 579
     protected function getFilterVisibility($itemId)
580 580
     {
581 581
         $W = bab_Widgets();
582
-        $filterVisibility = $W->getUserConfiguration($itemId . '/filterVisibility');
583
-        if(! isset($filterVisibility)){
582
+        $filterVisibility = $W->getUserConfiguration($itemId.'/filterVisibility');
583
+        if (!isset($filterVisibility)) {
584 584
             $filterVisibility = false;
585
-            $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);
585
+            $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);
586 586
         }
587 587
         return $filterVisibility;
588 588
     }
@@ -597,8 +597,8 @@  discard block
 block discarded – undo
597 597
     protected function getFilteredViewType($itemId)
598 598
     {
599 599
         $W = bab_Widgets();
600
-        $type = $W->getUserConfiguration($itemId . '/viewType');
601
-        if(! isset($type)){
600
+        $type = $W->getUserConfiguration($itemId.'/viewType');
601
+        if (!isset($type)) {
602 602
             $type = 'table';
603 603
         }
604 604
         return $type;
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
     public function setFilteredViewType($itemId, $type = null)
616 616
     {
617 617
         $W = bab_Widgets();
618
-        $W->setUserConfiguration($itemId . '/viewType', $type);
618
+        $W->setUserConfiguration($itemId.'/viewType', $type);
619 619
         
620 620
         return true;
621 621
     }
@@ -636,17 +636,17 @@  discard block
 block discarded – undo
636 636
         
637 637
         $filterPanel = $view->advancedFilterPanel($filter);
638 638
         
639
-        if($this->getFilterVisibility($itemId)){
639
+        if ($this->getFilterVisibility($itemId)) {
640 640
             $filterPanel->addClass('show-filter');
641 641
         }
642
-        else{
642
+        else {
643 643
             $filterPanel->addClass('hide-filter');
644 644
         }
645 645
         
646 646
         $toolbar = $this->toolbar($view);
647 647
         $listToolbar = $this->listToolbar($view);
648 648
         
649
-        if($view->isColumnSelectionAllowed()){
649
+        if ($view->isColumnSelectionAllowed()) {
650 650
             $App = $this->App();
651 651
             $columnSelectionMenu = $W->Link($App->translate('Table configuration'), $this->proxy()
652 652
                 ->modelViewColumnSettings($type, $itemId))
@@ -698,14 +698,14 @@  discard block
 block discarded – undo
698 698
         $tableModelViewId = $data['tableModelViewId'];
699 699
         $sessionOnly = isset($data['inSession']) ? $data['inSession'] : false;
700 700
         
701
-        if(isset($data['pageLength'])){
702
-            $W->setUserConfiguration($tableModelViewId . '/pageLength', $data['pageLength'], 'widgets', $sessionOnly);
701
+        if (isset($data['pageLength'])) {
702
+            $W->setUserConfiguration($tableModelViewId.'/pageLength', $data['pageLength'], 'widgets', $sessionOnly);
703 703
         }
704
-        if(isset($data['displaySubTotalRow'])){
705
-            $W->setUserConfiguration($tableModelViewId . '/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly);
704
+        if (isset($data['displaySubTotalRow'])) {
705
+            $W->setUserConfiguration($tableModelViewId.'/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly);
706 706
         }
707
-        if(isset($data['columns'])){
708
-            $W->setUserConfiguration($tableModelViewId . '/columns', $data['columns'], 'widgets', $sessionOnly);
707
+        if (isset($data['columns'])) {
708
+            $W->setUserConfiguration($tableModelViewId.'/columns', $data['columns'], 'widgets', $sessionOnly);
709 709
         }
710 710
         
711 711
         $this->addReloadSelector("#{$tableModelViewId}");
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
         $tableModelViewId = $data['tableModelViewId'];
721 721
         $sessionOnly = isset($data['inSession']) ? $data['inSession'] : false;
722 722
         
723
-        $W->deleteUserConfiguration($data['tableModelViewId'] . '/columns', 'widgets', $sessionOnly);
723
+        $W->deleteUserConfiguration($data['tableModelViewId'].'/columns', 'widgets', $sessionOnly);
724 724
         
725 725
         $this->addReloadSelector("#{$tableModelViewId}");
726 726
         return true;
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 
774 774
         $itemMenus = $this->getListItemMenus();
775 775
         
776
-        foreach ($itemMenus as $itemMenuId => $itemMenu){
776
+        foreach ($itemMenus as $itemMenuId => $itemMenu) {
777 777
             $page->addItemMenu($itemMenuId, $itemMenu['label'], $itemMenu['action']);
778 778
         }
779 779
         
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
         $columns = $tableview->getVisibleColumns();
813 813
         $column = isset($columns[$col]) ? $columns[$col] : null;
814 814
         
815
-        if(! isset($column)){
815
+        if (!isset($column)) {
816 816
             return true;
817 817
         }
818 818
         
@@ -826,8 +826,8 @@  discard block
 block discarded – undo
826 826
             $col
827 827
         )));
828 828
         
829
-        $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false);
830
-        if(isset($filter[$col])){
829
+        $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false);
830
+        if (isset($filter[$col])) {
831 831
             $widget->setValue($filter[$col]);
832 832
         }
833 833
         
@@ -843,24 +843,24 @@  discard block
 block discarded – undo
843 843
         
844 844
         $key = $data['key'];
845 845
         
846
-        $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false);
847
-        if(isset($data['moreCriteria']) && $data['moreCriteria']){
846
+        $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false);
847
+        if (isset($data['moreCriteria']) && $data['moreCriteria']) {
848 848
             $filter = array();
849 849
         }
850
-        foreach ($data['filter'] as $filterName => $filterValue){
850
+        foreach ($data['filter'] as $filterName => $filterValue) {
851 851
             $filter[$filterName] = $filterValue;
852 852
         }
853
-        $W->setUserConfiguration($key . '/filter', $filter, 'widgets', false);
853
+        $W->setUserConfiguration($key.'/filter', $filter, 'widgets', false);
854 854
         
855 855
         
856
-        if(session_status() == PHP_SESSION_NONE){
856
+        if (session_status() == PHP_SESSION_NONE) {
857 857
             session_start();
858 858
         }
859 859
         $_SESSION['modelViewMoreCriterias'][$key] = array();
860 860
         unset($_SESSION['modelViewMoreCriterias'][$key]);
861 861
         session_write_close();
862 862
         
863
-        $this->addReloadSelector('.depends-' . $key);
863
+        $this->addReloadSelector('.depends-'.$key);
864 864
         
865 865
         return true;
866 866
     }
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
         $Ui = $App->Ui();
872 872
         
873 873
         $page = $Ui->Page();
874
-        $page->addClass('depends-modelViewMoreCriterias-' . $key);
874
+        $page->addClass('depends-modelViewMoreCriterias-'.$key);
875 875
         
876 876
         $page->setTitle($App->translate('Search'));
877 877
         
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
         $editor = $Ui->BasicEditor($itemId, $W->VBoxLayout());
892 892
         $editor->setReloadAction($this->proxy()
893 893
             ->getDisplayListMoreCriteriaEditor($key, $editor->getId()));
894
-        $editor->addClass('depends-modelViewMoreCriterias-' . $key);
894
+        $editor->addClass('depends-modelViewMoreCriterias-'.$key);
895 895
         $editor->addClass('widget-no-close');
896 896
         $editor->setIconFormat();
897 897
         $editor->isAjax = true;
@@ -906,37 +906,37 @@  discard block
 block discarded – undo
906 906
         $columns = $tableview->getVisibleColumns();
907 907
         $filter = $tableview->getFilterValues();
908 908
         
909
-        if(! isset($itemId)){
909
+        if (!isset($itemId)) {
910 910
             $editor->setSaveAction($this->proxy()
911 911
                 ->saveDisplayListFilter(), $App->translate('Search'));
912 912
             $editor->setCancelAction($this->proxy()
913 913
                 ->cancel());
914 914
             
915 915
             $fields = array();
916
-            foreach ($filter as $fieldName => $value){
917
-                if(empty($value)){
916
+            foreach ($filter as $fieldName => $value) {
917
+                if (empty($value)) {
918 918
                     continue;
919 919
                 }
920
-                if(! isset($columns[$fieldName])){
920
+                if (!isset($columns[$fieldName])) {
921 921
                     continue;
922 922
                 }
923 923
                 
924 924
                 $column = $columns[$fieldName];
925 925
                 
926
-                if(! $column->isSearchable()){
926
+                if (!$column->isSearchable()) {
927 927
                     continue;
928 928
                 }
929 929
                 
930 930
                 $fields[$fieldName] = $value;
931 931
             }
932 932
             
933
-            if(session_status() == PHP_SESSION_NONE){
933
+            if (session_status() == PHP_SESSION_NONE) {
934 934
                 session_start();
935 935
             }
936 936
             $_SESSION['modelViewMoreCriterias'][$key] = $fields;
937 937
             session_write_close();
938 938
         }
939
-        else{
939
+        else {
940 940
             $fields = $_SESSION['modelViewMoreCriterias'][$key];
941 941
         }
942 942
         
@@ -944,24 +944,24 @@  discard block
 block discarded – undo
944 944
         
945 945
         $nbAlreadyAdded = 0;
946 946
         
947
-        foreach ($fields as $fieldName => $fieldValue){
948
-            if(! isset($columns[$fieldName])){
947
+        foreach ($fields as $fieldName => $fieldValue) {
948
+            if (!isset($columns[$fieldName])) {
949 949
                 continue;
950 950
             }
951 951
             $column = $columns[$fieldName];
952 952
             
953
-            if(! $column->isSearchable()){
953
+            if (!$column->isSearchable()) {
954 954
                 continue;
955 955
             }
956 956
             
957 957
             $field = $column->getField();
958 958
             
959
-            if($nbAlreadyAdded >= 2){
959
+            if ($nbAlreadyAdded >= 2) {
960 960
                 $nbAlreadyAdded = 0;
961 961
                 $alreadyFilteredBox = null;
962 962
             }
963 963
             
964
-            if(! isset($alreadyFilteredBox)){
964
+            if (!isset($alreadyFilteredBox)) {
965 965
                 $editor->addItem($alreadyFilteredBox = $W->FlexItems()
966 966
                     ->setSizePolicy('customsection-field-box customsection-fieldsgroup-box'));
967 967
             }
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
                 ->setJustifyContent(WidgetFlexLayout::FLEX_JUSTIFY_CONTENT_SPACE_BETWEEN)
982 982
                 ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_CONTENT_CENTER))
983 983
                 ->addClass('app-customsection-groupedfield app-displaylist-morecriteria-groupedfield'));
984
-            $nbAlreadyAdded ++;
984
+            $nbAlreadyAdded++;
985 985
             
986 986
             $alreadyAddedFilters[$fieldName] = $fieldName;
987 987
         }
@@ -991,26 +991,26 @@  discard block
 block discarded – undo
991 991
             ''
992 992
         );
993 993
         
994
-        foreach ($columns as $fieldName => $column){
995
-            if(! $column->isSearchable()){
994
+        foreach ($columns as $fieldName => $column) {
995
+            if (!$column->isSearchable()) {
996 996
                 continue;
997 997
             }
998 998
             
999 999
             $field = $column->getField();
1000 1000
             
1001
-            if(isset($alreadyAddedFilters[$fieldName])){
1001
+            if (isset($alreadyAddedFilters[$fieldName])) {
1002 1002
                 continue;
1003 1003
             }
1004 1004
             
1005 1005
             $label = $tableview->getFilterLabelWidget($fieldName, $field);
1006 1006
             $label = trim($label->getText());
1007
-            if(empty($label)){
1007
+            if (empty($label)) {
1008 1008
                 continue;
1009 1009
             }
1010 1010
             $options[$fieldName] = $label;
1011 1011
         }
1012 1012
         
1013
-        if(count($options) > 1){
1013
+        if (count($options) > 1) {
1014 1014
             $editor->addItem($W->Html('<hr/>'));
1015 1015
             $editor->addItem($W->FlexItems($W->LabelledWidget($App->translate('Add a new criteria'), $W->Select2()
1016 1016
                 ->setOptions($options), 'newField')
@@ -1025,16 +1025,16 @@  discard block
 block discarded – undo
1025 1025
     
1026 1026
     public function addMoreCriteriaField($key, $data = null)
1027 1027
     {
1028
-        if(session_status() == PHP_SESSION_NONE){
1028
+        if (session_status() == PHP_SESSION_NONE) {
1029 1029
             session_start();
1030 1030
         }
1031 1031
         $fields = isset($data['filter']) ? $data['filter'] : array();
1032
-        if(isset($data['newField']) && ! empty($data['newField'])){
1032
+        if (isset($data['newField']) && !empty($data['newField'])) {
1033 1033
             $newField = $data['newField'];
1034 1034
             unset($data['key']);
1035 1035
             unset($data['moreCriteria']);
1036 1036
             $fields[$newField] = '';
1037
-            $this->addReloadSelector('.depends-modelViewMoreCriterias-' . $key);
1037
+            $this->addReloadSelector('.depends-modelViewMoreCriterias-'.$key);
1038 1038
         }
1039 1039
         $_SESSION['modelViewMoreCriterias'][$key] = $fields;
1040 1040
         return true;
@@ -1043,14 +1043,14 @@  discard block
 block discarded – undo
1043 1043
     public function removeMoreCriteriaField($key, $field)
1044 1044
     {
1045 1045
         $fields = $_SESSION['modelViewMoreCriterias'][$key];
1046
-        if(isset($fields[$field])){
1046
+        if (isset($fields[$field])) {
1047 1047
             unset($fields[$field]);
1048
-            if(session_status() == PHP_SESSION_NONE){
1048
+            if (session_status() == PHP_SESSION_NONE) {
1049 1049
                 session_start();
1050 1050
             }
1051 1051
             $_SESSION['modelViewMoreCriterias'][$key] = $fields;
1052 1052
         }
1053
-        $this->addReloadSelector('.depends-modelViewMoreCriterias-' . $key);
1053
+        $this->addReloadSelector('.depends-modelViewMoreCriterias-'.$key);
1054 1054
         return true;
1055 1055
     }
1056 1056
     
@@ -1106,17 +1106,17 @@  discard block
 block discarded – undo
1106 1106
         
1107 1107
         switch ($format) {
1108 1108
             case 'xlsx':
1109
-                $tableview->downloadXlsx($filename . '.xlsx');
1109
+                $tableview->downloadXlsx($filename.'.xlsx');
1110 1110
                 break;
1111 1111
             case 'xls':
1112
-                $tableview->downloadExcel($filename . '.xls');
1112
+                $tableview->downloadExcel($filename.'.xls');
1113 1113
                 break;
1114 1114
             case 'ssv':
1115
-                $tableview->downloadCsv($filename . '.csv', ';', $inline, 'Windows-1252');
1115
+                $tableview->downloadCsv($filename.'.csv', ';', $inline, 'Windows-1252');
1116 1116
                 break;
1117 1117
             case 'csv':
1118 1118
             default:
1119
-                $tableview->downloadCsv($filename . '.csv', ',', $inline, BabCharset::getIso());
1119
+                $tableview->downloadCsv($filename.'.csv', ',', $inline, BabCharset::getIso());
1120 1120
                 break;
1121 1121
         }
1122 1122
     }
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
         $recordSet = $this->getRecordSet();
1183 1183
         
1184 1184
         $record = $recordSet->request($id);
1185
-        if(! $record->isReadable()){
1185
+        if (!$record->isReadable()) {
1186 1186
             throw new AppAccessException($App->translate('You do not have access to this page'));
1187 1187
         }
1188 1188
         
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
         
1191 1191
         $recordClassname = $this->getRecordClassName();
1192 1192
         
1193
-        $viewClassname = $recordClassname . 'FullFrame';
1193
+        $viewClassname = $recordClassname.'FullFrame';
1194 1194
         
1195 1195
         $fullFrame = $Ui->$viewClassname($record);
1196 1196
         $fullFrame->setView($view);
@@ -1202,17 +1202,17 @@  discard block
 block discarded – undo
1202 1202
         $mainMenu->setSizePolicy(FuncIcons::ICON_LEFT_24);
1203 1203
         
1204 1204
         $page = $Ui->Page();
1205
-        if(isset($itemId)){
1205
+        if (isset($itemId)) {
1206 1206
             $page->setId($itemId);
1207 1207
         }
1208
-        $page->addClass('depends-' . $this->getRecordClassName());
1208
+        $page->addClass('depends-'.$this->getRecordClassName());
1209 1209
         
1210 1210
         $page->addToolbar($mainMenu);
1211 1211
         
1212 1212
         $page->addItem($fullFrame);
1213 1213
         
1214 1214
         $page->setReloadAction($this->proxy()
1215
-            ->display($id, $view,$page->getId()));
1215
+            ->display($id, $view, $page->getId()));
1216 1216
         
1217 1217
         return $page;
1218 1218
     }
@@ -1244,14 +1244,14 @@  discard block
 block discarded – undo
1244 1244
         
1245 1245
         $editor = $this->recordEditor();
1246 1246
         
1247
-        if(isset($id)){
1247
+        if (isset($id)) {
1248 1248
             $record = $recordSet->request($id);
1249
-            if(! $record->isUpdatable()){
1249
+            if (!$record->isUpdatable()) {
1250 1250
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1251 1251
             }
1252 1252
         }
1253
-        else{
1254
-            if(! $recordSet->isCreatable()){
1253
+        else {
1254
+            if (!$recordSet->isCreatable()) {
1255 1255
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1256 1256
             }
1257 1257
             $record = $recordSet->newRecord();
@@ -1286,15 +1286,15 @@  discard block
 block discarded – undo
1286 1286
         
1287 1287
         $editor = $Ui->TagsEditor();
1288 1288
         
1289
-        if(isset($id)){
1289
+        if (isset($id)) {
1290 1290
             $record = $recordSet->request($id);
1291
-            if(! $record->isUpdatable()){
1291
+            if (!$record->isUpdatable()) {
1292 1292
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1293 1293
             }
1294 1294
             $editor->setRecord($record);
1295 1295
         }
1296
-        else{
1297
-            if(! $recordSet->isCreatable()){
1296
+        else {
1297
+            if (!$recordSet->isCreatable()) {
1298 1298
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1299 1299
             }
1300 1300
             $record = $recordSet->newRecord();
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
         
1346 1346
         $recordTitle = $record->getRecordTitle();
1347 1347
         
1348
-        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"');
1348
+        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"');
1349 1349
         return $message;
1350 1350
     }
1351 1351
     
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
      *
1377 1377
      * @param AppRecord $record
1378 1378
      */
1379
-    protected function preSave(ORMRecord &$record, $data)
1379
+    protected function preSave(ORMRecord & $record, $data)
1380 1380
     {
1381 1381
     }
1382 1382
     
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
      *
1386 1386
      * @param AppRecord $record
1387 1387
      */
1388
-    protected function postSave(ORMRecord &$record, $data)
1388
+    protected function postSave(ORMRecord & $record, $data)
1389 1389
     {
1390 1390
     }
1391 1391
     
@@ -1401,52 +1401,52 @@  discard block
 block discarded – undo
1401 1401
         $this->requireSaveMethod();
1402 1402
         $App = $this->App();
1403 1403
         $recordSet = $this->getSaveRecordSet();
1404
-        if(method_exists($recordSet, 'allowDraftCreation') && $recordSet->allowDraftCreation()){
1404
+        if (method_exists($recordSet, 'allowDraftCreation') && $recordSet->allowDraftCreation()) {
1405 1405
             $recordSet->setDefaultCriteria();
1406 1406
         }
1407 1407
         $pk = $recordSet->getPrimaryKey();
1408 1408
         $message = null;
1409 1409
         
1410
-        if(! empty($data[$pk])){
1410
+        if (!empty($data[$pk])) {
1411 1411
             $record = $recordSet->request($data[$pk]);
1412 1412
             $record->deleted = AppTraceableRecord::DELETED_STATUS_EXISTING;
1413 1413
             unset($data[$pk]);
1414 1414
             
1415
-            if(! $record->isUpdatable()){
1415
+            if (!$record->isUpdatable()) {
1416 1416
                 throw new AppAccessException('Access denied');
1417 1417
             }
1418 1418
             
1419 1419
             $message = $this->getModifedMessage($record);
1420 1420
         }
1421
-        else{
1421
+        else {
1422 1422
             
1423 1423
             $record = $recordSet->newRecord();
1424 1424
             
1425
-            if(! $recordSet->isCreatable()){
1425
+            if (!$recordSet->isCreatable()) {
1426 1426
                 throw new AppAccessException('Access denied');
1427 1427
             }
1428 1428
             
1429 1429
             $message = $this->getCreatedMessage();
1430 1430
         }
1431 1431
         
1432
-        if(! isset($record)){
1432
+        if (!isset($record)) {
1433 1433
             throw new AppSaveException($App->translate('The record does not exists'));
1434 1434
         }
1435 1435
         
1436
-        if(! isset($data)){
1436
+        if (!isset($data)) {
1437 1437
             throw new AppSaveException($App->translate('Nothing to save'));
1438 1438
         }
1439 1439
         
1440 1440
         $record->setFormInputValues($data);
1441 1441
         
1442 1442
         $this->preSave($record, $data);
1443
-        if($record->save()){
1443
+        if ($record->save()) {
1444 1444
             $this->postSave($record, $data);
1445
-            if(is_string($message)){
1445
+            if (is_string($message)) {
1446 1446
                 $this->addToast($message);
1447 1447
             }
1448 1448
             
1449
-            $this->addReloadSelector('.depends-' . $this->getRecordClassName());
1449
+            $this->addReloadSelector('.depends-'.$this->getRecordClassName());
1450 1450
             return true;
1451 1451
         }
1452 1452
         
@@ -1469,16 +1469,16 @@  discard block
 block discarded – undo
1469 1469
         
1470 1470
         $record = $recordSet->request($id);
1471 1471
         
1472
-        if(! $record->isDeletable()){
1472
+        if (!$record->isDeletable()) {
1473 1473
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1474 1474
         }
1475 1475
         $deletedMessage = $this->getDeletedMessage($record);
1476 1476
         
1477
-        if($record->delete()){
1477
+        if ($record->delete()) {
1478 1478
             $this->addToast($deletedMessage);
1479 1479
         }
1480 1480
         
1481
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1481
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1482 1482
         
1483 1483
         return true;
1484 1484
     }
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
         $page->addClass('app-page-editor');
1503 1503
         $page->setTitle($App->translate('Deletion'));
1504 1504
         
1505
-        if(! isset($record)){
1505
+        if (!isset($record)) {
1506 1506
             $page->addItem($W->Label($App->translate('This element does not exists.')));
1507 1507
             $page->addClass('alert', 'alert-warning');
1508 1508
             return $page;
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
         
1516 1516
         $recordTitle = $record->getRecordTitle();
1517 1517
         
1518
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1518
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1519 1519
         $form->addItem($W->Title($subTitle, 5));
1520 1520
         
1521 1521
         $form->addItem($W->Title($App->translate('Confirm delete?'), 6));
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
         
1525 1525
         $confirmedAction = $this->proxy()->delete($id);
1526 1526
         $parameters = $confirmedAction->getParameters();
1527
-        foreach ($parameters as $key => $value){
1527
+        foreach ($parameters as $key => $value) {
1528 1528
             $form->setHiddenValue($key, $value);
1529 1529
         }
1530 1530
         $form->addButton($W->SubmitButton()
@@ -1554,20 +1554,20 @@  discard block
 block discarded – undo
1554 1554
         
1555 1555
         $record = $recordSet->request($id);
1556 1556
         
1557
-        if(! $record->isRemovable()){
1557
+        if (!$record->isRemovable()) {
1558 1558
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1559 1559
         }
1560 1560
         
1561 1561
         $App = $this->App();
1562 1562
         $deletedMessage = $App->translate('The element has been moved to the trash');
1563 1563
         
1564
-        if($recordSet->delete($recordSet->id->is($record->id), AppTraceableRecord::DELETED_STATUS_IN_TRASH)){
1565
-            if(is_string($deletedMessage)){
1564
+        if ($recordSet->delete($recordSet->id->is($record->id), AppTraceableRecord::DELETED_STATUS_IN_TRASH)) {
1565
+            if (is_string($deletedMessage)) {
1566 1566
                 $this->addToast($deletedMessage);
1567 1567
             }
1568 1568
         }
1569 1569
         
1570
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1570
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1571 1571
         
1572 1572
         return true;
1573 1573
     }
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
         
1596 1596
         $recordTitle = $record->getRecordTitle();
1597 1597
         
1598
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1598
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1599 1599
         $form->addItem($W->Title($subTitle, 5));
1600 1600
         
1601 1601
         $form->addItem($W->Title($App->translate('Confirm delete?'), 6));
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
         
1605 1605
         $confirmedAction = $this->proxy()->remove($id);
1606 1606
         $parameters = $confirmedAction->getParameters();
1607
-        foreach ($parameters as $key => $value){
1607
+        foreach ($parameters as $key => $value) {
1608 1608
             $form->setHiddenValue($key, $value);
1609 1609
         }
1610 1610
         $form->addButton($W->SubmitButton()
@@ -1635,12 +1635,12 @@  discard block
 block discarded – undo
1635 1635
         $records = $recordSet->select($recordSet->id->is($id), true);
1636 1636
         
1637 1637
         $record = null;
1638
-        foreach ($records as $record){
1638
+        foreach ($records as $record) {
1639 1639
         }
1640
-        if(! isset($record)){
1640
+        if (!isset($record)) {
1641 1641
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1642 1642
         }
1643
-        if(! $record->isRestorable()){
1643
+        if (!$record->isRestorable()) {
1644 1644
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1645 1645
         }
1646 1646
         
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
         $record->save();
1652 1652
         $this->addToast($deletedMessage);
1653 1653
         
1654
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1654
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1655 1655
         
1656 1656
         return true;
1657 1657
     }
@@ -1671,9 +1671,9 @@  discard block
 block discarded – undo
1671 1671
         $records = $recordSet->select($recordSet->id->is($id), true);
1672 1672
         
1673 1673
         $record = null;
1674
-        foreach ($records as $record){
1674
+        foreach ($records as $record) {
1675 1675
         }
1676
-        if(! isset($record)){
1676
+        if (!isset($record)) {
1677 1677
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1678 1678
         }
1679 1679
         
@@ -1686,12 +1686,12 @@  discard block
 block discarded – undo
1686 1686
         
1687 1687
         $recordTitle = $record->getRecordTitle();
1688 1688
         
1689
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1689
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1690 1690
         $form->addItem($W->Title($subTitle, 5));
1691 1691
         
1692 1692
         $confirmedAction = $this->proxy()->restore($id);
1693 1693
         $parameters = $confirmedAction->getParameters();
1694
-        foreach ($parameters as $key => $value){
1694
+        foreach ($parameters as $key => $value) {
1695 1695
             $form->setHiddenValue($key, $value);
1696 1696
         }
1697 1697
         $form->addButton($W->SubmitButton()
@@ -1717,12 +1717,12 @@  discard block
 block discarded – undo
1717 1717
         $view = $this->modelView($filter, $type, null, $itemId);
1718 1718
         $view->setAjaxAction();
1719 1719
         
1720
-        if(isset($filter)){
1720
+        if (isset($filter)) {
1721 1721
             $view->setFilterValues($filter);
1722 1722
         }
1723 1723
         $filter = $view->getFilterValues();
1724 1724
         
1725
-        if(isset($filter['showTotal']) && $filter['showTotal']){
1725
+        if (isset($filter['showTotal']) && $filter['showTotal']) {
1726 1726
             $view->displaySubTotalRow(true);
1727 1727
         }
1728 1728
         
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
         $page->addItem($trashView);
1769 1769
         
1770 1770
         $itemMenus = $this->getListItemMenus();
1771
-        foreach ($itemMenus as $itemMenuId => $itemMenu){
1771
+        foreach ($itemMenus as $itemMenuId => $itemMenu) {
1772 1772
             $page->addItemMenu($itemMenuId, $itemMenu['label'], $itemMenu['action']);
1773 1773
         }
1774 1774
         $page->setCurrentItemMenu('displayTrash');
@@ -1794,16 +1794,16 @@  discard block
 block discarded – undo
1794 1794
         $registry = bab_getRegistryInstance();
1795 1795
         
1796 1796
         $userId = '0';
1797
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id . '/filters');
1797
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters');
1798 1798
         
1799
-        while ($filterName = $registry->fetchChildKey()){
1799
+        while ($filterName = $registry->fetchChildKey()) {
1800 1800
             $filters[] = $filterName;
1801 1801
         }
1802 1802
         
1803 1803
         $userId = bab_getUserId();
1804
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id . '/filters');
1804
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters');
1805 1805
         
1806
-        while ($filterName = $registry->fetchChildKey()){
1806
+        while ($filterName = $registry->fetchChildKey()) {
1807 1807
             $filters[] = $filterName;
1808 1808
         }
1809 1809
         
@@ -1820,15 +1820,15 @@  discard block
 block discarded – undo
1820 1820
     {
1821 1821
         $W = bab_Widgets();
1822 1822
         $tableview = $this->modelView(null, 'table');
1823
-        $W->setUserConfiguration($tableview->getId() . '/currentFilterName', $filterName, 'widgets', false);
1823
+        $W->setUserConfiguration($tableview->getId().'/currentFilterName', $filterName, 'widgets', false);
1824 1824
         
1825 1825
         $registry = bab_getRegistryInstance();
1826 1826
         $userId = '0';
1827
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $tableview->getId() . '/filters');
1827
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$tableview->getId().'/filters');
1828 1828
         $filterValues = $registry->getValue($filterName);
1829 1829
         
1830
-        if(! $filterValues){
1831
-            $filterValues = $W->getUserConfiguration($tableview->getId() . '/filters/' . $filterName, 'widgets', false);
1830
+        if (!$filterValues) {
1831
+            $filterValues = $W->getUserConfiguration($tableview->getId().'/filters/'.$filterName, 'widgets', false);
1832 1832
         }
1833 1833
         
1834 1834
         $tableview = $this->modelView($filterValues, 'table');
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
     {
1845 1845
         $W = bab_Widgets();
1846 1846
         $id = $this->getModelViewDefaultId();
1847
-        $filter = $W->getUserConfiguration($id . '/currentFilterName', 'widgets', false);
1847
+        $filter = $W->getUserConfiguration($id.'/currentFilterName', 'widgets', false);
1848 1848
         
1849 1849
         return $filter;
1850 1850
     }
@@ -1854,12 +1854,12 @@  discard block
 block discarded – undo
1854 1854
      */
1855 1855
     public function resetFilters($name = null)
1856 1856
     {
1857
-        if(isset($name)){
1857
+        if (isset($name)) {
1858 1858
             $W = bab_Widgets();
1859
-            $filter = $W->getUserConfiguration($tableview->getId() . '/filters/' . $name, 'widgets', false);
1859
+            $filter = $W->getUserConfiguration($tableview->getId().'/filters/'.$name, 'widgets', false);
1860 1860
             $filterValues = $filter['values'];
1861 1861
         }
1862
-        else{
1862
+        else {
1863 1863
             $filterValues = null;
1864 1864
         }
1865 1865
         
@@ -1886,7 +1886,7 @@  discard block
 block discarded – undo
1886 1886
             'values' => $filterValues
1887 1887
         );
1888 1888
         
1889
-        $W->setUserConfiguration($tableview->getId() . '/filters/' . $name, $data, 'widgets', false);
1889
+        $W->setUserConfiguration($tableview->getId().'/filters/'.$name, $data, 'widgets', false);
1890 1890
         
1891 1891
         return true;
1892 1892
     }
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
         $Ui = $App->Ui();
1904 1904
         
1905 1905
         $currentFilterName = $this->getCurrentFilterName();
1906
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $currentFilterName, 'widgets', false);
1906
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$currentFilterName, 'widgets', false);
1907 1907
         
1908 1908
         $page = $Ui->Page();
1909 1909
         
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
         $App = $this->App();
1941 1941
         $Ui = $App->Ui();
1942 1942
         
1943
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
1943
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
1944 1944
         
1945 1945
         $page = $Ui->Page();
1946 1946
         
@@ -1978,8 +1978,8 @@  discard block
 block discarded – undo
1978 1978
         $page->addItem($filtersBox);
1979 1979
         
1980 1980
         $filterNames = $this->getFilterNames();
1981
-        foreach ($filterNames as $filterName){
1982
-            $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false);
1981
+        foreach ($filterNames as $filterName) {
1982
+            $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false);
1983 1983
             
1984 1984
             $filterBox = $W->HBoxItems()
1985 1985
                 ->setVerticalAlign('middle')
@@ -2018,7 +2018,7 @@  discard block
 block discarded – undo
2018 2018
         $App = $this->App();
2019 2019
         $Ui = $App->Ui();
2020 2020
         
2021
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
2021
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
2022 2022
         
2023 2023
         $page = $Ui->Page();
2024 2024
         
@@ -2049,7 +2049,7 @@  discard block
 block discarded – undo
2049 2049
         $this->requireDeleteMethod();
2050 2050
         
2051 2051
         $W = bab_Widgets();
2052
-        $W->deleteUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
2052
+        $W->deleteUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
2053 2053
         
2054 2054
         return true;
2055 2055
     }
@@ -2059,7 +2059,7 @@  discard block
 block discarded – undo
2059 2059
         $modelView = $this->modelView();
2060 2060
         $modelView->setHighlightedRows($ids);
2061 2061
         
2062
-        $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords');
2062
+        $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords');
2063 2063
         
2064 2064
         return true;
2065 2065
     }
@@ -2069,7 +2069,7 @@  discard block
 block discarded – undo
2069 2069
         $modelView = $this->modelView();
2070 2070
         $modelView->clearHighlightedRows();
2071 2071
         
2072
-        $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords');
2072
+        $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords');
2073 2073
         
2074 2074
         return true;
2075 2075
     }
@@ -2088,34 +2088,34 @@  discard block
 block discarded – undo
2088 2088
         $box = $W->VBoxItems();
2089 2089
         
2090 2090
         $isComponent = false;
2091
-        if($component = $App->getCurrentComponent()){
2091
+        if ($component = $App->getCurrentComponent()) {
2092 2092
             $Ui = $component->ui();
2093 2093
             $viewClassname = 'FullFrame';
2094 2094
             $isComponent = true;
2095 2095
         }
2096
-        else{
2096
+        else {
2097 2097
             $Ui = $App->Ui();
2098 2098
             $recordClassname = $this->getRecordClassName();
2099
-            $viewClassname = $recordClassname . 'FullFrame';
2099
+            $viewClassname = $recordClassname.'FullFrame';
2100 2100
         }
2101 2101
         
2102
-        if($records->count() > 0){
2102
+        if ($records->count() > 0) {
2103 2103
             $box->addItem($W->Link('', $this->proxy()
2104 2104
                 ->clearHighlightedRecords())
2105 2105
                 ->setAjaxAction(null, false)
2106 2106
                 ->addClass('icon', FuncIcons::ACTIONS_ARROW_RIGHT_DOUBLE, "app_closeHighlightButton")
2107
-                ->setSizePolicy(FuncIcons::ICON_LEFT_32 . ' pull-right'));
2107
+                ->setSizePolicy(FuncIcons::ICON_LEFT_32.' pull-right'));
2108 2108
             
2109
-            foreach ($records as $record){
2109
+            foreach ($records as $record) {
2110 2110
                 
2111
-                if($isComponent){
2111
+                if ($isComponent) {
2112 2112
                     $fullFrame = $Ui->$viewClassname($record);
2113
-                    if(method_exists($record, "getBlueprint")){
2113
+                    if (method_exists($record, "getBlueprint")) {
2114 2114
                         $view = $record->getBlueprint();
2115 2115
                     }
2116 2116
                     $fullFrame->setView($view);
2117 2117
                 }
2118
-                else{
2118
+                else {
2119 2119
                     $fullFrame = $Ui->$viewClassname($record->id, $view);
2120 2120
                 }
2121 2121
                 
@@ -2124,23 +2124,23 @@  discard block
 block discarded – undo
2124 2124
             $box->addClass('box', 'shadow');
2125 2125
         }
2126 2126
         
2127
-        $box->addClass('depends-' . $modelView->getId() . '-HighlightedRecords');
2127
+        $box->addClass('depends-'.$modelView->getId().'-HighlightedRecords');
2128 2128
         $box->setReloadAction($this->proxy()
2129 2129
             ->previewHighlightedRecords($view));
2130 2130
         return $box;
2131 2131
     }
2132 2132
 
2133
-    protected function getActions(AppRecord $record,$currentView = ''){
2133
+    protected function getActions(AppRecord $record, $currentView = '') {
2134 2134
         return array();
2135 2135
     }
2136 2136
     
2137
-    public function search($q = null){
2137
+    public function search($q = null) {
2138 2138
         session_write_close();
2139 2139
         $set = $this->getRecordSet();
2140 2140
         $collection = new WidgetSelect2OptionsCollection();
2141
-        if($q == null || strlen($q) <= 1){
2141
+        if ($q == null || strlen($q) <= 1) {
2142 2142
             $collection->addOption(
2143
-                new WidgetSelect2Option(0,$this->App()->translate("Keyword too small"))
2143
+                new WidgetSelect2Option(0, $this->App()->translate("Keyword too small"))
2144 2144
             );
2145 2145
             header("Content-type: application/json; charset=utf-8");
2146 2146
             echo $collection->output();
@@ -2153,7 +2153,7 @@  discard block
 block discarded – undo
2153 2153
                 $set->$field->contains($q)
2154 2154
             )
2155 2155
         );
2156
-        foreach($records as $r){
2156
+        foreach ($records as $r) {
2157 2157
             $collection->addOption(
2158 2158
                 new WidgetSelect2Option($r->id, $r->$field)
2159 2159
             );
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -146,15 +146,12 @@  discard block
 block discarded – undo
146 146
                 $text = $actions->getTitle();
147 147
             }
148 148
             $html = '<li><a class="icon ' . $actions->getIcon() . '" href="' . $actions->url() . '">' . $text . '</a></li>';
149
-        }
150
-        elseif($actions instanceof WidgetDisplayableInterface){
149
+        } elseif($actions instanceof WidgetDisplayableInterface){
151 150
             $html = '<li>' . $actions->display($canvas) . '</li>';
152
-        }
153
-        elseif(is_array($actions)){
151
+        } elseif(is_array($actions)){
154 152
             if(isset($actions['items'])){
155 153
                 $items = $actions['items'];
156
-            }
157
-            else{
154
+            } else{
158 155
                 $items = $actions;
159 156
             }
160 157
             foreach ($items as $action){
@@ -218,8 +215,7 @@  discard block
 block discarded – undo
218 215
                         'label' => $method['label']
219 216
                     );
220 217
                 }
221
-            }
222
-            catch (\Exception $e){
218
+            } catch (\Exception $e){
223 219
                 unset($types[$index]);
224 220
                 continue;
225 221
             }
@@ -300,8 +296,7 @@  discard block
 block discarded – undo
300 296
             if(! $record->isUpdatable()){
301 297
                 throw new AppAccessException($App->translate('You do not have access to this page'));
302 298
             }
303
-        }
304
-        else{
299
+        } else{
305 300
             if(! $recordSet->isCreatable()){
306 301
                 throw new AppAccessException($App->translate('You do not have access to this page'));
307 302
             }
@@ -638,8 +633,7 @@  discard block
 block discarded – undo
638 633
         
639 634
         if($this->getFilterVisibility($itemId)){
640 635
             $filterPanel->addClass('show-filter');
641
-        }
642
-        else{
636
+        } else{
643 637
             $filterPanel->addClass('hide-filter');
644 638
         }
645 639
         
@@ -935,8 +929,7 @@  discard block
 block discarded – undo
935 929
             }
936 930
             $_SESSION['modelViewMoreCriterias'][$key] = $fields;
937 931
             session_write_close();
938
-        }
939
-        else{
932
+        } else{
940 933
             $fields = $_SESSION['modelViewMoreCriterias'][$key];
941 934
         }
942 935
         
@@ -1249,8 +1242,7 @@  discard block
 block discarded – undo
1249 1242
             if(! $record->isUpdatable()){
1250 1243
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1251 1244
             }
1252
-        }
1253
-        else{
1245
+        } else{
1254 1246
             if(! $recordSet->isCreatable()){
1255 1247
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1256 1248
             }
@@ -1292,8 +1284,7 @@  discard block
 block discarded – undo
1292 1284
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1293 1285
             }
1294 1286
             $editor->setRecord($record);
1295
-        }
1296
-        else{
1287
+        } else{
1297 1288
             if(! $recordSet->isCreatable()){
1298 1289
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1299 1290
             }
@@ -1417,8 +1408,7 @@  discard block
 block discarded – undo
1417 1408
             }
1418 1409
             
1419 1410
             $message = $this->getModifedMessage($record);
1420
-        }
1421
-        else{
1411
+        } else{
1422 1412
             
1423 1413
             $record = $recordSet->newRecord();
1424 1414
             
@@ -1858,8 +1848,7 @@  discard block
 block discarded – undo
1858 1848
             $W = bab_Widgets();
1859 1849
             $filter = $W->getUserConfiguration($tableview->getId() . '/filters/' . $name, 'widgets', false);
1860 1850
             $filterValues = $filter['values'];
1861
-        }
1862
-        else{
1851
+        } else{
1863 1852
             $filterValues = null;
1864 1853
         }
1865 1854
         
@@ -2092,8 +2081,7 @@  discard block
 block discarded – undo
2092 2081
             $Ui = $component->ui();
2093 2082
             $viewClassname = 'FullFrame';
2094 2083
             $isComponent = true;
2095
-        }
2096
-        else{
2084
+        } else{
2097 2085
             $Ui = $App->Ui();
2098 2086
             $recordClassname = $this->getRecordClassName();
2099 2087
             $viewClassname = $recordClassname . 'FullFrame';
@@ -2114,8 +2102,7 @@  discard block
 block discarded – undo
2114 2102
                         $view = $record->getBlueprint();
2115 2103
                     }
2116 2104
                     $fullFrame->setView($view);
2117
-                }
2118
-                else{
2105
+                } else{
2119 2106
                     $fullFrame = $Ui->$viewClassname($record->id, $view);
2120 2107
                 }
2121 2108
                 
Please login to merge, or discard this patch.
programs/Ui/AppHelpers.php 3 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		if (empty($description)) {
74 74
 			$description = $field->getName();
75 75
 		}
76
-		$fieldLabel = $W->Label($description . ':');
76
+		$fieldLabel = $W->Label($description.':');
77 77
 
78 78
 		if ($field instanceof ORMDateField) {
79 79
 			$widget = $W->DatePicker();
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		if (empty($description)) {
130 130
 			$description = $field->getName();
131 131
 		}
132
-		$fieldLabel = $W->Label($description . ':');
132
+		$fieldLabel = $W->Label($description.':');
133 133
 
134 134
 		if ($field instanceof ORMDateField) {
135 135
 			$widget = $W->PeriodPicker();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	$nbOptions = 0;
233 233
 	foreach ($iterator as $record) {
234 234
 		if (isset($record->code)) {
235
-			$optionText = $record->code . ' - ' . $record->$fieldName;
235
+			$optionText = $record->code.' - '.$record->$fieldName;
236 236
 		} else {
237 237
 			$optionText = $record->$fieldName;
238 238
 		}
@@ -314,18 +314,18 @@  discard block
 block discarded – undo
314 314
         $set = $parentSet->$fieldName;
315 315
         $records = $set->select();
316 316
 		$pkName = $set->getPrimaryKey();
317
-		if($set->fieldExist("name")){
317
+		if ($set->fieldExist("name")) {
318 318
 			$displayField = $set->name->getName();
319
-		}else if(method_exists($set,"getDisplayNameField")){
319
+		} else if (method_exists($set, "getDisplayNameField")) {
320 320
 			$displayField = $set->getDisplayNameField()->getName();
321
-		}else{
321
+		} else {
322 322
 			$displayField = $pkName;
323 323
 		}
324 324
 		$records->orderAsc($set->$displayField);
325
-		if($records->count() > 50){
325
+		if ($records->count() > 50) {
326 326
 			$widget = bab_Widgets()->select2();
327 327
 			$widget->setDataSource($set->getController()->search());
328
-		}else{
328
+		} else {
329 329
 			$widget = $W->Select();
330 330
 			$widget->addOption('', '');
331 331
 			foreach ($records as $record) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -316,16 +316,16 @@
 block discarded – undo
316 316
 		$pkName = $set->getPrimaryKey();
317 317
 		if($set->fieldExist("name")){
318 318
 			$displayField = $set->name->getName();
319
-		}else if(method_exists($set,"getDisplayNameField")){
319
+		} else if(method_exists($set,"getDisplayNameField")){
320 320
 			$displayField = $set->getDisplayNameField()->getName();
321
-		}else{
321
+		} else{
322 322
 			$displayField = $pkName;
323 323
 		}
324 324
 		$records->orderAsc($set->$displayField);
325 325
 		if($records->count() > 50){
326 326
 			$widget = bab_Widgets()->select2();
327 327
 			$widget->setDataSource($set->getController()->search());
328
-		}else{
328
+		} else{
329 329
 			$widget = $W->Select();
330 330
 			$widget->addOption('', '');
331 331
 			foreach ($records as $record) {
Please login to merge, or discard this patch.
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -63,50 +63,50 @@  discard block
 block discarded – undo
63 63
 
64 64
 function app_genericSetEditor(ORMRecordSet $set)
65 65
 {
66
-	$O = BabFunctionality::get('LibOrm');
67
-	$O->init();
68
-	$W = bab_Widgets();
69
-	$layout = $W->VBoxLayout();
70
-	$layout->setVerticalSpacing(1, 'em');
71
-
72
-
73
-	$fields = $set->getFields();
74
-
75
-	foreach ($fields as $field) {
76
-		$description = $field->getDescription();
77
-		if (empty($description)) {
78
-			$description = $field->getName();
79
-		}
80
-		$fieldLabel = $W->Label($description . ':');
81
-
82
-		if ($field instanceof ORMDateField) {
83
-			$widget = $W->DatePicker();
84
-		} else if ($field instanceof ORMTimeField) {
85
-			$widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
86
-		} else if ($field instanceof ORMStringField) {
87
-			$widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength())));
88
-		} else if ($field instanceof ORMEnumField) {
89
-			$widget = $W->Select();
90
-			$widget->addOption('', '');
91
-			foreach ($field->getValues() as $key => $text) {
92
-				$widget->addOption($key, $text);
93
-			}
94
-		} else if ($field instanceof ORMIntField) {
95
-			$widget = $W->LineEdit()->setSize(9);
96
-		} else if ($field instanceof ORMTextField) {
97
-			$widget = $W->TextEdit()->setColumns(80)->setLines(5);
98
-		} else if ($field instanceof ORMRecordSet) {
99
-				$widget = app_genericSetEditor($field);
100
-				$widget->addClass('sub-form');
101
-		} else {
102
-			$widget = null;
103
-		}
104
-		if (isset($widget)) {
105
-			$layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
106
-		}
107
-	}
108
-
109
-	return $layout;
66
+    $O = BabFunctionality::get('LibOrm');
67
+    $O->init();
68
+    $W = bab_Widgets();
69
+    $layout = $W->VBoxLayout();
70
+    $layout->setVerticalSpacing(1, 'em');
71
+
72
+
73
+    $fields = $set->getFields();
74
+
75
+    foreach ($fields as $field) {
76
+        $description = $field->getDescription();
77
+        if (empty($description)) {
78
+            $description = $field->getName();
79
+        }
80
+        $fieldLabel = $W->Label($description . ':');
81
+
82
+        if ($field instanceof ORMDateField) {
83
+            $widget = $W->DatePicker();
84
+        } else if ($field instanceof ORMTimeField) {
85
+            $widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
86
+        } else if ($field instanceof ORMStringField) {
87
+            $widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength())));
88
+        } else if ($field instanceof ORMEnumField) {
89
+            $widget = $W->Select();
90
+            $widget->addOption('', '');
91
+            foreach ($field->getValues() as $key => $text) {
92
+                $widget->addOption($key, $text);
93
+            }
94
+        } else if ($field instanceof ORMIntField) {
95
+            $widget = $W->LineEdit()->setSize(9);
96
+        } else if ($field instanceof ORMTextField) {
97
+            $widget = $W->TextEdit()->setColumns(80)->setLines(5);
98
+        } else if ($field instanceof ORMRecordSet) {
99
+                $widget = app_genericSetEditor($field);
100
+                $widget->addClass('sub-form');
101
+        } else {
102
+            $widget = null;
103
+        }
104
+        if (isset($widget)) {
105
+            $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
106
+        }
107
+    }
108
+
109
+    return $layout;
110 110
 }
111 111
 
112 112
 
@@ -119,50 +119,50 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function app_genericSetFilterForm(ORMRecordSet $set)
121 121
 {
122
-	$O = BabFunctionality::get('LibOrm');
123
-	$O->init();
124
-	$W = bab_Widgets();
125
-	$layout = $W->FlowLayout();
126
-	$layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em');
127
-
128
-
129
-	$fields = $set->getFields();
130
-
131
-	foreach ($fields as $field) {
132
-		$description = $field->getDescription();
133
-		if (empty($description)) {
134
-			$description = $field->getName();
135
-		}
136
-		$fieldLabel = $W->Label($description . ':');
137
-
138
-		if ($field instanceof ORMDateField) {
139
-			$widget = $W->PeriodPicker();
140
-		} else if ($field instanceof ORMTimeField) {
141
-			$widget = $W->TimePicker();
142
-		} else if ($field instanceof ORMStringField) {
143
-			$widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength())));
144
-		} else if ($field instanceof ORMEnumField) {
145
-			$widget = $W->Select();
146
-			$widget->addOption('', '');
147
-			foreach ($field->getValues() as $key => $text) {
148
-				$widget->addOption($key, $text);
149
-			}
150
-		} else if ($field instanceof ORMIntField) {
151
-			$widget = $W->LineEdit()->setSize(9);
152
-		} else if ($field instanceof ORMTextField) {
153
-			$widget = $widget = $W->LineEdit()->setSize(15);
154
-		} else if ($field instanceof ORMRecordSet) {
155
-			$widget = app_genericSetFilterForm($field);
156
-			$widget->addClass('sub-form');
157
-		} else {
158
-			$widget = null;
159
-		}
160
-		if (isset($widget)) {
161
-			$layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
162
-		}
163
-	}
164
-
165
-	return $layout;
122
+    $O = BabFunctionality::get('LibOrm');
123
+    $O->init();
124
+    $W = bab_Widgets();
125
+    $layout = $W->FlowLayout();
126
+    $layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em');
127
+
128
+
129
+    $fields = $set->getFields();
130
+
131
+    foreach ($fields as $field) {
132
+        $description = $field->getDescription();
133
+        if (empty($description)) {
134
+            $description = $field->getName();
135
+        }
136
+        $fieldLabel = $W->Label($description . ':');
137
+
138
+        if ($field instanceof ORMDateField) {
139
+            $widget = $W->PeriodPicker();
140
+        } else if ($field instanceof ORMTimeField) {
141
+            $widget = $W->TimePicker();
142
+        } else if ($field instanceof ORMStringField) {
143
+            $widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength())));
144
+        } else if ($field instanceof ORMEnumField) {
145
+            $widget = $W->Select();
146
+            $widget->addOption('', '');
147
+            foreach ($field->getValues() as $key => $text) {
148
+                $widget->addOption($key, $text);
149
+            }
150
+        } else if ($field instanceof ORMIntField) {
151
+            $widget = $W->LineEdit()->setSize(9);
152
+        } else if ($field instanceof ORMTextField) {
153
+            $widget = $widget = $W->LineEdit()->setSize(15);
154
+        } else if ($field instanceof ORMRecordSet) {
155
+            $widget = app_genericSetFilterForm($field);
156
+            $widget->addClass('sub-form');
157
+        } else {
158
+            $widget = null;
159
+        }
160
+        if (isset($widget)) {
161
+            $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
162
+        }
163
+    }
164
+
165
+    return $layout;
166 166
 }
167 167
 
168 168
 
@@ -175,47 +175,47 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function app_LabelledWidget($labelText, WidgetDisplayableInterface $widget)
177 177
 {
178
-	$W = bab_Widgets();
179
-
180
-	$label = $W->Label($labelText);
181
-	if ($widget instanceof WidgetInputWidget) {
182
-		$label->setAssociatedWidget($widget);
183
-	}
184
-
185
-	if ($widget instanceof WidgetCheckBox) {
186
-		$layout = $W->HBoxItems(
187
-			$widget->setSizePolicy(WidgetSizePolicy::MINIMUM),
188
-			$label
189
-		)->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
190
-	} else {
191
-		$layout = $W->VBoxItems(
192
-			$label,
193
-			$widget
194
-		)->setVerticalSpacing(0.5, 'em');
195
-	}
196
-
197
-	return $layout;
178
+    $W = bab_Widgets();
179
+
180
+    $label = $W->Label($labelText);
181
+    if ($widget instanceof WidgetInputWidget) {
182
+        $label->setAssociatedWidget($widget);
183
+    }
184
+
185
+    if ($widget instanceof WidgetCheckBox) {
186
+        $layout = $W->HBoxItems(
187
+            $widget->setSizePolicy(WidgetSizePolicy::MINIMUM),
188
+            $label
189
+        )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
190
+    } else {
191
+        $layout = $W->VBoxItems(
192
+            $label,
193
+            $widget
194
+        )->setVerticalSpacing(0.5, 'em');
195
+    }
196
+
197
+    return $layout;
198 198
 }
199 199
 
200 200
 
201 201
 
202 202
 function app_LabelledCheckbox($labelText, $checkboxName, $options = null)
203 203
 {
204
-	$W = bab_Widgets();
204
+    $W = bab_Widgets();
205 205
 
206
-	$label = $W->Label($labelText)->colon(false);
207
-	$checkbox = $W->Checkbox()->setName($checkboxName);
208
-	$label->setAssociatedWidget($checkbox);
209
-	if (isset($options)) {
210
-		$label->setSizePolicy(WidgetSizePolicy::FIXED)->setCanvasOptions($options);
211
-	}
206
+    $label = $W->Label($labelText)->colon(false);
207
+    $checkbox = $W->Checkbox()->setName($checkboxName);
208
+    $label->setAssociatedWidget($checkbox);
209
+    if (isset($options)) {
210
+        $label->setSizePolicy(WidgetSizePolicy::FIXED)->setCanvasOptions($options);
211
+    }
212 212
 
213
-	$layout = $W->HBoxItems(
214
-					$checkbox->setSizePolicy(WidgetSizePolicy::MINIMUM),
215
-					$label
216
-				)->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
213
+    $layout = $W->HBoxItems(
214
+                    $checkbox->setSizePolicy(WidgetSizePolicy::MINIMUM),
215
+                    $label
216
+                )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
217 217
 
218
-	return $layout;
218
+    return $layout;
219 219
 }
220 220
 
221 221
 
@@ -223,42 +223,42 @@  discard block
 block discarded – undo
223 223
 
224 224
 function app_LabelledOrmSelect(ORMMySqlIterator $iterator, $fieldName, $selectName, $label, $hidden = false, $groupFieldName = null)
225 225
 {
226
-	$W = bab_Widgets();
227
-
228
-	if (isset($groupFieldName)) {
229
-		$groupPathElements = explode('/', $groupFieldName);
230
-	}
231
-
232
-	$select = $W->Select()->setName($selectName);
233
-
234
-	$select->addOption('', '');
235
-
236
-	$nbOptions = 0;
237
-	foreach ($iterator as $record) {
238
-		if (isset($record->code)) {
239
-			$optionText = $record->code . ' - ' . $record->$fieldName;
240
-		} else {
241
-			$optionText = $record->$fieldName;
242
-		}
243
-		if (isset($groupFieldName)) {
244
-			$group = $record;
245
-			foreach ($groupPathElements as $groupPathElement) {
246
-				$group = $group->$groupPathElement;
247
-			}
248
-			$select->addOption($record->id, $optionText, $group);
249
-		} else {
250
-			$select->addOption($record->id, $optionText);
251
-		}
252
-		$nbOptions++;
253
-		$lastId = $record->id;
254
-	}
255
-
256
-	if ($nbOptions == 1) {
257
-		$select->setValue($lastId);
258
-	}
259
-
260
-
261
-	return app_LabelledWidget($label, $select);
226
+    $W = bab_Widgets();
227
+
228
+    if (isset($groupFieldName)) {
229
+        $groupPathElements = explode('/', $groupFieldName);
230
+    }
231
+
232
+    $select = $W->Select()->setName($selectName);
233
+
234
+    $select->addOption('', '');
235
+
236
+    $nbOptions = 0;
237
+    foreach ($iterator as $record) {
238
+        if (isset($record->code)) {
239
+            $optionText = $record->code . ' - ' . $record->$fieldName;
240
+        } else {
241
+            $optionText = $record->$fieldName;
242
+        }
243
+        if (isset($groupFieldName)) {
244
+            $group = $record;
245
+            foreach ($groupPathElements as $groupPathElement) {
246
+                $group = $group->$groupPathElement;
247
+            }
248
+            $select->addOption($record->id, $optionText, $group);
249
+        } else {
250
+            $select->addOption($record->id, $optionText);
251
+        }
252
+        $nbOptions++;
253
+        $lastId = $record->id;
254
+    }
255
+
256
+    if ($nbOptions == 1) {
257
+        $select->setValue($lastId);
258
+    }
259
+
260
+
261
+    return app_LabelledWidget($label, $select);
262 262
 }
263 263
 
264 264
 
@@ -307,36 +307,36 @@  discard block
 block discarded – undo
307 307
             ->setMaxSize($field->getMaxLength());
308 308
     } else if ($field instanceof ORMTextField) {
309 309
         $widget = $W->TextEdit()
310
-          ->addClass('widget-autoresize');
310
+            ->addClass('widget-autoresize');
311 311
     } else if ($field instanceof ORMPkField) {
312 312
         $widget = $W->Hidden();
313 313
     } else if ($field instanceof ORMFkField) {
314 314
 
315 315
         $fieldName = $field->getName();
316 316
         /** @var AppRecordSet $parentSet */
317
-		$parentSet = clone $field->getParentSet();
317
+        $parentSet = clone $field->getParentSet();
318 318
         $parentSet->join($fieldName);
319 319
         $set = $parentSet->$fieldName;
320 320
         $records = $set->select();
321
-		$pkName = $set->getPrimaryKey();
322
-		if($set->fieldExist("name")){
323
-			$displayField = $set->name->getName();
324
-		}else if(method_exists($set,"getDisplayNameField")){
325
-			$displayField = $set->getDisplayNameField()->getName();
326
-		}else{
327
-			$displayField = $pkName;
328
-		}
329
-		$records->orderAsc($set->$displayField);
330
-		if($records->count() > 50){
331
-			$widget = bab_Widgets()->select2();
332
-			$widget->setDataSource($set->getController()->search());
333
-		}else{
334
-			$widget = $W->Select();
335
-			$widget->addOption('', '');
336
-			foreach ($records as $record) {
337
-				$widget->addOption($record->$pkName, $record->$displayField);
338
-			}
339
-		}
321
+        $pkName = $set->getPrimaryKey();
322
+        if($set->fieldExist("name")){
323
+            $displayField = $set->name->getName();
324
+        }else if(method_exists($set,"getDisplayNameField")){
325
+            $displayField = $set->getDisplayNameField()->getName();
326
+        }else{
327
+            $displayField = $pkName;
328
+        }
329
+        $records->orderAsc($set->$displayField);
330
+        if($records->count() > 50){
331
+            $widget = bab_Widgets()->select2();
332
+            $widget->setDataSource($set->getController()->search());
333
+        }else{
334
+            $widget = $W->Select();
335
+            $widget->addOption('', '');
336
+            foreach ($records as $record) {
337
+                $widget->addOption($record->$pkName, $record->$displayField);
338
+            }
339
+        }
340 340
     } else if ($field instanceof ORMRecordSet) {
341 341
         $widget = $W->Select();
342 342
 ////        $widget = $W->MultiSelect()->setSingleSelect();
@@ -362,21 +362,21 @@  discard block
 block discarded – undo
362 362
 
363 363
 function app_LabelledOrmWidget(ORMField $field, $label = null, $hidden = false)
364 364
 {
365
-	$W = bab_Widgets();
365
+    $W = bab_Widgets();
366 366
 
367
-	if ($hidden) {
368
-		$widget = $W->Hidden();
369
-		$widget->setName($field->getName());
370
-		return $widget;
371
-	}
367
+    if ($hidden) {
368
+        $widget = $W->Hidden();
369
+        $widget->setName($field->getName());
370
+        return $widget;
371
+    }
372 372
 
373
-	if (is_null($label)) {
374
-		$label = $field->getDescription();
375
-	}
373
+    if (is_null($label)) {
374
+        $label = $field->getDescription();
375
+    }
376 376
 
377
-	$widget = app_OrmWidget($field);
377
+    $widget = app_OrmWidget($field);
378 378
 
379
-	return app_LabelledWidget($label, $widget);
379
+    return app_LabelledWidget($label, $widget);
380 380
 }
381 381
 
382 382
 
@@ -392,16 +392,16 @@  discard block
 block discarded – undo
392 392
  */
393 393
 function app_dateTime(ORMField $field, $value) {
394 394
 
395
-	$W = bab_Widgets();
396
-	$name = $field->getName();
397
-	$label = $W->Label($field->getDescription());
395
+    $W = bab_Widgets();
396
+    $name = $field->getName();
397
+    $label = $W->Label($field->getDescription());
398 398
 
399
-	$frame = app_dateTimeField($name, $label, $value);
399
+    $frame = app_dateTimeField($name, $label, $value);
400 400
 
401
-	return $W->VBoxItems(
402
-		$label,
403
-		$frame
404
-	);
401
+    return $W->VBoxItems(
402
+        $label,
403
+        $frame
404
+    );
405 405
 
406 406
 }
407 407
 
@@ -415,24 +415,24 @@  discard block
 block discarded – undo
415 415
  */
416 416
 function app_dateTimeField($fieldName, WidgetLabel $label, $value = null)
417 417
 {
418
-	$W = bab_Widgets();
418
+    $W = bab_Widgets();
419 419
 
420
-	$datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date');
421
-	$timepart = $W->TimePicker()->setName('time');
420
+    $datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date');
421
+    $timepart = $W->TimePicker()->setName('time');
422 422
 
423
-	if (isset($value)) {
423
+    if (isset($value)) {
424 424
 
425
-		$value = explode(' ', $value);
425
+        $value = explode(' ', $value);
426 426
 
427
-		$datepart->setValue($value[0]);
428
-		$timepart->setValue($value[1]);
429
-	}
427
+        $datepart->setValue($value[0]);
428
+        $timepart->setValue($value[1]);
429
+    }
430 430
 
431
-	$datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName)
432
-			->addItem($datepart)
433
-			->addItem($timepart);
431
+    $datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName)
432
+            ->addItem($datepart)
433
+            ->addItem($timepart);
434 434
 
435
-	return $datetime;
435
+    return $datetime;
436 436
 }
437 437
 
438 438
 
Please login to merge, or discard this patch.