Passed
Branchfeature/useWidgetsNamespaces (9efb1a)
by Robin
04:25
created
programs/Ctrl/AppCtrlRecord.php 2 patches
Spacing   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
     protected function getRecordClassName()
54 54
     {
55 55
         $class = $this->getClass();
56
-        if(strpos($class, 'Controller') !== false){
56
+        if (strpos($class, 'Controller') !== false) {
57 57
             $App = $this->App();
58 58
             $componentName = strtoupper(str_replace('Controller', '', $class));
59 59
             $component = $App->getComponentByName($componentName);
60
-            if($component){
60
+            if ($component) {
61 61
                 list (, $recordClassname) = explode($App->classPrefix, $component->getRecordClassName());
62 62
                 return $recordClassname;
63 63
             }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $App = $this->App();
79 79
         
80 80
         $recordClassname = $this->getRecordClassName();
81
-        $recordSetClassname = $recordClassname . 'Set';
81
+        $recordSetClassname = $recordClassname.'Set';
82 82
         
83 83
         $recordSet = $App->$recordSetClassname();
84 84
         return $recordSet;
@@ -121,29 +121,29 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $canvas = bab_Widgets()->HtmlCanvas();
123 123
         $html = '';
124
-        if($actions instanceof WidgetAction){
124
+        if ($actions instanceof WidgetAction) {
125 125
             $text = '';
126
-            if($showLabel){
126
+            if ($showLabel) {
127 127
                 $text = $actions->getTitle();
128 128
             }
129
-            $html = '<li><a class="icon ' . $actions->getIcon() . '" href="' . $actions->url() . '">' . $text . '</a></li>';
129
+            $html = '<li><a class="icon '.$actions->getIcon().'" href="'.$actions->url().'">'.$text.'</a></li>';
130 130
         }
131
-        elseif($actions instanceof WidgetLink){
132
-            $html = '<li>' . $actions->display($canvas) . '</li>';
131
+        elseif ($actions instanceof WidgetLink) {
132
+            $html = '<li>'.$actions->display($canvas).'</li>';
133 133
         }
134
-        elseif(is_array($actions)){
135
-            if(isset($actions['items'])){
134
+        elseif (is_array($actions)) {
135
+            if (isset($actions['items'])) {
136 136
                 $items = $actions['items'];
137 137
             }
138
-            else{
138
+            else {
139 139
                 $items = $actions;
140 140
             }
141
-            foreach ($items as $action){
141
+            foreach ($items as $action) {
142 142
                 $html .= $this->createMenu($action, true, true);
143 143
             }
144
-            if(isset($actions['icon'])){
144
+            if (isset($actions['icon'])) {
145 145
                 
146
-                $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'/*\Func_Icons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>') . '</a>' . '<ul class="dropdown-menu dropdown-menu-right ' . \Func_Icons::ICON_LEFT_SYMBOLIC . '">' . $html . '</ul>';
146
+                $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'/*\Func_Icons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>').'</a>'.'<ul class="dropdown-menu dropdown-menu-right '.\Func_Icons::ICON_LEFT_SYMBOLIC.'">'.$html.'</ul>';
147 147
             }
148 148
         }
149 149
         
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
             'label' => $App->translate('Statistics')
190 190
         );
191 191
         
192
-        foreach ($methods as $index => $method){
193
-            try{
194
-                $methodName = $recordClassname . $method['method'];
195
-                if($Ui->$methodName()){
192
+        foreach ($methods as $index => $method) {
193
+            try {
194
+                $methodName = $recordClassname.$method['method'];
195
+                if ($Ui->$methodName()) {
196 196
                     $types[$index] = array(
197 197
                         'classname' => $methodName,
198 198
                         'icon' => $method['icon'],
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                     );
201 201
                 }
202 202
             }
203
-            catch (\Exception $e){
203
+            catch (\Exception $e) {
204 204
                 unset($types[$index]);
205 205
                 continue;
206 206
             }
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
         
222 222
         $availableFields = array();
223 223
         
224
-        foreach ($recordSet->getFields() as $name => $field){
224
+        foreach ($recordSet->getFields() as $name => $field) {
225 225
             $fieldName = $field->getName();
226 226
             $fieldDescription = $field->getDescription();
227
-            if(substr($fieldName, 0, 1) !== '_'){
227
+            if (substr($fieldName, 0, 1) !== '_') {
228 228
                 $fieldDescription = $App->translate($fieldDescription);
229 229
             }
230
-            if(empty($fieldDescription)){
230
+            if (empty($fieldDescription)) {
231 231
                 $fieldDescription = $fieldName;
232 232
             }
233 233
             $availableFields[$name] = array(
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
         
277 277
         $recordSet = $this->getEditRecordSet();
278 278
         
279
-        if(isset($id)){
279
+        if (isset($id)) {
280 280
             $record = $recordSet->request($id);
281
-            if(! $record->isUpdatable()){
281
+            if (!$record->isUpdatable()) {
282 282
                 throw new AppAccessException($App->translate('You do not have access to this page'));
283 283
             }
284 284
         }
285
-        else{
286
-            if(! $recordSet->isCreatable()){
285
+        else {
286
+            if (!$recordSet->isCreatable()) {
287 287
                 throw new AppAccessException($App->translate('You do not have access to this page'));
288 288
             }
289 289
             $record = $recordSet->newRecord();
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
         $W = bab_Widgets();
312 312
         
313 313
         $recordClassname = $this->getRecordClassName();
314
-        $editorClassname = $recordClassname . 'SectionEditor';
314
+        $editorClassname = $recordClassname.'SectionEditor';
315 315
         
316 316
         /* @var $editor AppRecordEditor */
317 317
         $editor = $Ui->$editorClassname($record);
318
-        if(! isset($itemId)){
319
-            $itemId = $this->getClass() . '_' . __FUNCTION__;
318
+        if (!isset($itemId)) {
319
+            $itemId = $this->getClass().'_'.__FUNCTION__;
320 320
         }
321 321
         $editor->setId($itemId);
322 322
         $editor->setController($this);
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
      */
346 346
     public function getModelViewDefaultId($itemId = null)
347 347
     {
348
-        if(! isset($itemId)){
349
-            $itemId = $this->getClass() . '_modelView';
348
+        if (!isset($itemId)) {
349
+            $itemId = $this->getClass().'_modelView';
350 350
         }
351 351
         
352 352
         return $itemId;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
         
375 375
         $itemId = $this->getModelViewDefaultId($itemId);
376 376
         
377
-        if(! isset($type)){
377
+        if (!isset($type)) {
378 378
             $type = $this->getFilteredViewType($itemId);
379 379
         }
380 380
         
@@ -382,24 +382,24 @@  discard block
 block discarded – undo
382 382
         
383 383
         switch ($type) {
384 384
             case 'cards':
385
-                $tableviewClassname = $recordClassname . 'CardsView';
385
+                $tableviewClassname = $recordClassname.'CardsView';
386 386
                 break;
387 387
             
388 388
             case 'map':
389
-                $tableviewClassname = $recordClassname . 'MapView';
389
+                $tableviewClassname = $recordClassname.'MapView';
390 390
                 break;
391 391
             
392 392
             case 'calendar':
393
-                $tableviewClassname = $recordClassname . 'CalendarView';
393
+                $tableviewClassname = $recordClassname.'CalendarView';
394 394
                 break;
395 395
             
396 396
             case 'statistics':
397
-                $tableviewClassname = $recordClassname . 'StatisticsView';
397
+                $tableviewClassname = $recordClassname.'StatisticsView';
398 398
                 break;
399 399
             
400 400
             case 'table':
401 401
             default:
402
-                $tableviewClassname = $recordClassname . 'TableView';
402
+                $tableviewClassname = $recordClassname.'TableView';
403 403
                 break;
404 404
         }
405 405
         
@@ -412,12 +412,12 @@  discard block
 block discarded – undo
412 412
         
413 413
         $tableview->setRecordSet($recordSet);
414 414
         $tableview->addDefaultColumns($recordSet);
415
-        if(isset($filter)){
415
+        if (isset($filter)) {
416 416
             $tableview->setFilterValues($filter);
417 417
         }
418 418
         $filter = $tableview->getFilterValues();
419 419
         
420
-        if(isset($filter['showTotal']) && $filter['showTotal']){
420
+        if (isset($filter['showTotal']) && $filter['showTotal']) {
421 421
             $tableview->displaySubTotalRow(true);
422 422
         }
423 423
         
@@ -431,13 +431,13 @@  discard block
 block discarded – undo
431 431
         
432 432
         $tableview->setDataSource($records);
433 433
         
434
-        if(isset($columns)){
434
+        if (isset($columns)) {
435 435
             $availableColumns = $tableview->getVisibleColumns();
436 436
             
437 437
             $remainingColumns = array();
438
-            foreach ($availableColumns as $availableColumn){
438
+            foreach ($availableColumns as $availableColumn) {
439 439
                 $colPath = $availableColumn->getFieldPath();
440
-                if(isset($columns[$colPath]) && $columns[$colPath] == '1'){
440
+                if (isset($columns[$colPath]) && $columns[$colPath] == '1') {
441 441
                     $remainingColumns[] = $availableColumn;
442 442
                 }
443 443
             }
@@ -457,11 +457,11 @@  discard block
 block discarded – undo
457 457
         $App = $this->App();
458 458
         $Ui = $App->Ui();
459 459
         $recordClassname = $this->getRecordClassName();
460
-        $editorClassname = $recordClassname . 'Editor';
460
+        $editorClassname = $recordClassname.'Editor';
461 461
         $editor = $Ui->$editorClassname();
462 462
         
463
-        if(! isset($itemId)){
464
-            $itemId = $this->getClass() . '_' . __FUNCTION__;
463
+        if (!isset($itemId)) {
464
+            $itemId = $this->getClass().'_'.__FUNCTION__;
465 465
         }
466 466
         $editor->setId($itemId);
467 467
         $editor->setHiddenValue('tg', $App->controllerTg);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
         
505 505
         $viewTypes = $this->getAvailableModelViewTypes();
506 506
         
507
-        if(count($viewTypes) > 1){
507
+        if (count($viewTypes) > 1) {
508 508
             $viewsBox = $W->Items();
509 509
             $viewsBox->setSizePolicy('pull-right');
510 510
             // $viewsBox->addClass('btn-group', \Func_Icons::ICON_LEFT_16);
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
             
513 513
             $filteredViewType = $this->getFilteredViewType($tableView->getId());
514 514
             
515
-            foreach ($viewTypes as $viewTypeId => $viewType){
515
+            foreach ($viewTypes as $viewTypeId => $viewType) {
516 516
                 $viewsBox->addItem($W->Link('', $proxy->setFilteredViewType($tableView->getId(), $viewTypeId))
517
-                    ->addClass('icon', $viewType['icon'] . ($filteredViewType === $viewTypeId ? ' active' : ''))
517
+                    ->addClass('icon', $viewType['icon'].($filteredViewType === $viewTypeId ? ' active' : ''))
518 518
                     ->
519 519
                 // ->setSizePolicy('btn btn-xs btn-default ' . ($filteredViewType === $viewTypeId ? 'active' : ''))
520 520
                 setTitle($viewType['label'])
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
             }
523 523
         }
524 524
         
525
-        if(method_exists($proxy, 'exportSelect')){
525
+        if (method_exists($proxy, 'exportSelect')) {
526 526
             $toolbar->addItem($W->Link($App->translate('Export'), $proxy->exportSelect($filter))
527 527
                 ->addClass('icon', \Func_Icons::ACTIONS_DOCUMENT_DOWNLOAD)
528 528
                 ->setOpenMode(WidgetLink::OPEN_DIALOG)
529 529
                 ->setDialogClass('box gradient blue halfSizeDialog'));
530 530
         }
531 531
         
532
-        if(method_exists($proxy, 'printList')){
532
+        if (method_exists($proxy, 'printList')) {
533 533
             $toolbar->addItem($W->Link($App->translate('Print'), $proxy->printList($filter))
534 534
                 ->addClass('icon', \Func_Icons::ACTIONS_DOCUMENT_PRINT)
535 535
                 ->setOpenMode(WidgetLink::OPEN_POPUP));
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
         $W = bab_Widgets();
548 548
         
549 549
         $filterVisibility = $this->getFilterVisibility($itemId);
550
-        $filterVisibility = ! $filterVisibility;
551
-        $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);
550
+        $filterVisibility = !$filterVisibility;
551
+        $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);
552 552
         
553 553
         return true;
554 554
     }
@@ -560,10 +560,10 @@  discard block
 block discarded – undo
560 560
     protected function getFilterVisibility($itemId)
561 561
     {
562 562
         $W = bab_Widgets();
563
-        $filterVisibility = $W->getUserConfiguration($itemId . '/filterVisibility');
564
-        if(! isset($filterVisibility)){
563
+        $filterVisibility = $W->getUserConfiguration($itemId.'/filterVisibility');
564
+        if (!isset($filterVisibility)) {
565 565
             $filterVisibility = false;
566
-            $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);
566
+            $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);
567 567
         }
568 568
         return $filterVisibility;
569 569
     }
@@ -578,8 +578,8 @@  discard block
 block discarded – undo
578 578
     protected function getFilteredViewType($itemId)
579 579
     {
580 580
         $W = bab_Widgets();
581
-        $type = $W->getUserConfiguration($itemId . '/viewType');
582
-        if(! isset($type)){
581
+        $type = $W->getUserConfiguration($itemId.'/viewType');
582
+        if (!isset($type)) {
583 583
             $type = 'table';
584 584
         }
585 585
         return $type;
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
     public function setFilteredViewType($itemId, $type = null)
597 597
     {
598 598
         $W = bab_Widgets();
599
-        $W->setUserConfiguration($itemId . '/viewType', $type);
599
+        $W->setUserConfiguration($itemId.'/viewType', $type);
600 600
         
601 601
         return true;
602 602
     }
@@ -617,17 +617,17 @@  discard block
 block discarded – undo
617 617
         
618 618
         $filterPanel = $view->advancedFilterPanel($filter);
619 619
         
620
-        if($this->getFilterVisibility($itemId)){
620
+        if ($this->getFilterVisibility($itemId)) {
621 621
             $filterPanel->addClass('show-filter');
622 622
         }
623
-        else{
623
+        else {
624 624
             $filterPanel->addClass('hide-filter');
625 625
         }
626 626
         
627 627
         $toolbar = $this->toolbar($view);
628 628
         $listToolbar = $this->listToolbar($view);
629 629
         
630
-        if($view->isColumnSelectionAllowed()){
630
+        if ($view->isColumnSelectionAllowed()) {
631 631
             $App = $this->App();
632 632
             $columnSelectionMenu = $W->Link($App->translate('Table configuration'), $this->proxy()
633 633
                 ->modelViewColumnSettings($type, $itemId))
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
         $tableModelViewId = $data['tableModelViewId'];
680 680
         $sessionOnly = isset($data['inSession']) ? $data['inSession'] : false;
681 681
         
682
-        if(isset($data['pageLength'])){
683
-            $W->setUserConfiguration($tableModelViewId . '/pageLength', $data['pageLength'], 'widgets', $sessionOnly);
682
+        if (isset($data['pageLength'])) {
683
+            $W->setUserConfiguration($tableModelViewId.'/pageLength', $data['pageLength'], 'widgets', $sessionOnly);
684 684
         }
685
-        if(isset($data['displaySubTotalRow'])){
686
-            $W->setUserConfiguration($tableModelViewId . '/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly);
685
+        if (isset($data['displaySubTotalRow'])) {
686
+            $W->setUserConfiguration($tableModelViewId.'/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly);
687 687
         }
688
-        if(isset($data['columns'])){
689
-            $W->setUserConfiguration($tableModelViewId . '/columns', $data['columns'], 'widgets', $sessionOnly);
688
+        if (isset($data['columns'])) {
689
+            $W->setUserConfiguration($tableModelViewId.'/columns', $data['columns'], 'widgets', $sessionOnly);
690 690
         }
691 691
         
692 692
         $this->addReloadSelector("#{$tableModelViewId}");
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
         $tableModelViewId = $data['tableModelViewId'];
702 702
         $sessionOnly = isset($data['inSession']) ? $data['inSession'] : false;
703 703
         
704
-        $W->deleteUserConfiguration($data['tableModelViewId'] . '/columns', 'widgets', $sessionOnly);
704
+        $W->deleteUserConfiguration($data['tableModelViewId'].'/columns', 'widgets', $sessionOnly);
705 705
         
706 706
         $this->addReloadSelector("#{$tableModelViewId}");
707 707
         return true;
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
         
751 751
         $itemMenus = $this->getListItemMenus();
752 752
         
753
-        foreach ($itemMenus as $itemMenuId => $itemMenu){
753
+        foreach ($itemMenus as $itemMenuId => $itemMenu) {
754 754
             $page->addItemMenu($itemMenuId, $itemMenu['label'], $itemMenu['action']);
755 755
         }
756 756
         
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
         $columns = $tableview->getVisibleColumns();
791 791
         $column = isset($columns[$col]) ? $columns[$col] : null;
792 792
         
793
-        if(! isset($column)){
793
+        if (!isset($column)) {
794 794
             return true;
795 795
         }
796 796
         
@@ -804,8 +804,8 @@  discard block
 block discarded – undo
804 804
             $col
805 805
         )));
806 806
         
807
-        $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false);
808
-        if(isset($filter[$col])){
807
+        $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false);
808
+        if (isset($filter[$col])) {
809 809
             $widget->setValue($filter[$col]);
810 810
         }
811 811
         
@@ -821,21 +821,21 @@  discard block
 block discarded – undo
821 821
         
822 822
         $key = $data['key'];
823 823
         
824
-        $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false);
825
-        if(isset($data['moreCriteria']) && $data['moreCriteria']){
824
+        $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false);
825
+        if (isset($data['moreCriteria']) && $data['moreCriteria']) {
826 826
             $filter = array();
827 827
         }
828
-        foreach ($data['filter'] as $filterName => $filterValue){
828
+        foreach ($data['filter'] as $filterName => $filterValue) {
829 829
             $filter[$filterName] = $filterValue;
830 830
         }
831
-        $W->setUserConfiguration($key . '/filter', $filter, 'widgets', false);
831
+        $W->setUserConfiguration($key.'/filter', $filter, 'widgets', false);
832 832
         
833 833
         session_start();
834 834
         $_SESSION['modelViewMoreCriterias'][$key] = array();
835 835
         unset($_SESSION['modelViewMoreCriterias'][$key]);
836 836
         session_write_close();
837 837
         
838
-        $this->addReloadSelector('.depends-' . $key);
838
+        $this->addReloadSelector('.depends-'.$key);
839 839
         
840 840
         return true;
841 841
     }
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
         $Ui = $App->Ui();
847 847
         
848 848
         $page = $Ui->Page();
849
-        $page->addClass('depends-modelViewMoreCriterias-' . $key);
849
+        $page->addClass('depends-modelViewMoreCriterias-'.$key);
850 850
         
851 851
         $page->setTitle($App->translate('Search'));
852 852
         
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
         $editor = $Ui->Editor($itemId, $W->VBoxLayout());
867 867
         $editor->setReloadAction($this->proxy()
868 868
             ->getDisplayListMoreCriteriaEditor($key, $editor->getId()));
869
-        $editor->addClass('depends-modelViewMoreCriterias-' . $key);
869
+        $editor->addClass('depends-modelViewMoreCriterias-'.$key);
870 870
         $editor->addClass('widget-no-close');
871 871
         $editor->setIconFormat();
872 872
         $editor->isAjax = true;
@@ -881,24 +881,24 @@  discard block
 block discarded – undo
881 881
         $columns = $tableview->getVisibleColumns();
882 882
         $filter = $tableview->getFilterValues();
883 883
         
884
-        if(! isset($itemId)){
884
+        if (!isset($itemId)) {
885 885
             $editor->setSaveAction($this->proxy()
886 886
                 ->saveDisplayListFilter(), $App->translate('Search'));
887 887
             $editor->setCancelAction($this->proxy()
888 888
                 ->cancel());
889 889
             
890 890
             $fields = array();
891
-            foreach ($filter as $fieldName => $value){
892
-                if(empty($value)){
891
+            foreach ($filter as $fieldName => $value) {
892
+                if (empty($value)) {
893 893
                     continue;
894 894
                 }
895
-                if(! isset($columns[$fieldName])){
895
+                if (!isset($columns[$fieldName])) {
896 896
                     continue;
897 897
                 }
898 898
                 
899 899
                 $column = $columns[$fieldName];
900 900
                 
901
-                if(! $column->isSearchable()){
901
+                if (!$column->isSearchable()) {
902 902
                     continue;
903 903
                 }
904 904
                 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
             $_SESSION['modelViewMoreCriterias'][$key] = $fields;
909 909
             session_write_close();
910 910
         }
911
-        else{
911
+        else {
912 912
             $fields = $_SESSION['modelViewMoreCriterias'][$key];
913 913
         }
914 914
         
@@ -916,24 +916,24 @@  discard block
 block discarded – undo
916 916
         
917 917
         $nbAlreadyAdded = 0;
918 918
         
919
-        foreach ($fields as $fieldName => $fieldValue){
920
-            if(! isset($columns[$fieldName])){
919
+        foreach ($fields as $fieldName => $fieldValue) {
920
+            if (!isset($columns[$fieldName])) {
921 921
                 continue;
922 922
             }
923 923
             $column = $columns[$fieldName];
924 924
             
925
-            if(! $column->isSearchable()){
925
+            if (!$column->isSearchable()) {
926 926
                 continue;
927 927
             }
928 928
             
929 929
             $field = $column->getField();
930 930
             
931
-            if($nbAlreadyAdded >= 2){
931
+            if ($nbAlreadyAdded >= 2) {
932 932
                 $nbAlreadyAdded = 0;
933 933
                 $alreadyFilteredBox = null;
934 934
             }
935 935
             
936
-            if(! isset($alreadyFilteredBox)){
936
+            if (!isset($alreadyFilteredBox)) {
937 937
                 $editor->addItem($alreadyFilteredBox = $W->FlexItems()
938 938
                     ->setSizePolicy('customsection-field-box customsection-fieldsgroup-box'));
939 939
             }
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
                 ->setJustifyContent(WidgetFlexLayout::FLEX_JUSTIFY_CONTENT_SPACE_BETWEEN)
954 954
                 ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_CONTENT_CENTER))
955 955
                 ->addClass('app-customsection-groupedfield app-displaylist-morecriteria-groupedfield'));
956
-            $nbAlreadyAdded ++;
956
+            $nbAlreadyAdded++;
957 957
             
958 958
             $alreadyAddedFilters[$fieldName] = $fieldName;
959 959
         }
@@ -963,26 +963,26 @@  discard block
 block discarded – undo
963 963
             ''
964 964
         );
965 965
         
966
-        foreach ($columns as $fieldName => $column){
967
-            if(! $column->isSearchable()){
966
+        foreach ($columns as $fieldName => $column) {
967
+            if (!$column->isSearchable()) {
968 968
                 continue;
969 969
             }
970 970
             
971 971
             $field = $column->getField();
972 972
             
973
-            if(isset($alreadyAddedFilters[$fieldName])){
973
+            if (isset($alreadyAddedFilters[$fieldName])) {
974 974
                 continue;
975 975
             }
976 976
             
977 977
             $label = $tableview->getFilterLabelWidget($fieldName, $field);
978 978
             $label = trim($label->getText());
979
-            if(empty($label)){
979
+            if (empty($label)) {
980 980
                 continue;
981 981
             }
982 982
             $options[$fieldName] = $label;
983 983
         }
984 984
         
985
-        if(count($options) > 1){
985
+        if (count($options) > 1) {
986 986
             $editor->addItem($W->Html('<hr/>'));
987 987
             $editor->addItem($W->FlexItems($W->LabelledWidget($App->translate('Add a new criteria'), $W->Select2()
988 988
                 ->setOptions($options), 'newField')
@@ -999,12 +999,12 @@  discard block
 block discarded – undo
999 999
     {
1000 1000
         session_start();
1001 1001
         $fields = isset($data['filter']) ? $data['filter'] : array();
1002
-        if(isset($data['newField']) && ! empty($data['newField'])){
1002
+        if (isset($data['newField']) && !empty($data['newField'])) {
1003 1003
             $newField = $data['newField'];
1004 1004
             unset($data['key']);
1005 1005
             unset($data['moreCriteria']);
1006 1006
             $fields[$newField] = '';
1007
-            $this->addReloadSelector('.depends-modelViewMoreCriterias-' . $key);
1007
+            $this->addReloadSelector('.depends-modelViewMoreCriterias-'.$key);
1008 1008
         }
1009 1009
         $_SESSION['modelViewMoreCriterias'][$key] = $fields;
1010 1010
         return true;
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
     public function removeMoreCriteriaField($key, $field)
1014 1014
     {
1015 1015
         $fields = $_SESSION['modelViewMoreCriterias'][$key];
1016
-        if(isset($fields[$field])){
1016
+        if (isset($fields[$field])) {
1017 1017
             unset($fields[$field]);
1018 1018
             session_start();
1019 1019
             $_SESSION['modelViewMoreCriterias'][$key] = $fields;
1020 1020
         }
1021
-        $this->addReloadSelector('.depends-modelViewMoreCriterias-' . $key);
1021
+        $this->addReloadSelector('.depends-modelViewMoreCriterias-'.$key);
1022 1022
         return true;
1023 1023
     }
1024 1024
     
@@ -1074,17 +1074,17 @@  discard block
 block discarded – undo
1074 1074
         
1075 1075
         switch ($format) {
1076 1076
             case 'xlsx':
1077
-                $tableview->downloadXlsx($filename . '.xlsx');
1077
+                $tableview->downloadXlsx($filename.'.xlsx');
1078 1078
                 break;
1079 1079
             case 'xls':
1080
-                $tableview->downloadExcel($filename . '.xls');
1080
+                $tableview->downloadExcel($filename.'.xls');
1081 1081
                 break;
1082 1082
             case 'ssv':
1083
-                $tableview->downloadCsv($filename . '.csv', ';', $inline, 'Windows-1252');
1083
+                $tableview->downloadCsv($filename.'.csv', ';', $inline, 'Windows-1252');
1084 1084
                 break;
1085 1085
             case 'csv':
1086 1086
             default:
1087
-                $tableview->downloadCsv($filename . '.csv', ',', $inline, \bab_charset::getIso());
1087
+                $tableview->downloadCsv($filename.'.csv', ',', $inline, \bab_charset::getIso());
1088 1088
                 break;
1089 1089
         }
1090 1090
     }
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
         $recordSet = $this->getRecordSet();
1151 1151
         
1152 1152
         $record = $recordSet->request($id);
1153
-        if(! $record->isReadable()){
1153
+        if (!$record->isReadable()) {
1154 1154
             throw new AppAccessException($App->translate('You do not have access to this page'));
1155 1155
         }
1156 1156
         
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
         
1159 1159
         $recordClassname = $this->getRecordClassName();
1160 1160
         
1161
-        $viewClassname = $recordClassname . 'FullFrame';
1161
+        $viewClassname = $recordClassname.'FullFrame';
1162 1162
         
1163 1163
         $fullFrame = $Ui->$viewClassname($record);
1164 1164
         $fullFrame->setView($view);
@@ -1170,10 +1170,10 @@  discard block
 block discarded – undo
1170 1170
         $mainMenu->setSizePolicy(\Func_Icons::ICON_LEFT_24);
1171 1171
         
1172 1172
         $page = $Ui->Page();
1173
-        if(isset($itemId)){
1173
+        if (isset($itemId)) {
1174 1174
             $page->setId($itemId);
1175 1175
         }
1176
-        $page->addClass('depends-' . $this->getRecordClassName());
1176
+        $page->addClass('depends-'.$this->getRecordClassName());
1177 1177
         
1178 1178
         $page->addToolbar($mainMenu);
1179 1179
         
@@ -1212,14 +1212,14 @@  discard block
 block discarded – undo
1212 1212
         
1213 1213
         $editor = $this->recordEditor();
1214 1214
         
1215
-        if(isset($id)){
1215
+        if (isset($id)) {
1216 1216
             $record = $recordSet->request($id);
1217
-            if(! $record->isUpdatable()){
1217
+            if (!$record->isUpdatable()) {
1218 1218
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1219 1219
             }
1220 1220
         }
1221
-        else{
1222
-            if(! $recordSet->isCreatable()){
1221
+        else {
1222
+            if (!$recordSet->isCreatable()) {
1223 1223
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1224 1224
             }
1225 1225
             $record = $recordSet->newRecord();
@@ -1254,15 +1254,15 @@  discard block
 block discarded – undo
1254 1254
         
1255 1255
         $editor = $Ui->TagsEditor();
1256 1256
         
1257
-        if(isset($id)){
1257
+        if (isset($id)) {
1258 1258
             $record = $recordSet->request($id);
1259
-            if(! $record->isUpdatable()){
1259
+            if (!$record->isUpdatable()) {
1260 1260
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1261 1261
             }
1262 1262
             $editor->setRecord($record);
1263 1263
         }
1264
-        else{
1265
-            if(! $recordSet->isCreatable()){
1264
+        else {
1265
+            if (!$recordSet->isCreatable()) {
1266 1266
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1267 1267
             }
1268 1268
             $record = $recordSet->newRecord();
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
         
1314 1314
         $recordTitle = $record->getRecordTitle();
1315 1315
         
1316
-        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"');
1316
+        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"');
1317 1317
         return $message;
1318 1318
     }
1319 1319
     
@@ -1372,45 +1372,45 @@  discard block
 block discarded – undo
1372 1372
         $pk = $recordSet->getPrimaryKey();
1373 1373
         $message = null;
1374 1374
         
1375
-        if(! empty($data[$pk])){
1375
+        if (!empty($data[$pk])) {
1376 1376
             $record = $recordSet->request($data[$pk]);
1377 1377
             unset($data[$pk]);
1378 1378
             
1379
-            if(! $record->isUpdatable()){
1379
+            if (!$record->isUpdatable()) {
1380 1380
                 throw new AppAccessException('Access denied');
1381 1381
             }
1382 1382
             
1383 1383
             $message = $this->getModifedMessage($record);
1384 1384
         }
1385
-        else{
1385
+        else {
1386 1386
             
1387 1387
             $record = $recordSet->newRecord();
1388 1388
             
1389
-            if(! $recordSet->isCreatable()){
1389
+            if (!$recordSet->isCreatable()) {
1390 1390
                 throw new AppAccessException('Access denied');
1391 1391
             }
1392 1392
             
1393 1393
             $message = $this->getCreatedMessage();
1394 1394
         }
1395 1395
         
1396
-        if(! isset($record)){
1396
+        if (!isset($record)) {
1397 1397
             throw new AppSaveException($App->translate('The record does not exists'));
1398 1398
         }
1399 1399
         
1400
-        if(! isset($data)){
1400
+        if (!isset($data)) {
1401 1401
             throw new AppSaveException($App->translate('Nothing to save'));
1402 1402
         }
1403 1403
         
1404 1404
         $record->setFormInputValues($data);
1405 1405
         
1406 1406
         $this->preSave($record, $data);
1407
-        if($record->save()){
1407
+        if ($record->save()) {
1408 1408
             $this->postSave($record, $data);
1409
-            if(is_string($message)){
1409
+            if (is_string($message)) {
1410 1410
                 $this->addToast($message);
1411 1411
             }
1412 1412
             
1413
-            $this->addReloadSelector('.depends-' . $this->getRecordClassName());
1413
+            $this->addReloadSelector('.depends-'.$this->getRecordClassName());
1414 1414
             return true;
1415 1415
         }
1416 1416
         
@@ -1433,16 +1433,16 @@  discard block
 block discarded – undo
1433 1433
         
1434 1434
         $record = $recordSet->request($id);
1435 1435
         
1436
-        if(! $record->isDeletable()){
1436
+        if (!$record->isDeletable()) {
1437 1437
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1438 1438
         }
1439 1439
         $deletedMessage = $this->getDeletedMessage($record);
1440 1440
         
1441
-        if($record->delete()){
1441
+        if ($record->delete()) {
1442 1442
             $this->addToast($deletedMessage);
1443 1443
         }
1444 1444
         
1445
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1445
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1446 1446
         
1447 1447
         return true;
1448 1448
     }
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
         $page->addClass('app-page-editor');
1467 1467
         $page->setTitle($App->translate('Deletion'));
1468 1468
         
1469
-        if(! isset($record)){
1469
+        if (!isset($record)) {
1470 1470
             $page->addItem($W->Label($App->translate('This element does not exists.')));
1471 1471
             $page->addClass('alert', 'alert-warning');
1472 1472
             return $page;
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
         
1480 1480
         $recordTitle = $record->getRecordTitle();
1481 1481
         
1482
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1482
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1483 1483
         $form->addItem($W->Title($subTitle, 5));
1484 1484
         
1485 1485
         $form->addItem($W->Title($App->translate('Confirm delete?'), 6));
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
         
1489 1489
         $confirmedAction = $this->proxy()->delete($id);
1490 1490
         $parameters = $confirmedAction->getParameters();
1491
-        foreach ($parameters as $key => $value){
1491
+        foreach ($parameters as $key => $value) {
1492 1492
             $form->setHiddenValue($key, $value);
1493 1493
         }
1494 1494
         $form->addButton($W->SubmitButton()
@@ -1518,20 +1518,20 @@  discard block
 block discarded – undo
1518 1518
         
1519 1519
         $record = $recordSet->request($id);
1520 1520
         
1521
-        if(! $record->isRemovable()){
1521
+        if (!$record->isRemovable()) {
1522 1522
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1523 1523
         }
1524 1524
         
1525 1525
         $App = $this->App();
1526 1526
         $deletedMessage = $App->translate('The element has been moved to the trash');
1527 1527
         
1528
-        if($recordSet->delete($recordSet->id->is($record->id), AppTraceableRecord::DELETED_STATUS_IN_TRASH)){
1529
-            if(is_string($deletedMessage)){
1528
+        if ($recordSet->delete($recordSet->id->is($record->id), AppTraceableRecord::DELETED_STATUS_IN_TRASH)) {
1529
+            if (is_string($deletedMessage)) {
1530 1530
                 $this->addToast($deletedMessage);
1531 1531
             }
1532 1532
         }
1533 1533
         
1534
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1534
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1535 1535
         
1536 1536
         return true;
1537 1537
     }
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
         
1560 1560
         $recordTitle = $record->getRecordTitle();
1561 1561
         
1562
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1562
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1563 1563
         $form->addItem($W->Title($subTitle, 5));
1564 1564
         
1565 1565
         $form->addItem($W->Title($App->translate('Confirm delete?'), 6));
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
         
1569 1569
         $confirmedAction = $this->proxy()->remove($id);
1570 1570
         $parameters = $confirmedAction->getParameters();
1571
-        foreach ($parameters as $key => $value){
1571
+        foreach ($parameters as $key => $value) {
1572 1572
             $form->setHiddenValue($key, $value);
1573 1573
         }
1574 1574
         $form->addButton($W->SubmitButton()
@@ -1599,12 +1599,12 @@  discard block
 block discarded – undo
1599 1599
         $records = $recordSet->select($recordSet->id->is($id), true);
1600 1600
         
1601 1601
         $record = null;
1602
-        foreach ($records as $record){
1602
+        foreach ($records as $record) {
1603 1603
         }
1604
-        if(! isset($record)){
1604
+        if (!isset($record)) {
1605 1605
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1606 1606
         }
1607
-        if(! $record->isRestorable()){
1607
+        if (!$record->isRestorable()) {
1608 1608
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1609 1609
         }
1610 1610
         
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
         $record->save();
1616 1616
         $this->addToast($deletedMessage);
1617 1617
         
1618
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1618
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1619 1619
         
1620 1620
         return true;
1621 1621
     }
@@ -1635,9 +1635,9 @@  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 1643
         
@@ -1650,12 +1650,12 @@  discard block
 block discarded – undo
1650 1650
         
1651 1651
         $recordTitle = $record->getRecordTitle();
1652 1652
         
1653
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1653
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1654 1654
         $form->addItem($W->Title($subTitle, 5));
1655 1655
         
1656 1656
         $confirmedAction = $this->proxy()->restore($id);
1657 1657
         $parameters = $confirmedAction->getParameters();
1658
-        foreach ($parameters as $key => $value){
1658
+        foreach ($parameters as $key => $value) {
1659 1659
             $form->setHiddenValue($key, $value);
1660 1660
         }
1661 1661
         $form->addButton($W->SubmitButton()
@@ -1681,12 +1681,12 @@  discard block
 block discarded – undo
1681 1681
         $view = $this->modelView($filter, $type, null, $itemId);
1682 1682
         $view->setAjaxAction();
1683 1683
         
1684
-        if(isset($filter)){
1684
+        if (isset($filter)) {
1685 1685
             $view->setFilterValues($filter);
1686 1686
         }
1687 1687
         $filter = $view->getFilterValues();
1688 1688
         
1689
-        if(isset($filter['showTotal']) && $filter['showTotal']){
1689
+        if (isset($filter['showTotal']) && $filter['showTotal']) {
1690 1690
             $view->displaySubTotalRow(true);
1691 1691
         }
1692 1692
         
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
         $page->addItem($trashView);
1733 1733
         
1734 1734
         $itemMenus = $this->getListItemMenus();
1735
-        foreach ($itemMenus as $itemMenuId => $itemMenu){
1735
+        foreach ($itemMenus as $itemMenuId => $itemMenu) {
1736 1736
             $page->addItemMenu($itemMenuId, $itemMenu['label'], $itemMenu['action']);
1737 1737
         }
1738 1738
         $page->setCurrentItemMenu('displayTrash');
@@ -1758,16 +1758,16 @@  discard block
 block discarded – undo
1758 1758
         $registry = bab_getRegistryInstance();
1759 1759
         
1760 1760
         $userId = '0';
1761
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id . '/filters');
1761
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters');
1762 1762
         
1763
-        while ($filterName = $registry->fetchChildKey()){
1763
+        while ($filterName = $registry->fetchChildKey()) {
1764 1764
             $filters[] = $filterName;
1765 1765
         }
1766 1766
         
1767 1767
         $userId = bab_getUserId();
1768
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id . '/filters');
1768
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters');
1769 1769
         
1770
-        while ($filterName = $registry->fetchChildKey()){
1770
+        while ($filterName = $registry->fetchChildKey()) {
1771 1771
             $filters[] = $filterName;
1772 1772
         }
1773 1773
         
@@ -1784,15 +1784,15 @@  discard block
 block discarded – undo
1784 1784
     {
1785 1785
         $W = bab_Widgets();
1786 1786
         $tableview = $this->modelView(null, 'table');
1787
-        $W->setUserConfiguration($tableview->getId() . '/currentFilterName', $filterName, 'widgets', false);
1787
+        $W->setUserConfiguration($tableview->getId().'/currentFilterName', $filterName, 'widgets', false);
1788 1788
         
1789 1789
         $registry = bab_getRegistryInstance();
1790 1790
         $userId = '0';
1791
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $tableview->getId() . '/filters');
1791
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$tableview->getId().'/filters');
1792 1792
         $filterValues = $registry->getValue($filterName);
1793 1793
         
1794
-        if(! $filterValues){
1795
-            $filterValues = $W->getUserConfiguration($tableview->getId() . '/filters/' . $filterName, 'widgets', false);
1794
+        if (!$filterValues) {
1795
+            $filterValues = $W->getUserConfiguration($tableview->getId().'/filters/'.$filterName, 'widgets', false);
1796 1796
         }
1797 1797
         
1798 1798
         $tableview = $this->modelView($filterValues, 'table');
@@ -1808,7 +1808,7 @@  discard block
 block discarded – undo
1808 1808
     {
1809 1809
         $W = bab_Widgets();
1810 1810
         $id = $this->getModelViewDefaultId();
1811
-        $filter = $W->getUserConfiguration($id . '/currentFilterName', 'widgets', false);
1811
+        $filter = $W->getUserConfiguration($id.'/currentFilterName', 'widgets', false);
1812 1812
         
1813 1813
         return $filter;
1814 1814
     }
@@ -1818,12 +1818,12 @@  discard block
 block discarded – undo
1818 1818
      */
1819 1819
     public function resetFilters($name = null)
1820 1820
     {
1821
-        if(isset($name)){
1821
+        if (isset($name)) {
1822 1822
             $W = bab_Widgets();
1823
-            $filter = $W->getUserConfiguration($tableview->getId() . '/filters/' . $name, 'widgets', false);
1823
+            $filter = $W->getUserConfiguration($tableview->getId().'/filters/'.$name, 'widgets', false);
1824 1824
             $filterValues = $filter['values'];
1825 1825
         }
1826
-        else{
1826
+        else {
1827 1827
             $filterValues = null;
1828 1828
         }
1829 1829
         
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
             'values' => $filterValues
1851 1851
         );
1852 1852
         
1853
-        $W->setUserConfiguration($tableview->getId() . '/filters/' . $name, $data, 'widgets', false);
1853
+        $W->setUserConfiguration($tableview->getId().'/filters/'.$name, $data, 'widgets', false);
1854 1854
         
1855 1855
         return true;
1856 1856
     }
@@ -1867,7 +1867,7 @@  discard block
 block discarded – undo
1867 1867
         $Ui = $App->Ui();
1868 1868
         
1869 1869
         $currentFilterName = $this->getCurrentFilterName();
1870
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $currentFilterName, 'widgets', false);
1870
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$currentFilterName, 'widgets', false);
1871 1871
         
1872 1872
         $page = $Ui->Page();
1873 1873
         
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
         $App = $this->App();
1905 1905
         $Ui = $App->Ui();
1906 1906
         
1907
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
1907
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
1908 1908
         
1909 1909
         $page = $Ui->Page();
1910 1910
         
@@ -1942,8 +1942,8 @@  discard block
 block discarded – undo
1942 1942
         $page->addItem($filtersBox);
1943 1943
         
1944 1944
         $filterNames = $this->getFilterNames();
1945
-        foreach ($filterNames as $filterName){
1946
-            $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false);
1945
+        foreach ($filterNames as $filterName) {
1946
+            $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false);
1947 1947
             
1948 1948
             $filterBox = $W->HBoxItems()
1949 1949
                 ->setVerticalAlign('middle')
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
         $App = $this->App();
1983 1983
         $Ui = $App->Ui();
1984 1984
         
1985
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
1985
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
1986 1986
         
1987 1987
         $page = $Ui->Page();
1988 1988
         
@@ -2013,7 +2013,7 @@  discard block
 block discarded – undo
2013 2013
         $this->requireDeleteMethod();
2014 2014
         
2015 2015
         $W = bab_Widgets();
2016
-        $W->deleteUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
2016
+        $W->deleteUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
2017 2017
         
2018 2018
         return true;
2019 2019
     }
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
         $modelView = $this->modelView();
2024 2024
         $modelView->setHighlightedRows($ids);
2025 2025
         
2026
-        $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords');
2026
+        $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords');
2027 2027
         
2028 2028
         return true;
2029 2029
     }
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
         $modelView = $this->modelView();
2034 2034
         $modelView->clearHighlightedRows();
2035 2035
         
2036
-        $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords');
2036
+        $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords');
2037 2037
         
2038 2038
         return true;
2039 2039
     }
@@ -2052,34 +2052,34 @@  discard block
 block discarded – undo
2052 2052
         $box = $W->VBoxItems();
2053 2053
         
2054 2054
         $isComponent = false;
2055
-        if($component = $App->getCurrentComponent()){
2055
+        if ($component = $App->getCurrentComponent()) {
2056 2056
             $Ui = $component->ui();
2057 2057
             $viewClassname = 'FullFrame';
2058 2058
             $isComponent = true;
2059 2059
         }
2060
-        else{
2060
+        else {
2061 2061
             $Ui = $App->Ui();
2062 2062
             $recordClassname = $this->getRecordClassName();
2063
-            $viewClassname = $recordClassname . 'FullFrame';
2063
+            $viewClassname = $recordClassname.'FullFrame';
2064 2064
         }
2065 2065
         
2066
-        if($records->count() > 0){
2066
+        if ($records->count() > 0) {
2067 2067
             $box->addItem($W->Link('', $this->proxy()
2068 2068
                 ->clearHighlightedRecords())
2069 2069
                 ->setAjaxAction(null, false)
2070 2070
                 ->addClass('icon', \Func_Icons::ACTIONS_ARROW_RIGHT_DOUBLE, "app_closeHighlightButton")
2071
-                ->setSizePolicy(\Func_Icons::ICON_LEFT_32 . ' pull-right'));
2071
+                ->setSizePolicy(\Func_Icons::ICON_LEFT_32.' pull-right'));
2072 2072
             
2073
-            foreach ($records as $record){
2073
+            foreach ($records as $record) {
2074 2074
                 
2075
-                if($isComponent){
2075
+                if ($isComponent) {
2076 2076
                     $fullFrame = $Ui->$viewClassname($record);
2077
-                    if(method_exists($record, getBlueprint)){
2077
+                    if (method_exists($record, getBlueprint)) {
2078 2078
                         $view = $record->getBlueprint();
2079 2079
                     }
2080 2080
                     $fullFrame->setView($view);
2081 2081
                 }
2082
-                else{
2082
+                else {
2083 2083
                     $fullFrame = $Ui->$viewClassname($record->id, $view);
2084 2084
                 }
2085 2085
                 
@@ -2088,7 +2088,7 @@  discard block
 block discarded – undo
2088 2088
             $box->addClass('box', 'shadow');
2089 2089
         }
2090 2090
         
2091
-        $box->addClass('depends-' . $modelView->getId() . '-HighlightedRecords');
2091
+        $box->addClass('depends-'.$modelView->getId().'-HighlightedRecords');
2092 2092
         $box->setReloadAction($this->proxy()
2093 2093
             ->previewHighlightedRecords($view));
2094 2094
         return $box;
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -127,15 +127,12 @@  discard block
 block discarded – undo
127 127
                 $text = $actions->getTitle();
128 128
             }
129 129
             $html = '<li><a class="icon ' . $actions->getIcon() . '" href="' . $actions->url() . '">' . $text . '</a></li>';
130
-        }
131
-        elseif($actions instanceof WidgetLink){
130
+        } elseif($actions instanceof WidgetLink){
132 131
             $html = '<li>' . $actions->display($canvas) . '</li>';
133
-        }
134
-        elseif(is_array($actions)){
132
+        } elseif(is_array($actions)){
135 133
             if(isset($actions['items'])){
136 134
                 $items = $actions['items'];
137
-            }
138
-            else{
135
+            } else{
139 136
                 $items = $actions;
140 137
             }
141 138
             foreach ($items as $action){
@@ -199,8 +196,7 @@  discard block
 block discarded – undo
199 196
                         'label' => $method['label']
200 197
                     );
201 198
                 }
202
-            }
203
-            catch (\Exception $e){
199
+            } catch (\Exception $e){
204 200
                 unset($types[$index]);
205 201
                 continue;
206 202
             }
@@ -281,8 +277,7 @@  discard block
 block discarded – undo
281 277
             if(! $record->isUpdatable()){
282 278
                 throw new AppAccessException($App->translate('You do not have access to this page'));
283 279
             }
284
-        }
285
-        else{
280
+        } else{
286 281
             if(! $recordSet->isCreatable()){
287 282
                 throw new AppAccessException($App->translate('You do not have access to this page'));
288 283
             }
@@ -619,8 +614,7 @@  discard block
 block discarded – undo
619 614
         
620 615
         if($this->getFilterVisibility($itemId)){
621 616
             $filterPanel->addClass('show-filter');
622
-        }
623
-        else{
617
+        } else{
624 618
             $filterPanel->addClass('hide-filter');
625 619
         }
626 620
         
@@ -907,8 +901,7 @@  discard block
 block discarded – undo
907 901
             session_start();
908 902
             $_SESSION['modelViewMoreCriterias'][$key] = $fields;
909 903
             session_write_close();
910
-        }
911
-        else{
904
+        } else{
912 905
             $fields = $_SESSION['modelViewMoreCriterias'][$key];
913 906
         }
914 907
         
@@ -1217,8 +1210,7 @@  discard block
 block discarded – undo
1217 1210
             if(! $record->isUpdatable()){
1218 1211
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1219 1212
             }
1220
-        }
1221
-        else{
1213
+        } else{
1222 1214
             if(! $recordSet->isCreatable()){
1223 1215
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1224 1216
             }
@@ -1260,8 +1252,7 @@  discard block
 block discarded – undo
1260 1252
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1261 1253
             }
1262 1254
             $editor->setRecord($record);
1263
-        }
1264
-        else{
1255
+        } else{
1265 1256
             if(! $recordSet->isCreatable()){
1266 1257
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1267 1258
             }
@@ -1381,8 +1372,7 @@  discard block
 block discarded – undo
1381 1372
             }
1382 1373
             
1383 1374
             $message = $this->getModifedMessage($record);
1384
-        }
1385
-        else{
1375
+        } else{
1386 1376
             
1387 1377
             $record = $recordSet->newRecord();
1388 1378
             
@@ -1822,8 +1812,7 @@  discard block
 block discarded – undo
1822 1812
             $W = bab_Widgets();
1823 1813
             $filter = $W->getUserConfiguration($tableview->getId() . '/filters/' . $name, 'widgets', false);
1824 1814
             $filterValues = $filter['values'];
1825
-        }
1826
-        else{
1815
+        } else{
1827 1816
             $filterValues = null;
1828 1817
         }
1829 1818
         
@@ -2056,8 +2045,7 @@  discard block
 block discarded – undo
2056 2045
             $Ui = $component->ui();
2057 2046
             $viewClassname = 'FullFrame';
2058 2047
             $isComponent = true;
2059
-        }
2060
-        else{
2048
+        } else{
2061 2049
             $Ui = $App->Ui();
2062 2050
             $recordClassname = $this->getRecordClassName();
2063 2051
             $viewClassname = $recordClassname . 'FullFrame';
@@ -2078,8 +2066,7 @@  discard block
 block discarded – undo
2078 2066
                         $view = $record->getBlueprint();
2079 2067
                     }
2080 2068
                     $fullFrame->setView($view);
2081
-                }
2082
-                else{
2069
+                } else{
2083 2070
                     $fullFrame = $Ui->$viewClassname($record->id, $view);
2084 2071
                 }
2085 2072
                 
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlSSE.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
         
47 47
         $refreshFrequency = $this->getRefreshFrequency();
48 48
         
49
-        while (1){
49
+        while (1) {
50 50
             $data = $this->getSSEData();
51
-            if($data != '{}'){
51
+            if ($data != '{}') {
52 52
                 echo "event: ping\n";
53 53
                 echo "\n\n";
54
-                echo 'data: ' . $this->getSSEData() . "\n\n";
54
+                echo 'data: '.$this->getSSEData()."\n\n";
55 55
             }
56 56
             ob_end_flush();
57 57
             flush();
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     
62 62
     private function getRefreshFrequency()
63 63
     {
64
-        if(! isset($this->refreshFrequency)){
64
+        if (!isset($this->refreshFrequency)) {
65 65
             $registry = app_getRegistry();
66 66
             $registry->changeDirectory('configuration');
67 67
             $registry->changeDirectory('SSE');
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     
81 81
     private function getCurrentUser()
82 82
     {
83
-        if(isset($this->currentUser)){
83
+        if (isset($this->currentUser)) {
84 84
             return $this->currentUser;
85 85
         }
86 86
         
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlCustomContainer.php 2 patches
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
             ->_AND_($customSectionSet->object->is($customSection->object)));
60 60
         
61 61
         $allViewFieldNames = array();
62
-        foreach ($allViewSections as $viewSection){
62
+        foreach ($allViewSections as $viewSection) {
63 63
             $fields = $viewSection->getFields();
64
-            foreach ($fields as $field){
65
-                $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id;
64
+            foreach ($fields as $field) {
65
+                $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id;
66 66
             }
67 67
         }
68 68
         
69 69
         $box = $W->VBoxItems();
70
-        if(isset($itemId)){
70
+        if (isset($itemId)) {
71 71
             $box->setId($itemId);
72 72
         }
73 73
         
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         
83 83
         \bab_Sort::asort($availableFields, 'description', \bab_Sort::CASE_INSENSITIVE);
84 84
         
85
-        foreach ($availableFields as $field){
85
+        foreach ($availableFields as $field) {
86 86
             $fieldName = $field['name'];
87 87
             $fieldDescription = $field['description'];
88 88
             
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         
137 137
         $field = $customSection->getField($fieldName);
138 138
         
139
-        if(! isset($field)){
139
+        if (!isset($field)) {
140 140
             return null;
141 141
         }
142 142
         
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
         
153 153
         $field = $availableFields[$fieldName];
154 154
         $fieldDescription = $field['description'];
155
-        if(substr($fieldName, 0, 1) !== '_'){
155
+        if (substr($fieldName, 0, 1) !== '_') {
156 156
             $fieldDescription = $App->translate($fieldDescription);
157 157
         }
158 158
         
159
-        if(empty($field)){
159
+        if (empty($field)) {
160 160
             // continue;
161 161
         }
162 162
         
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
         $W = bab_Widgets();
258 258
         
259 259
         $customSectionSet = $App->CustomContainerSet();
260
-        if(isset($id)){
260
+        if (isset($id)) {
261 261
             $record = $customSectionSet->request($id);
262 262
         }
263
-        else{
263
+        else {
264 264
             $record = $customSectionSet->newRecord();
265 265
             $record->object = $object;
266 266
         }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
         $editor = new AppEditor($App);
274 274
         $editor->setHiddenValue('tg', $App->controllerTg);
275 275
         $editor->setHiddenValue('data[view]', $view);
276
-        if($record->id){
276
+        if ($record->id) {
277 277
             $editor->setHiddenValue('data[id]', $record->id);
278 278
         }
279 279
         $editor->setName('data');
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
         $record = $recordSet->request($id);
352 352
         
353 353
         $object = $record->object;
354
-        if(empty($object)){
354
+        if (empty($object)) {
355 355
             $object = $record->container()->object;
356 356
         }
357
-        if(strpos($object, $App->classPrefix) !== false){
357
+        if (strpos($object, $App->classPrefix) !== false) {
358 358
             $object = str_replace($App->classPrefix, '', $object);
359 359
         }
360 360
         $object .= 'Set';
@@ -369,25 +369,25 @@  discard block
 block discarded – undo
369 369
         $manySets = $objectRecordSet->getHasManyRelations();
370 370
         $oneSets = $objectRecordSet->getHasOneRelations();
371 371
         
372
-        if(! empty($record->visibilityCriteria)){
372
+        if (!empty($record->visibilityCriteria)) {
373 373
             $arrCriteria = json_decode($record->visibilityCriteria, true);
374 374
             
375 375
             $data = array();
376
-            foreach ($arrCriteria as $fieldName => $operation){
376
+            foreach ($arrCriteria as $fieldName => $operation) {
377 377
                 $data['field'] = $fieldName;
378
-                foreach ($operation as $condition => $value){
378
+                foreach ($operation as $condition => $value) {
379 379
                     $data['condition']['default'] = $condition;
380 380
                     $data['condition']['bool'] = $condition;
381
-                    if(is_array($value)){
382
-                        foreach ($value as $key => $subValue){
383
-                            foreach ($manySets as $manyFieldName => $manyRelation){
384
-                                if($key . 'Set' == $manyRelation->getForeignSetClassName()){
385
-                                    foreach ($subValue as $subFieldName => $subConditions){
386
-                                        if($subFieldName === '_foreignField'){
381
+                    if (is_array($value)) {
382
+                        foreach ($value as $key => $subValue) {
383
+                            foreach ($manySets as $manyFieldName => $manyRelation) {
384
+                                if ($key.'Set' == $manyRelation->getForeignSetClassName()) {
385
+                                    foreach ($subValue as $subFieldName => $subConditions) {
386
+                                        if ($subFieldName === '_foreignField') {
387 387
                                             continue;
388 388
                                         }
389 389
                                         $data['field'] = "{$manyFieldName}/{$subFieldName}";
390
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
390
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
391 391
                                             $data['condition']['default'] = $subCondition;
392 392
                                             $data['condition']['bool'] = $subCondition;
393 393
                                             $value = $subConditionValue;
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
                                     break;
397 397
                                 }
398 398
                             }
399
-                            foreach ($oneSets as $oneFieldName => $oneRelation){
400
-                                if($key . 'Set' == $oneRelation->getForeignSetClassName()){
401
-                                    foreach ($subValue as $subFieldName => $subConditions){
402
-                                        if($subFieldName === '_foreignField'){
399
+                            foreach ($oneSets as $oneFieldName => $oneRelation) {
400
+                                if ($key.'Set' == $oneRelation->getForeignSetClassName()) {
401
+                                    foreach ($subValue as $subFieldName => $subConditions) {
402
+                                        if ($subFieldName === '_foreignField') {
403 403
                                             continue;
404 404
                                         }
405 405
                                         $data['field'] = "{$oneFieldName}/{$subFieldName}";
406
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
406
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
407 407
                                             $data['condition']['default'] = $subCondition;
408 408
                                             $data['condition']['bool'] = $subCondition;
409 409
                                             $value = $subConditionValue;
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     protected function preSave(\ORM_Record $record, $data)
449 449
     {
450 450
         parent::preSave($record, $data);
451
-        if(! isset($record->id) || empty($record->id)){
451
+        if (!isset($record->id) || empty($record->id)) {
452 452
             $set = $record->getParentSet();
453 453
             $nbContainers = $set->select($set->all(array(
454 454
                 $set->object->is($record->object),
@@ -483,10 +483,10 @@  discard block
 block discarded – undo
483 483
         $record = $recordSet->request($data['id']);
484 484
         
485 485
         $object = $record->object;
486
-        if(empty($object)){
486
+        if (empty($object)) {
487 487
             $object = $record->container()->object;
488 488
         }
489
-        if(strpos($object, $App->classPrefix) !== false){
489
+        if (strpos($object, $App->classPrefix) !== false) {
490 490
             $object = str_replace($App->classPrefix, '', $object);
491 491
         }
492 492
         $object .= 'Set';
@@ -497,14 +497,14 @@  discard block
 block discarded – undo
497 497
         $field = $data['field'];
498 498
         $condition = $data['condition'];
499 499
         
500
-        if(strpos($field, '/') !== false){
500
+        if (strpos($field, '/') !== false) {
501 501
             // The selected field is a hasMany or a hasOne relation
502 502
             list ($selectedRelation, $selectedField) = explode('/', $field);
503 503
             $classPrefix = $App->classPrefix;
504 504
             
505 505
             $manyRelations = $objectRecordSet->getHasManyRelations();
506
-            foreach ($manyRelations as $manyRelation){
507
-                if($selectedRelation != $manyRelation->getOwnerSetFieldName()){
506
+            foreach ($manyRelations as $manyRelation) {
507
+                if ($selectedRelation != $manyRelation->getOwnerSetFieldName()) {
508 508
                     continue;
509 509
                 }
510 510
                 $foreignSetName = str_replace($classPrefix, '', $manyRelation->getForeignSetClassName());
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
                 
513 513
                 $visibilityCriteria = '';
514 514
                 
515
-                if($foreignSet){
515
+                if ($foreignSet) {
516 516
                     $selectedManyField = $foreignSet->$selectedField;
517 517
                     
518
-                    if($selectedManyField instanceof \ORM_BoolInterface){
518
+                    if ($selectedManyField instanceof \ORM_BoolInterface) {
519 519
                         $condition = $condition['bool'];
520 520
                     }
521
-                    else{
521
+                    else {
522 522
                         $condition = $condition['default'];
523 523
                     }
524 524
                     
@@ -530,9 +530,9 @@  discard block
 block discarded – undo
530 530
             }
531 531
             
532 532
             $oneRelations = $objectRecordSet->getHasOneRelations();
533
-            foreach ($oneRelations as $oneRelation){
533
+            foreach ($oneRelations as $oneRelation) {
534 534
                 /* @var $oneRelation \ORM_OneRelation*/
535
-                if($selectedRelation != $oneRelation->getOwnerSetFieldName()){
535
+                if ($selectedRelation != $oneRelation->getOwnerSetFieldName()) {
536 536
                     continue;
537 537
                 }
538 538
                 $foreignSetClassName = $oneRelation->getForeignSetClassName();
@@ -541,13 +541,13 @@  discard block
 block discarded – undo
541 541
                 
542 542
                 $visibilityCriteria = '';
543 543
                 
544
-                if($foreignSet){
544
+                if ($foreignSet) {
545 545
                     $selectedOneField = $foreignSet->$selectedField;
546 546
                     
547
-                    if($selectedOneField instanceof \ORM_BoolInterface){
547
+                    if ($selectedOneField instanceof \ORM_BoolInterface) {
548 548
                         $condition = $condition['bool'];
549 549
                     }
550
-                    else{
550
+                    else {
551 551
                         $condition = $condition['default'];
552 552
                     }
553 553
                     
@@ -557,20 +557,20 @@  discard block
 block discarded – undo
557 557
                 break;
558 558
             }
559 559
         }
560
-        else{
560
+        else {
561 561
             
562 562
             $field = $objectRecordSet->$field;
563 563
             
564
-            if($field instanceof \ORM_BoolInterface){
564
+            if ($field instanceof \ORM_BoolInterface) {
565 565
                 $condition = $condition['bool'];
566 566
             }
567
-            else{
567
+            else {
568 568
                 $condition = $condition['default'];
569 569
             }
570 570
             
571 571
             $visibilityCriteria = '';
572 572
             
573
-            if(! empty($condition)){
573
+            if (!empty($condition)) {
574 574
                 $criteria = $field->{$condition}($data['value']);
575 575
                 $visibilityCriteria = $criteria->toJson();
576 576
             }
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
         
606 606
         $containerBoxes = $W->Items();
607 607
         
608
-        foreach ($customContainers as $customContainer){
608
+        foreach ($customContainers as $customContainer) {
609 609
             
610 610
             $menu = $W->HBoxItems($W->Link('', $customSectionCtrl->edit($customContainer->id))
611 611
                 ->addClass('icon', \Func_Icons::ACTIONS_LIST_ADD)
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
             $menu->setSizePolicy(\Func_Icons::ICON_LEFT_16);
621 621
             
622 622
             $hasVisibilityBox = $W->FlowItems()->addClass('widget-100');
623
-            if(! empty($customContainer->visibilityCriteria)){
623
+            if (!empty($customContainer->visibilityCriteria)) {
624 624
                 $hasVisibilityBox->addItem($W->HBoxItems($W->Label($App->translate('This container has a visibility condition')))
625 625
                     ->setSizePolicy('alert alert-warning widget-100pc'));
626 626
             }
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
                 ->addClass($customContainer->classname));
632 632
         }
633 633
         
634
-        if(isset($itemId)){
634
+        if (isset($itemId)) {
635 635
             $containerBoxes->setId($itemId);
636 636
         }
637 637
         
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
         $customSectionSet = $App->CustomSectionSet();
658 658
         
659 659
         $containersValues = array();
660
-        foreach ($customContainers as $customContainer){
660
+        foreach ($customContainers as $customContainer) {
661 661
             $values = $customContainer->getValues();
662 662
             unset($values['id']);
663 663
             unset($values['uuid']);
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
             unset($values['deleted']);
671 671
             $values['customSections'] = array();
672 672
             $customSections = $customSectionSet->select($customSectionSet->container->is($customContainer->id));
673
-            foreach ($customSections as $customSection){
673
+            foreach ($customSections as $customSection) {
674 674
                 $customSectionValues = $customSection->getValues();
675 675
                 unset($customSectionValues['id']);
676 676
                 unset($customSectionValues['uuid']);
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
         }
690 690
         
691 691
         header('Content-type: application/json');
692
-        header('Content-Disposition: attachment; filename="' . $object . '.' . ($view === '' ? 'default' : $view) . '.json"' . "\n");
692
+        header('Content-Disposition: attachment; filename="'.$object.'.'.($view === '' ? 'default' : $view).'.json"'."\n");
693 693
         
694 694
         $json = bab_json_encode($containersValues);
695 695
         $json = bab_convertStringFromDatabase($json, \bab_charset::UTF_8);
@@ -747,12 +747,12 @@  discard block
 block discarded – undo
747 747
         $files->push($containersfile['uid']);
748 748
         
749 749
         $data = null;
750
-        foreach ($files as $f){
750
+        foreach ($files as $f) {
751 751
             $data = file_get_contents($f->toString());
752 752
             break;
753 753
         }
754 754
         
755
-        if(! isset($data)){
755
+        if (!isset($data)) {
756 756
             $this->addError($App->translate('Unable to get file content'));
757 757
             return true;
758 758
         }
@@ -768,13 +768,13 @@  discard block
 block discarded – undo
768 768
         $customContainerSet->delete($customContainerSet->view->is($view)
769 769
             ->_AND_($customContainerSet->object->is($object)));
770 770
         
771
-        foreach ($containersValues as $containerValues){
771
+        foreach ($containersValues as $containerValues) {
772 772
             $customContainer = $customContainerSet->newRecord();
773 773
             $customContainer->setValues($containerValues);
774 774
             $customContainer->object = $object;
775 775
             $customContainer->view = $view;
776 776
             $customContainer->save();
777
-            foreach ($containerValues['customSections'] as $sectionValues){
777
+            foreach ($containerValues['customSections'] as $sectionValues) {
778 778
                 $customSection = $customSectionSet->newRecord();
779 779
                 $sectionValues['fields'] = json_encode($sectionValues['fields']);
780 780
                 $customSection->setValues($sectionValues);
@@ -907,9 +907,9 @@  discard block
 block discarded – undo
907 907
         $containersRawFields = array();
908 908
         
909 909
         $rank = 0;
910
-        foreach (array_keys($containers) as $containerFieldId){
910
+        foreach (array_keys($containers) as $containerFieldId) {
911 911
             
912
-            if(substr($containerFieldId, 0, 1) === '#'){
912
+            if (substr($containerFieldId, 0, 1) === '#') {
913 913
                 $currentContainerId = substr($containerFieldId, 1);
914 914
                 
915 915
                 $customContainer = $customContainerSet->request($customContainerSet->id->is($currentContainerId));
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
                 $containersRawFields[$currentContainerId] = $customContainer->getRawFields();
919 919
                 
920 920
                 $customContainer->rank = $rank;
921
-                $rank ++;
921
+                $rank++;
922 922
                 $customContainer->save();
923 923
                 continue;
924 924
             }
@@ -926,18 +926,18 @@  discard block
 block discarded – undo
926 926
             $containersFields[$currentContainerId][] = $containerFieldId;
927 927
         }
928 928
         
929
-        foreach ($containersFields as $containerId => $containerFieldIds){
930
-            foreach ($containerFieldIds as $containerFieldId){
929
+        foreach ($containersFields as $containerId => $containerFieldIds) {
930
+            foreach ($containerFieldIds as $containerFieldId) {
931 931
                 list ($srcContainerId, $srcfieldId) = explode('.', $containerFieldId);
932
-                if(! isset($containersRawFields[$srcContainerId][$srcfieldId])){
932
+                if (!isset($containersRawFields[$srcContainerId][$srcfieldId])) {
933 933
                     return true;
934 934
                 }
935 935
             }
936 936
         }
937 937
         
938
-        foreach ($containersFields as $containerId => $containerFieldIds){
938
+        foreach ($containersFields as $containerId => $containerFieldIds) {
939 939
             $newRawFields = array();
940
-            foreach ($containerFieldIds as $containerFieldId){
940
+            foreach ($containerFieldIds as $containerFieldId) {
941 941
                 list ($srcContainerId, $srcfieldId) = explode('.', $containerFieldId);
942 942
                 $newRawFields[] = $containersRawFields[$srcContainerId][$srcfieldId];
943 943
             }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -259,8 +259,7 @@  discard block
 block discarded – undo
259 259
         $customSectionSet = $App->CustomContainerSet();
260 260
         if(isset($id)){
261 261
             $record = $customSectionSet->request($id);
262
-        }
263
-        else{
262
+        } else{
264 263
             $record = $customSectionSet->newRecord();
265 264
             $record->object = $object;
266 265
         }
@@ -517,8 +516,7 @@  discard block
 block discarded – undo
517 516
                     
518 517
                     if($selectedManyField instanceof \ORM_BoolInterface){
519 518
                         $condition = $condition['bool'];
520
-                    }
521
-                    else{
519
+                    } else{
522 520
                         $condition = $condition['default'];
523 521
                     }
524 522
                     
@@ -546,8 +544,7 @@  discard block
 block discarded – undo
546 544
                     
547 545
                     if($selectedOneField instanceof \ORM_BoolInterface){
548 546
                         $condition = $condition['bool'];
549
-                    }
550
-                    else{
547
+                    } else{
551 548
                         $condition = $condition['default'];
552 549
                     }
553 550
                     
@@ -556,15 +553,13 @@  discard block
 block discarded – undo
556 553
                 }
557 554
                 break;
558 555
             }
559
-        }
560
-        else{
556
+        } else{
561 557
             
562 558
             $field = $objectRecordSet->$field;
563 559
             
564 560
             if($field instanceof \ORM_BoolInterface){
565 561
                 $condition = $condition['bool'];
566
-            }
567
-            else{
562
+            } else{
568 563
                 $condition = $condition['default'];
569 564
             }
570 565
             
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlConfiguration.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
     public function __construct(Func_App $app = null)
40 40
     {
41 41
         parent::__construct($app);
42
-        if(! bab_isUserAdministrator()){
42
+        if (!bab_isUserAdministrator()) {
43 43
             $action = WidgetAction::fromRequest();
44 44
             list (, $method) = explode('.', $action->getMethod());
45
-            if($method !== 'denied'){
45
+            if ($method !== 'denied') {
46 46
                 $this->redirect($this->proxy()
47 47
                     ->denied());
48 48
             }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $box->addClass('reload-configuration-page');
110 110
         $box->addClass('widget-100pc');
111 111
         
112
-        if(! isset($itemId)){
112
+        if (!isset($itemId)) {
113 113
             $this->resetCurrentTab();
114 114
         }
115 115
         
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
         $navBoxHtml = '<ul class="nav nav-tabs">';
120 120
         $htmlCanvas = $W->HtmlCanvas();
121 121
         
122
-        foreach ($configurationItems as $tabId => $tab){
122
+        foreach ($configurationItems as $tabId => $tab) {
123 123
             $tabLink = $W->Link($tab['tabTitle'], $this->proxy()
124 124
                 ->setDisplayTab($tabId))
125 125
                 ->setOpenMode(WidgetLink::OPEN_DIALOG);
126 126
             $tabLinkHtml = '<li role="configuration"';
127
-            if($tabId == $currentTab){
127
+            if ($tabId == $currentTab) {
128 128
                 $tabLinkHtml .= ' class="active"';
129 129
             }
130 130
             $tabLinkHtml .= '>';
131
-            $tabLinkHtml .= $tabLink->display($htmlCanvas) . '</li>';
131
+            $tabLinkHtml .= $tabLink->display($htmlCanvas).'</li>';
132 132
             $navBoxHtml .= $tabLinkHtml;
133 133
         }
134 134
         
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
             ->addClass('icon-left icon-48x48 icon-left-48');
158 158
         $box->addItem($configBox);
159 159
         
160
-        if(! isset($configurationItems[$currentTab])){
160
+        if (!isset($configurationItems[$currentTab])) {
161 161
             return $box;
162 162
         }
163 163
         
164 164
         $tab = $configurationItems[$currentTab];
165 165
         
166
-        foreach ($tab['tabContent'] as $tabSection){
167
-            if(! isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])){
166
+        foreach ($tab['tabContent'] as $tabSection) {
167
+            if (!isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])) {
168 168
                 continue;
169 169
             }
170 170
             $configBox->addItem($W->Section($tabSection['sectionName'], $sectionContentBox = $W->HBoxItems())
171 171
                 ->setFoldable(true));
172
-            foreach ($tabSection['sectionContent'] as $tabSection){
172
+            foreach ($tabSection['sectionContent'] as $tabSection) {
173 173
                 $sectionContentBox->addItem($tabSection);
174 174
             }
175 175
         }
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
         );
195 195
         
196 196
         $definitions = $App->getComponentDefinitions();
197
-        foreach ($definitions as $packageName => $definition){
197
+        foreach ($definitions as $packageName => $definition) {
198 198
             /* @var $definition AppComponentDefinition */
199
-            if(! method_exists($definition, 'getConfiguration')){
199
+            if (!method_exists($definition, 'getConfiguration')) {
200 200
                 continue;
201 201
             }
202 202
             $configurationItems[$packageName] = array(
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlCustomSection.php 2 patches
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $customSection = $customSectionSet->request($customSectionSet->id->is($section));
58 58
         
59 59
         $object = $customSection->container->object;
60
-        if(strpos($object, $App->classPrefix) !== false){
60
+        if (strpos($object, $App->classPrefix) !== false) {
61 61
             list (, $object) = explode($App->classPrefix, $object);
62 62
         }
63 63
         $objectCtrl = $App->Controller()->$object(false);
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
             ->_AND_($customSectionSet->object->is($customSection->object)));
67 67
         
68 68
         $allViewFieldNames = array();
69
-        foreach ($allViewSections as $viewSection){
69
+        foreach ($allViewSections as $viewSection) {
70 70
             $fields = $viewSection->getFields();
71
-            foreach ($fields as $field){
72
-                $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id;
73
-                foreach ($field['fields'] as $subField){
74
-                    $allViewFieldNames[$subField['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id;
71
+            foreach ($fields as $field) {
72
+                $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id;
73
+                foreach ($field['fields'] as $subField) {
74
+                    $allViewFieldNames[$subField['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id;
75 75
                 }
76 76
             }
77 77
         }
78 78
         
79 79
         $box = $W->VBoxItems();
80
-        if(isset($itemId)){
80
+        if (isset($itemId)) {
81 81
             $box->setId($itemId);
82 82
         }
83 83
         
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         
93 93
         \bab_Sort::asort($availableFields, 'description', \bab_Sort::CASE_INSENSITIVE);
94 94
         
95
-        foreach ($availableFields as $field){
95
+        foreach ($availableFields as $field) {
96 96
             $fieldName = $field['name'];
97 97
             $fieldDescription = $field['description'];
98 98
             
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         
148 148
         $field = $customSection->getField($fieldName);
149 149
         
150
-        if(! isset($field)){
150
+        if (!isset($field)) {
151 151
             return null;
152 152
         }
153 153
         
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
         
165 165
         $field = $availableFields[$fieldName];
166 166
         $fieldDescription = $field['description'];
167
-        if(substr($fieldName, 0, 1) !== '_'){
167
+        if (substr($fieldName, 0, 1) !== '_') {
168 168
             $fieldDescription = $App->translate($fieldDescription);
169 169
         }
170 170
         
171
-        if(empty($field)){
171
+        if (empty($field)) {
172 172
             // continue;
173 173
         }
174 174
         
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
         
239 239
         $groupField = $customSection->getField($fieldGroupName);
240 240
         
241
-        if(! isset($groupField)){
241
+        if (!isset($groupField)) {
242 242
             return null;
243 243
         }
244 244
         
245 245
         $field = $groupField['fields'][$fieldName];
246
-        if(! isset($field)){
246
+        if (!isset($field)) {
247 247
             return null;
248 248
         }
249 249
         
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
         
260 260
         $field = $availableFields[$fieldName];
261 261
         $fieldDescription = $field['description'];
262
-        if(substr($fieldName, 0, 1) !== '_'){
262
+        if (substr($fieldName, 0, 1) !== '_') {
263 263
             $fieldDescription = $App->translate($fieldDescription);
264 264
         }
265 265
         
266
-        if(empty($field)){
266
+        if (empty($field)) {
267 267
             // continue;
268 268
         }
269 269
         
@@ -346,12 +346,12 @@  discard block
 block discarded – undo
346 346
         
347 347
         $customSection = $customSectionSet->request($customSectionSet->id->is($section));
348 348
         $fields = $customSection->getFields();
349
-        if(! isset($fields[$fieldGroupName])){
349
+        if (!isset($fields[$fieldGroupName])) {
350 350
             throw new AppException($App->translate('This fields group does not seem to exist'));
351 351
         }
352 352
         
353 353
         $object = $customSection->container->object;
354
-        if(strpos($object, $App->classPrefix) !== false){
354
+        if (strpos($object, $App->classPrefix) !== false) {
355 355
             list (, $object) = explode($App->classPrefix, $object);
356 356
         }
357 357
         
@@ -361,18 +361,18 @@  discard block
 block discarded – undo
361 361
             ->_AND_($customSectionSet->object->is($customSection->object)));
362 362
         
363 363
         $allViewFieldNames = array();
364
-        foreach ($allViewSections as $viewSection){
364
+        foreach ($allViewSections as $viewSection) {
365 365
             $fields = $viewSection->getFields();
366
-            foreach ($fields as $field){
367
-                $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id;
368
-                foreach ($field['fields'] as $subField){
369
-                    $allViewFieldNames[$subField['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id;
366
+            foreach ($fields as $field) {
367
+                $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id;
368
+                foreach ($field['fields'] as $subField) {
369
+                    $allViewFieldNames[$subField['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id;
370 370
                 }
371 371
             }
372 372
         }
373 373
         
374 374
         $box = $W->VBoxItems();
375
-        if(isset($itemId)){
375
+        if (isset($itemId)) {
376 376
             $box->setId($itemId);
377 377
         }
378 378
         
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         
390 390
         \bab_Sort::asort($availableFields, 'description', \bab_Sort::CASE_INSENSITIVE);
391 391
         
392
-        foreach ($availableFields as $field){
392
+        foreach ($availableFields as $field) {
393 393
             $fieldName = $field['name'];
394 394
             $fieldDescription = $field['description'];
395 395
             
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
         $container = $customContainerSet->request($customContainerSet->id->is($container));
502 502
         
503 503
         $customSectionSet = $App->CustomSectionSet();
504
-        if(isset($id)){
504
+        if (isset($id)) {
505 505
             $record = $customSectionSet->request($id);
506 506
         }
507
-        else{
507
+        else {
508 508
             $record = $customSectionSet->newRecord();
509 509
             $record->container = $container->id;
510 510
         }
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
         
517 517
         $editor = new AppEditor($App);
518 518
         $editor->setHiddenValue('tg', $App->controllerTg);
519
-        if($record->id){
519
+        if ($record->id) {
520 520
             $editor->setHiddenValue('data[id]', $record->id);
521 521
         }
522 522
         $editor->setName('data');
@@ -532,16 +532,16 @@  discard block
 block discarded – undo
532 532
         
533 533
         $options = array();
534 534
         $rank = 1;
535
-        foreach ($containers as $container){
535
+        foreach ($containers as $container) {
536 536
             $options[$container->id] = sprintf('%d (%s)', $rank, $container->name);
537
-            $rank ++;
537
+            $rank++;
538 538
         }
539 539
         
540 540
         $containerSections = $customSectionSet->select($customSectionSet->container->is($container->id))
541 541
             ->orderDesc($customSectionSet->rank);
542 542
         
543 543
         $nbSections = 0;
544
-        foreach ($containerSections as $containerSection){
544
+        foreach ($containerSections as $containerSection) {
545 545
             $nbSections = $containerSection->rank + 1;
546 546
             break;
547 547
         }
@@ -625,10 +625,10 @@  discard block
 block discarded – undo
625 625
         $record = $recordSet->request($id);
626 626
         
627 627
         $object = $record->object;
628
-        if(empty($object)){
628
+        if (empty($object)) {
629 629
             $object = $record->container()->object;
630 630
         }
631
-        if(strpos($object, $App->classPrefix) !== false){
631
+        if (strpos($object, $App->classPrefix) !== false) {
632 632
             $object = str_replace($App->classPrefix, '', $object);
633 633
         }
634 634
         $object .= 'Set';
@@ -643,25 +643,25 @@  discard block
 block discarded – undo
643 643
         $manySets = $objectRecordSet->getHasManyRelations();
644 644
         $oneSets = $objectRecordSet->getHasOneRelations();
645 645
         
646
-        if(! empty($record->visibilityCriteria)){
646
+        if (!empty($record->visibilityCriteria)) {
647 647
             $arrCriteria = json_decode($record->visibilityCriteria, true);
648 648
             
649 649
             $data = array();
650
-            foreach ($arrCriteria as $fieldName => $operation){
650
+            foreach ($arrCriteria as $fieldName => $operation) {
651 651
                 $data['field'] = $fieldName;
652
-                foreach ($operation as $condition => $value){
652
+                foreach ($operation as $condition => $value) {
653 653
                     $data['condition']['default'] = $condition;
654 654
                     $data['condition']['bool'] = $condition;
655
-                    if(is_array($value)){
656
-                        foreach ($value as $key => $subValue){
657
-                            foreach ($manySets as $manyFieldName => $manyRelation){
658
-                                if($key . 'Set' == $manyRelation->getForeignSetClassName()){
659
-                                    foreach ($subValue as $subFieldName => $subConditions){
660
-                                        if($subFieldName === '_foreignField'){
655
+                    if (is_array($value)) {
656
+                        foreach ($value as $key => $subValue) {
657
+                            foreach ($manySets as $manyFieldName => $manyRelation) {
658
+                                if ($key.'Set' == $manyRelation->getForeignSetClassName()) {
659
+                                    foreach ($subValue as $subFieldName => $subConditions) {
660
+                                        if ($subFieldName === '_foreignField') {
661 661
                                             continue;
662 662
                                         }
663 663
                                         $data['field'] = "{$manyFieldName}/{$subFieldName}";
664
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
664
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
665 665
                                             $data['condition']['default'] = $subCondition;
666 666
                                             $data['condition']['bool'] = $subCondition;
667 667
                                             $value = $subConditionValue;
@@ -670,14 +670,14 @@  discard block
 block discarded – undo
670 670
                                     break;
671 671
                                 }
672 672
                             }
673
-                            foreach ($oneSets as $oneFieldName => $oneRelation){
674
-                                if($key . 'Set' == $oneRelation->getForeignSetClassName()){
675
-                                    foreach ($subValue as $subFieldName => $subConditions){
676
-                                        if($subFieldName === '_foreignField'){
673
+                            foreach ($oneSets as $oneFieldName => $oneRelation) {
674
+                                if ($key.'Set' == $oneRelation->getForeignSetClassName()) {
675
+                                    foreach ($subValue as $subFieldName => $subConditions) {
676
+                                        if ($subFieldName === '_foreignField') {
677 677
                                             continue;
678 678
                                         }
679 679
                                         $data['field'] = "{$oneFieldName}/{$subFieldName}";
680
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
680
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
681 681
                                             $data['condition']['default'] = $subCondition;
682 682
                                             $data['condition']['bool'] = $subCondition;
683 683
                                             $value = $subConditionValue;
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
      */
713 713
     public function save($data = null)
714 714
     {
715
-        if(! isset($data['id']) && isset($data['container']) && $data['container'] != 0 && ! isset($data['rank'])){
715
+        if (!isset($data['id']) && isset($data['container']) && $data['container'] != 0 && !isset($data['rank'])) {
716 716
             $set = $this->getRecordSet();
717 717
             $data['rank'] = $set->select($set->container->is($data['container']))
718 718
                 ->count();
@@ -745,11 +745,11 @@  discard block
 block discarded – undo
745 745
             $set->rank->greaterThanOrEqual($record->rank)
746 746
         )));
747 747
         
748
-        $position ++;
749
-        foreach ($afterSections as $afterSection){
748
+        $position++;
749
+        foreach ($afterSections as $afterSection) {
750 750
             $afterSection->rank = $position;
751 751
             $afterSection->save();
752
-            $position ++;
752
+            $position++;
753 753
         }
754 754
     }
755 755
     
@@ -777,10 +777,10 @@  discard block
 block discarded – undo
777 777
         $record = $recordSet->request($data['id']);
778 778
         
779 779
         $object = $record->object;
780
-        if(empty($object)){
780
+        if (empty($object)) {
781 781
             $object = $record->container()->object;
782 782
         }
783
-        if(strpos($object, $App->classPrefix) !== false){
783
+        if (strpos($object, $App->classPrefix) !== false) {
784 784
             $object = str_replace($App->classPrefix, '', $object);
785 785
         }
786 786
         $object .= 'Set';
@@ -790,14 +790,14 @@  discard block
 block discarded – undo
790 790
         $field = $data['field'];
791 791
         $condition = $data['condition'];
792 792
         
793
-        if(strpos($field, '/') !== false){
793
+        if (strpos($field, '/') !== false) {
794 794
             // The selected field is a hasMany or a hasOne relation
795 795
             list ($selectedRelation, $selectedField) = explode('/', $field);
796 796
             $classPrefix = $App->classPrefix;
797 797
             
798 798
             $manyRelations = $objectRecordSet->getHasManyRelations();
799
-            foreach ($manyRelations as $manyRelation){
800
-                if($selectedRelation != $manyRelation->getOwnerSetFieldName()){
799
+            foreach ($manyRelations as $manyRelation) {
800
+                if ($selectedRelation != $manyRelation->getOwnerSetFieldName()) {
801 801
                     continue;
802 802
                 }
803 803
                 $foreignSetName = str_replace($classPrefix, '', $manyRelation->getForeignSetClassName());
@@ -805,13 +805,13 @@  discard block
 block discarded – undo
805 805
                 
806 806
                 $visibilityCriteria = '';
807 807
                 
808
-                if($foreignSet){
808
+                if ($foreignSet) {
809 809
                     $selectedManyField = $foreignSet->$selectedField;
810 810
                     
811
-                    if($selectedManyField instanceof \ORM_BoolInterface){
811
+                    if ($selectedManyField instanceof \ORM_BoolInterface) {
812 812
                         $condition = $condition['bool'];
813 813
                     }
814
-                    else{
814
+                    else {
815 815
                         $condition = $condition['default'];
816 816
                     }
817 817
                     
@@ -823,9 +823,9 @@  discard block
 block discarded – undo
823 823
             }
824 824
             
825 825
             $oneRelations = $objectRecordSet->getHasOneRelations();
826
-            foreach ($oneRelations as $oneRelation){
826
+            foreach ($oneRelations as $oneRelation) {
827 827
                 /* @var $oneRelation \ORM_OneRelation*/
828
-                if($selectedRelation != $oneRelation->getOwnerSetFieldName()){
828
+                if ($selectedRelation != $oneRelation->getOwnerSetFieldName()) {
829 829
                     continue;
830 830
                 }
831 831
                 $foreignSetClassName = $oneRelation->getForeignSetClassName();
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
                 
835 835
                 $visibilityCriteria = '';
836 836
                 
837
-                if($foreignSet){
837
+                if ($foreignSet) {
838 838
                     $selectedOneField = $foreignSet->$selectedField;
839 839
                     
840
-                    if($selectedOneField instanceof \ORM_BoolInterface){
840
+                    if ($selectedOneField instanceof \ORM_BoolInterface) {
841 841
                         $condition = $condition['bool'];
842 842
                     }
843
-                    else{
843
+                    else {
844 844
                         $condition = $condition['default'];
845 845
                     }
846 846
                     
@@ -850,20 +850,20 @@  discard block
 block discarded – undo
850 850
                 break;
851 851
             }
852 852
         }
853
-        else{
853
+        else {
854 854
             
855 855
             $field = $objectRecordSet->$field;
856 856
             
857
-            if($field instanceof \ORM_BoolInterface){
857
+            if ($field instanceof \ORM_BoolInterface) {
858 858
                 $condition = $condition['bool'];
859 859
             }
860
-            else{
860
+            else {
861 861
                 $condition = $condition['default'];
862 862
             }
863 863
             
864 864
             $visibilityCriteria = '';
865 865
             
866
-            if(! empty($condition)){
866
+            if (!empty($condition)) {
867 867
                 $criteria = $field->{$condition}($data['value']);
868 868
                 $visibilityCriteria = $criteria->toJson();
869 869
             }
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
         $customContainer = $customContainerSet->request($container);
893 893
         
894 894
         $object = $customContainer->object;
895
-        if(strpos($object, $App->classPrefix) !== false){
895
+        if (strpos($object, $App->classPrefix) !== false) {
896 896
             list (, $object) = explode($App->classPrefix, $object);
897 897
         }
898 898
         
@@ -919,17 +919,17 @@  discard block
 block discarded – undo
919 919
         
920 920
         $nbCol = 0;
921 921
         
922
-        foreach ($customSections as $customSection){
922
+        foreach ($customSections as $customSection) {
923 923
             
924
-            list (, , $nbCol) = explode('-', $customSection->sizePolicy);
924
+            list (,, $nbCol) = explode('-', $customSection->sizePolicy);
925 925
             
926 926
             $currentColumn += $nbCol;
927 927
             
928
-            $sectionSection = $W->Section($customSection->name . ' (' . $customSection->rank . ')', $sectionBox = $W->VBoxItems($W->Hidden()
929
-                ->setName('#' . $customSection->id)));
928
+            $sectionSection = $W->Section($customSection->name.' ('.$customSection->rank.')', $sectionBox = $W->VBoxItems($W->Hidden()
929
+                ->setName('#'.$customSection->id)));
930 930
             $sectionSection->addClass('app-custom-section');
931 931
             $sectionSection->addClass($customSection->classname);
932
-            $sectionSection->setSizePolicy($customSection->sizePolicy . ' widget-sameheight');
932
+            $sectionSection->setSizePolicy($customSection->sizePolicy.' widget-sameheight');
933 933
             
934 934
             $row->addItem($sectionSection);
935 935
             
@@ -947,40 +947,40 @@  discard block
 block discarded – undo
947 947
                 ->addClass('icon', \Func_Icons::ACTIONS_EDIT_DELETE)
948 948
                 ->setOpenMode(WidgetLink::OPEN_DIALOG)
949 949
                 ->setDialogClass('box red')));
950
-            if(! empty($customSection->visibilityCriteria)){
950
+            if (!empty($customSection->visibilityCriteria)) {
951 951
                 $sectionBox->addItem($W->HBoxItems($W->Label($App->translate('This section has a visibility condition')))
952 952
                     ->setSizePolicy('alert alert-warning widget-100pc'));
953 953
             }
954 954
             $fields = $customSection->getFields();
955
-            if(count($fields) == 0){
955
+            if (count($fields) == 0) {
956 956
                 $sectionBox->addItem($W->HBoxItems($W->Label($App->translate('This section does not contain any field')))
957 957
                     ->setSizePolicy('alert alert-warning'));
958 958
             }
959
-            foreach ($fields as $fieldId => $field){
960
-                if(empty($field)){
959
+            foreach ($fields as $fieldId => $field) {
960
+                if (empty($field)) {
961 961
                     continue;
962 962
                 }
963 963
                 
964 964
                 $fieldName = $field['fieldname'];
965 965
                 
966 966
                 $isFieldsGroup = false;
967
-                if(strpos($fieldName, '_fieldsGroup') !== false){
967
+                if (strpos($fieldName, '_fieldsGroup') !== false) {
968 968
                     $fieldName = '_fieldsGroup';
969 969
                     $isFieldsGroup = true;
970 970
                 }
971 971
                 
972 972
                 $field = $availableFields[$fieldName];
973 973
                 $fieldDescription = $field['description'];
974
-                if(substr($fieldName, 0, 1) !== '_'){
974
+                if (substr($fieldName, 0, 1) !== '_') {
975 975
                     $fieldDescription = $App->translate($fieldDescription);
976 976
                 }
977 977
                 
978
-                if(empty($field)){
978
+                if (empty($field)) {
979 979
                     continue;
980 980
                 }
981 981
                 
982 982
                 $fieldName = $field['name'];
983
-                if($isFieldsGroup){
983
+                if ($isFieldsGroup) {
984 984
                     $fieldName = $fieldId;
985 985
                 }
986 986
                 
@@ -991,20 +991,20 @@  discard block
 block discarded – undo
991 991
                     ->setGrowable(true)
992 992
                     ->setWrap(WidgetFlexLayout::FLEX_WRAP_WRAP))
993 993
                     ->setSizePolicy('maximum'), $btnBox = $W->HBoxItems($W->Hidden()
994
-                    ->setName($customSection->id . '.' . $fieldId)
994
+                    ->setName($customSection->id.'.'.$fieldId)
995 995
                     ->setValue($fieldName))
996 996
                     ->addClass('widget-actions'))
997 997
                     ->setSizePolicy('widget-list-element widget-actions-target')
998 998
                     ->addClass(\Func_Icons::ICON_LEFT_16);
999
-                if(strpos($field['name'], '_fieldsGroup') !== false){
999
+                if (strpos($field['name'], '_fieldsGroup') !== false) {
1000 1000
                     $btnBox->addItem($W->Link('', $customSectionCtrl->addDisplayFieldToGroup($customSection->id, $fieldName))
1001 1001
                         ->addClass('icon', \Func_Icons::ACTIONS_LIST_ADD)
1002 1002
                         ->setOpenMode(WidgetLink::OPEN_DIALOG));
1003 1003
                     $groupedFields = $fields[$fieldName]['fields'];
1004
-                    foreach ($groupedFields as $groupedField){
1004
+                    foreach ($groupedFields as $groupedField) {
1005 1005
                         $groupedFieldDetails = $availableFields[$groupedField['fieldname']];
1006 1006
                         $fieldGroupBox->addItem($flexField = $W->FlowItems($W->Hidden(null, array(
1007
-                            $customSection->id . '.fieldsGroups',
1007
+                            $customSection->id.'.fieldsGroups',
1008 1008
                             $fieldName,
1009 1009
                             $groupedField['fieldname']
1010 1010
                         ), $groupedField['fieldname']), $W->Label($groupedFieldDetails['description']), $W->FlowItems($W->Link('', $customSectionCtrl->editGroupFieldDisplayField($customSection->id, $fieldName, $groupedField['fieldname']))
@@ -1032,23 +1032,23 @@  discard block
 block discarded – undo
1032 1032
             $sectionsBoxes[] = $sectionBox;
1033 1033
         }
1034 1034
         
1035
-        if($currentColumn + $nbCol > 0){
1035
+        if ($currentColumn + $nbCol > 0) {
1036 1036
             $sectionsSection->addItem($row);
1037 1037
         }
1038 1038
         
1039
-        foreach ($sectionsBoxes as $sectionsBox){
1039
+        foreach ($sectionsBoxes as $sectionsBox) {
1040 1040
             $sectionsBox->sortable(true, $sectionsBoxes);
1041 1041
             $sectionsBox->setMetadata('samePlaceholderSize', true);
1042 1042
         }
1043 1043
         
1044
-        foreach ($rows as $row){
1044
+        foreach ($rows as $row) {
1045 1045
             $row->sortable(true, $rows);
1046 1046
             $row->setMetadata('samePlaceholderSize', true);
1047 1047
         }
1048 1048
         
1049 1049
         $form = $W->Form();
1050 1050
         
1051
-        if(isset($itemId)){
1051
+        if (isset($itemId)) {
1052 1052
             $form->setId($itemId);
1053 1053
         }
1054 1054
         $form->setHiddenValue('tg', $App->controllerTg);
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
         $customSections = $customSectionSet->select($customSectionSet->container->is($container));
1076 1076
         
1077 1077
         $sectionsValues = array();
1078
-        foreach ($customSections as $customSection){
1078
+        foreach ($customSections as $customSection) {
1079 1079
             $values = $customSection->getValues();
1080 1080
             unset($values['id']);
1081 1081
             unset($values['createdBy']);
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
         }
1090 1090
         
1091 1091
         header('Content-type: application/json');
1092
-        header('Content-Disposition: attachment; filename="' . $container->object . '.' . ($container->view === '' ? 'default' : $container->view) . '.' . $container->name . '.json"' . "\n");
1092
+        header('Content-Disposition: attachment; filename="'.$container->object.'.'.($container->view === '' ? 'default' : $container->view).'.'.$container->name.'.json"'."\n");
1093 1093
         
1094 1094
         $json = bab_json_encode($sectionsValues);
1095 1095
         $json = bab_convertStringFromDatabase($json, \bab_charset::UTF_8);
@@ -1141,12 +1141,12 @@  discard block
 block discarded – undo
1141 1141
         $files->push($sectionsfile['uid']);
1142 1142
         
1143 1143
         $data = null;
1144
-        foreach ($files as $f){
1144
+        foreach ($files as $f) {
1145 1145
             $data = file_get_contents($f->toString());
1146 1146
             break;
1147 1147
         }
1148 1148
         
1149
-        if(! isset($data)){
1149
+        if (!isset($data)) {
1150 1150
             $this->addError($App->translate('Unable to get file content'));
1151 1151
             return true;
1152 1152
         }
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
         
1159 1159
         $customSectionSet->delete($customSectionSet->container->is($container));
1160 1160
         
1161
-        foreach ($sectionsValues as $sectionValues){
1161
+        foreach ($sectionsValues as $sectionValues) {
1162 1162
             $customSection = $customSectionSet->newRecord();
1163 1163
             $customSection->setValues($sectionValues);
1164 1164
             $customSection->container = $container;
@@ -1236,59 +1236,59 @@  discard block
 block discarded – undo
1236 1236
         $ranks = array();
1237 1237
         $rank = 0;
1238 1238
         
1239
-        foreach ($sections as $key => $value){
1239
+        foreach ($sections as $key => $value) {
1240 1240
             // Sections ids start with #, while section fields start with their original section id
1241
-            if(substr($key, 0, 1) === '#'){
1241
+            if (substr($key, 0, 1) === '#') {
1242 1242
                 $currentSectionId = substr($key, 1);
1243 1243
                 $rawSectionData[$currentSectionId] = array();
1244
-                if(! isset($oldSectionId)){
1244
+                if (!isset($oldSectionId)) {
1245 1245
                     $oldSectionId = $currentSectionId;
1246 1246
                 }
1247
-                if(isset($currentSection) && $oldSectionId != $currentSectionId){
1247
+                if (isset($currentSection) && $oldSectionId != $currentSectionId) {
1248 1248
                     $oldSectionId = $currentSectionId;
1249 1249
                 }
1250 1250
                 $ranks[$currentSectionId] = $rank;
1251
-                $rank ++;
1251
+                $rank++;
1252 1252
                 $currentSection = $customSectionSet->get($customSectionSet->id->is($currentSectionId));
1253 1253
                 continue;
1254 1254
             }
1255
-            if(! isset($currentSection)){
1255
+            if (!isset($currentSection)) {
1256 1256
                 continue;
1257 1257
             }
1258 1258
             list ($fieldSectionId, $fieldName) = explode('.', $key);
1259
-            if($fieldSectionId == $currentSectionId){
1259
+            if ($fieldSectionId == $currentSectionId) {
1260 1260
                 $field = $currentSection->getField($fieldName);
1261
-                if(strpos($fieldName, '_fieldsGroup') !== false){
1261
+                if (strpos($fieldName, '_fieldsGroup') !== false) {
1262 1262
                     $rawSectionData[$currentSectionId][$fieldName]['block'] = $field['block'];
1263 1263
                     $rawSectionData[$currentSectionId][$fieldName]['fieldname'] = '_fieldsGroup';
1264 1264
                     $rawSectionData[$currentSectionId][$fieldName]['parameters'] = $field['parameters'];
1265
-                    foreach ($sections[$currentSection->id . '.fieldsGroups'][$fieldName] as $subKey => $subValue){
1265
+                    foreach ($sections[$currentSection->id.'.fieldsGroups'][$fieldName] as $subKey => $subValue) {
1266 1266
                         $rawSectionData[$currentSectionId][$fieldName]['fields'][$subKey] = $field['fields'][$subKey];
1267 1267
                     }
1268 1268
                 }
1269
-                elseif($fieldName != 'fieldsGroups'){
1269
+                elseif ($fieldName != 'fieldsGroups') {
1270 1270
                     $rawSectionData[$currentSectionId][$fieldName] = $field;
1271 1271
                 }
1272 1272
             }
1273
-            else{
1273
+            else {
1274 1274
                 $field = null;
1275 1275
                 $tmpSection = $customSectionSet->get($customSectionSet->id->is($fieldSectionId));
1276
-                if($tmpSection){
1276
+                if ($tmpSection) {
1277 1277
                     $field = $tmpSection->getField($fieldName);
1278 1278
                 }
1279
-                if(isset($field)){
1279
+                if (isset($field)) {
1280 1280
                     $rawSectionData[$currentSectionId][$fieldName] = $field;
1281 1281
                 }
1282 1282
             }
1283 1283
         }
1284 1284
         
1285
-        foreach ($rawSectionData as $sectionId => $fields){
1285
+        foreach ($rawSectionData as $sectionId => $fields) {
1286 1286
             $section = $customSectionSet->get($customSectionSet->id->is($sectionId));
1287
-            if($section){
1287
+            if ($section) {
1288 1288
                 $section->fields = json_encode($fields);
1289 1289
                 $section->rank = isset($ranks[$sectionId]) ? $ranks[$sectionId] : 0;
1290 1290
                 $section->save();
1291
-                $rank ++;
1291
+                $rank++;
1292 1292
             }
1293 1293
         }
1294 1294
         
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -503,8 +503,7 @@  discard block
 block discarded – undo
503 503
         $customSectionSet = $App->CustomSectionSet();
504 504
         if(isset($id)){
505 505
             $record = $customSectionSet->request($id);
506
-        }
507
-        else{
506
+        } else{
508 507
             $record = $customSectionSet->newRecord();
509 508
             $record->container = $container->id;
510 509
         }
@@ -810,8 +809,7 @@  discard block
 block discarded – undo
810 809
                     
811 810
                     if($selectedManyField instanceof \ORM_BoolInterface){
812 811
                         $condition = $condition['bool'];
813
-                    }
814
-                    else{
812
+                    } else{
815 813
                         $condition = $condition['default'];
816 814
                     }
817 815
                     
@@ -839,8 +837,7 @@  discard block
 block discarded – undo
839 837
                     
840 838
                     if($selectedOneField instanceof \ORM_BoolInterface){
841 839
                         $condition = $condition['bool'];
842
-                    }
843
-                    else{
840
+                    } else{
844 841
                         $condition = $condition['default'];
845 842
                     }
846 843
                     
@@ -849,15 +846,13 @@  discard block
 block discarded – undo
849 846
                 }
850 847
                 break;
851 848
             }
852
-        }
853
-        else{
849
+        } else{
854 850
             
855 851
             $field = $objectRecordSet->$field;
856 852
             
857 853
             if($field instanceof \ORM_BoolInterface){
858 854
                 $condition = $condition['bool'];
859
-            }
860
-            else{
855
+            } else{
861 856
                 $condition = $condition['default'];
862 857
             }
863 858
             
@@ -1265,12 +1260,10 @@  discard block
 block discarded – undo
1265 1260
                     foreach ($sections[$currentSection->id . '.fieldsGroups'][$fieldName] as $subKey => $subValue){
1266 1261
                         $rawSectionData[$currentSectionId][$fieldName]['fields'][$subKey] = $field['fields'][$subKey];
1267 1262
                     }
1268
-                }
1269
-                elseif($fieldName != 'fieldsGroups'){
1263
+                } elseif($fieldName != 'fieldsGroups'){
1270 1264
                     $rawSectionData[$currentSectionId][$fieldName] = $field;
1271 1265
                 }
1272
-            }
1273
-            else{
1266
+            } else{
1274 1267
                 $field = null;
1275 1268
                 $tmpSection = $customSectionSet->get($customSectionSet->id->is($fieldSectionId));
1276 1269
                 if($tmpSection){
Please login to merge, or discard this patch.
programs/Ctrl/AppController.php 2 patches
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 use Capwelton\LibApp\Exceptions\AppNotFoundException;
39 39
 use Capwelton\LibApp\Func_App;
40 40
 use Capwelton\LibApp\AppComponent;
41
-require_once $GLOBALS['babInstallPath'] . 'utilit/controller.class.php';
42
-require_once $GLOBALS['babInstallPath'] . 'utilit/json.php';
41
+require_once $GLOBALS['babInstallPath'].'utilit/controller.class.php';
42
+require_once $GLOBALS['babInstallPath'].'utilit/json.php';
43 43
 
44
-require_once dirname(__FILE__) . '/functions.php';
44
+require_once dirname(__FILE__).'/functions.php';
45 45
 
46 46
 class AppController extends \bab_Controller implements AppObjectInterface
47 47
 {
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     public function addReloadSelector($reloadSelector, $withSSE = false, $for = null)
71 71
     {
72 72
         $this->reloadSelectors[$reloadSelector] = $reloadSelector;
73
-        if($withSSE){
73
+        if ($withSSE) {
74 74
             $sseRecordSet = $this->getSSERecordSet();
75 75
             $sseRecordSet->newReloadSelector($reloadSelector, $for);
76 76
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     
88 88
     public function getSSERecordSet()
89 89
     {
90
-        if(isset($this->SSERecordSet)){
90
+        if (isset($this->SSERecordSet)) {
91 91
             return $this->SSERecordSet;
92 92
         }
93 93
         
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     public function __call($name, $arguments = array())
127 127
     {
128 128
         $component = $this->App()->getComponentByName($name);
129
-        if($component){
129
+        if ($component) {
130 130
             return call_user_func_array(array(
131 131
                 $component,
132 132
                 'controller'
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function isAjaxRequest()
171 171
     {
172
-        if(! isset($this->isAjaxRequest)){
172
+        if (!isset($this->isAjaxRequest)) {
173 173
             $this->isAjaxRequest = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
174 174
         }
175 175
         return $this->isAjaxRequest;
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function requireCredential($message = null)
183 183
     {
184
-        if($this->isAjaxRequest()){
184
+        if ($this->isAjaxRequest()) {
185 185
             $authType = 'Basic';
186 186
         }
187
-        else{
187
+        else {
188 188
             $authType = '';
189 189
         }
190 190
         
191
-        if(! isset($message)){
191
+        if (!isset($message)) {
192 192
             $message = $this->App()->translate('You must be logged in to access this page.');
193 193
         }
194 194
         
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
         // we try to select one according to the classname prefix.
212 212
         list ($prefix) = explode('_', __CLASS__);
213 213
         $functionalityName = ucwords($prefix);
214
-        $App = @\bab_functionality::get('App/' . $functionalityName);
214
+        $App = @\bab_functionality::get('App/'.$functionalityName);
215 215
         
216
-        if(! $App){
217
-            throw new AppException('Faild to autodetect functionality App/' . $functionalityName . ', the getInstance method is deprecated, use $App->ControllerProxy() instead');
216
+        if (!$App) {
217
+            throw new AppException('Faild to autodetect functionality App/'.$functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead');
218 218
         }
219 219
         
220 220
         $controller = $App->ControllerProxy($classname, $proxy);
@@ -232,39 +232,39 @@  discard block
 block discarded – undo
232 232
     static function getProxyInstance(Func_App $App, $classname)
233 233
     {
234 234
         $class = new \ReflectionClass($classname);
235
-        $proxyClassname = $class->getShortName() . self::PROXY_CLASS_SUFFIX;
236
-        if(! class_exists($proxyClassname)){
237
-            $classStr = 'class ' . $proxyClassname . ' extends ' . $class->name . ' {' . "\n";
235
+        $proxyClassname = $class->getShortName().self::PROXY_CLASS_SUFFIX;
236
+        if (!class_exists($proxyClassname)) {
237
+            $classStr = 'class '.$proxyClassname.' extends '.$class->name.' {'."\n";
238 238
             $methods = $class->getMethods();
239 239
             
240 240
             $classStr .= '	public function __construct(Func_App $App) {
241 241
                 $this->setApp($App);
242 242
             }' . "\n";
243 243
             
244
-            foreach ($methods as $method){
245
-                if($method->name === '__construct' || ! $method->isPublic() || $method->isStatic() || $method->isFinal() || $method->name === 'setApp' || $method->name === 'App' || $method->name === 'setCrm' || $method->name === 'Crm'){
244
+            foreach ($methods as $method) {
245
+                if ($method->name === '__construct' || !$method->isPublic() || $method->isStatic() || $method->isFinal() || $method->name === 'setApp' || $method->name === 'App' || $method->name === 'setCrm' || $method->name === 'Crm') {
246 246
                     continue;
247 247
                 }
248 248
                 
249
-                $classStr .= '	public function ' . $method->name . '(';
249
+                $classStr .= '	public function '.$method->name.'(';
250 250
                 $parameters = $method->getParameters();
251 251
                 $parametersStr = array();
252
-                foreach ($parameters as $parameter){
252
+                foreach ($parameters as $parameter) {
253 253
                     
254
-                    if($parameter->isDefaultValueAvailable()){
255
-                        $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true);
254
+                    if ($parameter->isDefaultValueAvailable()) {
255
+                        $parametersStr[] = '$'.$parameter->name.' = '.var_export($parameter->getDefaultValue(), true);
256 256
                     }
257
-                    else{
258
-                        $parametersStr[] = '$' . $parameter->name;
257
+                    else {
258
+                        $parametersStr[] = '$'.$parameter->name;
259 259
                     }
260 260
                 }
261 261
                 $classStr .= implode(', ', $parametersStr);
262
-                $classStr .= ') {' . "\n";
263
-                $classStr .= '		$args = func_get_args();' . "\n";
264
-                $classStr .= '		return $this->getMethodAction(__FUNCTION__, $args);' . "\n";
265
-                $classStr .= '	}' . "\n";
262
+                $classStr .= ') {'."\n";
263
+                $classStr .= '		$args = func_get_args();'."\n";
264
+                $classStr .= '		return $this->getMethodAction(__FUNCTION__, $args);'."\n";
265
+                $classStr .= '	}'."\n";
266 266
             }
267
-            $classStr .= '}' . "\n";
267
+            $classStr .= '}'."\n";
268 268
             
269 269
             // We define the proxy class
270 270
             eval($classStr);
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     protected function getObjectName($classname)
304 304
     {
305 305
         list ($objectname) = explode('Controller', $classname);
306
-        if($this->App()->getComponentByName($objectname)){
306
+        if ($this->App()->getComponentByName($objectname)) {
307 307
             return strtolower($objectname);
308 308
         }
309 309
         list (, $objectname) = explode('_Ctrl', $classname);
@@ -325,18 +325,18 @@  discard block
 block discarded – undo
325 325
         
326 326
         $reflector = new \ReflectionClass(get_class($this));
327 327
         $parent = $reflector->getParentClass();
328
-        if($parent){
328
+        if ($parent) {
329 329
             $parentMethod = $parent->getMethod('__construct');
330 330
             $docComment = $parentMethod->getDocComment();
331
-            if(strpos($docComment, '@isComponentController') !== false){
331
+            if (strpos($docComment, '@isComponentController') !== false) {
332 332
                 $fullClassName = $parent->getName();
333 333
             }
334 334
         }
335 335
         
336 336
         $rc = new \ReflectionClass($fullClassName);
337 337
         
338
-        if(! $rc->hasMethod($methodName)){
339
-            throw new \bab_InvalidActionException($fullClassName . '::' . $methodName);
338
+        if (!$rc->hasMethod($methodName)) {
339
+            throw new \bab_InvalidActionException($fullClassName.'::'.$methodName);
340 340
         }
341 341
         $method = new \ReflectionMethod($fullClassName, $methodName);
342 342
         
@@ -345,32 +345,32 @@  discard block
 block discarded – undo
345 345
         $parameters = $method->getParameters();
346 346
         $actionParams = array();
347 347
         $argNumber = 0;
348
-        foreach ($parameters as $parameter){
348
+        foreach ($parameters as $parameter) {
349 349
             $parameterName = $parameter->getName();
350
-            if(isset($args[$argNumber])){
350
+            if (isset($args[$argNumber])) {
351 351
                 $actionParams[$parameterName] = $args[$argNumber];
352 352
             }
353
-            elseif($parameter->isDefaultValueAvailable()){
353
+            elseif ($parameter->isDefaultValueAvailable()) {
354 354
                 $actionParams[$parameterName] = $parameter->getDefaultValue();
355 355
             }
356
-            else{
356
+            else {
357 357
                 $actionParams[$parameterName] = null;
358 358
             }
359
-            $argNumber ++;
359
+            $argNumber++;
360 360
         }
361 361
         
362 362
         $action = new WidgetAction();
363 363
         
364
-        $action->setMethod($this->getControllerTg(), $objectName . '.' . $methodName, $actionParams);
364
+        $action->setMethod($this->getControllerTg(), $objectName.'.'.$methodName, $actionParams);
365 365
         
366 366
         $docComment = $method->getDocComment();
367
-        if(strpos($docComment, '@ajax') !== false){
367
+        if (strpos($docComment, '@ajax') !== false) {
368 368
             $action->setAjax(true);
369 369
         }
370
-        if(strpos($docComment, '@requireSaveMethod') !== false && method_exists($action, 'setRequireSaveMethod')){
370
+        if (strpos($docComment, '@requireSaveMethod') !== false && method_exists($action, 'setRequireSaveMethod')) {
371 371
             $action->setRequireSaveMethod(true);
372 372
         }
373
-        if(strpos($docComment, '@requireDeleteMethod') !== false && method_exists($action, 'setRequireDeleteMethod')){
373
+        if (strpos($docComment, '@requireDeleteMethod') !== false && method_exists($action, 'setRequireDeleteMethod')) {
374 374
             $action->setRequireDeleteMethod(true);
375 375
         }
376 376
         
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
         
400 400
         $action->setParameters($actionParams);
401 401
         
402
-        list (, , $file) = explode('/', $App->controllerTg);
402
+        list (,, $file) = explode('/', $App->controllerTg);
403 403
         
404
-        $action->setParameter('addon', $App->getAddonName() . '.' . $file);
404
+        $action->setParameter('addon', $App->getAddonName().'.'.$file);
405 405
         $action->setParameter('idx', $idx);
406 406
         
407 407
         return $action;
@@ -419,44 +419,44 @@  discard block
 block discarded – undo
419 419
         
420 420
         $method = $action->getMethod();
421 421
         
422
-        if(! isset($method) || '' === $method){
422
+        if (!isset($method) || '' === $method) {
423 423
             return false;
424 424
         }
425 425
         
426 426
         list ($objectName,) = explode('.', $method);
427 427
         
428
-        if(! method_exists($this, $objectName)){
428
+        if (!method_exists($this, $objectName)) {
429 429
             /* @var $component AppComponent */
430 430
             $component = $this->app->getComponentByName($objectName);
431
-            if($component){
431
+            if ($component) {
432 432
                 $this->app->setCurrentComponent($component);
433 433
                 $objectController = $component->controller(false);
434 434
             }
435
-            else{
435
+            else {
436 436
                 header('HTTP/1.0 400 Bad Request');
437 437
                 throw new AppUnknownActionException($action);
438 438
             }
439 439
         }
440 440
         
441
-        if(! isset($component)){
441
+        if (!isset($component)) {
442 442
             $objectController = $this->{$objectName}(false);
443
-            if(! ($objectController instanceof AppController)){
443
+            if (!($objectController instanceof AppController)) {
444 444
                 return false;
445 445
             }
446 446
         }
447 447
         
448
-        try{
448
+        try {
449 449
             $returnedValue = $objectController->execAction($action);
450 450
         }
451
-        catch (AppAccessException $e){
451
+        catch (AppAccessException $e) {
452 452
             
453
-            if(! bab_isUserLogged() && $e->requireCredential){
453
+            if (!bab_isUserLogged() && $e->requireCredential) {
454 454
                 bab_requireCredential($e->getMessage());
455 455
             }
456
-            else{
457
-                if($this->isAjaxRequest()){
456
+            else {
457
+                if ($this->isAjaxRequest()) {
458 458
                     
459
-                    header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
459
+                    header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
460 460
                     
461 461
                     die(bab_json_encode(array(
462 462
                         'exception' => 'app_AccessException',
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
                 $this->accessPage($e);
468 468
             }
469 469
         }
470
-        catch (AppSaveException $e){
470
+        catch (AppSaveException $e) {
471 471
             
472
-            if($this->isAjaxRequest()){
473
-                header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
472
+            if ($this->isAjaxRequest()) {
473
+                header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
474 474
                 header('Cache-Control: no-cache, must-revalidate');
475 475
                 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
476 476
                 header('Content-type: application/json');
@@ -482,32 +482,32 @@  discard block
 block discarded – undo
482 482
                 )));
483 483
             }
484 484
         }
485
-        catch (AppDeletedRecordException $e){
485
+        catch (AppDeletedRecordException $e) {
486 486
             $this->deletedItemPage($action, $e);
487 487
         }
488
-        catch (AppNotFoundException $e){
488
+        catch (AppNotFoundException $e) {
489 489
             $this->notFoundPage($action, $e);
490 490
         }
491
-        catch (\ORM_Exception $e){
491
+        catch (\ORM_Exception $e) {
492 492
             $this->errorPage($e);
493 493
         }
494
-        catch (\Exception $e){
494
+        catch (\Exception $e) {
495 495
             $this->unexpectedErrorPage($e);
496 496
         }
497 497
         
498 498
         $W = bab_Widgets();
499 499
         
500
-        if($returnedValue instanceof WidgetDisplayableInterface){
500
+        if ($returnedValue instanceof WidgetDisplayableInterface) {
501 501
             
502
-            if($returnedValue instanceof WidgetBabPage && ! $this->isAjaxRequest()){
502
+            if ($returnedValue instanceof WidgetBabPage && !$this->isAjaxRequest()) {
503 503
                 
504 504
                 // If the action returned a page, we display it.
505 505
                 $returnedValue->displayHtml();
506 506
             }
507
-            else{
507
+            else {
508 508
                 
509 509
                 $htmlCanvas = $W->HtmlCanvas();
510
-                if(self::$acceptJson){
510
+                if (self::$acceptJson) {
511 511
                     $itemId = $returnedValue->getId();
512 512
                     $returnArray = array(
513 513
                         $itemId => $returnedValue->display($htmlCanvas)
@@ -517,18 +517,18 @@  discard block
 block discarded – undo
517 517
                     header('Content-type: application/json');
518 518
                     die(bab_json_encode($returnArray));
519 519
                 }
520
-                else{
520
+                else {
521 521
                     header('Cache-Control: no-cache, must-revalidate');
522 522
                     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
523 523
                     header('Content-type: text/html');
524
-                    if($returnedValue instanceof WidgetPage && method_exists($returnedValue, 'getPageTitle')){
524
+                    if ($returnedValue instanceof WidgetPage && method_exists($returnedValue, 'getPageTitle')) {
525 525
                         $pageTitle = $returnedValue->getPageTitle();
526 526
                         
527
-                        if(method_exists($htmlCanvas, 'sendPageTitle')){
527
+                        if (method_exists($htmlCanvas, 'sendPageTitle')) {
528 528
                             $htmlCanvas->sendPageTitle($pageTitle);
529 529
                         }
530
-                        else{
531
-                            header('X-Cto-PageTitle: ' . $pageTitle);
530
+                        else {
531
+                            header('X-Cto-PageTitle: '.$pageTitle);
532 532
                         }
533 533
                     }
534 534
                     $html = $returnedValue->display($htmlCanvas);
@@ -536,15 +536,15 @@  discard block
 block discarded – undo
536 536
                 }
537 537
             }
538 538
         }
539
-        elseif(is_array($returnedValue)){
539
+        elseif (is_array($returnedValue)) {
540 540
             
541 541
             $htmlCanvas = $W->HtmlCanvas();
542 542
             $returnedArray = array();
543
-            foreach ($returnedValue as $key => &$item){
544
-                if($item instanceof WidgetDisplayableInterface){
543
+            foreach ($returnedValue as $key => &$item) {
544
+                if ($item instanceof WidgetDisplayableInterface) {
545 545
                     $returnedArray[$item->getId()] = $item->display($htmlCanvas);
546 546
                 }
547
-                else{
547
+                else {
548 548
                     $returnedArray[$key] = $item;
549 549
                 }
550 550
             }
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
             header('Content-type: application/json');
554 554
             die(bab_convertStringFromDatabase(bab_json_encode($returnedArray), \bab_charset::UTF_8));
555 555
         }
556
-        elseif(true === $returnedValue || is_string($returnedValue)){
556
+        elseif (true === $returnedValue || is_string($returnedValue)) {
557 557
             
558
-            if($this->isAjaxRequest()){
558
+            if ($this->isAjaxRequest()) {
559 559
                 $body = bab_getBody();
560 560
                 $json = array();
561 561
                 $json['messages'] = array();
@@ -563,21 +563,21 @@  discard block
 block discarded – undo
563 563
                 unset($body->messages['toasts']);
564 564
                 $messages = $body->messages;
565 565
                 $errors = $body->errors;
566
-                foreach ($messages as $message){
566
+                foreach ($messages as $message) {
567 567
                     $json['messages'][] = array(
568 568
                         'level' => 'info',
569 569
                         'content' => $message,
570 570
                         'time' => 4000
571 571
                     );
572 572
                 }
573
-                foreach ($errors as $message){
573
+                foreach ($errors as $message) {
574 574
                     $json['messages'][] = array(
575 575
                         'level' => 'danger',
576 576
                         'content' => $message
577 577
                     );
578 578
                 }
579 579
                 $json['toasts'] = $toasts;
580
-                if($objectController->getReloadSelectors()){
580
+                if ($objectController->getReloadSelectors()) {
581 581
                     $json['reloadSelector'] = implode(',', $objectController->getReloadSelectors());
582 582
                 }
583 583
                 echo bab_json_encode($json);
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
     
591 591
     private function deletedItemPage(WidgetAction $action, AppDeletedRecordException $e)
592 592
     {
593
-        if($this->isAjaxRequest()){
594
-            header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
593
+        if ($this->isAjaxRequest()) {
594
+            header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
595 595
             header('Cache-Control: no-cache, must-revalidate');
596 596
             header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
597 597
             header('Content-type: application/json');
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
                 'errorMessage' => bab_convertStringFromDatabase($e->getMessage(), 'UTF-8')
604 604
             )));
605 605
         }
606
-        header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);
606
+        header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
607 607
         
608 608
         $App = app_App();
609 609
         $W = bab_Widgets();
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
             ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_ITEMS_CENTER));
626 626
         $section->addItems($W->Title($App->translate('Error'), 1), $W->Title(sprintf($App->translate('This %s has been deleted'), $e->getObjectTitle())));
627 627
         
628
-        if($e instanceof AppDeletedRecordException){
628
+        if ($e instanceof AppDeletedRecordException) {
629 629
             $section->addItems($e->getDeletedBy(), $e->getDeletedOn());
630 630
         }
631 631
         
@@ -634,8 +634,8 @@  discard block
 block discarded – undo
634 634
     
635 635
     private function notFoundPage(WidgetAction $action, AppNotFoundException $e)
636 636
     {
637
-        if($this->isAjaxRequest()){
638
-            $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle() . ' (' . $e->getId() . ')');
637
+        if ($this->isAjaxRequest()) {
638
+            $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle().' ('.$e->getId().')');
639 639
             $json = array(
640 640
                 'messages' => array(
641 641
                     array(
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
             echo bab_json_encode($json);
648 648
             die();
649 649
         }
650
-        header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);
650
+        header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
651 651
         header('Cache-Control: no-cache, must-revalidate');
652 652
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
653 653
         
@@ -676,8 +676,8 @@  discard block
 block discarded – undo
676 676
     
677 677
     private function unexpectedErrorPage(\Exception $e)
678 678
     {
679
-        if($this->isAjaxRequest()){
680
-            $message = sprintf(app_translate('An unexpected error occured') . ':' . '%s', $e->getMessage());
679
+        if ($this->isAjaxRequest()) {
680
+            $message = sprintf(app_translate('An unexpected error occured').':'.'%s', $e->getMessage());
681 681
             $json = array(
682 682
                 'messages' => array(
683 683
                     array(
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
             echo bab_json_encode($json);
690 690
             die();
691 691
         }
692
-        header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500);
692
+        header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500);
693 693
         header('Cache-Control: no-cache, must-revalidate');
694 694
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
695 695
         
@@ -713,25 +713,25 @@  discard block
 block discarded – undo
713 713
             ->addClass('widget-50pc alert alert-danger')
714 714
             ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL));
715 715
         
716
-        $logCode = '#' . hrtime(true);
716
+        $logCode = '#'.hrtime(true);
717 717
         $message = addcslashes($e->getMessage(), "\000..\037\177..\377\\");
718 718
         $trace = addcslashes($e->getTraceAsString(), "\000..\037\177..\377\\");
719 719
         
720
-        error_log(sprintf('Error %s : %s', $logCode, $message) . PHP_EOL . $trace);
720
+        error_log(sprintf('Error %s : %s', $logCode, $message).PHP_EOL.$trace);
721 721
         
722 722
         $section->addItems($W->Title($App->translate('Error'), 1), $W->Title($App->translate('An unexpected error occured')), $W->Label(sprintf($App->translate('It has been logged with the following error code : %s'), $logCode)));
723 723
         
724
-        if(bab_isUserAdministrator()){
724
+        if (bab_isUserAdministrator()) {
725 725
             $contentBox->addItem($W->Section('Stack trace', $stackTraceBox = $W->FlexItems($W->Label($message)
726 726
                 ->addClass('widget-description'))
727 727
                 ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL))
728 728
                 ->setFoldable(true, true));
729 729
             $traces = explode("\n", $e->getTraceAsString());
730
-            foreach ($traces as $trace){
730
+            foreach ($traces as $trace) {
731 731
                 $stackTraceBox->addItem($W->Label($trace));
732 732
             }
733 733
         }
734
-        else{
734
+        else {
735 735
             $section->addItem($W->Label($App->translate('Please contact the administrator')));
736 736
         }
737 737
         
@@ -740,8 +740,8 @@  discard block
 block discarded – undo
740 740
     
741 741
     private function errorPage(\Exception $e)
742 742
     {
743
-        if($this->isAjaxRequest()){
744
-            $message = sprintf(app_translate('An unexpected error occured') . ':' . '%s', $e->getMessage());
743
+        if ($this->isAjaxRequest()) {
744
+            $message = sprintf(app_translate('An unexpected error occured').':'.'%s', $e->getMessage());
745 745
             $json = array(
746 746
                 'messages' => array(
747 747
                     array(
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
             echo bab_json_encode($json);
754 754
             die();
755 755
         }
756
-        header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500);
756
+        header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500);
757 757
         header('Cache-Control: no-cache, must-revalidate');
758 758
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
759 759
         
@@ -777,25 +777,25 @@  discard block
 block discarded – undo
777 777
             ->addClass('widget-50pc alert alert-danger')
778 778
             ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL));
779 779
         
780
-        $logCode = '#' . hrtime(true);
780
+        $logCode = '#'.hrtime(true);
781 781
         $message = addcslashes($e->getMessage(), "\000..\037\177..\377\\");
782 782
         $trace = addcslashes($e->getTraceAsString(), "\000..\037\177..\377\\");
783 783
         
784
-        error_log(sprintf('Error %s : %s', $logCode, $message) . PHP_EOL . $trace);
784
+        error_log(sprintf('Error %s : %s', $logCode, $message).PHP_EOL.$trace);
785 785
         
786 786
         $section->addItems($W->Title($App->translate('Error'), 1), $W->Title($App->translate('An unexpected error occured')), $W->Label(sprintf($App->translate('It has been logged with the following error code : %s'), $logCode)));
787 787
         
788
-        if(bab_isUserAdministrator()){
788
+        if (bab_isUserAdministrator()) {
789 789
             $contentBox->addItem($W->Section('Stack trace', $stackTraceBox = $W->FlexItems($W->Label($message)
790 790
                 ->addClass('widget-description'))
791 791
                 ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL))
792 792
                 ->setFoldable(true, true));
793 793
             $traces = explode("\n", $e->getTraceAsString());
794
-            foreach ($traces as $trace){
794
+            foreach ($traces as $trace) {
795 795
                 $stackTraceBox->addItem($W->Label($trace));
796 796
             }
797 797
         }
798
-        else{
798
+        else {
799 799
             $section->addItem($W->Label($App->translate('Please contact the administrator')));
800 800
         }
801 801
         
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
     
805 805
     private function accessPage(\Exception $e)
806 806
     {
807
-        if($this->isAjaxRequest()){
807
+        if ($this->isAjaxRequest()) {
808 808
             $message = $e->getMessage();
809 809
             $json = array(
810 810
                 'messages' => array(
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
             echo bab_json_encode($json);
818 818
             die();
819 819
         }
820
-        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
820
+        header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
821 821
         header('Cache-Control: no-cache, must-revalidate');
822 822
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
823 823
         
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
      */
855 855
     public function requireSaveMethod()
856 856
     {
857
-        if('GET' === $_SERVER['REQUEST_METHOD']){
857
+        if ('GET' === $_SERVER['REQUEST_METHOD']) {
858 858
             throw new AppException('Method not allowed');
859 859
         }
860 860
         
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
      */
870 870
     public function requireDeleteMethod()
871 871
     {
872
-        if('GET' === $_SERVER['REQUEST_METHOD']){
872
+        if ('GET' === $_SERVER['REQUEST_METHOD']) {
873 873
             throw new AppException('Method not allowed');
874 874
         }
875 875
         
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
             'position' => $position
902 902
         );
903 903
         $babBody = bab_getBody();
904
-        if(! isset($babBody->messages['toasts'])){
904
+        if (!isset($babBody->messages['toasts'])) {
905 905
             $babBody->messages['toasts'] = array();
906 906
         }
907 907
         $babBody->messages['toasts'][] = $toast;
Please login to merge, or discard this patch.
Braces   +20 added lines, -40 removed lines patch added patch discarded remove patch
@@ -183,8 +183,7 @@  discard block
 block discarded – undo
183 183
     {
184 184
         if($this->isAjaxRequest()){
185 185
             $authType = 'Basic';
186
-        }
187
-        else{
186
+        } else{
188 187
             $authType = '';
189 188
         }
190 189
         
@@ -253,8 +252,7 @@  discard block
 block discarded – undo
253 252
                     
254 253
                     if($parameter->isDefaultValueAvailable()){
255 254
                         $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true);
256
-                    }
257
-                    else{
255
+                    } else{
258 256
                         $parametersStr[] = '$' . $parameter->name;
259 257
                     }
260 258
                 }
@@ -349,11 +347,9 @@  discard block
 block discarded – undo
349 347
             $parameterName = $parameter->getName();
350 348
             if(isset($args[$argNumber])){
351 349
                 $actionParams[$parameterName] = $args[$argNumber];
352
-            }
353
-            elseif($parameter->isDefaultValueAvailable()){
350
+            } elseif($parameter->isDefaultValueAvailable()){
354 351
                 $actionParams[$parameterName] = $parameter->getDefaultValue();
355
-            }
356
-            else{
352
+            } else{
357 353
                 $actionParams[$parameterName] = null;
358 354
             }
359 355
             $argNumber ++;
@@ -431,8 +427,7 @@  discard block
 block discarded – undo
431 427
             if($component){
432 428
                 $this->app->setCurrentComponent($component);
433 429
                 $objectController = $component->controller(false);
434
-            }
435
-            else{
430
+            } else{
436 431
                 header('HTTP/1.0 400 Bad Request');
437 432
                 throw new AppUnknownActionException($action);
438 433
             }
@@ -447,13 +442,11 @@  discard block
 block discarded – undo
447 442
         
448 443
         try{
449 444
             $returnedValue = $objectController->execAction($action);
450
-        }
451
-        catch (AppAccessException $e){
445
+        } catch (AppAccessException $e){
452 446
             
453 447
             if(! bab_isUserLogged() && $e->requireCredential){
454 448
                 bab_requireCredential($e->getMessage());
455
-            }
456
-            else{
449
+            } else{
457 450
                 if($this->isAjaxRequest()){
458 451
                     
459 452
                     header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
@@ -466,8 +459,7 @@  discard block
 block discarded – undo
466 459
                 }
467 460
                 $this->accessPage($e);
468 461
             }
469
-        }
470
-        catch (AppSaveException $e){
462
+        } catch (AppSaveException $e){
471 463
             
472 464
             if($this->isAjaxRequest()){
473 465
                 header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
@@ -481,17 +473,13 @@  discard block
 block discarded – undo
481 473
                     'errorMessage' => bab_convertStringFromDatabase($e->getMessage(), 'UTF-8')
482 474
                 )));
483 475
             }
484
-        }
485
-        catch (AppDeletedRecordException $e){
476
+        } catch (AppDeletedRecordException $e){
486 477
             $this->deletedItemPage($action, $e);
487
-        }
488
-        catch (AppNotFoundException $e){
478
+        } catch (AppNotFoundException $e){
489 479
             $this->notFoundPage($action, $e);
490
-        }
491
-        catch (\ORM_Exception $e){
480
+        } catch (\ORM_Exception $e){
492 481
             $this->errorPage($e);
493
-        }
494
-        catch (\Exception $e){
482
+        } catch (\Exception $e){
495 483
             $this->unexpectedErrorPage($e);
496 484
         }
497 485
         
@@ -503,8 +491,7 @@  discard block
 block discarded – undo
503 491
                 
504 492
                 // If the action returned a page, we display it.
505 493
                 $returnedValue->displayHtml();
506
-            }
507
-            else{
494
+            } else{
508 495
                 
509 496
                 $htmlCanvas = $W->HtmlCanvas();
510 497
                 if(self::$acceptJson){
@@ -516,8 +503,7 @@  discard block
 block discarded – undo
516 503
                     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
517 504
                     header('Content-type: application/json');
518 505
                     die(bab_json_encode($returnArray));
519
-                }
520
-                else{
506
+                } else{
521 507
                     header('Cache-Control: no-cache, must-revalidate');
522 508
                     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
523 509
                     header('Content-type: text/html');
@@ -526,8 +512,7 @@  discard block
 block discarded – undo
526 512
                         
527 513
                         if(method_exists($htmlCanvas, 'sendPageTitle')){
528 514
                             $htmlCanvas->sendPageTitle($pageTitle);
529
-                        }
530
-                        else{
515
+                        } else{
531 516
                             header('X-Cto-PageTitle: ' . $pageTitle);
532 517
                         }
533 518
                     }
@@ -535,16 +520,14 @@  discard block
 block discarded – undo
535 520
                     die($html);
536 521
                 }
537 522
             }
538
-        }
539
-        elseif(is_array($returnedValue)){
523
+        } elseif(is_array($returnedValue)){
540 524
             
541 525
             $htmlCanvas = $W->HtmlCanvas();
542 526
             $returnedArray = array();
543 527
             foreach ($returnedValue as $key => &$item){
544 528
                 if($item instanceof WidgetDisplayableInterface){
545 529
                     $returnedArray[$item->getId()] = $item->display($htmlCanvas);
546
-                }
547
-                else{
530
+                } else{
548 531
                     $returnedArray[$key] = $item;
549 532
                 }
550 533
             }
@@ -552,8 +535,7 @@  discard block
 block discarded – undo
552 535
             header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
553 536
             header('Content-type: application/json');
554 537
             die(bab_convertStringFromDatabase(bab_json_encode($returnedArray), \bab_charset::UTF_8));
555
-        }
556
-        elseif(true === $returnedValue || is_string($returnedValue)){
538
+        } elseif(true === $returnedValue || is_string($returnedValue)){
557 539
             
558 540
             if($this->isAjaxRequest()){
559 541
                 $body = bab_getBody();
@@ -730,8 +712,7 @@  discard block
 block discarded – undo
730 712
             foreach ($traces as $trace){
731 713
                 $stackTraceBox->addItem($W->Label($trace));
732 714
             }
733
-        }
734
-        else{
715
+        } else{
735 716
             $section->addItem($W->Label($App->translate('Please contact the administrator')));
736 717
         }
737 718
         
@@ -794,8 +775,7 @@  discard block
 block discarded – undo
794 775
             foreach ($traces as $trace){
795 776
                 $stackTraceBox->addItem($W->Label($trace));
796 777
             }
797
-        }
798
-        else{
778
+        } else{
799 779
             $section->addItem($W->Label($App->translate('Please contact the administrator')));
800 780
         }
801 781
         
Please login to merge, or discard this patch.
programs/Exceptions/AppUnknownActionException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 {
28 28
     public function __construct($action, $code = 0)
29 29
     {
30
-        $message = 'Unknown method "' . $action->getController() . '::' . $action->getMethod() . '"';
30
+        $message = 'Unknown method "'.$action->getController().'::'.$action->getMethod().'"';
31 31
         parent::__construct($message, $code);
32 32
     }
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
programs/Exceptions/AppNotFoundException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
     public function getObjectTitle()
73 73
     {
74 74
         $element = app_translate('object');
75
-        if($description = $this->getRecordSet()->getDescription()){
75
+        if ($description = $this->getRecordSet()->getDescription()) {
76 76
             $element = mb_strtolower(app_translate($description));
77 77
         }
78 78
         
Please login to merge, or discard this patch.
programs/Exceptions/AppDeletedRecordException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function getDeletedBy()
55 55
     {
56
-        if(! $this->record->deletedBy){
56
+        if (!$this->record->deletedBy) {
57 57
             return null;
58 58
         }
59 59
         
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     public function getDeletedOn()
69 69
     {
70 70
         $set = $this->getRecordSet();
71
-        if(! $set->deletedOn->isValueSet($this->record->deletedOn)){
71
+        if (!$set->deletedOn->isValueSet($this->record->deletedOn)) {
72 72
             return null;
73 73
         }
74 74
         
Please login to merge, or discard this patch.