Passed
Branchfeature/useWidgetsNamespaces_c... (264d4b)
by Robin
04:22
created
programs/Ui/AppTableModelViewColumnSettingsEditor.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $this->modelView = $modelView;
45 45
         $this->modelViewId = $modelView->getId();
46
-        if(! isset($id) || empty($id)){
46
+        if (!isset($id) || empty($id)) {
47 47
             $id = $this->getDefaultEditorId();
48 48
         }
49 49
         parent::__construct($app, $id, $layout);
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
         );
96 96
         
97 97
         $select = $W->Select();
98
-        foreach ($pagesLengths as $pagesLength){
98
+        foreach ($pagesLengths as $pagesLength) {
99 99
             $select->addOption($pagesLength, $pagesLength);
100 100
         }
101 101
         $value = 15; 
102
-        if(($temp = $W->getUserConfiguration($this->modelViewId . '/pageLength', 'widgets')) != null){
102
+        if (($temp = $W->getUserConfiguration($this->modelViewId.'/pageLength', 'widgets')) != null) {
103 103
             $value = $temp;
104 104
         }
105 105
         $select->setValue($value);
@@ -114,20 +114,20 @@  discard block
 block discarded – undo
114 114
         $W = bab_Widgets();
115 115
         $columns = $this->modelView->getVisibleColumns();
116 116
         $sum = false;
117
-        foreach($columns as $column){
117
+        foreach ($columns as $column) {
118 118
             /**
119 119
              * @var WidgetTableModelViewColumn $column 
120 120
              */
121
-            if($column->isSummable()){
121
+            if ($column->isSummable()) {
122 122
                 $sum = true;
123 123
                 break;
124 124
             }
125 125
         }
126
-        if(!$sum){
126
+        if (!$sum) {
127 127
             return null;
128 128
         }
129 129
         $checkbox = $W->CheckBox();
130
-        $checkbox->setValue($W->getUserConfiguration($this->modelViewId . '/displaySubTotalRow', 'widgets'));
130
+        $checkbox->setValue($W->getUserConfiguration($this->modelViewId.'/displaySubTotalRow', 'widgets'));
131 131
         
132 132
         return $W->LabelledWidget($this->App()
133 133
             ->translate('Display subtotal rows'), $checkbox, 'displaySubTotalRow')
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         $columns = $this->modelView->getVisibleColumns();
143 143
         
144 144
         $columnsBox = $W->VBoxItems();
145
-        $columnsBox->addAttribute("style","padding-top: 2em");
145
+        $columnsBox->addAttribute("style", "padding-top: 2em");
146 146
         $columnsBox->setId('tableviewColumnSelectionFormTopSubmitBox');
147 147
         $columnsBox->addClass('widget-100pc');
148 148
         
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
             ->setWrap(WidgetFlexLayout::FLEX_WRAP_WRAP)));
159 159
         $col = 0;
160 160
         
161
-        foreach ($columns as $path => $column){
161
+        foreach ($columns as $path => $column) {
162 162
             
163
-            if(! $column->isInList()){
163
+            if (!$column->isInList()) {
164 164
                 continue;
165 165
             }
166
-            if($column->isSelectable() && $column->getSelectableName() != ''){
166
+            if ($column->isSelectable() && $column->getSelectableName() != '') {
167 167
                 $columnList->addItem($W->FlexItems($labelledWidget = $W->LabelledWidget($column->getSelectableName(), $W->CheckBox()
168 168
                     ->setValue($column->isVisible()), array(
169 169
                     'columns',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                     ->addAttribute('style', 'flex-grow: 1; width: 33%;'));
175 175
                 $labelledWidget->getLabelWidget()->addClass('columnListElementLabel');
176 176
             }
177
-            $col ++;
177
+            $col++;
178 178
         }
179 179
         
180 180
         return $columnsBox;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $W = $this->widgets;
193 193
         $App = $this->App();
194 194
         
195
-        if(isset($this->saveAction)){
195
+        if (isset($this->saveAction)) {
196 196
             $saveLabel = isset($this->saveLabel) ? $this->saveLabel : $App->translate('Save');
197 197
             $submitButton = $W->SubmitButton();
198 198
             $submitButton->validate()
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
                 ->setFailedAction($this->failedAction)
201 201
                 ->setSuccessAction($this->successAction)
202 202
                 ->setLabel($saveLabel);
203
-            if($this->isAjax){
203
+            if ($this->isAjax) {
204 204
                 $submitButton->setAjaxAction();
205 205
             }
206 206
             $this->addButton($submitButton);
207 207
         }
208 208
         
209
-        if(isset($this->resetAction)){
209
+        if (isset($this->resetAction)) {
210 210
             $resetLabel = isset($this->resetLabel) ? $this->resetLabel : $App->translate('Reset default columns');
211 211
             $resetButton = $W->SubmitButton();
212 212
             $resetButton->validate()
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
                 ->setSuccessAction($this->resetAction)
216 216
                 ->addClass('resetButton')
217 217
                 ->setLabel($resetLabel);
218
-            if($this->isAjax){
218
+            if ($this->isAjax) {
219 219
                 $resetButton->setAjaxAction();
220 220
             }
221 221
             $this->addButton($resetButton);
222 222
         }
223 223
         
224
-        if(isset($this->cancelAction)){
224
+        if (isset($this->cancelAction)) {
225 225
             $cancelLabel = isset($this->cancelLabel) ? $this->cancelLabel : $App->translate('Cancel');
226 226
             $this->addButton($W->SubmitButton()
227 227
                 ->addClass('widget-close-dialog')
Please login to merge, or discard this patch.
programs/FuncApp.php 2 patches
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 
57 57
 bab_Widgets();
58 58
 
59
-require_once dirname(__FILE__) . '/define.php';
60
-require_once dirname(__FILE__) . '/functions.php';
59
+require_once dirname(__FILE__).'/define.php';
60
+require_once dirname(__FILE__).'/functions.php';
61 61
 
62 62
 $libappAddon = bab_getAddonInfosInstance('libapp');
63 63
 $libappPhpPath = $libappAddon->getPhpPath();
64 64
 
65
-require_once $libappPhpPath . '../vendor/autoload.php';
65
+require_once $libappPhpPath.'../vendor/autoload.php';
66 66
 
67 67
 /**
68 68
  * Provides extensible functionalities to manage an application.
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
         $this->addonPrefix = 'app';
99 99
 
100 100
         $this->classPrefix = 'App';
101
-        $this->controllerTg = 'addon/' . $this->addonName . '/main';
101
+        $this->controllerTg = 'addon/'.$this->addonName.'/main';
102 102
 
103 103
         $addon = bab_getAddonInfosInstance($this->addonName);
104 104
         $this->phpPath = $addon->getPhpPath();
105 105
         $this->recordSetPath = $this->phpPath;
106 106
         $this->ctrlPath = $this->phpPath;
107
-        $this->uiPath = $this->phpPath . 'ui/';
107
+        $this->uiPath = $this->phpPath.'ui/';
108 108
 
109 109
         $babDB = bab_GetDatabaseInstance();
110 110
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         if (class_exists($componentDefinitionObjectName)) {
122 122
             $componentDefinition = new $componentDefinitionObjectName;
123 123
             $components = $componentDefinition->getComponents($this);
124
-            foreach ($components as $singleName => $singleComponent){
124
+            foreach ($components as $singleName => $singleComponent) {
125 125
                 $this->addComponent($singleName, $singleComponent);
126 126
             }
127 127
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $nbElem = count($componentName);
151 151
         $componentName = $componentName[$nbElem - 1];
152 152
         $componentName = strtoupper($componentName);
153
-        if(isset($this->components[$componentName])){
153
+        if (isset($this->components[$componentName])) {
154 154
             return $this->components[$componentName];
155 155
         }
156 156
         return null;
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
     
180 180
     public function __get($componentName)
181 181
     {
182
-        if(isset($this->components[$componentName])){
182
+        if (isset($this->components[$componentName])) {
183 183
             return $this->components[$componentName];
184
-        }else{
184
+        } else {
185 185
             return null;
186 186
         }
187 187
     }
@@ -200,12 +200,12 @@  discard block
 block discarded – undo
200 200
         
201 201
         $messages = array();
202 202
         
203
-        foreach ($components as $componentName => $component){
203
+        foreach ($components as $componentName => $component) {
204 204
             $dependencies = $component->checkDependencies();
205
-            foreach($dependencies['requiredComponents'] as $requiredComponent){
205
+            foreach ($dependencies['requiredComponents'] as $requiredComponent) {
206 206
                 $messages['requiredComponents'][$componentName][] = $requiredComponent;
207 207
             }
208
-            foreach($dependencies['optionalComponents'] as $optionalComponent){
208
+            foreach ($dependencies['optionalComponents'] as $optionalComponent) {
209 209
                 $messages['optionalComponents'][$componentName][] = $optionalComponent;
210 210
             }
211 211
         }
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
     {
218 218
         $components = $this->getComponents();
219 219
         $componentDefinitions = array();
220
-        foreach ($components as $component){
220
+        foreach ($components as $component) {
221 221
             $packageName = $component->getPackageName();
222
-            if(isset($componentDefinitions[$packageName]) && !empty($componentDefinitions[$packageName])){
222
+            if (isset($componentDefinitions[$packageName]) && !empty($componentDefinitions[$packageName])) {
223 223
                 continue;
224 224
             }
225 225
             $componentDefinitions[$packageName] = $component->getDefinition();
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
     public function getRecordSetPathname($class)
263 263
     {
264 264
         // $App->MyRecordSet() -> myrecord.class.php
265
-        $file = strtolower(substr($class, strlen($this->classPrefix), -3)) . '.class.php';
266
-        return $this->recordSetPath . $file;
265
+        $file = strtolower(substr($class, strlen($this->classPrefix), -3)).'.class.php';
266
+        return $this->recordSetPath.$file;
267 267
     }
268 268
 
269 269
     /**
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
     public function getRecordPathname($class)
276 276
     {
277 277
         // $App->MyRecord() -> myrecord.class.php
278
-        $file = strtolower(substr($class, strlen($this->classPrefix))) . '.class.php';
279
-        return $this->recordSetPath . $file;
278
+        $file = strtolower(substr($class, strlen($this->classPrefix))).'.class.php';
279
+        return $this->recordSetPath.$file;
280 280
     }
281 281
 
282 282
     /**
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 
377 377
             if (substr($method, 0, 7) === 'include' && substr($method, -3) === 'Set') {
378 378
                 $incl = $method;
379
-                $classNameMethod = substr($method, strlen('include')) . 'ClassName';
379
+                $classNameMethod = substr($method, strlen('include')).'ClassName';
380 380
 
381 381
 
382 382
                 $classname = $this->$classNameMethod();
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                                 // We need to revert to multilang fields before synchronizing.
399 399
                                 $set->useLang(false);
400 400
                             }
401
-                            $sql .= $mysqlbackend->setToSql($set) . "\n";
401
+                            $sql .= $mysqlbackend->setToSql($set)."\n";
402 402
                         }
403 403
                     }
404 404
                 }
@@ -423,9 +423,9 @@  discard block
 block discarded – undo
423 423
             ';
424 424
 
425 425
         $noPackageNames = array();
426
-        foreach ($this->components as $component){
426
+        foreach ($this->components as $component) {
427 427
             /* @var $component AppComponent */
428
-            try{
428
+            try {
429 429
                 /* @var $set ORMRecordSet */
430 430
                 $set = $component->recordSet();
431 431
                 //Check if the component is not overriden by the addon
@@ -433,26 +433,26 @@  discard block
 block discarded – undo
433 433
                 //In case the set has been overriden, we simply do nothing here, as it will be instanciated by the synchronizeSql method
434 434
                 $cmprc = new \ReflectionClass($set);
435 435
                 $componentSetClass = $cmprc->getShortName();
436
-                if(method_exists($this, $componentSetClass)){
436
+                if (method_exists($this, $componentSetClass)) {
437 437
                     continue;
438 438
                 }
439
-                if(method_exists($set, 'useLang')){
439
+                if (method_exists($set, 'useLang')) {
440 440
                     // This is necessary if the recordSet constructor uses a setLang().
441 441
                     // We need to revert to multilang fields before synchronizing.
442 442
                     $set->useLang(false);
443 443
                 }
444
-                $sql .= $mysqlbackend->setToSql($set) . "\n";
444
+                $sql .= $mysqlbackend->setToSql($set)."\n";
445 445
                 
446
-                if(empty($component->getPackageName())){
446
+                if (empty($component->getPackageName())) {
447 447
                     $noPackageNames[] = $component->getName();
448 448
                 }
449 449
             }
450
-            catch (\Exception $e){
450
+            catch (\Exception $e) {
451 451
                 
452 452
             }
453 453
         }
454 454
         
455
-        if(!empty($noPackageNames)){
455
+        if (!empty($noPackageNames)) {
456 456
             $errorMessage = implode(', ', $noPackageNames);
457 457
             babinstallWindow::message(
458 458
                 sprintf(
@@ -475,18 +475,18 @@  discard block
 block discarded – undo
475 475
         $synchronize->fromSqlString($sql);
476 476
         
477 477
         $dependencies = $this->checkComponentsDependencies();
478
-        foreach ($dependencies['requiredComponents'] as $componentName => $requiredComponents){
479
-            foreach ($requiredComponents as $requiredComponent){
478
+        foreach ($dependencies['requiredComponents'] as $componentName => $requiredComponents) {
479
+            foreach ($requiredComponents as $requiredComponent) {
480 480
                 $hasComponent = $this->getComponentByName($requiredComponent);
481
-                if(!$hasComponent){
481
+                if (!$hasComponent) {
482 482
                     BabInstallWindow::message(sprintf($this->translate('The component %s is required for the component %s to work. You will encounter fatal errors'), $requiredComponent, $componentName));
483 483
                 }
484 484
             }
485 485
         }
486
-        foreach ($dependencies['optionalComponents'] as $componentName => $optionalComponents){
487
-            foreach ($optionalComponents as $optionalComponent){
486
+        foreach ($dependencies['optionalComponents'] as $componentName => $optionalComponents) {
487
+            foreach ($optionalComponents as $optionalComponent) {
488 488
                 $hasComponent = $this->getComponentByName($optionalComponent);
489
-                if(!$hasComponent){
489
+                if (!$hasComponent) {
490 490
                     BabInstallWindow::message(sprintf($this->translate('The optional component %s has not been added. The component %s may have reduced functionalities'), $optionalComponent, $componentName));
491 491
                 }
492 492
             }
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
     {
500 500
         $components = $this->getComponents();
501 501
         
502
-        foreach ($components as $component){
502
+        foreach ($components as $component) {
503 503
             $component->onUpdate();
504 504
         }
505 505
         
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 
521 521
             if (substr($method, 0, strlen('include')) === 'include' && substr($method, -strlen('Set')) === 'Set') {
522 522
                 $incl = $method;
523
-                $classNameMethod = substr($method, strlen('include')) . 'ClassName';
523
+                $classNameMethod = substr($method, strlen('include')).'ClassName';
524 524
 
525 525
                 $classname = $this->$classNameMethod();
526 526
 
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 
535 535
                             if (class_exists($classname) && method_exists($this, $call)) {
536 536
                                 $set = $this->$call();
537
-                                $sql .= $mysqlbackend->setToSql($set) . "\n";
537
+                                $sql .= $mysqlbackend->setToSql($set)."\n";
538 538
                             }
539 539
                         }
540 540
                     }
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 
549 549
     public function includeBase()
550 550
     {
551
-        require_once APP_PHP_PATH . 'base.class.php';
551
+        require_once APP_PHP_PATH.'base.class.php';
552 552
     }
553 553
 
554 554
     /**
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
     public function getRecordSetByRef($recordClassname)
596 596
     {
597 597
         $recordClassname = str_replace($this->classPrefix, '', $recordClassname);
598
-        $classSet = $recordClassname . 'Set';
598
+        $classSet = $recordClassname.'Set';
599 599
         $set = $this->$classSet();
600 600
         return $set;
601 601
     }
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         list($recordClassname, $id) = $refParts;
617 617
         $set = $this->getRecordSetByRef($recordClassname);
618 618
         if (isset($set)) {
619
-            if($noDefaultCriteria){
619
+            if ($noDefaultCriteria) {
620 620
                 $set->setDefaultCriteria(null);
621 621
             }
622 622
             return $set->get($id);
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
     {
636 636
         $fullClassName = get_class($record);
637 637
         list(, $className) = explode('_', $fullClassName);
638
-        return $className . ':' . $record->id;
638
+        return $className.':'.$record->id;
639 639
     }
640 640
 
641 641
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
         
692 692
         //Then, check if current component has a translation
693 693
         if ($translation === $str) {
694
-            if($currentComponent = $this->getCurrentComponent()){
694
+            if ($currentComponent = $this->getCurrentComponent()) {
695 695
                 $translator->setAddonName($currentComponent->getPackageName());
696 696
                 $translator->setLangPath($currentComponent->getLangPath());
697 697
                 $translation = $translator->translate($str, $str_plurals, $number);
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
         }
701 701
         //Then, check if libapp has a translation
702 702
         if ($translation === $str) { 
703
-            $translator->setLangPath(null);//Reset lang path
703
+            $translator->setLangPath(null); //Reset lang path
704 704
             $translator->setAddonName('libapp');
705 705
             $translation = $translator->translate($str, $str_plurals, $number);
706 706
         }
@@ -748,16 +748,16 @@  discard block
 block discarded – undo
748 748
      */
749 749
     public function mailTo($addr, $subject = null, $body = null)
750 750
     {
751
-        $mailTo = 'mailto:' . $addr;
751
+        $mailTo = 'mailto:'.$addr;
752 752
         $parameters = array();
753 753
         if (isset($subject)) {
754
-            $parameters[] = 'subject=' . $subject;
754
+            $parameters[] = 'subject='.$subject;
755 755
         }
756 756
         if (isset($body)) {
757
-            $parameters[] = 'body=' . $body;
757
+            $parameters[] = 'body='.$body;
758 758
         }
759 759
         if (!empty($parameters)) {
760
-            $mailTo .= '?' . implode('&', $parameters);
760
+            $mailTo .= '?'.implode('&', $parameters);
761 761
         }
762 762
 
763 763
         return $mailTo;
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
         }
809 809
 
810 810
         $number = number_format($number, $decimals, ',', ' ');
811
-        return str_replace(' ', bab_nbsp(), $number . ' ' . $prefix . $unitSymbol);
811
+        return str_replace(' ', bab_nbsp(), $number.' '.$prefix.$unitSymbol);
812 812
     }
813 813
 
814 814
 
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
         }
829 829
 
830 830
         if (!isset($format)) {
831
-            $format = BabRegistry::get('/' . $this->addonName . '/numberFormat', $PhoneNumber->getDefaultFormat());
831
+            $format = BabRegistry::get('/'.$this->addonName.'/numberFormat', $PhoneNumber->getDefaultFormat());
832 832
         }
833 833
         $phoneNumberUtil = $PhoneNumber->PhoneNumberUtil();
834 834
 
@@ -870,12 +870,12 @@  discard block
 block discarded – undo
870 870
         $rc = new \ReflectionClass($this);
871 871
         $namespace = $rc->getNamespaceName();
872 872
         $prefix = '';
873
-        if(!empty($namespace)){
873
+        if (!empty($namespace)) {
874 874
             $namespaces = explode('\\', $namespace);
875 875
             $prefix = $namespaces[0].'\\'.$namespaces[1].'\Ctrl\\';
876 876
         }
877 877
         $this->includeController();
878
-        return bab_getInstance($prefix.$this->classPrefix . 'Controller')->setApp($this);
878
+        return bab_getInstance($prefix.$this->classPrefix.'Controller')->setApp($this);
879 879
     }
880 880
 
881 881
 
@@ -916,12 +916,12 @@  discard block
 block discarded – undo
916 916
         $rc = new \ReflectionClass($this);
917 917
         $namespace = $rc->getNamespaceName();
918 918
         $prefix = '';
919
-        if(!empty($namespace)){
919
+        if (!empty($namespace)) {
920 920
             $namespaces = explode('\\', $namespace);
921 921
             $prefix = $namespaces[0].'\\'.$namespaces[1].'\Ui\\';
922 922
         }
923 923
         $this->includeUi();
924
-        return bab_getInstance($prefix.$this->classPrefix . 'Ui')->setApp($this);
924
+        return bab_getInstance($prefix.$this->classPrefix.'Ui')->setApp($this);
925 925
     }
926 926
 
927 927
     /**
@@ -948,40 +948,40 @@  discard block
 block discarded – undo
948 948
 
949 949
             case substr($name, -strlen('SetClassName')) === 'SetClassName':
950 950
                 $className = substr($name, 0, strlen($name) - strlen('SetClassName'));
951
-                if($component = $this->getComponentByName($className)){
951
+                if ($component = $this->getComponentByName($className)) {
952 952
                     return $component->getSetClassName();
953 953
                 }
954 954
                 $setName = $className.'Set';
955
-                return $this->classPrefix . $setName;
955
+                return $this->classPrefix.$setName;
956 956
 
957 957
             case substr($name, -strlen('ClassName')) === 'ClassName':
958 958
                 $recordName = substr($name, 0, strlen($name) - strlen('ClassName'));
959
-                if($component = $this->getComponentByName($recordName)){
959
+                if ($component = $this->getComponentByName($recordName)) {
960 960
                     return $component->getRecordClassName();
961 961
                 }
962
-                return $this->classPrefix . $recordName;
962
+                return $this->classPrefix.$recordName;
963 963
 
964 964
             case substr($name, 0, strlen('include')) === 'include' && substr($name, -strlen('Set')) === 'Set':
965 965
                 $fileNameBase = strtolower(substr(substr($name, 0, strlen($name) - strlen('Set')), strlen('include')));
966
-                if($this->getComponentByName($fileNameBase)){
966
+                if ($this->getComponentByName($fileNameBase)) {
967 967
                     return;
968 968
                 }
969
-                $path = APP_SET_PATH . $fileNameBase . '.class.php';
970
-                if(is_file($path)){
969
+                $path = APP_SET_PATH.$fileNameBase.'.class.php';
970
+                if (is_file($path)) {
971 971
                     require_once $path;
972 972
                 }
973 973
                 return;
974 974
 
975 975
             case substr($name, -strlen('Set')) === 'Set':
976
-                try{
976
+                try {
977 977
                     $sClassName = str_replace($this->classPrefix, '', $name);
978
-                    if(method_exists($this, $sClassName)){
978
+                    if (method_exists($this, $sClassName)) {
979 979
                         return $this->$sClassName();
980 980
                     }
981 981
                     throw new Exception("Class '{$sClassName}' not found");
982 982
                 }
983
-                catch(Exception $e){
984
-                    if($component = $this->getComponentByName(substr($name, 0, strlen($name) -strlen('Set')))){
983
+                catch (Exception $e) {
984
+                    if ($component = $this->getComponentByName(substr($name, 0, strlen($name) - strlen('Set')))) {
985 985
                         return $component->recordSet();
986 986
                     }
987 987
                     throw $e;
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
             case ($component = $this->getComponentByName($name)) != false:
991 991
                 return $component;
992 992
             default:
993
-                $setName = $name . 'Set';
994
-                $recordClassNameMethod = $name . 'ClassName';
993
+                $setName = $name.'Set';
994
+                $recordClassNameMethod = $name.'ClassName';
995 995
                 $recordClassName = $this->$recordClassNameMethod();
996 996
                 if (isset($arguments[0])) {
997 997
                     if ($arguments[0] instanceof $recordClassName) {
@@ -1005,38 +1005,38 @@  discard block
 block discarded – undo
1005 1005
     }
1006 1006
     
1007 1007
 
1008
-    public function LinkSet(){
1008
+    public function LinkSet() {
1009 1009
         return $this->AppLinkSet();
1010 1010
     }
1011
-    public function AppLinkSet(){
1011
+    public function AppLinkSet() {
1012 1012
         return new AppLinkSet($this);
1013 1013
     }
1014 1014
 
1015
-    public function CustomFieldSet(){
1015
+    public function CustomFieldSet() {
1016 1016
         return $this->AppCustomFieldSet();
1017 1017
     }
1018
-    public function AppCustomFieldSet(){
1018
+    public function AppCustomFieldSet() {
1019 1019
         return new AppCustomFieldSet($this);
1020 1020
     }
1021 1021
 
1022
-    public function CustomContainerSet(){
1022
+    public function CustomContainerSet() {
1023 1023
         return $this->AppCustomContainerSet();
1024 1024
     }
1025
-    public function AppCustomContainerSet(){
1025
+    public function AppCustomContainerSet() {
1026 1026
         return new AppCustomContainerSet($this);
1027 1027
     }
1028 1028
 
1029
-    public function CustomSectionSet(){
1029
+    public function CustomSectionSet() {
1030 1030
         return $this->AppCustomSectionSet();
1031 1031
     }
1032
-    public function AppCustomSectionSet(){
1032
+    public function AppCustomSectionSet() {
1033 1033
         return new AppCustomSectionSet($this);
1034 1034
     }
1035 1035
 
1036
-    public function LogSet(){
1036
+    public function LogSet() {
1037 1037
         return $this->AppLogSet();
1038 1038
     }
1039
-    public function AppLogSet(){
1039
+    public function AppLogSet() {
1040 1040
         return new AppLogSet($this);
1041 1041
     }
1042 1042
     
Please login to merge, or discard this patch.
Braces   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         if(isset($this->components[$componentName])){
183 183
             return $this->components[$componentName];
184
-        }else{
184
+        } else{
185 185
             return null;
186 186
         }
187 187
     }
@@ -446,8 +446,7 @@  discard block
 block discarded – undo
446 446
                 if(empty($component->getPackageName())){
447 447
                     $noPackageNames[] = $component->getName();
448 448
                 }
449
-            }
450
-            catch (\Exception $e){
449
+            } catch (\Exception $e){
451 450
                 
452 451
             }
453 452
         }
@@ -979,8 +978,7 @@  discard block
 block discarded – undo
979 978
                         return $this->$sClassName();
980 979
                     }
981 980
                     throw new Exception("Class '{$sClassName}' not found");
982
-                }
983
-                catch(Exception $e){
981
+                } catch(Exception $e){
984 982
                     if($component = $this->getComponentByName(substr($name, 0, strlen($name) -strlen('Set')))){
985 983
                         return $component->recordSet();
986 984
                     }
Please login to merge, or discard this patch.
programs/Ui/AppToolbar.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     
40 40
     public function __construct($id = null, WidgetLayout $layout = null)
41 41
     {
42
-        if(! isset($layout)){
42
+        if (!isset($layout)) {
43 43
             $W = bab_Widgets();
44 44
             $layout = $W->FlowLayout()->setHorizontalSpacing(1, 'em');
45 45
             $layout->setVerticalAlign('top');
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $W = bab_Widgets();
61 61
         $button = $W->Link($labelText, $action, $id);
62
-        if(isset($iconName)){
62
+        if (isset($iconName)) {
63 63
             $button->addClass('icon', $iconName);
64 64
         }
65 65
         
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
     public function addInstantForm(WidgetDisplayableInterface $form, $labelText = null, $iconName = null, $action = null, $id = null)
72 72
     {
73 73
         $W = bab_Widgets();
74
-        if(isset($iconName)){
74
+        if (isset($iconName)) {
75 75
             $content = $W->Icon($labelText, $iconName);
76 76
         }
77
-        else{
77
+        else {
78 78
             $content = $labelText;
79 79
         }
80 80
         $button = $W->Link($content, $action, $id);
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $this->addItem($W->VBoxItems($button->addClass('widget-instant-button'), $form->addClass('widget-instant-form'))
83 83
             ->addClass('widget-instant-container'));
84 84
         
85
-        if($form->getTitle() === null){
85
+        if ($form->getTitle() === null) {
86 86
             $form->setTitle($labelText);
87 87
         }
88 88
         
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
     
92 92
     public function display(WidgetCanvas $canvas)
93 93
     {
94
-        if(! $this->local){
94
+        if (!$this->local) {
95 95
             $this->addClass('widget-toolbar');
96 96
         }
97
-        else{
97
+        else {
98 98
             $this->addClass('app-toolbar');
99 99
         }
100 100
         $this->addClass(FuncIcons::ICON_LEFT_16);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,8 +73,7 @@  discard block
 block discarded – undo
73 73
         $W = bab_Widgets();
74 74
         if(isset($iconName)){
75 75
             $content = $W->Icon($labelText, $iconName);
76
-        }
77
-        else{
76
+        } else{
78 77
             $content = $labelText;
79 78
         }
80 79
         $button = $W->Link($content, $action, $id);
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
     {
94 93
         if(! $this->local){
95 94
             $this->addClass('widget-toolbar');
96
-        }
97
-        else{
95
+        } else{
98 96
             $this->addClass('app-toolbar');
99 97
         }
100 98
         $this->addClass(FuncIcons::ICON_LEFT_16);
Please login to merge, or discard this patch.
programs/Ui/AppTableModelView.php 2 patches
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
         
118 118
         $filterValues = $this->getFilterValues();
119 119
         
120
-        foreach ($this->visibleColumns as $columnPath => $column){
120
+        foreach ($this->visibleColumns as $columnPath => $column) {
121 121
             
122
-            if(! isset($this->columnsDescriptions[$columnPath])){
122
+            if (!isset($this->columnsDescriptions[$columnPath])) {
123 123
                 $this->columnsDescriptions[$columnPath] = $column->getDescription();
124 124
             }
125 125
             
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
             
132 132
             $sizePolicy = 'widget-actions-target';
133 133
             
134
-            if($this->isMultiSelect() && $columnPath === '_select_'){
134
+            if ($this->isMultiSelect() && $columnPath === '_select_') {
135 135
                 $this->toggleCheckAllBox = $W->CheckBox();
136 136
                 $this->toggleCheckAllBox->setName('toggleCheckAllBox');
137 137
                 $this->toggleCheckAllBox->setTitle(widget_translate('Select all on page'));
138 138
                 $this->toggleCheckAllBox->setSizePolicy('condensed');
139 139
                 $this->toggleCheckAllBox->setCheckedValue(true);
140
-                if(isset($_SESSION['toggleCheckAllBox'][$this->getId()]) && ! empty($_SESSION['toggleCheckAllBox'][$this->getId()]) && $_SESSION['toggleCheckAllBox'][$this->getId()] == 'on'){
140
+                if (isset($_SESSION['toggleCheckAllBox'][$this->getId()]) && !empty($_SESSION['toggleCheckAllBox'][$this->getId()]) && $_SESSION['toggleCheckAllBox'][$this->getId()] == 'on') {
141 141
                     $this->toggleCheckAllBox->setValue(true);
142 142
                 }
143 143
                 $isSearchable = false;
@@ -149,28 +149,28 @@  discard block
 block discarded – undo
149 149
 
150 150
                 }
151 151
                 
152
-                if($this->sortField === $columnPath && $this->sortAscending){
152
+                if ($this->sortField === $columnPath && $this->sortAscending) {
153 153
                     $direction = ':down';
154 154
                 }
155
-                else{
155
+                else {
156 156
                     $direction = ':up';
157 157
                 }
158 158
                 
159
-                $url = BabUrl::mod($this->sortBaseUrl, $this->sortParameterName, $columnPath . $direction);
159
+                $url = BabUrl::mod($this->sortBaseUrl, $this->sortParameterName, $columnPath.$direction);
160 160
                 if ($anchor = $this->getAnchor()) {
161
-                    $url .= '#' . urlencode($anchor);
161
+                    $url .= '#'.urlencode($anchor);
162 162
                 }
163 163
                 
164 164
                 $columnItem = $W->Link($W->FlexItems($W->Label($columnLabel), $W->Items()
165 165
                     ->addClass('widget-table-column-sorting-icons'))
166 166
                     ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_CONTENT_CENTER), $url)
167 167
                     ->addClass('widget-table-column-sorting-action');
168
-                if($this->sortAjaxAction){
169
-                    $columnItem->setAjaxAction($this->sortAjaxAction->setParameter('sort', $columnPath . $direction), '');
168
+                if ($this->sortAjaxAction) {
169
+                    $columnItem->setAjaxAction($this->sortAjaxAction->setParameter('sort', $columnPath.$direction), '');
170 170
                 }
171 171
                 $columnItem = $W->FlexItems($columnItem);
172 172
             }
173
-            else{
173
+            else {
174 174
                 $columnItem = $W->FlexItems($W->Label($columnLabel), $W->Label(''));
175 175
             }
176 176
             
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 
183 183
             }
184 184
             
185
-            if($isSortable){
185
+            if ($isSortable) {
186 186
                 $sizePolicy .= ' widget-table-column-sortable';
187 187
             }
188
-            if($isSearchable){
189
-                if(! isset($this->filterBaseUrl)){
188
+            if ($isSearchable) {
189
+                if (!isset($this->filterBaseUrl)) {
190 190
                     $this->filterBaseUrl = $this->getRecordControllerProxy()->displayListFilter();
191 191
                 }
192 192
                 $url = $this->filterBaseUrl;
@@ -198,27 +198,27 @@  discard block
 block discarded – undo
198 198
                     ->setDialogClass('box blue')
199 199
                     ->setDialogPositionRelativeToLink(true), 0);
200 200
                 $sizePolicy .= ' widget-table-column-searchable';
201
-                if(isset($filterValues[$columnPath]) && ! empty($filterValues[$columnPath])){
201
+                if (isset($filterValues[$columnPath]) && !empty($filterValues[$columnPath])) {
202 202
                     $sizePolicy .= ' widget-table-column-searched';
203 203
                 }
204 204
             }
205 205
             $items = $W->Items()->setSizePolicy($sizePolicy);
206 206
             $items->addItem($columnItem);
207 207
             
208
-            $this->addItem($items, 0, $col ++);
208
+            $this->addItem($items, 0, $col++);
209 209
         }
210 210
     }
211 211
     
212 212
     protected function initRow($record, $row)
213 213
     {
214
-        if($this->highlightRows == null){
214
+        if ($this->highlightRows == null) {
215 215
             $this->highlightRows = $this->getHighlightedRows();
216 216
         }
217 217
         
218
-        if($this->highlightRows == null){
219
-            return parent::initRow($record,$row);
218
+        if ($this->highlightRows == null) {
219
+            return parent::initRow($record, $row);
220 220
         }
221
-        if(in_array($record->id,$this->highlightRows)){
221
+        if (in_array($record->id, $this->highlightRows)) {
222 222
             $this->addRowClass($row, "app_highlightRow");
223 223
         }
224 224
         $this->addRowClass($row, "app_highlightAvailable");
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function App()
246 246
     {
247
-        if(! isset($this->app)){
247
+        if (!isset($this->app)) {
248 248
             // If the app object was not specified (through the setApp() method)
249 249
             // we try to select one according to the classname prefix.
250 250
             list ($prefix) = explode('_', get_class($this));
251 251
             $functionalityName = ucwords($prefix);
252
-            $this->app = BabFunctionality::get('App/' . $functionalityName);
252
+            $this->app = BabFunctionality::get('App/'.$functionalityName);
253 253
             if (!$this->app) {
254 254
                 $this->app = BabFunctionality::get('App');
255 255
             }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     {
262 262
         $customFields = $recordSet->getCustomFields();
263 263
         
264
-        foreach ($customFields as $customField){
264
+        foreach ($customFields as $customField) {
265 265
             $fieldname = $customField->fieldname;
266 266
             $this->addColumn(app_TableModelViewColumn($recordSet->$fieldname, $customField->name)->setSortable(true)
267 267
                 ->setExportable(true)
@@ -288,39 +288,39 @@  discard block
 block discarded – undo
288 288
         
289 289
         $filterPanel = $W->Filter();
290 290
         $filterPanel->setLayout($W->VBoxLayout());
291
-        if(isset($name)){
291
+        if (isset($name)) {
292 292
             $filterPanel->setName($name);
293 293
         }
294 294
         
295 295
         $pageLength = $this->getPageLength();
296
-        if(null === $pageLength){
296
+        if (null === $pageLength) {
297 297
             $pageLength = 15;
298 298
         }
299 299
         
300 300
         $pageNumber = $this->getCurrentPage();
301
-        if(null === $pageNumber){
301
+        if (null === $pageNumber) {
302 302
             $pageNumber = 0;
303 303
         }
304 304
         
305 305
         $this->setPageLength(isset($filter['pageSize']) ? $filter['pageSize'] : $pageLength);
306 306
         $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber);
307 307
         
308
-        if(isset($name)){
309
-            $this->sortParameterName = $name . '[filter][sort]';
308
+        if (isset($name)) {
309
+            $this->sortParameterName = $name.'[filter][sort]';
310 310
         }
311
-        else{
311
+        else {
312 312
             $this->sortParameterName = 'filter[sort]';
313 313
         }
314 314
         
315
-        if(isset($filter['sort'])){
315
+        if (isset($filter['sort'])) {
316 316
             $this->setSortField($filter['sort']);
317 317
         }
318
-        elseif(! isset($this->sortField)){
318
+        elseif (!isset($this->sortField)) {
319 319
             
320
-            if(method_exists($this, 'getDefaultSortField')){
320
+            if (method_exists($this, 'getDefaultSortField')) {
321 321
                 $this->setSortField($this->getDefaultSortField());
322 322
             }
323
-            else{
323
+            else {
324 324
                 $columns = $this->getVisibleColumns();
325 325
                 $sortField = key($columns);
326 326
                 $this->setSortField($sortField);
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
         
330 330
         $form = $this->getFilterForm();
331 331
         
332
-        if(isset($filter)){
333
-            if(isset($name)){
332
+        if (isset($filter)) {
333
+            if (isset($name)) {
334 334
                 $path = array(
335 335
                     $name,
336 336
                     'filter'
337 337
                 );
338 338
             }
339
-            else{
339
+            else {
340 340
                 $path = array(
341 341
                     'filter'
342 342
                 );
@@ -362,19 +362,19 @@  discard block
 block discarded – undo
362 362
     
363 363
     protected function isFilterFieldSpecified($filter, $fieldPath)
364 364
     {
365
-        if(isset($filter[$fieldPath])){
365
+        if (isset($filter[$fieldPath])) {
366 366
             $value = $filter[$fieldPath];
367
-            if(is_array($value)){
368
-                foreach ($value as $val){
367
+            if (is_array($value)) {
368
+                foreach ($value as $val) {
369 369
                     $val = trim($val);
370
-                    if(! empty($val)){
370
+                    if (!empty($val)) {
371 371
                         return true;
372 372
                     }
373 373
                 }
374 374
                 return false;
375 375
             }
376 376
             
377
-            if(trim($value) !== ''){
377
+            if (trim($value) !== '') {
378 378
                 return true;
379 379
             }
380 380
         }
@@ -384,21 +384,21 @@  discard block
 block discarded – undo
384 384
     
385 385
     protected function handleFilterInputWidget($name, ORMField $field = null)
386 386
     {
387
-        if(null === $field){
387
+        if (null === $field) {
388 388
             return null;
389 389
         }
390 390
         
391 391
         $W = bab_Widgets();
392 392
         
393
-        if($field instanceof ORMFkField){            
393
+        if ($field instanceof ORMFkField) {            
394 394
             $App = $this->App();
395 395
             $setName = $field->getForeignSetName();
396 396
             
397 397
             $pos = strrpos($setName, '\\');
398
-            if($pos === false){
398
+            if ($pos === false) {
399 399
                 list (, $appSetName) = explode('_', $setName);
400 400
             }
401
-            else{
401
+            else {
402 402
                 list (, $appSetName) = array(
403 403
                     substr($setName, 0, $pos),
404 404
                     substr($setName, $pos + 1)
@@ -409,18 +409,18 @@  discard block
 block discarded – undo
409 409
             $set->setName($field->getName());
410 410
             $set->setDescription($field->getDescription());
411 411
             
412
-            if($set === null){
412
+            if ($set === null) {
413 413
                 return null;
414 414
             }
415 415
             
416 416
             $values = $set->select();
417
-            if($values->count()>15){
417
+            if ($values->count() > 15) {
418 418
                 $widget = bab_Widgets()->select2();
419 419
                 $widget->setDataSource($set->getController()->search());
420
-            }else{
420
+            } else {
421 421
                 $widget = $W->Select();
422 422
                 $widget->addOption('', '');
423
-                foreach ($values as $record){
423
+                foreach ($values as $record) {
424 424
                     $widget->addOption($record->id, (string) $record->name);
425 425
                 }
426 426
                 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
         $displayAdvancedForm = $this->isAdvancedFormDisplayed();
505 505
         $advancedFiltersFrame = $W->VBoxItems($addFilterButton)->addClass('widget-instant-container');
506 506
             
507
-        if($displayAdvancedForm){
507
+        if ($displayAdvancedForm) {
508 508
             $filterBox = $W->FlowLayout()
509 509
                 ->addClass('widget-instant-form')
510 510
                 ->setHorizontalSpacing(2, 'em')
@@ -515,20 +515,20 @@  discard block
 block discarded – undo
515 515
         
516 516
         $columns = $this->getVisibleColumns();
517 517
         
518
-        foreach ($columns as $fieldName => $column){
518
+        foreach ($columns as $fieldName => $column) {
519 519
             $field = $column->getField();
520
-            if(! $column->isSearchable()){
520
+            if (!$column->isSearchable()) {
521 521
                 continue;
522 522
             }
523 523
             
524
-            if(! ($field instanceof ORMField)){
524
+            if (!($field instanceof ORMField)) {
525 525
                 $field = null;
526 526
             }
527 527
             
528 528
             $label = $this->handleFilterLabelWidget($fieldName, $field);
529 529
             $input = $this->handleFilterInputWidget($fieldName, $field);
530 530
             
531
-            if(isset($input) && isset($label)){
531
+            if (isset($input) && isset($label)) {
532 532
                 
533 533
                 $input->setName($fieldName);
534 534
                 $label->setAssociatedWidget($input);
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
                 $formItem = $this->handleFilterLabel($label, $input);
539 539
                 
540 540
                 // $formItem = $W->Section($label->getText(), $input, 7)->setFoldable(true, true);
541
-                $formItem->addClass('compact', 'field_' . $fieldName);
541
+                $formItem->addClass('compact', 'field_'.$fieldName);
542 542
                 
543 543
                 $mainSearch = (method_exists($column, 'isMainSearch') && $column->isMainSearch());
544 544
                 
545
-                if($mainSearch || $this->isFilterFieldSpecified($filter, $column->getFieldPath())){
545
+                if ($mainSearch || $this->isFilterFieldSpecified($filter, $column->getFieldPath())) {
546 546
                     
547 547
                     $removeColumnsAction = $W->Action();
548 548
                     $removeColumnsAction->setMethod('addon/widgets/configurationstorage', 'removeFilter', array(
@@ -558,19 +558,19 @@  discard block
 block discarded – undo
558 558
                         ->addAttribute('data-removefor', $column->getFieldPath()))
559 559
                         ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_ITEMS_FLEX_END));
560 560
                 }
561
-                elseif($displayAdvancedForm){
561
+                elseif ($displayAdvancedForm) {
562 562
                     $formItem->setSizePolicy('col-lg-2 col-md-3 col-sm-6 col-xs-12');
563 563
                     $filterBox->addItem($formItem);
564 564
                 }
565 565
             }
566 566
         }
567 567
         
568
-        if(! $this->submit){
568
+        if (!$this->submit) {
569 569
             $this->submit = $W->SubmitButton();
570 570
             $this->submit->setLabel(Widget_translate('Apply filter'));
571 571
         }
572 572
         
573
-        if($controller = $this->getRecordController()){
573
+        if ($controller = $this->getRecordController()) {
574 574
             $proxy = $controller->proxy();
575 575
             $this->reset = $W->Link($App->translate('Reset'), $proxy->resetFilters())
576 576
                 ->addClass('icon', FuncIcons::ACTIONS_VIEW_REFRESH, 'widget-actionbutton')
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
             $this->filterMenu->addClass(FuncIcons::ICON_LEFT_16);
593 593
             
594 594
             $filterNames = $controller->getFilterNames();
595
-            if(count($filterNames) > 0){
595
+            if (count($filterNames) > 0) {
596 596
                 // $this->select = $W->Menu(null, $W->VBoxItems());
597 597
                 // $this->select->setButtonClass('widget-link icon actions-list-filter');
598 598
                 // $this->select->setButtonLabel($App->translate('Saved filters'));
599 599
                 // $this->select->addClass(FuncIcons::ICON_LEFT_16);
600 600
                 
601
-                foreach ($filterNames as $filterName){
602
-                    $filter = $W->getUserConfiguration($controller->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false);
601
+                foreach ($filterNames as $filterName) {
602
+                    $filter = $W->getUserConfiguration($controller->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false);
603 603
                     
604 604
                     // $this->select->addItem(
605 605
                     // $W->Link(
@@ -673,39 +673,39 @@  discard block
 block discarded – undo
673 673
         
674 674
         $filterPanel = $W->Filter();
675 675
         $filterPanel->setLayout($W->VBoxLayout());
676
-        if(isset($name)){
676
+        if (isset($name)) {
677 677
             $filterPanel->setName($name);
678 678
         }
679 679
         
680 680
         $pageLength = $this->getPageLength();
681
-        if(null === $pageLength){
681
+        if (null === $pageLength) {
682 682
             $pageLength = 15;
683 683
         }
684 684
         
685 685
         $pageNumber = $this->getCurrentPage();
686
-        if(null === $pageNumber){
686
+        if (null === $pageNumber) {
687 687
             $pageNumber = 0;
688 688
         }
689 689
         
690 690
         $this->setPageLength(isset($filter['pageSize']) ? $filter['pageSize'] : $pageLength);
691 691
         // $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber);
692 692
         
693
-        if(isset($name)){
694
-            $this->sortParameterName = $name . '[filter][sort]';
693
+        if (isset($name)) {
694
+            $this->sortParameterName = $name.'[filter][sort]';
695 695
         }
696
-        else{
696
+        else {
697 697
             $this->sortParameterName = 'filter[sort]';
698 698
         }
699 699
         
700
-        if(isset($filter['sort'])){
700
+        if (isset($filter['sort'])) {
701 701
             $this->setSortField($filter['sort']);
702 702
         }
703
-        elseif(! isset($this->sortField)){
703
+        elseif (!isset($this->sortField)) {
704 704
             
705
-            if(method_exists($this, 'getDefaultSortField')){
705
+            if (method_exists($this, 'getDefaultSortField')) {
706 706
                 $this->setSortField($this->getDefaultSortField());
707 707
             }
708
-            else{
708
+            else {
709 709
                 $columns = $this->getVisibleColumns();
710 710
                 $sortField = key($columns);
711 711
                 $this->setSortField($sortField);
@@ -714,14 +714,14 @@  discard block
 block discarded – undo
714 714
         
715 715
         $form = $this->getAdvancedFilterForm(null, $filter);
716 716
         
717
-        if(isset($filter)){
718
-            if(isset($name)){
717
+        if (isset($filter)) {
718
+            if (isset($name)) {
719 719
                 $path = array(
720 720
                     $name,
721 721
                     'filter'
722 722
                 );
723 723
             }
724
-            else{
724
+            else {
725 725
                 $path = array(
726 726
                     'filter'
727 727
                 );
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      */
759 759
     public function getRecordControllerProxy()
760 760
     {
761
-        if(! isset($this->recordControllerProxy)){
761
+        if (!isset($this->recordControllerProxy)) {
762 762
             $this->recordControllerProxy = $this->getRecordController()->proxy();
763 763
         }
764 764
         return $this->recordControllerProxy;
@@ -773,11 +773,11 @@  discard block
 block discarded – undo
773 773
  */
774 774
 function app_TableModelViewColumn($field, $description = null)
775 775
 {
776
-    if(null === $field){
776
+    if (null === $field) {
777 777
         return null;
778 778
     }
779 779
     
780
-    if(! isset($description) && $field instanceof ORMField){
780
+    if (!isset($description) && $field instanceof ORMField) {
781 781
         $App = $field->getParentSet()->App();
782 782
         $description = $App->translate($field->getDescription());
783 783
     }
Please login to merge, or discard this patch.
Braces   +13 added lines, -25 removed lines patch added patch discarded remove patch
@@ -151,8 +151,7 @@  discard block
 block discarded – undo
151 151
                 
152 152
                 if($this->sortField === $columnPath && $this->sortAscending){
153 153
                     $direction = ':down';
154
-                }
155
-                else{
154
+                } else{
156 155
                     $direction = ':up';
157 156
                 }
158 157
                 
@@ -169,8 +168,7 @@  discard block
 block discarded – undo
169 168
                     $columnItem->setAjaxAction($this->sortAjaxAction->setParameter('sort', $columnPath . $direction), '');
170 169
                 }
171 170
                 $columnItem = $W->FlexItems($columnItem);
172
-            }
173
-            else{
171
+            } else{
174 172
                 $columnItem = $W->FlexItems($W->Label($columnLabel), $W->Label(''));
175 173
             }
176 174
             
@@ -307,20 +305,17 @@  discard block
 block discarded – undo
307 305
         
308 306
         if(isset($name)){
309 307
             $this->sortParameterName = $name . '[filter][sort]';
310
-        }
311
-        else{
308
+        } else{
312 309
             $this->sortParameterName = 'filter[sort]';
313 310
         }
314 311
         
315 312
         if(isset($filter['sort'])){
316 313
             $this->setSortField($filter['sort']);
317
-        }
318
-        elseif(! isset($this->sortField)){
314
+        } elseif(! isset($this->sortField)){
319 315
             
320 316
             if(method_exists($this, 'getDefaultSortField')){
321 317
                 $this->setSortField($this->getDefaultSortField());
322
-            }
323
-            else{
318
+            } else{
324 319
                 $columns = $this->getVisibleColumns();
325 320
                 $sortField = key($columns);
326 321
                 $this->setSortField($sortField);
@@ -335,8 +330,7 @@  discard block
 block discarded – undo
335 330
                     $name,
336 331
                     'filter'
337 332
                 );
338
-            }
339
-            else{
333
+            } else{
340 334
                 $path = array(
341 335
                     'filter'
342 336
                 );
@@ -397,8 +391,7 @@  discard block
 block discarded – undo
397 391
             $pos = strrpos($setName, '\\');
398 392
             if($pos === false){
399 393
                 list (, $appSetName) = explode('_', $setName);
400
-            }
401
-            else{
394
+            } else{
402 395
                 list (, $appSetName) = array(
403 396
                     substr($setName, 0, $pos),
404 397
                     substr($setName, $pos + 1)
@@ -417,7 +410,7 @@  discard block
 block discarded – undo
417 410
             if($values->count()>15){
418 411
                 $widget = bab_Widgets()->select2();
419 412
                 $widget->setDataSource($set->getController()->search());
420
-            }else{
413
+            } else{
421 414
                 $widget = $W->Select();
422 415
                 $widget->addOption('', '');
423 416
                 foreach ($values as $record){
@@ -557,8 +550,7 @@  discard block
 block discarded – undo
557 550
                         ->addClass('icon', FuncIcons::STATUS_DIALOG_ERROR)
558 551
                         ->addAttribute('data-removefor', $column->getFieldPath()))
559 552
                         ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_ITEMS_FLEX_END));
560
-                }
561
-                elseif($displayAdvancedForm){
553
+                } elseif($displayAdvancedForm){
562 554
                     $formItem->setSizePolicy('col-lg-2 col-md-3 col-sm-6 col-xs-12');
563 555
                     $filterBox->addItem($formItem);
564 556
                 }
@@ -692,20 +684,17 @@  discard block
 block discarded – undo
692 684
         
693 685
         if(isset($name)){
694 686
             $this->sortParameterName = $name . '[filter][sort]';
695
-        }
696
-        else{
687
+        } else{
697 688
             $this->sortParameterName = 'filter[sort]';
698 689
         }
699 690
         
700 691
         if(isset($filter['sort'])){
701 692
             $this->setSortField($filter['sort']);
702
-        }
703
-        elseif(! isset($this->sortField)){
693
+        } elseif(! isset($this->sortField)){
704 694
             
705 695
             if(method_exists($this, 'getDefaultSortField')){
706 696
                 $this->setSortField($this->getDefaultSortField());
707
-            }
708
-            else{
697
+            } else{
709 698
                 $columns = $this->getVisibleColumns();
710 699
                 $sortField = key($columns);
711 700
                 $this->setSortField($sortField);
@@ -720,8 +709,7 @@  discard block
 block discarded – undo
720 709
                     $name,
721 710
                     'filter'
722 711
                 );
723
-            }
724
-            else{
712
+            } else{
725 713
                 $path = array(
726 714
                     'filter'
727 715
                 );
Please login to merge, or discard this patch.
programs/Ui/Items/AppChip.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,14 +100,14 @@
 block discarded – undo
100 100
         
101 101
         $html = "<div class='chip'>";
102 102
         
103
-        if(isset($this->labelIcon)){
103
+        if (isset($this->labelIcon)) {
104 104
             $icon = $W->Label('')->setIconFormat(16, 'left')->setIcon($this->labelIcon);
105 105
             $html .= $icon->display($W->HtmlCanvas());
106 106
         }
107 107
         
108 108
         $html .= $this->label;
109 109
         
110
-        if(isset($this->action)){
110
+        if (isset($this->action)) {
111 111
             $icon = $W->Link('', $this->action)->setIconFormat(16, 'left')->setOpenMode(WidgetLink::OPEN_DIALOG_AND_RELOAD);
112 112
             $icon->setIcon(isset($this->actionIcon) ? $this->actionIcon : FuncIcons::ACTIONS_DIALOG_CANCEL);
113 113
             $icon->addClass('chip-right-action');
Please login to merge, or discard this patch.
programs/Set/AppLink.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public function getSource()
48 48
     {
49 49
         $App = $this->App();
50
-        return $App->getRecordByRef($this->sourceClass . ':' . $this->sourceId);
50
+        return $App->getRecordByRef($this->sourceClass.':'.$this->sourceId);
51 51
     }
52 52
     
53 53
     /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function getTarget()
57 57
     {
58 58
         $App = $this->App();
59
-        return $App->getRecordByRef($this->targetClass . ':' . $this->targetId);
59
+        return $App->getRecordByRef($this->targetClass.':'.$this->targetId);
60 60
     }
61 61
 }
62 62
 
Please login to merge, or discard this patch.
programs/AppComponent.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
             "requiredComponents" => array(),
72 72
             "optionalComponents" => array()
73 73
         );
74
-        if($main->hasMethod('getRequiredComponents')){
74
+        if ($main->hasMethod('getRequiredComponents')) {
75 75
             $requiredComponents = $this->recordSet()->getRequiredComponents();
76
-            foreach ($requiredComponents as $requiredComponent){
76
+            foreach ($requiredComponents as $requiredComponent) {
77 77
                 $dependencies['requiredComponents'][] = $requiredComponent;
78 78
             }
79 79
         }
80
-        if($main->hasMethod('getOptionalComponents')){
80
+        if ($main->hasMethod('getOptionalComponents')) {
81 81
             $optionalComponents = $this->recordSet()->getOptionalComponents();
82
-            foreach ($optionalComponents as $optionalComponent){
82
+            foreach ($optionalComponents as $optionalComponent) {
83 83
                 $dependencies['optionalComponents'][] = $optionalComponent;
84 84
             }
85 85
         }
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
     
96 96
     public function getPackageName()
97 97
     {
98
-        if(! isset($this->packageName) || empty($this->packageName)){
98
+        if (!isset($this->packageName) || empty($this->packageName)) {
99 99
             $packageName = '';
100 100
             $setRc = new \ReflectionClass($this->set);
101 101
             // Tries to automatically retrieve the package name from the definition.json
102
-            if($setRc){
102
+            if ($setRc) {
103 103
                 // Get definition file path
104 104
                 $definitionPathParts = explode('/', $setRc->getFileName());
105 105
                 $definitionPath = implode('/', (array_splice($definitionPathParts, 0, - 3)));
106 106
                 $definitionPath .= '/definition.json';
107 107
                 $definitionContent = file_get_contents($definitionPath);
108
-                if($definitionContent){
108
+                if ($definitionContent) {
109 109
                     // Get definition.json content
110 110
                     $definitionContent = json_decode($definitionContent, true);
111
-                    if($definitionContent && isset($definitionContent['name'])){
111
+                    if ($definitionContent && isset($definitionContent['name'])) {
112 112
                         // Get name in definition.json
113 113
                         $definitionNameParts = explode('/', $definitionContent['name']);
114 114
                         $packageName = $definitionNameParts[count($definitionNameParts) - 1];
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     public function onUpdate()
129 129
     {
130 130
         $main = new \ReflectionClass($this->set);
131
-        if($main->hasMethod('onUpdate')){
131
+        if ($main->hasMethod('onUpdate')) {
132 132
             $this->recordSet()->onUpdate();
133 133
         }
134 134
     }
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public function controller($proxy = true)
140 140
     {
141
-        if(! isset($this->controllerObject)){
141
+        if (!isset($this->controllerObject)) {
142 142
             $this->app->includeRecordController();
143 143
             $ctrl = $this->controller;
144 144
             $this->controllerObject = new $ctrl($this->app, $this);
145 145
         }
146
-        if($proxy){
146
+        if ($proxy) {
147 147
             return $this->controllerObject->proxy();
148 148
         }
149 149
         return $this->controllerObject;
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
     public function ui()
164 164
     {
165 165
         $this->app->includeUi();
166
-        if(! isset($this->uiObject)){
166
+        if (!isset($this->uiObject)) {
167 167
             $ui = $this->ui;
168
-            if(! isset($ui)){
168
+            if (!isset($ui)) {
169 169
                 return null;
170 170
             }
171 171
             $this->uiObject = new $ui($this->app);
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
     
199 199
     public function getDefinition()
200 200
     {
201
-        $componentDefinitionObjectName = 'Capwelton\App\\' . $this->getPackageName() . '\ComponentDefinition\ComponentDefinition';
202
-        if(class_exists($componentDefinitionObjectName)){
201
+        $componentDefinitionObjectName = 'Capwelton\App\\'.$this->getPackageName().'\ComponentDefinition\ComponentDefinition';
202
+        if (class_exists($componentDefinitionObjectName)) {
203 203
             return new $componentDefinitionObjectName();
204 204
         }
205 205
         return null;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     public function getLangPath()
209 209
     {
210 210
         $def = $this->getDefinition();
211
-        if($def){
211
+        if ($def) {
212 212
             return $def->getLangPath($this->app);
213 213
         }
214 214
         return null;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     public function getStylePath()
218 218
     {
219 219
         $def = $this->getDefinition();
220
-        if($def){
220
+        if ($def) {
221 221
             return $def->getStylePath($this->app);
222 222
         }
223 223
         return null;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     public function getScriptPath()
227 227
     {
228 228
         $def = $this->getDefinition();
229
-        if($def){
229
+        if ($def) {
230 230
             return $def->getScriptPath($this->app);
231 231
         }
232 232
         return null;
Please login to merge, or discard this patch.
programs/main.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@
 block discarded – undo
24 24
 use Capwelton\Widgets\Widgets\Helpers\WidgetAction;
25 25
 use Cofy\Exception\BabUnknownActionException;
26 26
 
27
-require_once dirname(__FILE__) . '/functions.php';
27
+require_once dirname(__FILE__).'/functions.php';
28 28
 
29 29
 $App = app_App();
30 30
 
31
-try{
31
+try {
32 32
     $controller = $App->Controller();
33 33
     $action = WidgetAction::fromRequest();
34 34
     $controller->execute($action);
35 35
 }
36
-catch (BabUnknownActionException $e){
37
-    die('<div class="app-error">' . $App->translate('We have a problem finding this page...') . '</div>');
36
+catch (BabUnknownActionException $e) {
37
+    die('<div class="app-error">'.$App->translate('We have a problem finding this page...').'</div>');
38 38
 }
39 39
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@
 block discarded – undo
32 32
     $controller = $App->Controller();
33 33
     $action = WidgetAction::fromRequest();
34 34
     $controller->execute($action);
35
-}
36
-catch (BabUnknownActionException $e){
35
+} catch (BabUnknownActionException $e){
37 36
     die('<div class="app-error">' . $App->translate('We have a problem finding this page...') . '</div>');
38 37
 }
39 38
 
Please login to merge, or discard this patch.
programs/Traits/LocaleApp.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,25 +36,25 @@
 block discarded – undo
36 36
      */
37 37
     public static function getLocaleApp()
38 38
     {
39
-        try{
39
+        try {
40 40
             $rc = new \ReflectionClass(static::class);
41 41
             $path = new BabPath($rc->getFileName());
42
-            for ($popLevel = 0; $popLevel < 7; $popLevel ++){
42
+            for ($popLevel = 0; $popLevel < 7; $popLevel++) {
43 43
                 $path->pop();
44 44
             }
45 45
             $path->push('composer.json');
46
-            if(! $path->fileExists()){
46
+            if (!$path->fileExists()) {
47 47
                 return null;
48 48
             }
49 49
             
50 50
             $composer = file_get_contents($path->tostring());
51 51
             $composerjson = json_decode($composer, true);
52
-            if(!isset($composerjson['appFunctionality']) || empty($composerjson['appFunctionality'])){
52
+            if (!isset($composerjson['appFunctionality']) || empty($composerjson['appFunctionality'])) {
53 53
                 return null;
54 54
             }
55 55
             return BabFunctionality::get($composerjson['appFunctionality']);
56 56
         }
57
-        catch (\Exception $e){
57
+        catch (\Exception $e) {
58 58
             return null;
59 59
         }
60 60
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@
 block discarded – undo
53 53
                 return null;
54 54
             }
55 55
             return BabFunctionality::get($composerjson['appFunctionality']);
56
-        }
57
-        catch (\Exception $e){
56
+        } catch (\Exception $e){
58 57
             return null;
59 58
         }
60 59
     }
Please login to merge, or discard this patch.