Passed
Branchfeature/useWidgetsNamespaces (54f503)
by Robin
04:17
created
programs/Ctrl/AppCtrlConfiguration.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
     public function __construct(Func_App $app = null)
41 41
     {
42 42
         parent::__construct($app);
43
-        if(! bab_isUserAdministrator()){
43
+        if (!bab_isUserAdministrator()) {
44 44
             $action = WidgetAction::fromRequest();
45 45
             list (, $method) = explode('.', $action->getMethod());
46
-            if($method !== 'accessDenied'){
46
+            if ($method !== 'accessDenied') {
47 47
                 /**
48 48
                  * @var WidgetAction
49 49
                  */
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $box->addClass('reload-configuration-page');
102 102
         $box->addClass('widget-100pc');
103 103
         
104
-        if(! isset($itemId)){
104
+        if (!isset($itemId)) {
105 105
             $this->resetCurrentTab();
106 106
         }
107 107
         
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
         $navBoxHtml = '<ul class="nav nav-tabs">';
112 112
         $htmlCanvas = $W->HtmlCanvas();
113 113
         
114
-        foreach ($configurationItems as $tabId => $tab){
114
+        foreach ($configurationItems as $tabId => $tab) {
115 115
             $tabLink = $W->Link($tab['tabTitle'], $this->proxy()
116 116
                 ->setDisplayTab($tabId))
117 117
                 ->setOpenMode(WidgetLink::OPEN_DIALOG);
118 118
             $tabLinkHtml = '<li role="configuration"';
119
-            if($tabId == $currentTab){
119
+            if ($tabId == $currentTab) {
120 120
                 $tabLinkHtml .= ' class="active"';
121 121
             }
122 122
             $tabLinkHtml .= '>';
123
-            $tabLinkHtml .= $tabLink->display($htmlCanvas) . '</li>';
123
+            $tabLinkHtml .= $tabLink->display($htmlCanvas).'</li>';
124 124
             $navBoxHtml .= $tabLinkHtml;
125 125
         }
126 126
         
@@ -149,19 +149,19 @@  discard block
 block discarded – undo
149 149
             ->addClass('icon-left icon-48x48 icon-left-48');
150 150
         $box->addItem($configBox);
151 151
         
152
-        if(! isset($configurationItems[$currentTab])){
152
+        if (!isset($configurationItems[$currentTab])) {
153 153
             return $box;
154 154
         }
155 155
         
156 156
         $tab = $configurationItems[$currentTab];
157 157
         
158
-        foreach ($tab['tabContent'] as $tabSection){
159
-            if(! isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])){
158
+        foreach ($tab['tabContent'] as $tabSection) {
159
+            if (!isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])) {
160 160
                 continue;
161 161
             }
162 162
             $configBox->addItem($W->Section($tabSection['sectionName'], $sectionContentBox = $W->HBoxItems())
163 163
                 ->setFoldable(true));
164
-            foreach ($tabSection['sectionContent'] as $tabSection){
164
+            foreach ($tabSection['sectionContent'] as $tabSection) {
165 165
                 $sectionContentBox->addItem($tabSection);
166 166
             }
167 167
         }
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
         );
187 187
         
188 188
         $definitions = $App->getComponentDefinitions();
189
-        foreach ($definitions as $packageName => $definition){
189
+        foreach ($definitions as $packageName => $definition) {
190 190
             /* @var $definition AppComponentDefinition */
191
-            if(! method_exists($definition, 'getConfiguration')){
191
+            if (!method_exists($definition, 'getConfiguration')) {
192 192
                 continue;
193 193
             }
194 194
             $configurationItems[$packageName] = array(
Please login to merge, or discard this patch.
programs/Ctrl/AppController.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 use Capwelton\LibApp\Func_App;
40 40
 use Capwelton\LibApp\AppComponent;
41 41
 use Capwelton\LibOrm\Exceptions\ORMException;
42
-require_once $GLOBALS['babInstallPath'] . 'utilit/controller.class.php';
43
-require_once $GLOBALS['babInstallPath'] . 'utilit/json.php';
42
+require_once $GLOBALS['babInstallPath'].'utilit/controller.class.php';
43
+require_once $GLOBALS['babInstallPath'].'utilit/json.php';
44 44
 
45
-require_once dirname(__FILE__) . '/../functions.php';
45
+require_once dirname(__FILE__).'/../functions.php';
46 46
 
47 47
 /**
48 48
  * @method self proxy()
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     public function addReloadSelector($reloadSelector, $withSSE = false, $for = null)
77 77
     {
78 78
         $this->reloadSelectors[$reloadSelector] = $reloadSelector;
79
-        if($withSSE){
79
+        if ($withSSE) {
80 80
             $sseRecordSet = $this->getSSERecordSet();
81 81
             $sseRecordSet->newReloadSelector($reloadSelector, $for);
82 82
         }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     
94 94
     public function getSSERecordSet()
95 95
     {
96
-        if(isset($this->SSERecordSet)){
96
+        if (isset($this->SSERecordSet)) {
97 97
             return $this->SSERecordSet;
98 98
         }
99 99
         
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     public function __call($name, $arguments = array())
139 139
     {
140 140
         $component = $this->App()->getComponentByName($name);
141
-        if($component){
141
+        if ($component) {
142 142
             return call_user_func_array(array(
143 143
                 $component,
144 144
                 'controller'
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function isAjaxRequest()
183 183
     {
184
-        if(! isset($this->isAjaxRequest)){
184
+        if (!isset($this->isAjaxRequest)) {
185 185
             $this->isAjaxRequest = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
186 186
         }
187 187
         return $this->isAjaxRequest;
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
      */
194 194
     public function requireCredential($message = null)
195 195
     {
196
-        if($this->isAjaxRequest()){
196
+        if ($this->isAjaxRequest()) {
197 197
             $authType = 'Basic';
198 198
         }
199
-        else{
199
+        else {
200 200
             $authType = '';
201 201
         }
202 202
         
203
-        if(! isset($message)){
203
+        if (!isset($message)) {
204 204
             $message = $this->App()->translate('You must be logged in to access this page.');
205 205
         }
206 206
         
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
         list ($prefix) = explode('_', __CLASS__);
225 225
         $functionalityName = ucwords($prefix);
226 226
         /** @var Func_App */
227
-        $App = @\bab_functionality::get('App/' . $functionalityName);
227
+        $App = @\bab_functionality::get('App/'.$functionalityName);
228 228
         
229
-        if(!$App){
230
-            throw new AppException('Faild to autodetect functionality App/' . $functionalityName . ', the getInstance method is deprecated, use $App->ControllerProxy() instead');
229
+        if (!$App) {
230
+            throw new AppException('Faild to autodetect functionality App/'.$functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead');
231 231
         }
232 232
         
233 233
         $controller = $App->ControllerProxy($classname, $proxy);
@@ -245,44 +245,44 @@  discard block
 block discarded – undo
245 245
     static function getProxyInstance(Func_App $App, $classname)
246 246
     {
247 247
         $class = new \ReflectionClass($classname);
248
-        $proxyClassname = $class->getShortName() . self::PROXY_CLASS_SUFFIX;
248
+        $proxyClassname = $class->getShortName().self::PROXY_CLASS_SUFFIX;
249 249
         $finalProxyClassname = $class->getNamespaceName()."\\".$proxyClassname;
250
-        if(! class_exists($finalProxyClassname)){
250
+        if (!class_exists($finalProxyClassname)) {
251 251
             $classStr = "";
252
-            if($class->getNamespaceName() != ""){
252
+            if ($class->getNamespaceName() != "") {
253 253
                 $classStr .= " namespace ".$class->getNamespaceName()."; ";
254 254
             }
255
-            $classStr .= 'class ' . $proxyClassname . ' extends ' . $class->getShortName() . ' {' . "\n";
255
+            $classStr .= 'class '.$proxyClassname.' extends '.$class->getShortName().' {'."\n";
256 256
             $methods = $class->getMethods();
257 257
             
258 258
             $classStr .= '	public function __construct($App) {
259 259
                 $this->setApp($App);
260 260
             }' . "\n";
261 261
             
262
-            foreach ($methods as $method){
263
-                if($method->name === '__construct' || ! $method->isPublic() || $method->isStatic() || $method->isFinal() || $method->name === 'setApp' || $method->name === 'App' || $method->name === 'setCrm' || $method->name === 'Crm'){
262
+            foreach ($methods as $method) {
263
+                if ($method->name === '__construct' || !$method->isPublic() || $method->isStatic() || $method->isFinal() || $method->name === 'setApp' || $method->name === 'App' || $method->name === 'setCrm' || $method->name === 'Crm') {
264 264
                     continue;
265 265
                 }
266 266
                 
267
-                $classStr .= '	public function ' . $method->name . '(';
267
+                $classStr .= '	public function '.$method->name.'(';
268 268
                 $parameters = $method->getParameters();
269 269
                 $parametersStr = array();
270
-                foreach ($parameters as $parameter){
270
+                foreach ($parameters as $parameter) {
271 271
                     
272
-                    if($parameter->isDefaultValueAvailable()){
273
-                        $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true);
272
+                    if ($parameter->isDefaultValueAvailable()) {
273
+                        $parametersStr[] = '$'.$parameter->name.' = '.var_export($parameter->getDefaultValue(), true);
274 274
                     }
275
-                    else{
276
-                        $parametersStr[] = '$' . $parameter->name;
275
+                    else {
276
+                        $parametersStr[] = '$'.$parameter->name;
277 277
                     }
278 278
                 }
279 279
                 $classStr .= implode(', ', $parametersStr);
280
-                $classStr .= ') {' . "\n";
281
-                $classStr .= '		$args = func_get_args();' . "\n";
282
-                $classStr .= '		return $this->getMethodAction(__FUNCTION__, $args);' . "\n";
283
-                $classStr .= '	}' . "\n";
280
+                $classStr .= ') {'."\n";
281
+                $classStr .= '		$args = func_get_args();'."\n";
282
+                $classStr .= '		return $this->getMethodAction(__FUNCTION__, $args);'."\n";
283
+                $classStr .= '	}'."\n";
284 284
             }
285
-            $classStr .= '}' . "\n";
285
+            $classStr .= '}'."\n";
286 286
             // We define the proxy class
287 287
             eval($classStr);
288 288
         }
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     protected function getObjectName($classname)
321 321
     {
322 322
         list ($objectname) = explode('Controller', $classname);
323
-        if($this->App()->getComponentByName($objectname)){
323
+        if ($this->App()->getComponentByName($objectname)) {
324 324
             return strtolower($objectname);
325 325
         }
326 326
         list (, $objectname) = explode('Ctrl', $classname);
@@ -342,18 +342,18 @@  discard block
 block discarded – undo
342 342
         
343 343
         $reflector = new \ReflectionClass(get_class($this));
344 344
         $parent = $reflector->getParentClass();
345
-        if($parent){
345
+        if ($parent) {
346 346
             $parentMethod = $parent->getMethod('__construct');
347 347
             $docComment = $parentMethod->getDocComment();
348
-            if(strpos($docComment, '@isComponentController') !== false){
348
+            if (strpos($docComment, '@isComponentController') !== false) {
349 349
                 $fullClassName = $parent->getName();
350 350
             }
351 351
         }
352 352
         
353 353
         $rc = new \ReflectionClass($fullClassName);
354 354
         
355
-        if(! $rc->hasMethod($methodName)){
356
-            throw new \bab_InvalidActionException($fullClassName . '::' . $methodName);
355
+        if (!$rc->hasMethod($methodName)) {
356
+            throw new \bab_InvalidActionException($fullClassName.'::'.$methodName);
357 357
         }
358 358
         $method = new \ReflectionMethod($fullClassName, $methodName);
359 359
         
@@ -362,32 +362,32 @@  discard block
 block discarded – undo
362 362
         $parameters = $method->getParameters();
363 363
         $actionParams = array();
364 364
         $argNumber = 0;
365
-        foreach ($parameters as $parameter){
365
+        foreach ($parameters as $parameter) {
366 366
             $parameterName = $parameter->getName();
367
-            if(isset($args[$argNumber])){
367
+            if (isset($args[$argNumber])) {
368 368
                 $actionParams[$parameterName] = $args[$argNumber];
369 369
             }
370
-            elseif($parameter->isDefaultValueAvailable()){
370
+            elseif ($parameter->isDefaultValueAvailable()) {
371 371
                 $actionParams[$parameterName] = $parameter->getDefaultValue();
372 372
             }
373
-            else{
373
+            else {
374 374
                 $actionParams[$parameterName] = null;
375 375
             }
376
-            $argNumber ++;
376
+            $argNumber++;
377 377
         }
378 378
         
379 379
         $action = new WidgetAction();
380 380
         
381
-        $action->setMethod($this->getControllerTg(), $objectName . '.' . $methodName, $actionParams);
381
+        $action->setMethod($this->getControllerTg(), $objectName.'.'.$methodName, $actionParams);
382 382
         
383 383
         $docComment = $method->getDocComment();
384
-        if(strpos($docComment, '@ajax') !== false){
384
+        if (strpos($docComment, '@ajax') !== false) {
385 385
             $action->setAjax(true);
386 386
         }
387
-        if(strpos($docComment, '@requireSaveMethod') !== false && method_exists($action, 'setRequireSaveMethod')){
387
+        if (strpos($docComment, '@requireSaveMethod') !== false && method_exists($action, 'setRequireSaveMethod')) {
388 388
             $action->setRequireSaveMethod(true);
389 389
         }
390
-        if(strpos($docComment, '@requireDeleteMethod') !== false && method_exists($action, 'setRequireDeleteMethod')){
390
+        if (strpos($docComment, '@requireDeleteMethod') !== false && method_exists($action, 'setRequireDeleteMethod')) {
391 391
             $action->setRequireDeleteMethod(true);
392 392
         }
393 393
         
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
         
417 417
         $action->setParameters($actionParams);
418 418
         
419
-        list (, , $file) = explode('/', $App->controllerTg);
419
+        list (,, $file) = explode('/', $App->controllerTg);
420 420
         
421
-        $action->setParameter('addon', $App->getAddonName() . '.' . $file);
421
+        $action->setParameter('addon', $App->getAddonName().'.'.$file);
422 422
         $action->setParameter('idx', $idx);
423 423
         
424 424
         return $action;
@@ -436,44 +436,44 @@  discard block
 block discarded – undo
436 436
         
437 437
         $method = $action->getMethod();
438 438
         
439
-        if(! isset($method) || '' === $method){
439
+        if (!isset($method) || '' === $method) {
440 440
             return false;
441 441
         }
442 442
         
443 443
         list ($objectName,) = explode('.', $method);
444 444
         
445
-        if(! method_exists($this, $objectName)){
445
+        if (!method_exists($this, $objectName)) {
446 446
             /* @var $component AppComponent */
447 447
             $component = $this->app->getComponentByName($objectName);
448
-            if($component){
448
+            if ($component) {
449 449
                 $this->app->setCurrentComponent($component);
450 450
                 $objectController = $component->controller(false);
451 451
             }
452
-            else{
452
+            else {
453 453
                 header('HTTP/1.0 400 Bad Request');
454 454
                 throw new AppUnknownActionException($action);
455 455
             }
456 456
         }
457 457
         
458
-        if(! isset($component)){
458
+        if (!isset($component)) {
459 459
             $objectController = $this->{$objectName}(false);
460
-            if(! ($objectController instanceof AppController)){
460
+            if (!($objectController instanceof AppController)) {
461 461
                 return false;
462 462
             }
463 463
         }
464 464
         
465
-        try{
465
+        try {
466 466
             $returnedValue = $objectController->execAction($action);
467 467
         }
468
-        catch (AppAccessException $e){
468
+        catch (AppAccessException $e) {
469 469
             
470
-            if(! bab_isUserLogged() && $e->requireCredential){
470
+            if (!bab_isUserLogged() && $e->requireCredential) {
471 471
                 bab_requireCredential($e->getMessage());
472 472
             }
473
-            else{
474
-                if($this->isAjaxRequest()){
473
+            else {
474
+                if ($this->isAjaxRequest()) {
475 475
                     
476
-                    header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
476
+                    header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
477 477
                     
478 478
                     die(bab_json_encode(array(
479 479
                         'exception' => 'app_AccessException',
@@ -484,10 +484,10 @@  discard block
 block discarded – undo
484 484
                 $this->accessPage($e);
485 485
             }
486 486
         }
487
-        catch (AppSaveException $e){
487
+        catch (AppSaveException $e) {
488 488
             
489
-            if($this->isAjaxRequest()){
490
-                header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
489
+            if ($this->isAjaxRequest()) {
490
+                header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
491 491
                 header('Cache-Control: no-cache, must-revalidate');
492 492
                 header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
493 493
                 header('Content-type: application/json');
@@ -499,32 +499,32 @@  discard block
 block discarded – undo
499 499
                 )));
500 500
             }
501 501
         }
502
-        catch (AppDeletedRecordException $e){
502
+        catch (AppDeletedRecordException $e) {
503 503
             $this->deletedItemPage($action, $e);
504 504
         }
505
-        catch (AppNotFoundException $e){
505
+        catch (AppNotFoundException $e) {
506 506
             $this->notFoundPage($action, $e);
507 507
         }
508
-        catch (ORMException $e){
508
+        catch (ORMException $e) {
509 509
             $this->errorPage($e);
510 510
         }
511
-        catch (\Exception $e){
511
+        catch (\Exception $e) {
512 512
             $this->unexpectedErrorPage($e);
513 513
         }
514 514
         
515 515
         $W = bab_Widgets();
516 516
         
517
-        if($returnedValue instanceof WidgetDisplayableInterface){
517
+        if ($returnedValue instanceof WidgetDisplayableInterface) {
518 518
             
519
-            if($returnedValue instanceof WidgetBabPage && ! $this->isAjaxRequest()){
519
+            if ($returnedValue instanceof WidgetBabPage && !$this->isAjaxRequest()) {
520 520
                 
521 521
                 // If the action returned a page, we display it.
522 522
                 $returnedValue->displayHtml();
523 523
             }
524
-            else{
524
+            else {
525 525
                 
526 526
                 $htmlCanvas = $W->HtmlCanvas();
527
-                if(self::$acceptJson){
527
+                if (self::$acceptJson) {
528 528
                     $itemId = $returnedValue->getId();
529 529
                     $returnArray = array(
530 530
                         $itemId => $returnedValue->display($htmlCanvas)
@@ -534,18 +534,18 @@  discard block
 block discarded – undo
534 534
                     header('Content-type: application/json');
535 535
                     die(bab_json_encode($returnArray));
536 536
                 }
537
-                else{
537
+                else {
538 538
                     header('Cache-Control: no-cache, must-revalidate');
539 539
                     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
540 540
                     header('Content-type: text/html');
541
-                    if($returnedValue instanceof WidgetPage && method_exists($returnedValue, 'getPageTitle')){
541
+                    if ($returnedValue instanceof WidgetPage && method_exists($returnedValue, 'getPageTitle')) {
542 542
                         $pageTitle = $returnedValue->getPageTitle();
543 543
                         
544
-                        if(method_exists($htmlCanvas, 'sendPageTitle')){
544
+                        if (method_exists($htmlCanvas, 'sendPageTitle')) {
545 545
                             $htmlCanvas->sendPageTitle($pageTitle);
546 546
                         }
547
-                        else{
548
-                            header('X-Cto-PageTitle: ' . $pageTitle);
547
+                        else {
548
+                            header('X-Cto-PageTitle: '.$pageTitle);
549 549
                         }
550 550
                     }
551 551
                     $html = $returnedValue->display($htmlCanvas);
@@ -553,15 +553,15 @@  discard block
 block discarded – undo
553 553
                 }
554 554
             }
555 555
         }
556
-        elseif(is_array($returnedValue)){
556
+        elseif (is_array($returnedValue)) {
557 557
             
558 558
             $htmlCanvas = $W->HtmlCanvas();
559 559
             $returnedArray = array();
560
-            foreach ($returnedValue as $key => &$item){
561
-                if($item instanceof WidgetDisplayableInterface){
560
+            foreach ($returnedValue as $key => &$item) {
561
+                if ($item instanceof WidgetDisplayableInterface) {
562 562
                     $returnedArray[$item->getId()] = $item->display($htmlCanvas);
563 563
                 }
564
-                else{
564
+                else {
565 565
                     $returnedArray[$key] = $item;
566 566
                 }
567 567
             }
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
             header('Content-type: application/json');
571 571
             die(bab_convertStringFromDatabase(bab_json_encode($returnedArray), \bab_charset::UTF_8));
572 572
         }
573
-        elseif(true === $returnedValue || is_string($returnedValue)){
573
+        elseif (true === $returnedValue || is_string($returnedValue)) {
574 574
             
575
-            if($this->isAjaxRequest()){
575
+            if ($this->isAjaxRequest()) {
576 576
                 $body = bab_getBody();
577 577
                 $json = array();
578 578
                 $json['messages'] = array();
@@ -580,24 +580,24 @@  discard block
 block discarded – undo
580 580
                 unset($body->messages['toasts']);
581 581
                 $messages = $body->messages;
582 582
                 $errors = $body->errors;
583
-                foreach ($messages as $message){
583
+                foreach ($messages as $message) {
584 584
                     $json['messages'][] = array(
585 585
                         'level' => 'info',
586 586
                         'content' => $message,
587 587
                         'time' => 4000
588 588
                     );
589 589
                 }
590
-                foreach ($errors as $message){
590
+                foreach ($errors as $message) {
591 591
                     $json['messages'][] = array(
592 592
                         'level' => 'danger',
593 593
                         'content' => $message
594 594
                     );
595 595
                 }
596 596
                 $json['toasts'] = $toasts;
597
-                if($objectController->getReloadSelectors()){
597
+                if ($objectController->getReloadSelectors()) {
598 598
                     $json['reloadSelector'] = implode(',', $objectController->getReloadSelectors());
599 599
                 }
600
-                if($objectController->keepDialogOpened){
600
+                if ($objectController->keepDialogOpened) {
601 601
                     $json['keepDialogOpened'] = true;
602 602
                 }
603 603
                 echo bab_json_encode($json);
@@ -610,8 +610,8 @@  discard block
 block discarded – undo
610 610
     
611 611
     protected function deletedItemPage(WidgetAction $action, AppDeletedRecordException $e)
612 612
     {
613
-        if($this->isAjaxRequest()){
614
-            header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
613
+        if ($this->isAjaxRequest()) {
614
+            header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
615 615
             header('Cache-Control: no-cache, must-revalidate');
616 616
             header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
617 617
             header('Content-type: application/json');
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
                 'errorMessage' => bab_convertStringFromDatabase($e->getMessage(), 'UTF-8')
624 624
             )));
625 625
         }
626
-        header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);
626
+        header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
627 627
         
628 628
         $App = app_App();
629 629
         $W = bab_Widgets();
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
             ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_ITEMS_CENTER));
646 646
         $section->addItems($W->Title($App->translate('Error'), 1), $W->Title(sprintf($App->translate('This %s has been deleted'), $e->getObjectTitle())));
647 647
         
648
-        if($e instanceof AppDeletedRecordException){
648
+        if ($e instanceof AppDeletedRecordException) {
649 649
             $section->addItems($e->getDeletedBy(), $e->getDeletedOn());
650 650
         }
651 651
         
@@ -654,8 +654,8 @@  discard block
 block discarded – undo
654 654
     
655 655
     protected function notFoundPage(WidgetAction $action, AppNotFoundException $e)
656 656
     {
657
-        if($this->isAjaxRequest()){
658
-            $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle() . ' (' . $e->getId() . ')');
657
+        if ($this->isAjaxRequest()) {
658
+            $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle().' ('.$e->getId().')');
659 659
             $json = array(
660 660
                 'messages' => array(
661 661
                     array(
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
             echo bab_json_encode($json);
668 668
             die();
669 669
         }
670
-        header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);
670
+        header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
671 671
         header('Cache-Control: no-cache, must-revalidate');
672 672
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
673 673
         
@@ -696,8 +696,8 @@  discard block
 block discarded – undo
696 696
     
697 697
     protected function unexpectedErrorPage(\Exception $e)
698 698
     {
699
-        if($this->isAjaxRequest()){
700
-            $message = sprintf(app_translate('An unexpected error occured') . ':' . '%s', $e->getMessage());
699
+        if ($this->isAjaxRequest()) {
700
+            $message = sprintf(app_translate('An unexpected error occured').':'.'%s', $e->getMessage());
701 701
             $json = array(
702 702
                 'messages' => array(
703 703
                     array(
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
             echo bab_json_encode($json);
710 710
             die();
711 711
         }
712
-        header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500);
712
+        header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500);
713 713
         header('Cache-Control: no-cache, must-revalidate');
714 714
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
715 715
         
@@ -733,25 +733,25 @@  discard block
 block discarded – undo
733 733
             ->addClass('widget-50pc alert alert-danger')
734 734
             ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL));
735 735
         
736
-        $logCode = '#' . hrtime(true);
736
+        $logCode = '#'.hrtime(true);
737 737
         $message = addcslashes($e->getMessage(), "\000..\037\177..\377\\");
738 738
         $trace = addcslashes($e->getTraceAsString(), "\000..\037\177..\377\\");
739 739
         
740
-        error_log(sprintf('Error %s : %s', $logCode, $message) . PHP_EOL . $trace);
740
+        error_log(sprintf('Error %s : %s', $logCode, $message).PHP_EOL.$trace);
741 741
         
742 742
         $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)));
743 743
         
744
-        if(bab_isUserAdministrator()){
744
+        if (bab_isUserAdministrator()) {
745 745
             $contentBox->addItem($W->Section('Stack trace', $stackTraceBox = $W->FlexItems($W->Label($message)
746 746
                 ->addClass('widget-description'))
747 747
                 ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL))
748 748
                 ->setFoldable(true, true));
749 749
             $traces = explode("\n", $e->getTraceAsString());
750
-            foreach ($traces as $trace){
750
+            foreach ($traces as $trace) {
751 751
                 $stackTraceBox->addItem($W->Label($trace));
752 752
             }
753 753
         }
754
-        else{
754
+        else {
755 755
             $section->addItem($W->Label($App->translate('Please contact the administrator')));
756 756
         }
757 757
         
@@ -760,8 +760,8 @@  discard block
 block discarded – undo
760 760
     
761 761
     protected function errorPage(\Exception $e)
762 762
     {
763
-        if($this->isAjaxRequest()){
764
-            $message = sprintf(app_translate('An unexpected error occured') . ':' . '%s', $e->getMessage());
763
+        if ($this->isAjaxRequest()) {
764
+            $message = sprintf(app_translate('An unexpected error occured').':'.'%s', $e->getMessage());
765 765
             $json = array(
766 766
                 'messages' => array(
767 767
                     array(
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
             echo bab_json_encode($json);
774 774
             die();
775 775
         }
776
-        header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500);
776
+        header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500);
777 777
         header('Cache-Control: no-cache, must-revalidate');
778 778
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
779 779
         
@@ -797,25 +797,25 @@  discard block
 block discarded – undo
797 797
             ->addClass('widget-50pc alert alert-danger')
798 798
             ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL));
799 799
         
800
-        $logCode = '#' . hrtime(true);
800
+        $logCode = '#'.hrtime(true);
801 801
         $message = addcslashes($e->getMessage(), "\000..\037\177..\377\\");
802 802
         $trace = addcslashes($e->getTraceAsString(), "\000..\037\177..\377\\");
803 803
         
804
-        error_log(sprintf('Error %s : %s', $logCode, $message) . PHP_EOL . $trace);
804
+        error_log(sprintf('Error %s : %s', $logCode, $message).PHP_EOL.$trace);
805 805
         
806 806
         $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)));
807 807
         
808
-        if(bab_isUserAdministrator()){
808
+        if (bab_isUserAdministrator()) {
809 809
             $contentBox->addItem($W->Section('Stack trace', $stackTraceBox = $W->FlexItems($W->Label($message)
810 810
                 ->addClass('widget-description'))
811 811
                 ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL))
812 812
                 ->setFoldable(true, true));
813 813
             $traces = explode("\n", $e->getTraceAsString());
814
-            foreach ($traces as $trace){
814
+            foreach ($traces as $trace) {
815 815
                 $stackTraceBox->addItem($W->Label($trace));
816 816
             }
817 817
         }
818
-        else{
818
+        else {
819 819
             $section->addItem($W->Label($App->translate('Please contact the administrator')));
820 820
         }
821 821
         
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
     
825 825
     protected function accessPage(\Exception $e)
826 826
     {
827
-        if($this->isAjaxRequest()){
827
+        if ($this->isAjaxRequest()) {
828 828
             $message = $e->getMessage();
829 829
             $json = array(
830 830
                 'messages' => array(
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
             echo bab_json_encode($json);
838 838
             die();
839 839
         }
840
-        header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403);
840
+        header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
841 841
         header('Cache-Control: no-cache, must-revalidate');
842 842
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
843 843
         
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
      */
875 875
     public function requireSaveMethod()
876 876
     {
877
-        if('GET' === $_SERVER['REQUEST_METHOD']){
877
+        if ('GET' === $_SERVER['REQUEST_METHOD']) {
878 878
             throw new AppException('Method not allowed');
879 879
         }
880 880
         
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
      */
890 890
     public function requireDeleteMethod()
891 891
     {
892
-        if('GET' === $_SERVER['REQUEST_METHOD']){
892
+        if ('GET' === $_SERVER['REQUEST_METHOD']) {
893 893
             throw new AppException('Method not allowed');
894 894
         }
895 895
         
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
             'position' => $position
922 922
         );
923 923
         $babBody = bab_getBody();
924
-        if(! isset($babBody->messages['toasts'])){
924
+        if (!isset($babBody->messages['toasts'])) {
925 925
             $babBody->messages['toasts'] = array();
926 926
         }
927 927
         $babBody->messages['toasts'][] = $toast;
Please login to merge, or discard this patch.
programs/Ctrl/AppCtrlRecord.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2141,7 +2141,7 @@
 block discarded – undo
2141 2141
         }
2142 2142
     
2143 2143
         header("Content-type: application/json; charset=utf-8");
2144
-	    echo $collection->output();
2145
-	    die();
2144
+        echo $collection->output();
2145
+        die();
2146 2146
     }
2147 2147
 }
Please login to merge, or discard this patch.
Spacing   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
     protected function getRecordClassName()
60 60
     {
61 61
         $class = $this->getClass();
62
-        if(strpos($class, 'Controller') !== false){
62
+        if (strpos($class, 'Controller') !== false) {
63 63
             $App = $this->App();
64 64
             $componentName = strtoupper(str_replace('Controller', '', $class));
65 65
             $component = $App->getComponentByName($componentName);
66
-            if($component){
66
+            if ($component) {
67 67
                 list (, $recordClassname) = explode($App->classPrefix, $component->getRecordClassName());
68 68
                 return $recordClassname;
69 69
             }
70 70
         }
71
-        if(strpos($class, '_Ctrl')){
71
+        if (strpos($class, '_Ctrl')) {
72 72
             list (, $recordClassname) = explode('_Ctrl', $class);
73 73
             return $recordClassname;
74 74
         }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         
90 90
         
91 91
         $recordClassname = $this->getRecordClassName();
92
-        $recordSetClassname = $recordClassname . 'Set';
92
+        $recordSetClassname = $recordClassname.'Set';
93 93
         
94 94
         $recordSet = $App->$recordSetClassname();
95 95
         return $recordSet;
@@ -132,29 +132,29 @@  discard block
 block discarded – undo
132 132
     {
133 133
         $canvas = bab_Widgets()->HtmlCanvas();
134 134
         $html = '';
135
-        if($actions instanceof WidgetAction){
135
+        if ($actions instanceof WidgetAction) {
136 136
             $text = '';
137
-            if($showLabel){
137
+            if ($showLabel) {
138 138
                 $text = $actions->getTitle();
139 139
             }
140
-            $html = '<li><a class="icon ' . $actions->getIcon() . '" href="' . $actions->url() . '">' . $text . '</a></li>';
140
+            $html = '<li><a class="icon '.$actions->getIcon().'" href="'.$actions->url().'">'.$text.'</a></li>';
141 141
         }
142
-        elseif($actions instanceof WidgetLink){
143
-            $html = '<li>' . $actions->display($canvas) . '</li>';
142
+        elseif ($actions instanceof WidgetLink) {
143
+            $html = '<li>'.$actions->display($canvas).'</li>';
144 144
         }
145
-        elseif(is_array($actions)){
146
-            if(isset($actions['items'])){
145
+        elseif (is_array($actions)) {
146
+            if (isset($actions['items'])) {
147 147
                 $items = $actions['items'];
148 148
             }
149
-            else{
149
+            else {
150 150
                 $items = $actions;
151 151
             }
152
-            foreach ($items as $action){
152
+            foreach ($items as $action) {
153 153
                 $html .= $this->createMenu($action, true, true);
154 154
             }
155
-            if(isset($actions['icon'])){
155
+            if (isset($actions['icon'])) {
156 156
                 
157
-                $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>';
157
+                $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>';
158 158
             }
159 159
         }
160 160
         
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
             'label' => $App->translate('Statistics')
201 201
         );
202 202
         
203
-        foreach ($methods as $index => $method){
204
-            try{
205
-                $methodName = $recordClassname . $method['method'];
206
-                if($Ui->$methodName()){
203
+        foreach ($methods as $index => $method) {
204
+            try {
205
+                $methodName = $recordClassname.$method['method'];
206
+                if ($Ui->$methodName()) {
207 207
                     $types[$index] = array(
208 208
                         'classname' => $methodName,
209 209
                         'icon' => $method['icon'],
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                     );
212 212
                 }
213 213
             }
214
-            catch (\Exception $e){
214
+            catch (\Exception $e) {
215 215
                 unset($types[$index]);
216 216
                 continue;
217 217
             }
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
         
233 233
         $availableFields = array();
234 234
         
235
-        foreach ($recordSet->getFields() as $name => $field){
235
+        foreach ($recordSet->getFields() as $name => $field) {
236 236
             $fieldName = $field->getName();
237 237
             $fieldDescription = $field->getDescription();
238
-            if(substr($fieldName, 0, 1) !== '_'){
238
+            if (substr($fieldName, 0, 1) !== '_') {
239 239
                 $fieldDescription = $App->translate($fieldDescription);
240 240
             }
241
-            if(empty($fieldDescription)){
241
+            if (empty($fieldDescription)) {
242 242
                 $fieldDescription = $fieldName;
243 243
             }
244 244
             $availableFields[$name] = array(
@@ -287,14 +287,14 @@  discard block
 block discarded – undo
287 287
         
288 288
         $recordSet = $this->getEditRecordSet();
289 289
         
290
-        if(isset($id)){
290
+        if (isset($id)) {
291 291
             $record = $recordSet->request($id);
292
-            if(! $record->isUpdatable()){
292
+            if (!$record->isUpdatable()) {
293 293
                 throw new AppAccessException($App->translate('You do not have access to this page'));
294 294
             }
295 295
         }
296
-        else{
297
-            if(! $recordSet->isCreatable()){
296
+        else {
297
+            if (!$recordSet->isCreatable()) {
298 298
                 throw new AppAccessException($App->translate('You do not have access to this page'));
299 299
             }
300 300
             $record = $recordSet->newRecord();
@@ -322,12 +322,12 @@  discard block
 block discarded – undo
322 322
         $W = bab_Widgets();
323 323
         
324 324
         $recordClassname = $this->getRecordClassName();
325
-        $editorClassname = $recordClassname . 'SectionEditor';
325
+        $editorClassname = $recordClassname.'SectionEditor';
326 326
         
327 327
         /* @var $editor AppRecordEditor */
328 328
         $editor = $Ui->$editorClassname($record);
329
-        if(! isset($itemId)){
330
-            $itemId = $this->getClass() . '_' . __FUNCTION__;
329
+        if (!isset($itemId)) {
330
+            $itemId = $this->getClass().'_'.__FUNCTION__;
331 331
         }
332 332
         $editor->setId($itemId);
333 333
         $editor->setController($this);
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
      */
357 357
     public function getModelViewDefaultId($itemId = null)
358 358
     {
359
-        if(! isset($itemId)){
360
-            $itemId = $this->getClass() . '_modelView';
359
+        if (!isset($itemId)) {
360
+            $itemId = $this->getClass().'_modelView';
361 361
         }
362 362
         
363 363
         return $itemId;
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
         
386 386
         $itemId = $this->getModelViewDefaultId($itemId);
387 387
         
388
-        if(! isset($type)){
388
+        if (!isset($type)) {
389 389
             $type = $this->getFilteredViewType($itemId);
390 390
         }
391 391
         
@@ -393,24 +393,24 @@  discard block
 block discarded – undo
393 393
         
394 394
         switch ($type) {
395 395
             case 'cards':
396
-                $tableviewClassname = $recordClassname . 'CardsView';
396
+                $tableviewClassname = $recordClassname.'CardsView';
397 397
                 break;
398 398
             
399 399
             case 'map':
400
-                $tableviewClassname = $recordClassname . 'MapView';
400
+                $tableviewClassname = $recordClassname.'MapView';
401 401
                 break;
402 402
             
403 403
             case 'calendar':
404
-                $tableviewClassname = $recordClassname . 'CalendarView';
404
+                $tableviewClassname = $recordClassname.'CalendarView';
405 405
                 break;
406 406
             
407 407
             case 'statistics':
408
-                $tableviewClassname = $recordClassname . 'StatisticsView';
408
+                $tableviewClassname = $recordClassname.'StatisticsView';
409 409
                 break;
410 410
             
411 411
             case 'table':
412 412
             default:
413
-                $tableviewClassname = $recordClassname . 'TableView';
413
+                $tableviewClassname = $recordClassname.'TableView';
414 414
                 break;
415 415
         }
416 416
         
@@ -423,12 +423,12 @@  discard block
 block discarded – undo
423 423
         
424 424
         $tableview->setRecordSet($recordSet);
425 425
         $tableview->addDefaultColumns($recordSet);
426
-        if(isset($filter)){
426
+        if (isset($filter)) {
427 427
             $tableview->setFilterValues($filter);
428 428
         }
429 429
         $filter = $tableview->getFilterValues();
430 430
         
431
-        if(isset($filter['showTotal']) && $filter['showTotal']){
431
+        if (isset($filter['showTotal']) && $filter['showTotal']) {
432 432
             $tableview->displaySubTotalRow(true);
433 433
         }
434 434
         
@@ -442,13 +442,13 @@  discard block
 block discarded – undo
442 442
         
443 443
         $tableview->setDataSource($records);
444 444
         
445
-        if(isset($columns)){
445
+        if (isset($columns)) {
446 446
             $availableColumns = $tableview->getVisibleColumns();
447 447
             
448 448
             $remainingColumns = array();
449
-            foreach ($availableColumns as $availableColumn){
449
+            foreach ($availableColumns as $availableColumn) {
450 450
                 $colPath = $availableColumn->getFieldPath();
451
-                if(isset($columns[$colPath]) && $columns[$colPath] == '1'){
451
+                if (isset($columns[$colPath]) && $columns[$colPath] == '1') {
452 452
                     $remainingColumns[] = $availableColumn;
453 453
                 }
454 454
             }
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
         $App = $this->App();
469 469
         $Ui = $App->Ui();
470 470
         $recordClassname = $this->getRecordClassName();
471
-        $editorClassname = $recordClassname . 'Editor';
471
+        $editorClassname = $recordClassname.'Editor';
472 472
         $editor = $Ui->$editorClassname();
473 473
         
474
-        if(! isset($itemId)){
475
-            $itemId = $this->getClass() . '_' . __FUNCTION__;
474
+        if (!isset($itemId)) {
475
+            $itemId = $this->getClass().'_'.__FUNCTION__;
476 476
         }
477 477
         $editor->setId($itemId);
478 478
         $editor->setHiddenValue('tg', $App->controllerTg);
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
         
516 516
         $viewTypes = $this->getAvailableModelViewTypes();
517 517
         
518
-        if(count($viewTypes) > 1){
518
+        if (count($viewTypes) > 1) {
519 519
             $viewsBox = $W->Items();
520 520
             $viewsBox->setSizePolicy('pull-right');
521 521
             // $viewsBox->addClass('btn-group', \Func_Icons::ICON_LEFT_16);
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
             
524 524
             $filteredViewType = $this->getFilteredViewType($tableView->getId());
525 525
             
526
-            foreach ($viewTypes as $viewTypeId => $viewType){
526
+            foreach ($viewTypes as $viewTypeId => $viewType) {
527 527
                 $viewsBox->addItem($W->Link('', $proxy->setFilteredViewType($tableView->getId(), $viewTypeId))
528
-                    ->addClass('icon', $viewType['icon'] . ($filteredViewType === $viewTypeId ? ' active' : ''))
528
+                    ->addClass('icon', $viewType['icon'].($filteredViewType === $viewTypeId ? ' active' : ''))
529 529
                     ->
530 530
                 // ->setSizePolicy('btn btn-xs btn-default ' . ($filteredViewType === $viewTypeId ? 'active' : ''))
531 531
                 setTitle($viewType['label'])
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
             }
534 534
         }
535 535
         
536
-        if(method_exists($proxy, 'exportSelect')){
536
+        if (method_exists($proxy, 'exportSelect')) {
537 537
             $toolbar->addItem($W->Link($App->translate('Export'), $proxy->exportSelect($filter))
538 538
                 ->addClass('icon', \Func_Icons::ACTIONS_DOCUMENT_DOWNLOAD)
539 539
                 ->setOpenMode(WidgetLink::OPEN_DIALOG)
540 540
                 ->setDialogClass('box gradient blue halfSizeDialog'));
541 541
         }
542 542
         
543
-        if(method_exists($proxy, 'printList')){
543
+        if (method_exists($proxy, 'printList')) {
544 544
             $toolbar->addItem($W->Link($App->translate('Print'), $proxy->printList($filter))
545 545
                 ->addClass('icon', \Func_Icons::ACTIONS_DOCUMENT_PRINT)
546 546
                 ->setOpenMode(WidgetLink::OPEN_POPUP));
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
         $W = bab_Widgets();
559 559
         
560 560
         $filterVisibility = $this->getFilterVisibility($itemId);
561
-        $filterVisibility = ! $filterVisibility;
562
-        $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);
561
+        $filterVisibility = !$filterVisibility;
562
+        $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);
563 563
         
564 564
         return true;
565 565
     }
@@ -571,10 +571,10 @@  discard block
 block discarded – undo
571 571
     protected function getFilterVisibility($itemId)
572 572
     {
573 573
         $W = bab_Widgets();
574
-        $filterVisibility = $W->getUserConfiguration($itemId . '/filterVisibility');
575
-        if(! isset($filterVisibility)){
574
+        $filterVisibility = $W->getUserConfiguration($itemId.'/filterVisibility');
575
+        if (!isset($filterVisibility)) {
576 576
             $filterVisibility = false;
577
-            $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility);
577
+            $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility);
578 578
         }
579 579
         return $filterVisibility;
580 580
     }
@@ -589,8 +589,8 @@  discard block
 block discarded – undo
589 589
     protected function getFilteredViewType($itemId)
590 590
     {
591 591
         $W = bab_Widgets();
592
-        $type = $W->getUserConfiguration($itemId . '/viewType');
593
-        if(! isset($type)){
592
+        $type = $W->getUserConfiguration($itemId.'/viewType');
593
+        if (!isset($type)) {
594 594
             $type = 'table';
595 595
         }
596 596
         return $type;
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
     public function setFilteredViewType($itemId, $type = null)
608 608
     {
609 609
         $W = bab_Widgets();
610
-        $W->setUserConfiguration($itemId . '/viewType', $type);
610
+        $W->setUserConfiguration($itemId.'/viewType', $type);
611 611
         
612 612
         return true;
613 613
     }
@@ -628,17 +628,17 @@  discard block
 block discarded – undo
628 628
         
629 629
         $filterPanel = $view->advancedFilterPanel($filter);
630 630
         
631
-        if($this->getFilterVisibility($itemId)){
631
+        if ($this->getFilterVisibility($itemId)) {
632 632
             $filterPanel->addClass('show-filter');
633 633
         }
634
-        else{
634
+        else {
635 635
             $filterPanel->addClass('hide-filter');
636 636
         }
637 637
         
638 638
         $toolbar = $this->toolbar($view);
639 639
         $listToolbar = $this->listToolbar($view);
640 640
         
641
-        if($view->isColumnSelectionAllowed()){
641
+        if ($view->isColumnSelectionAllowed()) {
642 642
             $App = $this->App();
643 643
             $columnSelectionMenu = $W->Link($App->translate('Table configuration'), $this->proxy()
644 644
                 ->modelViewColumnSettings($type, $itemId))
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         $page->setTitle($App->translate('Table configuration'));
666 666
         $W = bab_Widgets();
667 667
         
668
-        $currentFilter = $W->getUserConfiguration($itemId . '/filter', 'widgets', false);
668
+        $currentFilter = $W->getUserConfiguration($itemId.'/filter', 'widgets', false);
669 669
         
670 670
         $view = $this->modelView(array(), $type, null, $itemId);
671 671
         
@@ -697,21 +697,21 @@  discard block
 block discarded – undo
697 697
         $tableModelViewId = $data['tableModelViewId'];
698 698
         $sessionOnly = isset($data['inSession']) ? $data['inSession'] : false;
699 699
         
700
-        if(isset($data['pageLength'])){
701
-            $W->setUserConfiguration($tableModelViewId . '/pageLength', $data['pageLength'], 'widgets', $sessionOnly);
700
+        if (isset($data['pageLength'])) {
701
+            $W->setUserConfiguration($tableModelViewId.'/pageLength', $data['pageLength'], 'widgets', $sessionOnly);
702 702
         }
703
-        if(isset($data['displaySubTotalRow'])){
704
-            $W->setUserConfiguration($tableModelViewId . '/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly);
703
+        if (isset($data['displaySubTotalRow'])) {
704
+            $W->setUserConfiguration($tableModelViewId.'/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly);
705 705
         }
706
-        if(isset($data['columns'])){
707
-            $W->setUserConfiguration($tableModelViewId . '/columns', $data['columns'], 'widgets', $sessionOnly);
706
+        if (isset($data['columns'])) {
707
+            $W->setUserConfiguration($tableModelViewId.'/columns', $data['columns'], 'widgets', $sessionOnly);
708 708
         }
709
-        if(isset($data['currentFilter'])){
709
+        if (isset($data['currentFilter'])) {
710 710
             $filter = json_decode($data['currentFilter'], true);
711
-            $W->setUserConfiguration($tableModelViewId . '/filter', $filter, 'widgets', $sessionOnly);
711
+            $W->setUserConfiguration($tableModelViewId.'/filter', $filter, 'widgets', $sessionOnly);
712 712
         }
713 713
         
714
-        $this->addReloadSelector('.depends-' . $tableModelViewId);
714
+        $this->addReloadSelector('.depends-'.$tableModelViewId);
715 715
         return true;
716 716
     }
717 717
     
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
         $tableModelViewId = $data['tableModelViewId'];
724 724
         $sessionOnly = isset($data['inSession']) ? $data['inSession'] : false;
725 725
         
726
-        $W->deleteUserConfiguration($data['tableModelViewId'] . '/columns', 'widgets', $sessionOnly);
726
+        $W->deleteUserConfiguration($data['tableModelViewId'].'/columns', 'widgets', $sessionOnly);
727 727
         
728 728
         $this->addReloadSelector("#{$tableModelViewId}");
729 729
         return true;
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
         
773 773
         $itemMenus = $this->getListItemMenus();
774 774
         
775
-        foreach ($itemMenus as $itemMenuId => $itemMenu){
775
+        foreach ($itemMenus as $itemMenuId => $itemMenu) {
776 776
             $page->addItemMenu($itemMenuId, $itemMenu['label'], $itemMenu['action']);
777 777
         }
778 778
         
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
         $columns = $tableview->getVisibleColumns();
812 812
         $column = isset($columns[$col]) ? $columns[$col] : null;
813 813
         
814
-        if(! isset($column)){
814
+        if (!isset($column)) {
815 815
             return true;
816 816
         }
817 817
         
@@ -825,8 +825,8 @@  discard block
 block discarded – undo
825 825
             $col
826 826
         )));
827 827
         
828
-        $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false);
829
-        if(isset($filter[$col])){
828
+        $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false);
829
+        if (isset($filter[$col])) {
830 830
             $widget->setValue($filter[$col]);
831 831
         }
832 832
         
@@ -842,21 +842,21 @@  discard block
 block discarded – undo
842 842
         
843 843
         $key = $data['key'];
844 844
         
845
-        $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false);
846
-        if(isset($data['moreCriteria']) && $data['moreCriteria']){
845
+        $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false);
846
+        if (isset($data['moreCriteria']) && $data['moreCriteria']) {
847 847
             $filter = array();
848 848
         }
849
-        foreach ($data['filter'] as $filterName => $filterValue){
849
+        foreach ($data['filter'] as $filterName => $filterValue) {
850 850
             $filter[$filterName] = $filterValue;
851 851
         }
852
-        $W->setUserConfiguration($key . '/filter', $filter, 'widgets', false);
852
+        $W->setUserConfiguration($key.'/filter', $filter, 'widgets', false);
853 853
         
854 854
         session_start();
855 855
         $_SESSION['modelViewMoreCriterias'][$key] = array();
856 856
         unset($_SESSION['modelViewMoreCriterias'][$key]);
857 857
         session_write_close();
858 858
         
859
-        $this->addReloadSelector('.depends-' . $key);
859
+        $this->addReloadSelector('.depends-'.$key);
860 860
         
861 861
         return true;
862 862
     }
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
         $Ui = $App->Ui();
868 868
         
869 869
         $page = $Ui->Page();
870
-        $page->addClass('depends-modelViewMoreCriterias-' . $key);
870
+        $page->addClass('depends-modelViewMoreCriterias-'.$key);
871 871
         
872 872
         $page->setTitle($App->translate('Search'));
873 873
         
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
         $editor = $Ui->BasicEditor($itemId, $W->VBoxLayout());
888 888
         $editor->setReloadAction($this->proxy()
889 889
             ->getDisplayListMoreCriteriaEditor($key, $editor->getId()));
890
-        $editor->addClass('depends-modelViewMoreCriterias-' . $key);
890
+        $editor->addClass('depends-modelViewMoreCriterias-'.$key);
891 891
         $editor->addClass('widget-no-close');
892 892
         $editor->setIconFormat();
893 893
         $editor->isAjax = true;
@@ -902,24 +902,24 @@  discard block
 block discarded – undo
902 902
         $columns = $tableview->getVisibleColumns();
903 903
         $filter = $tableview->getFilterValues();
904 904
         
905
-        if(! isset($itemId)){
905
+        if (!isset($itemId)) {
906 906
             $editor->setSaveAction($this->proxy()
907 907
                 ->saveDisplayListFilter(), $App->translate('Search'));
908 908
             $editor->setCancelAction($this->proxy()
909 909
                 ->cancel());
910 910
             
911 911
             $fields = array();
912
-            foreach ($filter as $fieldName => $value){
913
-                if(empty($value)){
912
+            foreach ($filter as $fieldName => $value) {
913
+                if (empty($value)) {
914 914
                     continue;
915 915
                 }
916
-                if(! isset($columns[$fieldName])){
916
+                if (!isset($columns[$fieldName])) {
917 917
                     continue;
918 918
                 }
919 919
                 
920 920
                 $column = $columns[$fieldName];
921 921
                 
922
-                if(! $column->isSearchable()){
922
+                if (!$column->isSearchable()) {
923 923
                     continue;
924 924
                 }
925 925
                 
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
             $_SESSION['modelViewMoreCriterias'][$key] = $fields;
930 930
             session_write_close();
931 931
         }
932
-        else{
932
+        else {
933 933
             $fields = $_SESSION['modelViewMoreCriterias'][$key];
934 934
         }
935 935
         
@@ -937,24 +937,24 @@  discard block
 block discarded – undo
937 937
         
938 938
         $nbAlreadyAdded = 0;
939 939
         
940
-        foreach ($fields as $fieldName => $fieldValue){
941
-            if(! isset($columns[$fieldName])){
940
+        foreach ($fields as $fieldName => $fieldValue) {
941
+            if (!isset($columns[$fieldName])) {
942 942
                 continue;
943 943
             }
944 944
             $column = $columns[$fieldName];
945 945
             
946
-            if(! $column->isSearchable()){
946
+            if (!$column->isSearchable()) {
947 947
                 continue;
948 948
             }
949 949
             
950 950
             $field = $column->getField();
951 951
             
952
-            if($nbAlreadyAdded >= 2){
952
+            if ($nbAlreadyAdded >= 2) {
953 953
                 $nbAlreadyAdded = 0;
954 954
                 $alreadyFilteredBox = null;
955 955
             }
956 956
             
957
-            if(! isset($alreadyFilteredBox)){
957
+            if (!isset($alreadyFilteredBox)) {
958 958
                 $editor->addItem($alreadyFilteredBox = $W->FlexItems()
959 959
                     ->setSizePolicy('customsection-field-box customsection-fieldsgroup-box'));
960 960
             }
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
                 ->setJustifyContent(WidgetFlexLayout::FLEX_JUSTIFY_CONTENT_SPACE_BETWEEN)
975 975
                 ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_CONTENT_CENTER))
976 976
                 ->addClass('app-customsection-groupedfield app-displaylist-morecriteria-groupedfield'));
977
-            $nbAlreadyAdded ++;
977
+            $nbAlreadyAdded++;
978 978
             
979 979
             $alreadyAddedFilters[$fieldName] = $fieldName;
980 980
         }
@@ -984,26 +984,26 @@  discard block
 block discarded – undo
984 984
             ''
985 985
         );
986 986
         
987
-        foreach ($columns as $fieldName => $column){
988
-            if(! $column->isSearchable()){
987
+        foreach ($columns as $fieldName => $column) {
988
+            if (!$column->isSearchable()) {
989 989
                 continue;
990 990
             }
991 991
             
992 992
             $field = $column->getField();
993 993
             
994
-            if(isset($alreadyAddedFilters[$fieldName])){
994
+            if (isset($alreadyAddedFilters[$fieldName])) {
995 995
                 continue;
996 996
             }
997 997
             
998 998
             $label = $tableview->getFilterLabelWidget($fieldName, $field);
999 999
             $label = trim($label->getText());
1000
-            if(empty($label)){
1000
+            if (empty($label)) {
1001 1001
                 continue;
1002 1002
             }
1003 1003
             $options[$fieldName] = $label;
1004 1004
         }
1005 1005
         
1006
-        if(count($options) > 1){
1006
+        if (count($options) > 1) {
1007 1007
             $editor->addItem($W->Html('<hr/>'));
1008 1008
             $editor->addItem($W->FlexItems($W->LabelledWidget($App->translate('Add a new criteria'), $W->Select2()
1009 1009
                 ->setOptions($options), 'newField')
@@ -1020,12 +1020,12 @@  discard block
 block discarded – undo
1020 1020
     {
1021 1021
         session_start();
1022 1022
         $fields = isset($data['filter']) ? $data['filter'] : array();
1023
-        if(isset($data['newField']) && ! empty($data['newField'])){
1023
+        if (isset($data['newField']) && !empty($data['newField'])) {
1024 1024
             $newField = $data['newField'];
1025 1025
             unset($data['key']);
1026 1026
             unset($data['moreCriteria']);
1027 1027
             $fields[$newField] = '';
1028
-            $this->addReloadSelector('.depends-modelViewMoreCriterias-' . $key);
1028
+            $this->addReloadSelector('.depends-modelViewMoreCriterias-'.$key);
1029 1029
         }
1030 1030
         $_SESSION['modelViewMoreCriterias'][$key] = $fields;
1031 1031
         return true;
@@ -1034,12 +1034,12 @@  discard block
 block discarded – undo
1034 1034
     public function removeMoreCriteriaField($key, $field)
1035 1035
     {
1036 1036
         $fields = $_SESSION['modelViewMoreCriterias'][$key];
1037
-        if(isset($fields[$field])){
1037
+        if (isset($fields[$field])) {
1038 1038
             unset($fields[$field]);
1039 1039
             session_start();
1040 1040
             $_SESSION['modelViewMoreCriterias'][$key] = $fields;
1041 1041
         }
1042
-        $this->addReloadSelector('.depends-modelViewMoreCriterias-' . $key);
1042
+        $this->addReloadSelector('.depends-modelViewMoreCriterias-'.$key);
1043 1043
         return true;
1044 1044
     }
1045 1045
     
@@ -1095,17 +1095,17 @@  discard block
 block discarded – undo
1095 1095
         
1096 1096
         switch ($format) {
1097 1097
             case 'xlsx':
1098
-                $tableview->downloadXlsx($filename . '.xlsx');
1098
+                $tableview->downloadXlsx($filename.'.xlsx');
1099 1099
                 break;
1100 1100
             case 'xls':
1101
-                $tableview->downloadExcel($filename . '.xls');
1101
+                $tableview->downloadExcel($filename.'.xls');
1102 1102
                 break;
1103 1103
             case 'ssv':
1104
-                $tableview->downloadCsv($filename . '.csv', ';', $inline, 'Windows-1252');
1104
+                $tableview->downloadCsv($filename.'.csv', ';', $inline, 'Windows-1252');
1105 1105
                 break;
1106 1106
             case 'csv':
1107 1107
             default:
1108
-                $tableview->downloadCsv($filename . '.csv', ',', $inline, \bab_charset::getIso());
1108
+                $tableview->downloadCsv($filename.'.csv', ',', $inline, \bab_charset::getIso());
1109 1109
                 break;
1110 1110
         }
1111 1111
     }
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
         $recordSet = $this->getRecordSet();
1172 1172
         
1173 1173
         $record = $recordSet->request($id);
1174
-        if(! $record->isReadable()){
1174
+        if (!$record->isReadable()) {
1175 1175
             throw new AppAccessException($App->translate('You do not have access to this page'));
1176 1176
         }
1177 1177
         
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
         
1180 1180
         $recordClassname = $this->getRecordClassName();
1181 1181
         
1182
-        $viewClassname = $recordClassname . 'FullFrame';
1182
+        $viewClassname = $recordClassname.'FullFrame';
1183 1183
         
1184 1184
         $fullFrame = $Ui->$viewClassname($record);
1185 1185
         $fullFrame->setView($view);
@@ -1191,10 +1191,10 @@  discard block
 block discarded – undo
1191 1191
         $mainMenu->setSizePolicy(\Func_Icons::ICON_LEFT_24);
1192 1192
         
1193 1193
         $page = $Ui->Page();
1194
-        if(isset($itemId)){
1194
+        if (isset($itemId)) {
1195 1195
             $page->setId($itemId);
1196 1196
         }
1197
-        $page->addClass('depends-' . $this->getRecordClassName());
1197
+        $page->addClass('depends-'.$this->getRecordClassName());
1198 1198
         
1199 1199
         $page->addToolbar($mainMenu);
1200 1200
         
@@ -1233,14 +1233,14 @@  discard block
 block discarded – undo
1233 1233
         
1234 1234
         $editor = $this->recordEditor();
1235 1235
         
1236
-        if(isset($id)){
1236
+        if (isset($id)) {
1237 1237
             $record = $recordSet->request($id);
1238
-            if(! $record->isUpdatable()){
1238
+            if (!$record->isUpdatable()) {
1239 1239
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1240 1240
             }
1241 1241
         }
1242
-        else{
1243
-            if(! $recordSet->isCreatable()){
1242
+        else {
1243
+            if (!$recordSet->isCreatable()) {
1244 1244
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1245 1245
             }
1246 1246
             $record = $recordSet->newRecord();
@@ -1275,15 +1275,15 @@  discard block
 block discarded – undo
1275 1275
         
1276 1276
         $editor = $Ui->TagsEditor();
1277 1277
         
1278
-        if(isset($id)){
1278
+        if (isset($id)) {
1279 1279
             $record = $recordSet->request($id);
1280
-            if(! $record->isUpdatable()){
1280
+            if (!$record->isUpdatable()) {
1281 1281
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1282 1282
             }
1283 1283
             $editor->setRecord($record);
1284 1284
         }
1285
-        else{
1286
-            if(! $recordSet->isCreatable()){
1285
+        else {
1286
+            if (!$recordSet->isCreatable()) {
1287 1287
                 throw new AppAccessException($App->translate('You do not have access to this page'));
1288 1288
             }
1289 1289
             $record = $recordSet->newRecord();
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
         
1335 1335
         $recordTitle = $record->getRecordTitle();
1336 1336
         
1337
-        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"');
1337
+        $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"');
1338 1338
         return $message;
1339 1339
     }
1340 1340
     
@@ -1393,45 +1393,45 @@  discard block
 block discarded – undo
1393 1393
         $pk = $recordSet->getPrimaryKey();
1394 1394
         $message = null;
1395 1395
         
1396
-        if(! empty($data[$pk])){
1396
+        if (!empty($data[$pk])) {
1397 1397
             $record = $recordSet->request($data[$pk]);
1398 1398
             unset($data[$pk]);
1399 1399
             
1400
-            if(! $record->isUpdatable()){
1400
+            if (!$record->isUpdatable()) {
1401 1401
                 throw new AppAccessException('Access denied');
1402 1402
             }
1403 1403
             
1404 1404
             $message = $this->getModifedMessage($record);
1405 1405
         }
1406
-        else{
1406
+        else {
1407 1407
             
1408 1408
             $record = $recordSet->newRecord();
1409 1409
             
1410
-            if(! $recordSet->isCreatable()){
1410
+            if (!$recordSet->isCreatable()) {
1411 1411
                 throw new AppAccessException('Access denied');
1412 1412
             }
1413 1413
             
1414 1414
             $message = $this->getCreatedMessage();
1415 1415
         }
1416 1416
         
1417
-        if(! isset($record)){
1417
+        if (!isset($record)) {
1418 1418
             throw new AppSaveException($App->translate('The record does not exists'));
1419 1419
         }
1420 1420
         
1421
-        if(! isset($data)){
1421
+        if (!isset($data)) {
1422 1422
             throw new AppSaveException($App->translate('Nothing to save'));
1423 1423
         }
1424 1424
         
1425 1425
         $record->setFormInputValues($data);
1426 1426
         
1427 1427
         $this->preSave($record, $data);
1428
-        if($record->save()){
1428
+        if ($record->save()) {
1429 1429
             $this->postSave($record, $data);
1430
-            if(is_string($message)){
1430
+            if (is_string($message)) {
1431 1431
                 $this->addToast($message);
1432 1432
             }
1433 1433
             
1434
-            $this->addReloadSelector('.depends-' . $this->getRecordClassName());
1434
+            $this->addReloadSelector('.depends-'.$this->getRecordClassName());
1435 1435
             return true;
1436 1436
         }
1437 1437
         
@@ -1454,16 +1454,16 @@  discard block
 block discarded – undo
1454 1454
         
1455 1455
         $record = $recordSet->request($id);
1456 1456
         
1457
-        if(! $record->isDeletable()){
1457
+        if (!$record->isDeletable()) {
1458 1458
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1459 1459
         }
1460 1460
         $deletedMessage = $this->getDeletedMessage($record);
1461 1461
         
1462
-        if($record->delete()){
1462
+        if ($record->delete()) {
1463 1463
             $this->addToast($deletedMessage);
1464 1464
         }
1465 1465
         
1466
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1466
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1467 1467
         
1468 1468
         return true;
1469 1469
     }
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
         $page->addClass('app-page-editor');
1488 1488
         $page->setTitle($App->translate('Deletion'));
1489 1489
         
1490
-        if(! isset($record)){
1490
+        if (!isset($record)) {
1491 1491
             $page->addItem($W->Label($App->translate('This element does not exists.')));
1492 1492
             $page->addClass('alert', 'alert-warning');
1493 1493
             return $page;
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
         
1501 1501
         $recordTitle = $record->getRecordTitle();
1502 1502
         
1503
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1503
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1504 1504
         $form->addItem($W->Title($subTitle, 5));
1505 1505
         
1506 1506
         $form->addItem($W->Title($App->translate('Confirm delete?'), 6));
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
         
1510 1510
         $confirmedAction = $this->proxy()->delete($id);
1511 1511
         $parameters = $confirmedAction->getParameters();
1512
-        foreach ($parameters as $key => $value){
1512
+        foreach ($parameters as $key => $value) {
1513 1513
             $form->setHiddenValue($key, $value);
1514 1514
         }
1515 1515
         $form->addButton($W->SubmitButton()
@@ -1539,20 +1539,20 @@  discard block
 block discarded – undo
1539 1539
         
1540 1540
         $record = $recordSet->request($id);
1541 1541
         
1542
-        if(! $record->isRemovable()){
1542
+        if (!$record->isRemovable()) {
1543 1543
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1544 1544
         }
1545 1545
         
1546 1546
         $App = $this->App();
1547 1547
         $deletedMessage = $App->translate('The element has been moved to the trash');
1548 1548
         
1549
-        if($recordSet->delete($recordSet->id->is($record->id), AppTraceableRecord::DELETED_STATUS_IN_TRASH)){
1550
-            if(is_string($deletedMessage)){
1549
+        if ($recordSet->delete($recordSet->id->is($record->id), AppTraceableRecord::DELETED_STATUS_IN_TRASH)) {
1550
+            if (is_string($deletedMessage)) {
1551 1551
                 $this->addToast($deletedMessage);
1552 1552
             }
1553 1553
         }
1554 1554
         
1555
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1555
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1556 1556
         
1557 1557
         return true;
1558 1558
     }
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
         
1581 1581
         $recordTitle = $record->getRecordTitle();
1582 1582
         
1583
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1583
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1584 1584
         $form->addItem($W->Title($subTitle, 5));
1585 1585
         
1586 1586
         $form->addItem($W->Title($App->translate('Confirm delete?'), 6));
@@ -1589,7 +1589,7 @@  discard block
 block discarded – undo
1589 1589
         
1590 1590
         $confirmedAction = $this->proxy()->remove($id);
1591 1591
         $parameters = $confirmedAction->getParameters();
1592
-        foreach ($parameters as $key => $value){
1592
+        foreach ($parameters as $key => $value) {
1593 1593
             $form->setHiddenValue($key, $value);
1594 1594
         }
1595 1595
         $form->addButton($W->SubmitButton()
@@ -1620,12 +1620,12 @@  discard block
 block discarded – undo
1620 1620
         $records = $recordSet->select($recordSet->id->is($id), true);
1621 1621
         
1622 1622
         $record = null;
1623
-        foreach ($records as $record){
1623
+        foreach ($records as $record) {
1624 1624
         }
1625
-        if(! isset($record)){
1625
+        if (!isset($record)) {
1626 1626
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1627 1627
         }
1628
-        if(! $record->isRestorable()){
1628
+        if (!$record->isRestorable()) {
1629 1629
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1630 1630
         }
1631 1631
         
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
         $record->save();
1637 1637
         $this->addToast($deletedMessage);
1638 1638
         
1639
-        $this->addReloadSelector('.depends-' . $record->getClassName());
1639
+        $this->addReloadSelector('.depends-'.$record->getClassName());
1640 1640
         
1641 1641
         return true;
1642 1642
     }
@@ -1656,9 +1656,9 @@  discard block
 block discarded – undo
1656 1656
         $records = $recordSet->select($recordSet->id->is($id), true);
1657 1657
         
1658 1658
         $record = null;
1659
-        foreach ($records as $record){
1659
+        foreach ($records as $record) {
1660 1660
         }
1661
-        if(! isset($record)){
1661
+        if (!isset($record)) {
1662 1662
             throw new AppAccessException('Sorry, You are not allowed to perform this operation');
1663 1663
         }
1664 1664
         
@@ -1671,12 +1671,12 @@  discard block
 block discarded – undo
1671 1671
         
1672 1672
         $recordTitle = $record->getRecordTitle();
1673 1673
         
1674
-        $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"';
1674
+        $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"';
1675 1675
         $form->addItem($W->Title($subTitle, 5));
1676 1676
         
1677 1677
         $confirmedAction = $this->proxy()->restore($id);
1678 1678
         $parameters = $confirmedAction->getParameters();
1679
-        foreach ($parameters as $key => $value){
1679
+        foreach ($parameters as $key => $value) {
1680 1680
             $form->setHiddenValue($key, $value);
1681 1681
         }
1682 1682
         $form->addButton($W->SubmitButton()
@@ -1702,12 +1702,12 @@  discard block
 block discarded – undo
1702 1702
         $view = $this->modelView($filter, $type, null, $itemId);
1703 1703
         $view->setAjaxAction();
1704 1704
         
1705
-        if(isset($filter)){
1705
+        if (isset($filter)) {
1706 1706
             $view->setFilterValues($filter);
1707 1707
         }
1708 1708
         $filter = $view->getFilterValues();
1709 1709
         
1710
-        if(isset($filter['showTotal']) && $filter['showTotal']){
1710
+        if (isset($filter['showTotal']) && $filter['showTotal']) {
1711 1711
             $view->displaySubTotalRow(true);
1712 1712
         }
1713 1713
         
@@ -1753,7 +1753,7 @@  discard block
 block discarded – undo
1753 1753
         $page->addItem($trashView);
1754 1754
         
1755 1755
         $itemMenus = $this->getListItemMenus();
1756
-        foreach ($itemMenus as $itemMenuId => $itemMenu){
1756
+        foreach ($itemMenus as $itemMenuId => $itemMenu) {
1757 1757
             $page->addItemMenu($itemMenuId, $itemMenu['label'], $itemMenu['action']);
1758 1758
         }
1759 1759
         $page->setCurrentItemMenu('displayTrash');
@@ -1779,16 +1779,16 @@  discard block
 block discarded – undo
1779 1779
         $registry = bab_getRegistryInstance();
1780 1780
         
1781 1781
         $userId = '0';
1782
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id . '/filters');
1782
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters');
1783 1783
         
1784
-        while ($filterName = $registry->fetchChildKey()){
1784
+        while ($filterName = $registry->fetchChildKey()) {
1785 1785
             $filters[] = $filterName;
1786 1786
         }
1787 1787
         
1788 1788
         $userId = bab_getUserId();
1789
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id . '/filters');
1789
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters');
1790 1790
         
1791
-        while ($filterName = $registry->fetchChildKey()){
1791
+        while ($filterName = $registry->fetchChildKey()) {
1792 1792
             $filters[] = $filterName;
1793 1793
         }
1794 1794
         
@@ -1805,15 +1805,15 @@  discard block
 block discarded – undo
1805 1805
     {
1806 1806
         $W = bab_Widgets();
1807 1807
         $tableview = $this->modelView(null, 'table');
1808
-        $W->setUserConfiguration($tableview->getId() . '/currentFilterName', $filterName, 'widgets', false);
1808
+        $W->setUserConfiguration($tableview->getId().'/currentFilterName', $filterName, 'widgets', false);
1809 1809
         
1810 1810
         $registry = bab_getRegistryInstance();
1811 1811
         $userId = '0';
1812
-        $registry->changeDirectory('/widgets/user/' . $userId . '/' . $tableview->getId() . '/filters');
1812
+        $registry->changeDirectory('/widgets/user/'.$userId.'/'.$tableview->getId().'/filters');
1813 1813
         $filterValues = $registry->getValue($filterName);
1814 1814
         
1815
-        if(! $filterValues){
1816
-            $filterValues = $W->getUserConfiguration($tableview->getId() . '/filters/' . $filterName, 'widgets', false);
1815
+        if (!$filterValues) {
1816
+            $filterValues = $W->getUserConfiguration($tableview->getId().'/filters/'.$filterName, 'widgets', false);
1817 1817
         }
1818 1818
         
1819 1819
         $tableview = $this->modelView($filterValues, 'table');
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
     {
1830 1830
         $W = bab_Widgets();
1831 1831
         $id = $this->getModelViewDefaultId();
1832
-        $filter = $W->getUserConfiguration($id . '/currentFilterName', 'widgets', false);
1832
+        $filter = $W->getUserConfiguration($id.'/currentFilterName', 'widgets', false);
1833 1833
         
1834 1834
         return $filter;
1835 1835
     }
@@ -1839,12 +1839,12 @@  discard block
 block discarded – undo
1839 1839
      */
1840 1840
     public function resetFilters($name = null)
1841 1841
     {
1842
-        if(isset($name)){
1842
+        if (isset($name)) {
1843 1843
             $W = bab_Widgets();
1844
-            $filter = $W->getUserConfiguration($tableview->getId() . '/filters/' . $name, 'widgets', false);
1844
+            $filter = $W->getUserConfiguration($tableview->getId().'/filters/'.$name, 'widgets', false);
1845 1845
             $filterValues = $filter['values'];
1846 1846
         }
1847
-        else{
1847
+        else {
1848 1848
             $filterValues = null;
1849 1849
         }
1850 1850
         
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
             'values' => $filterValues
1872 1872
         );
1873 1873
         
1874
-        $W->setUserConfiguration($tableview->getId() . '/filters/' . $name, $data, 'widgets', false);
1874
+        $W->setUserConfiguration($tableview->getId().'/filters/'.$name, $data, 'widgets', false);
1875 1875
         
1876 1876
         return true;
1877 1877
     }
@@ -1888,7 +1888,7 @@  discard block
 block discarded – undo
1888 1888
         $Ui = $App->Ui();
1889 1889
         
1890 1890
         $currentFilterName = $this->getCurrentFilterName();
1891
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $currentFilterName, 'widgets', false);
1891
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$currentFilterName, 'widgets', false);
1892 1892
         
1893 1893
         $page = $Ui->Page();
1894 1894
         
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
         $App = $this->App();
1926 1926
         $Ui = $App->Ui();
1927 1927
         
1928
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
1928
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
1929 1929
         
1930 1930
         $page = $Ui->Page();
1931 1931
         
@@ -1963,8 +1963,8 @@  discard block
 block discarded – undo
1963 1963
         $page->addItem($filtersBox);
1964 1964
         
1965 1965
         $filterNames = $this->getFilterNames();
1966
-        foreach ($filterNames as $filterName){
1967
-            $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false);
1966
+        foreach ($filterNames as $filterName) {
1967
+            $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false);
1968 1968
             
1969 1969
             $filterBox = $W->HBoxItems()
1970 1970
                 ->setVerticalAlign('middle')
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
         $App = $this->App();
2004 2004
         $Ui = $App->Ui();
2005 2005
         
2006
-        $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
2006
+        $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
2007 2007
         
2008 2008
         $page = $Ui->Page();
2009 2009
         
@@ -2034,7 +2034,7 @@  discard block
 block discarded – undo
2034 2034
         $this->requireDeleteMethod();
2035 2035
         
2036 2036
         $W = bab_Widgets();
2037
-        $W->deleteUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false);
2037
+        $W->deleteUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false);
2038 2038
         
2039 2039
         return true;
2040 2040
     }
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
         $modelView = $this->modelView();
2045 2045
         $modelView->setHighlightedRows($ids);
2046 2046
         
2047
-        $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords');
2047
+        $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords');
2048 2048
         
2049 2049
         return true;
2050 2050
     }
@@ -2054,7 +2054,7 @@  discard block
 block discarded – undo
2054 2054
         $modelView = $this->modelView();
2055 2055
         $modelView->clearHighlightedRows();
2056 2056
         
2057
-        $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords');
2057
+        $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords');
2058 2058
         
2059 2059
         return true;
2060 2060
     }
@@ -2073,34 +2073,34 @@  discard block
 block discarded – undo
2073 2073
         $box = $W->VBoxItems();
2074 2074
         
2075 2075
         $isComponent = false;
2076
-        if($component = $App->getCurrentComponent()){
2076
+        if ($component = $App->getCurrentComponent()) {
2077 2077
             $Ui = $component->ui();
2078 2078
             $viewClassname = 'FullFrame';
2079 2079
             $isComponent = true;
2080 2080
         }
2081
-        else{
2081
+        else {
2082 2082
             $Ui = $App->Ui();
2083 2083
             $recordClassname = $this->getRecordClassName();
2084
-            $viewClassname = $recordClassname . 'FullFrame';
2084
+            $viewClassname = $recordClassname.'FullFrame';
2085 2085
         }
2086 2086
         
2087
-        if($records->count() > 0){
2087
+        if ($records->count() > 0) {
2088 2088
             $box->addItem($W->Link('', $this->proxy()
2089 2089
                 ->clearHighlightedRecords())
2090 2090
                 ->setAjaxAction(null, false)
2091 2091
                 ->addClass('icon', \Func_Icons::ACTIONS_ARROW_RIGHT_DOUBLE, "app_closeHighlightButton")
2092
-                ->setSizePolicy(\Func_Icons::ICON_LEFT_32 . ' pull-right'));
2092
+                ->setSizePolicy(\Func_Icons::ICON_LEFT_32.' pull-right'));
2093 2093
             
2094
-            foreach ($records as $record){
2094
+            foreach ($records as $record) {
2095 2095
                 
2096
-                if($isComponent){
2096
+                if ($isComponent) {
2097 2097
                     $fullFrame = $Ui->$viewClassname($record);
2098
-                    if(method_exists($record, "getBlueprint")){
2098
+                    if (method_exists($record, "getBlueprint")) {
2099 2099
                         $view = $record->getBlueprint();
2100 2100
                     }
2101 2101
                     $fullFrame->setView($view);
2102 2102
                 }
2103
-                else{
2103
+                else {
2104 2104
                     $fullFrame = $Ui->$viewClassname($record->id, $view);
2105 2105
                 }
2106 2106
                 
@@ -2109,19 +2109,19 @@  discard block
 block discarded – undo
2109 2109
             $box->addClass('box', 'shadow');
2110 2110
         }
2111 2111
         
2112
-        $box->addClass('depends-' . $modelView->getId() . '-HighlightedRecords');
2112
+        $box->addClass('depends-'.$modelView->getId().'-HighlightedRecords');
2113 2113
         $box->setReloadAction($this->proxy()
2114 2114
             ->previewHighlightedRecords($view));
2115 2115
         return $box;
2116 2116
     }
2117 2117
 
2118
-    public function search($q = null){
2118
+    public function search($q = null) {
2119 2119
         session_write_close();
2120 2120
         $set = $this->getRecordSet();
2121 2121
         $collection = new WidgetSelect2OptionsCollection();
2122
-        if($q == null || strlen($q) <= 1){
2122
+        if ($q == null || strlen($q) <= 1) {
2123 2123
             $collection->addOption(
2124
-                new WidgetSelect2Option(0,$this->App()->translate("Keyword too small"))
2124
+                new WidgetSelect2Option(0, $this->App()->translate("Keyword too small"))
2125 2125
             );
2126 2126
             header("Content-type: application/json; charset=utf-8");
2127 2127
             echo $collection->output();
@@ -2134,7 +2134,7 @@  discard block
 block discarded – undo
2134 2134
                 $set->$field->contains($q)
2135 2135
             )
2136 2136
         );
2137
-        foreach($records as $r){
2137
+        foreach ($records as $r) {
2138 2138
             $collection->addOption(
2139 2139
                 new WidgetSelect2Option($r->id, $r->$field)
2140 2140
             );
Please login to merge, or discard this patch.
programs/Ui/AppHelpers.php 3 patches
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -59,50 +59,50 @@  discard block
 block discarded – undo
59 59
 
60 60
 function app_genericSetEditor(ORMRecordSet $set)
61 61
 {
62
-	$O = \bab_functionality::get('LibOrm');
63
-	$O->init();
64
-	$W = \bab_Widgets();
65
-	$layout = $W->VBoxLayout();
66
-	$layout->setVerticalSpacing(1, 'em');
67
-
68
-
69
-	$fields = $set->getFields();
70
-
71
-	foreach ($fields as $field) {
72
-		$description = $field->getDescription();
73
-		if (empty($description)) {
74
-			$description = $field->getName();
75
-		}
76
-		$fieldLabel = $W->Label($description . ':');
77
-
78
-		if ($field instanceof ORMDateField) {
79
-			$widget = $W->DatePicker();
80
-		} else if ($field instanceof ORMTimeField) {
81
-			$widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
82
-		} else if ($field instanceof ORMStringField) {
83
-			$widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength())));
84
-		} else if ($field instanceof ORMEnumField) {
85
-			$widget = $W->Select();
86
-			$widget->addOption('', '');
87
-			foreach ($field->getValues() as $key => $text) {
88
-				$widget->addOption($key, $text);
89
-			}
90
-		} else if ($field instanceof ORMIntField) {
91
-			$widget = $W->LineEdit()->setSize(9);
92
-		} else if ($field instanceof ORMTextField) {
93
-			$widget = $W->TextEdit()->setColumns(80)->setLines(5);
94
-		} else if ($field instanceof ORMRecordSet) {
95
-				$widget = app_genericSetEditor($field);
96
-				$widget->addClass('sub-form');
97
-		} else {
98
-			$widget = null;
99
-		}
100
-		if (isset($widget)) {
101
-			$layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
102
-		}
103
-	}
104
-
105
-	return $layout;
62
+    $O = \bab_functionality::get('LibOrm');
63
+    $O->init();
64
+    $W = \bab_Widgets();
65
+    $layout = $W->VBoxLayout();
66
+    $layout->setVerticalSpacing(1, 'em');
67
+
68
+
69
+    $fields = $set->getFields();
70
+
71
+    foreach ($fields as $field) {
72
+        $description = $field->getDescription();
73
+        if (empty($description)) {
74
+            $description = $field->getName();
75
+        }
76
+        $fieldLabel = $W->Label($description . ':');
77
+
78
+        if ($field instanceof ORMDateField) {
79
+            $widget = $W->DatePicker();
80
+        } else if ($field instanceof ORMTimeField) {
81
+            $widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker');
82
+        } else if ($field instanceof ORMStringField) {
83
+            $widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength())));
84
+        } else if ($field instanceof ORMEnumField) {
85
+            $widget = $W->Select();
86
+            $widget->addOption('', '');
87
+            foreach ($field->getValues() as $key => $text) {
88
+                $widget->addOption($key, $text);
89
+            }
90
+        } else if ($field instanceof ORMIntField) {
91
+            $widget = $W->LineEdit()->setSize(9);
92
+        } else if ($field instanceof ORMTextField) {
93
+            $widget = $W->TextEdit()->setColumns(80)->setLines(5);
94
+        } else if ($field instanceof ORMRecordSet) {
95
+                $widget = app_genericSetEditor($field);
96
+                $widget->addClass('sub-form');
97
+        } else {
98
+            $widget = null;
99
+        }
100
+        if (isset($widget)) {
101
+            $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
102
+        }
103
+    }
104
+
105
+    return $layout;
106 106
 }
107 107
 
108 108
 
@@ -115,50 +115,50 @@  discard block
 block discarded – undo
115 115
  */
116 116
 function app_genericSetFilterForm(ORMRecordSet $set)
117 117
 {
118
-	$O = \bab_functionality::get('LibOrm');
119
-	$O->init();
120
-	$W = \bab_Widgets();
121
-	$layout = $W->FlowLayout();
122
-	$layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em');
123
-
124
-
125
-	$fields = $set->getFields();
126
-
127
-	foreach ($fields as $field) {
128
-		$description = $field->getDescription();
129
-		if (empty($description)) {
130
-			$description = $field->getName();
131
-		}
132
-		$fieldLabel = $W->Label($description . ':');
133
-
134
-		if ($field instanceof ORMDateField) {
135
-			$widget = $W->PeriodPicker();
136
-		} else if ($field instanceof ORMTimeField) {
137
-			$widget = $W->TimePicker();
138
-		} else if ($field instanceof ORMStringField) {
139
-			$widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength())));
140
-		} else if ($field instanceof ORMEnumField) {
141
-			$widget = $W->Select();
142
-			$widget->addOption('', '');
143
-			foreach ($field->getValues() as $key => $text) {
144
-				$widget->addOption($key, $text);
145
-			}
146
-		} else if ($field instanceof ORMIntField) {
147
-			$widget = $W->LineEdit()->setSize(9);
148
-		} else if ($field instanceof ORMTextField) {
149
-			$widget = $widget = $W->LineEdit()->setSize(15);
150
-		} else if ($field instanceof ORMRecordSet) {
151
-			$widget = app_genericSetFilterForm($field);
152
-			$widget->addClass('sub-form');
153
-		} else {
154
-			$widget = null;
155
-		}
156
-		if (isset($widget)) {
157
-			$layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
158
-		}
159
-	}
160
-
161
-	return $layout;
118
+    $O = \bab_functionality::get('LibOrm');
119
+    $O->init();
120
+    $W = \bab_Widgets();
121
+    $layout = $W->FlowLayout();
122
+    $layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em');
123
+
124
+
125
+    $fields = $set->getFields();
126
+
127
+    foreach ($fields as $field) {
128
+        $description = $field->getDescription();
129
+        if (empty($description)) {
130
+            $description = $field->getName();
131
+        }
132
+        $fieldLabel = $W->Label($description . ':');
133
+
134
+        if ($field instanceof ORMDateField) {
135
+            $widget = $W->PeriodPicker();
136
+        } else if ($field instanceof ORMTimeField) {
137
+            $widget = $W->TimePicker();
138
+        } else if ($field instanceof ORMStringField) {
139
+            $widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength())));
140
+        } else if ($field instanceof ORMEnumField) {
141
+            $widget = $W->Select();
142
+            $widget->addOption('', '');
143
+            foreach ($field->getValues() as $key => $text) {
144
+                $widget->addOption($key, $text);
145
+            }
146
+        } else if ($field instanceof ORMIntField) {
147
+            $widget = $W->LineEdit()->setSize(9);
148
+        } else if ($field instanceof ORMTextField) {
149
+            $widget = $widget = $W->LineEdit()->setSize(15);
150
+        } else if ($field instanceof ORMRecordSet) {
151
+            $widget = app_genericSetFilterForm($field);
152
+            $widget->addClass('sub-form');
153
+        } else {
154
+            $widget = null;
155
+        }
156
+        if (isset($widget)) {
157
+            $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget));
158
+        }
159
+    }
160
+
161
+    return $layout;
162 162
 }
163 163
 
164 164
 
@@ -171,47 +171,47 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function app_LabelledWidget($labelText, WidgetDisplayableInterface $widget)
173 173
 {
174
-	$W = \bab_Widgets();
175
-
176
-	$label = $W->Label($labelText);
177
-	if ($widget instanceof WidgetInputWidget) {
178
-		$label->setAssociatedWidget($widget);
179
-	}
180
-
181
-	if ($widget instanceof WidgetCheckBox) {
182
-		$layout = $W->HBoxItems(
183
-			$widget->setSizePolicy(WidgetSizePolicy::MINIMUM),
184
-			$label
185
-		)->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
186
-	} else {
187
-		$layout = $W->VBoxItems(
188
-			$label,
189
-			$widget
190
-		)->setVerticalSpacing(0.5, 'em');
191
-	}
192
-
193
-	return $layout;
174
+    $W = \bab_Widgets();
175
+
176
+    $label = $W->Label($labelText);
177
+    if ($widget instanceof WidgetInputWidget) {
178
+        $label->setAssociatedWidget($widget);
179
+    }
180
+
181
+    if ($widget instanceof WidgetCheckBox) {
182
+        $layout = $W->HBoxItems(
183
+            $widget->setSizePolicy(WidgetSizePolicy::MINIMUM),
184
+            $label
185
+        )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
186
+    } else {
187
+        $layout = $W->VBoxItems(
188
+            $label,
189
+            $widget
190
+        )->setVerticalSpacing(0.5, 'em');
191
+    }
192
+
193
+    return $layout;
194 194
 }
195 195
 
196 196
 
197 197
 
198 198
 function app_LabelledCheckbox($labelText, $checkboxName, $options = null)
199 199
 {
200
-	$W = \bab_Widgets();
200
+    $W = \bab_Widgets();
201 201
 
202
-	$label = $W->Label($labelText)->colon(false);
203
-	$checkbox = $W->Checkbox()->setName($checkboxName);
204
-	$label->setAssociatedWidget($checkbox);
205
-	if (isset($options)) {
206
-		$label->setSizePolicy(WidgetSizePolicy::FIXED)->setCanvasOptions($options);
207
-	}
202
+    $label = $W->Label($labelText)->colon(false);
203
+    $checkbox = $W->Checkbox()->setName($checkboxName);
204
+    $label->setAssociatedWidget($checkbox);
205
+    if (isset($options)) {
206
+        $label->setSizePolicy(WidgetSizePolicy::FIXED)->setCanvasOptions($options);
207
+    }
208 208
 
209
-	$layout = $W->HBoxItems(
210
-					$checkbox->setSizePolicy(WidgetSizePolicy::MINIMUM),
211
-					$label
212
-				)->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
209
+    $layout = $W->HBoxItems(
210
+                    $checkbox->setSizePolicy(WidgetSizePolicy::MINIMUM),
211
+                    $label
212
+                )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em');
213 213
 
214
-	return $layout;
214
+    return $layout;
215 215
 }
216 216
 
217 217
 
@@ -219,42 +219,42 @@  discard block
 block discarded – undo
219 219
 
220 220
 function app_LabelledOrmSelect(ORMMySqlIterator $iterator, $fieldName, $selectName, $label, $hidden = false, $groupFieldName = null)
221 221
 {
222
-	$W = \bab_Widgets();
223
-
224
-	if (isset($groupFieldName)) {
225
-		$groupPathElements = explode('/', $groupFieldName);
226
-	}
227
-
228
-	$select = $W->Select()->setName($selectName);
229
-
230
-	$select->addOption('', '');
231
-
232
-	$nbOptions = 0;
233
-	foreach ($iterator as $record) {
234
-		if (isset($record->code)) {
235
-			$optionText = $record->code . ' - ' . $record->$fieldName;
236
-		} else {
237
-			$optionText = $record->$fieldName;
238
-		}
239
-		if (isset($groupFieldName)) {
240
-			$group = $record;
241
-			foreach ($groupPathElements as $groupPathElement) {
242
-				$group = $group->$groupPathElement;
243
-			}
244
-			$select->addOption($record->id, $optionText, $group);
245
-		} else {
246
-			$select->addOption($record->id, $optionText);
247
-		}
248
-		$nbOptions++;
249
-		$lastId = $record->id;
250
-	}
251
-
252
-	if ($nbOptions == 1) {
253
-		$select->setValue($lastId);
254
-	}
255
-
256
-
257
-	return app_LabelledWidget($label, $select);
222
+    $W = \bab_Widgets();
223
+
224
+    if (isset($groupFieldName)) {
225
+        $groupPathElements = explode('/', $groupFieldName);
226
+    }
227
+
228
+    $select = $W->Select()->setName($selectName);
229
+
230
+    $select->addOption('', '');
231
+
232
+    $nbOptions = 0;
233
+    foreach ($iterator as $record) {
234
+        if (isset($record->code)) {
235
+            $optionText = $record->code . ' - ' . $record->$fieldName;
236
+        } else {
237
+            $optionText = $record->$fieldName;
238
+        }
239
+        if (isset($groupFieldName)) {
240
+            $group = $record;
241
+            foreach ($groupPathElements as $groupPathElement) {
242
+                $group = $group->$groupPathElement;
243
+            }
244
+            $select->addOption($record->id, $optionText, $group);
245
+        } else {
246
+            $select->addOption($record->id, $optionText);
247
+        }
248
+        $nbOptions++;
249
+        $lastId = $record->id;
250
+    }
251
+
252
+    if ($nbOptions == 1) {
253
+        $select->setValue($lastId);
254
+    }
255
+
256
+
257
+    return app_LabelledWidget($label, $select);
258 258
 }
259 259
 
260 260
 
@@ -302,36 +302,36 @@  discard block
 block discarded – undo
302 302
             ->setMaxSize($field->getMaxLength());
303 303
     } else if ($field instanceof ORMTextField) {
304 304
         $widget = $W->TextEdit()
305
-          ->addClass('widget-autoresize');
305
+            ->addClass('widget-autoresize');
306 306
     } else if ($field instanceof ORMPkField) {
307 307
         $widget = $W->Hidden();
308 308
     } else if ($field instanceof ORMFkField) {
309 309
 
310 310
         $fieldName = $field->getName();
311 311
         /** @var AppRecordSet $parentSet */
312
-		$parentSet = clone $field->getParentSet();
312
+        $parentSet = clone $field->getParentSet();
313 313
         $parentSet->join($fieldName);
314 314
         $set = $parentSet->$fieldName;
315 315
         $records = $set->select();
316
-		$pkName = $set->getPrimaryKey();
317
-		if($set->fieldExist("name")){
318
-			$displayField = $set->name->getName();
319
-		}else if(method_exists($set,"getDisplayNameField")){
320
-			$displayField = $set->getDisplayNameField()->getName();
321
-		}else{
322
-			$displayField = $pkName;
323
-		}
324
-		$records->orderAsc($set->$displayField);
325
-		if($records->count() > 50){
326
-			$widget = bab_Widgets()->select2();
327
-			$widget->setDataSource($set->getController()->search());
328
-		}else{
329
-			$widget = $W->Select();
330
-			$widget->addOption('', '');
331
-			foreach ($records as $record) {
332
-				$widget->addOption($record->$pkName, $record->$displayField);
333
-			}
334
-		}
316
+        $pkName = $set->getPrimaryKey();
317
+        if($set->fieldExist("name")){
318
+            $displayField = $set->name->getName();
319
+        }else if(method_exists($set,"getDisplayNameField")){
320
+            $displayField = $set->getDisplayNameField()->getName();
321
+        }else{
322
+            $displayField = $pkName;
323
+        }
324
+        $records->orderAsc($set->$displayField);
325
+        if($records->count() > 50){
326
+            $widget = bab_Widgets()->select2();
327
+            $widget->setDataSource($set->getController()->search());
328
+        }else{
329
+            $widget = $W->Select();
330
+            $widget->addOption('', '');
331
+            foreach ($records as $record) {
332
+                $widget->addOption($record->$pkName, $record->$displayField);
333
+            }
334
+        }
335 335
     } else if ($field instanceof ORMRecordSet) {
336 336
         $widget = $W->Select();
337 337
 ////        $widget = $W->MultiSelect()->setSingleSelect();
@@ -357,21 +357,21 @@  discard block
 block discarded – undo
357 357
 
358 358
 function app_LabelledOrmWidget(ORMField $field, $label = null, $hidden = false)
359 359
 {
360
-	$W = \bab_Widgets();
360
+    $W = \bab_Widgets();
361 361
 
362
-	if ($hidden) {
363
-		$widget = $W->Hidden();
364
-		$widget->setName($field->getName());
365
-		return $widget;
366
-	}
362
+    if ($hidden) {
363
+        $widget = $W->Hidden();
364
+        $widget->setName($field->getName());
365
+        return $widget;
366
+    }
367 367
 
368
-	if (is_null($label)) {
369
-		$label = $field->getDescription();
370
-	}
368
+    if (is_null($label)) {
369
+        $label = $field->getDescription();
370
+    }
371 371
 
372
-	$widget = app_OrmWidget($field);
372
+    $widget = app_OrmWidget($field);
373 373
 
374
-	return app_LabelledWidget($label, $widget);
374
+    return app_LabelledWidget($label, $widget);
375 375
 }
376 376
 
377 377
 
@@ -387,16 +387,16 @@  discard block
 block discarded – undo
387 387
  */
388 388
 function app_dateTime(ORMField $field, $value) {
389 389
 
390
-	$W = \bab_functionality::get('Widgets');
391
-	$name = $field->getName();
392
-	$label = $W->Label($field->getDescription());
390
+    $W = \bab_functionality::get('Widgets');
391
+    $name = $field->getName();
392
+    $label = $W->Label($field->getDescription());
393 393
 
394
-	$frame = app_dateTimeField($name, $label, $value);
394
+    $frame = app_dateTimeField($name, $label, $value);
395 395
 
396
-	return $W->VBoxItems(
397
-		$label,
398
-		$frame
399
-	);
396
+    return $W->VBoxItems(
397
+        $label,
398
+        $frame
399
+    );
400 400
 
401 401
 }
402 402
 
@@ -410,24 +410,24 @@  discard block
 block discarded – undo
410 410
  */
411 411
 function app_dateTimeField($fieldName, WidgetLabel $label, $value = null)
412 412
 {
413
-	$W = \bab_functionality::get('Widgets');
413
+    $W = \bab_functionality::get('Widgets');
414 414
 
415
-	$datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date');
416
-	$timepart = $W->TimePicker()->setName('time');
415
+    $datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date');
416
+    $timepart = $W->TimePicker()->setName('time');
417 417
 
418
-	if (isset($value)) {
418
+    if (isset($value)) {
419 419
 
420
-		$value = explode(' ', $value);
420
+        $value = explode(' ', $value);
421 421
 
422
-		$datepart->setValue($value[0]);
423
-		$timepart->setValue($value[1]);
424
-	}
422
+        $datepart->setValue($value[0]);
423
+        $timepart->setValue($value[1]);
424
+    }
425 425
 
426
-	$datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName)
427
-			->addItem($datepart)
428
-			->addItem($timepart);
426
+    $datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName)
427
+            ->addItem($datepart)
428
+            ->addItem($timepart);
429 429
 
430
-	return $datetime;
430
+    return $datetime;
431 431
 }
432 432
 
433 433
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		if (empty($description)) {
74 74
 			$description = $field->getName();
75 75
 		}
76
-		$fieldLabel = $W->Label($description . ':');
76
+		$fieldLabel = $W->Label($description.':');
77 77
 
78 78
 		if ($field instanceof ORMDateField) {
79 79
 			$widget = $W->DatePicker();
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		if (empty($description)) {
130 130
 			$description = $field->getName();
131 131
 		}
132
-		$fieldLabel = $W->Label($description . ':');
132
+		$fieldLabel = $W->Label($description.':');
133 133
 
134 134
 		if ($field instanceof ORMDateField) {
135 135
 			$widget = $W->PeriodPicker();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	$nbOptions = 0;
233 233
 	foreach ($iterator as $record) {
234 234
 		if (isset($record->code)) {
235
-			$optionText = $record->code . ' - ' . $record->$fieldName;
235
+			$optionText = $record->code.' - '.$record->$fieldName;
236 236
 		} else {
237 237
 			$optionText = $record->$fieldName;
238 238
 		}
@@ -314,18 +314,18 @@  discard block
 block discarded – undo
314 314
         $set = $parentSet->$fieldName;
315 315
         $records = $set->select();
316 316
 		$pkName = $set->getPrimaryKey();
317
-		if($set->fieldExist("name")){
317
+		if ($set->fieldExist("name")) {
318 318
 			$displayField = $set->name->getName();
319
-		}else if(method_exists($set,"getDisplayNameField")){
319
+		} else if (method_exists($set, "getDisplayNameField")) {
320 320
 			$displayField = $set->getDisplayNameField()->getName();
321
-		}else{
321
+		} else {
322 322
 			$displayField = $pkName;
323 323
 		}
324 324
 		$records->orderAsc($set->$displayField);
325
-		if($records->count() > 50){
325
+		if ($records->count() > 50) {
326 326
 			$widget = bab_Widgets()->select2();
327 327
 			$widget->setDataSource($set->getController()->search());
328
-		}else{
328
+		} else {
329 329
 			$widget = $W->Select();
330 330
 			$widget->addOption('', '');
331 331
 			foreach ($records as $record) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -316,16 +316,16 @@
 block discarded – undo
316 316
 		$pkName = $set->getPrimaryKey();
317 317
 		if($set->fieldExist("name")){
318 318
 			$displayField = $set->name->getName();
319
-		}else if(method_exists($set,"getDisplayNameField")){
319
+		} else if(method_exists($set,"getDisplayNameField")){
320 320
 			$displayField = $set->getDisplayNameField()->getName();
321
-		}else{
321
+		} else{
322 322
 			$displayField = $pkName;
323 323
 		}
324 324
 		$records->orderAsc($set->$displayField);
325 325
 		if($records->count() > 50){
326 326
 			$widget = bab_Widgets()->select2();
327 327
 			$widget->setDataSource($set->getController()->search());
328
-		}else{
328
+		} else{
329 329
 			$widget = $W->Select();
330 330
 			$widget->addOption('', '');
331 331
 			foreach ($records as $record) {
Please login to merge, or discard this patch.
programs/Ui/AppTableModelView.php 2 patches
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     protected function initHeaderRow(ORMRecordSet $set)
100 100
     {
101
-        require_once $GLOBALS['babInstallPath'] . 'utilit/urlincl.php';
101
+        require_once $GLOBALS['babInstallPath'].'utilit/urlincl.php';
102 102
         
103 103
         \bab_functionality::includefile('Icons');
104 104
         
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
         
115 115
         $filterValues = $this->getFilterValues();
116 116
         
117
-        foreach ($this->visibleColumns as $columnPath => $column){
117
+        foreach ($this->visibleColumns as $columnPath => $column) {
118 118
             
119
-            if(! isset($this->columnsDescriptions[$columnPath])){
119
+            if (!isset($this->columnsDescriptions[$columnPath])) {
120 120
                 $this->columnsDescriptions[$columnPath] = $column->getDescription();
121 121
             }
122 122
             
@@ -128,61 +128,61 @@  discard block
 block discarded – undo
128 128
             
129 129
             $sizePolicy = 'widget-actions-target';
130 130
             
131
-            if($this->isMultiSelect() && $columnPath === '_select_'){
131
+            if ($this->isMultiSelect() && $columnPath === '_select_') {
132 132
                 $this->toggleCheckAllBox = $W->CheckBox();
133 133
                 $this->toggleCheckAllBox->setName('toggleCheckAllBox');
134 134
                 $this->toggleCheckAllBox->setTitle(widget_translate('Select all on page'));
135 135
                 $this->toggleCheckAllBox->setSizePolicy('condensed');
136 136
                 $this->toggleCheckAllBox->setCheckedValue(true);
137
-                if(isset($_SESSION['toggleCheckAllBox'][$this->getId()]) && ! empty($_SESSION['toggleCheckAllBox'][$this->getId()]) && $_SESSION['toggleCheckAllBox'][$this->getId()] == 'on'){
137
+                if (isset($_SESSION['toggleCheckAllBox'][$this->getId()]) && !empty($_SESSION['toggleCheckAllBox'][$this->getId()]) && $_SESSION['toggleCheckAllBox'][$this->getId()] == 'on') {
138 138
                     $this->toggleCheckAllBox->setValue(true);
139 139
                 }
140 140
                 $isSearchable = false;
141 141
                 $isSortable = false;
142 142
                 $columnItem = $W->FlexItems($this->toggleCheckAllBox);
143 143
             }
144
-            elseif(isset($this->sortParameterName) && self::getRecordSetField($set, $columnPath) && $isSortable){
145
-                if(! isset($this->sortBaseUrl)){
144
+            elseif (isset($this->sortParameterName) && self::getRecordSetField($set, $columnPath) && $isSortable) {
145
+                if (!isset($this->sortBaseUrl)) {
146 146
                     $this->sortBaseUrl = \bab_url::request_gp();
147 147
                 }
148 148
                 
149
-                if($this->sortField === $columnPath && $this->sortAscending){
149
+                if ($this->sortField === $columnPath && $this->sortAscending) {
150 150
                     $direction = ':down';
151 151
                 }
152
-                else{
152
+                else {
153 153
                     $direction = ':up';
154 154
                 }
155 155
                 
156
-                $url = \bab_url::mod($this->sortBaseUrl, $this->sortParameterName, $columnPath . $direction);
157
-                if($anchor = $this->getAnchor()){
158
-                    $url .= '#' . urlencode($anchor);
156
+                $url = \bab_url::mod($this->sortBaseUrl, $this->sortParameterName, $columnPath.$direction);
157
+                if ($anchor = $this->getAnchor()) {
158
+                    $url .= '#'.urlencode($anchor);
159 159
                 }
160 160
                 
161 161
                 $columnItem = $W->Link($W->FlexItems($W->Label($columnLabel), $W->Items()
162 162
                     ->addClass('widget-table-column-sorting-icons'))
163 163
                     ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_CONTENT_CENTER), $url)
164 164
                     ->addClass('widget-table-column-sorting-action');
165
-                if($this->sortAjaxAction){
166
-                    $columnItem->setAjaxAction($this->sortAjaxAction->setParameter('sort', $columnPath . $direction), '');
165
+                if ($this->sortAjaxAction) {
166
+                    $columnItem->setAjaxAction($this->sortAjaxAction->setParameter('sort', $columnPath.$direction), '');
167 167
                 }
168 168
                 $columnItem = $W->FlexItems($columnItem);
169 169
             }
170
-            else{
170
+            else {
171 171
                 $columnItem = $W->FlexItems($W->Label($columnLabel), $W->Label(''));
172 172
             }
173 173
             
174 174
             $columnItem->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_CONTENT_CENTER)->setJustifyContent(WidgetFlexLayout::FLEX_JUSTIFY_CONTENT_SPACE_BETWEEN);
175 175
             $columnItem->addClass('widget-table-column-header-item');
176 176
             
177
-            if(isset($columnIcon)){
177
+            if (isset($columnIcon)) {
178 178
                 $columnItem->addClass('icon', $columnIcon)->setSizePolicy(\Func_Icons::ICON_LEFT_16);
179 179
             }
180 180
             
181
-            if($isSortable){
181
+            if ($isSortable) {
182 182
                 $sizePolicy .= ' widget-table-column-sortable';
183 183
             }
184
-            if($isSearchable){
185
-                if(! isset($this->filterBaseUrl)){
184
+            if ($isSearchable) {
185
+                if (!isset($this->filterBaseUrl)) {
186 186
                     $this->filterBaseUrl = $this->getRecordControllerProxy()->displayListFilter();
187 187
                 }
188 188
                 $url = $this->filterBaseUrl;
@@ -193,24 +193,24 @@  discard block
 block discarded – undo
193 193
                     ->addClass('widget-table-column-search-action')
194 194
                     ->setDialogClass('box blue'), 0);
195 195
                 $sizePolicy .= ' widget-table-column-searchable';
196
-                if(isset($filterValues[$columnPath]) && ! empty($filterValues[$columnPath])){
196
+                if (isset($filterValues[$columnPath]) && !empty($filterValues[$columnPath])) {
197 197
                     $sizePolicy .= ' widget-table-column-searched';
198 198
                 }
199 199
             }
200 200
             $items = $W->Items()->setSizePolicy($sizePolicy);
201 201
             $items->addItem($columnItem);
202 202
             
203
-            $this->addItem($items, 0, $col ++);
203
+            $this->addItem($items, 0, $col++);
204 204
         }
205 205
     }
206 206
     
207 207
     protected function initRow($record, $row)
208 208
     {
209
-        if($this->highlightRows == null){
209
+        if ($this->highlightRows == null) {
210 210
             $this->highlightRows = $this->getHighlightedRows();
211 211
         }
212 212
         
213
-        if(in_array($record->id, $this->highlightRows)){
213
+        if (in_array($record->id, $this->highlightRows)) {
214 214
             $this->addRowClass($row, "app_highlightRow");
215 215
         }
216 216
         $this->addRowClass($row, "app_highlightAvailable");
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function App()
238 238
     {
239
-        if(! isset($this->app)){
239
+        if (!isset($this->app)) {
240 240
             // If the app object was not specified (through the setApp() method)
241 241
             // we try to select one according to the classname prefix.
242 242
             list ($prefix) = explode('_', get_class($this));
243 243
             $functionalityName = ucwords($prefix);
244
-            $this->app = @\bab_functionality::get('App/' . $functionalityName);
245
-            if(! $this->app){
244
+            $this->app = @\bab_functionality::get('App/'.$functionalityName);
245
+            if (!$this->app) {
246 246
                 $this->app = @\bab_functionality::get('App');
247 247
             }
248 248
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     {
254 254
         $customFields = $recordSet->getCustomFields();
255 255
         
256
-        foreach ($customFields as $customField){
256
+        foreach ($customFields as $customField) {
257 257
             $fieldname = $customField->fieldname;
258 258
             $this->addColumn(app_TableModelViewColumn($recordSet->$fieldname, $customField->name)->setSortable(true)
259 259
                 ->setExportable(true)
@@ -280,39 +280,39 @@  discard block
 block discarded – undo
280 280
         
281 281
         $filterPanel = $W->Filter();
282 282
         $filterPanel->setLayout($W->VBoxLayout());
283
-        if(isset($name)){
283
+        if (isset($name)) {
284 284
             $filterPanel->setName($name);
285 285
         }
286 286
         
287 287
         $pageLength = $this->getPageLength();
288
-        if(null === $pageLength){
288
+        if (null === $pageLength) {
289 289
             $pageLength = 15;
290 290
         }
291 291
         
292 292
         $pageNumber = $this->getCurrentPage();
293
-        if(null === $pageNumber){
293
+        if (null === $pageNumber) {
294 294
             $pageNumber = 0;
295 295
         }
296 296
         
297 297
         $this->setPageLength(isset($filter['pageSize']) ? $filter['pageSize'] : $pageLength);
298 298
         $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber);
299 299
         
300
-        if(isset($name)){
301
-            $this->sortParameterName = $name . '[filter][sort]';
300
+        if (isset($name)) {
301
+            $this->sortParameterName = $name.'[filter][sort]';
302 302
         }
303
-        else{
303
+        else {
304 304
             $this->sortParameterName = 'filter[sort]';
305 305
         }
306 306
         
307
-        if(isset($filter['sort'])){
307
+        if (isset($filter['sort'])) {
308 308
             $this->setSortField($filter['sort']);
309 309
         }
310
-        elseif(! isset($this->sortField)){
310
+        elseif (!isset($this->sortField)) {
311 311
             
312
-            if(method_exists($this, 'getDefaultSortField')){
312
+            if (method_exists($this, 'getDefaultSortField')) {
313 313
                 $this->setSortField($this->getDefaultSortField());
314 314
             }
315
-            else{
315
+            else {
316 316
                 $columns = $this->getVisibleColumns();
317 317
                 $sortField = key($columns);
318 318
                 $this->setSortField($sortField);
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
         
322 322
         $form = $this->getFilterForm();
323 323
         
324
-        if(isset($filter)){
325
-            if(isset($name)){
324
+        if (isset($filter)) {
325
+            if (isset($name)) {
326 326
                 $path = array(
327 327
                     $name,
328 328
                     'filter'
329 329
                 );
330 330
             }
331
-            else{
331
+            else {
332 332
                 $path = array(
333 333
                     'filter'
334 334
                 );
@@ -354,19 +354,19 @@  discard block
 block discarded – undo
354 354
     
355 355
     protected function isFilterFieldSpecified($filter, $fieldPath)
356 356
     {
357
-        if(isset($filter[$fieldPath])){
357
+        if (isset($filter[$fieldPath])) {
358 358
             $value = $filter[$fieldPath];
359
-            if(is_array($value)){
360
-                foreach ($value as $val){
359
+            if (is_array($value)) {
360
+                foreach ($value as $val) {
361 361
                     $val = trim($val);
362
-                    if(! empty($val)){
362
+                    if (!empty($val)) {
363 363
                         return true;
364 364
                     }
365 365
                 }
366 366
                 return false;
367 367
             }
368 368
             
369
-            if(trim($value) !== ''){
369
+            if (trim($value) !== '') {
370 370
                 return true;
371 371
             }
372 372
         }
@@ -376,21 +376,21 @@  discard block
 block discarded – undo
376 376
     
377 377
     protected function handleFilterInputWidget($name, ORMField $field = null)
378 378
     {
379
-        if(null === $field){
379
+        if (null === $field) {
380 380
             return null;
381 381
         }
382 382
         
383 383
         $W = bab_Widgets();
384 384
         
385
-        if($field instanceof ORMFkField){            
385
+        if ($field instanceof ORMFkField) {            
386 386
             $App = $this->App();
387 387
             $setName = $field->getForeignSetName();
388 388
             
389 389
             $pos = strrpos($setName, '\\');
390
-            if($pos === false){
390
+            if ($pos === false) {
391 391
                 list (, $appSetName) = explode('_', $setName);
392 392
             }
393
-            else{
393
+            else {
394 394
                 list (, $appSetName) = array(
395 395
                     substr($setName, 0, $pos),
396 396
                     substr($setName, $pos + 1)
@@ -401,18 +401,18 @@  discard block
 block discarded – undo
401 401
             $set->setName($field->getName());
402 402
             $set->setDescription($field->getDescription());
403 403
             
404
-            if($set === null){
404
+            if ($set === null) {
405 405
                 return null;
406 406
             }
407 407
             
408 408
             $values = $set->select();
409
-            if($values->count()>15){
409
+            if ($values->count() > 15) {
410 410
                 $widget = bab_Widgets()->select2();
411 411
                 $widget->setDataSource($set->getController()->search());
412
-            }else{
412
+            } else {
413 413
                 $widget = $W->Select();
414 414
                 $widget->addOption('', '');
415
-                foreach ($values as $record){
415
+                foreach ($values as $record) {
416 416
                     $widget->addOption($record->id, (string) $record->name);
417 417
                 }
418 418
                 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
         $displayAdvancedForm = $this->isAdvancedFormDisplayed();
497 497
         $advancedFiltersFrame = $W->VBoxItems($addFilterButton)->addClass('widget-instant-container');
498 498
             
499
-        if($displayAdvancedForm){
499
+        if ($displayAdvancedForm) {
500 500
             $filterBox = $W->FlowLayout()
501 501
                 ->addClass('widget-instant-form')
502 502
                 ->setHorizontalSpacing(2, 'em')
@@ -507,20 +507,20 @@  discard block
 block discarded – undo
507 507
         
508 508
         $columns = $this->getVisibleColumns();
509 509
         
510
-        foreach ($columns as $fieldName => $column){
510
+        foreach ($columns as $fieldName => $column) {
511 511
             $field = $column->getField();
512
-            if(! $column->isSearchable()){
512
+            if (!$column->isSearchable()) {
513 513
                 continue;
514 514
             }
515 515
             
516
-            if(! ($field instanceof ORMField)){
516
+            if (!($field instanceof ORMField)) {
517 517
                 $field = null;
518 518
             }
519 519
             
520 520
             $label = $this->handleFilterLabelWidget($fieldName, $field);
521 521
             $input = $this->handleFilterInputWidget($fieldName, $field);
522 522
             
523
-            if(isset($input) && isset($label)){
523
+            if (isset($input) && isset($label)) {
524 524
                 
525 525
                 $input->setName($fieldName);
526 526
                 $label->setAssociatedWidget($input);
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
                 $formItem = $this->handleFilterLabel($label, $input);
531 531
                 
532 532
                 // $formItem = $W->Section($label->getText(), $input, 7)->setFoldable(true, true);
533
-                $formItem->addClass('compact', 'field_' . $fieldName);
533
+                $formItem->addClass('compact', 'field_'.$fieldName);
534 534
                 
535 535
                 $mainSearch = (method_exists($column, 'isMainSearch') && $column->isMainSearch());
536 536
                 
537
-                if($mainSearch || $this->isFilterFieldSpecified($filter, $column->getFieldPath())){
537
+                if ($mainSearch || $this->isFilterFieldSpecified($filter, $column->getFieldPath())) {
538 538
                     
539 539
                     $removeColumnsAction = $W->Action();
540 540
                     $removeColumnsAction->setMethod('addon/widgets/configurationstorage', 'removeFilter', array(
@@ -550,19 +550,19 @@  discard block
 block discarded – undo
550 550
                         ->addAttribute('data-removefor', $column->getFieldPath()))
551 551
                         ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_ITEMS_FLEX_END));
552 552
                 }
553
-                elseif($displayAdvancedForm){
553
+                elseif ($displayAdvancedForm) {
554 554
                     $formItem->setSizePolicy('col-lg-2 col-md-3 col-sm-6 col-xs-12');
555 555
                     $filterBox->addItem($formItem);
556 556
                 }
557 557
             }
558 558
         }
559 559
         
560
-        if(! $this->submit){
560
+        if (!$this->submit) {
561 561
             $this->submit = $W->SubmitButton();
562 562
             $this->submit->setLabel(Widget_translate('Apply filter'));
563 563
         }
564 564
         
565
-        if($controller = $this->getRecordController()){
565
+        if ($controller = $this->getRecordController()) {
566 566
             $proxy = $controller->proxy();
567 567
             $this->reset = $W->Link($App->translate('Reset'), $proxy->resetFilters())
568 568
                 ->addClass('icon', \Func_Icons::ACTIONS_VIEW_REFRESH, 'widget-actionbutton')
@@ -584,14 +584,14 @@  discard block
 block discarded – undo
584 584
             $this->filterMenu->addClass(\Func_Icons::ICON_LEFT_16);
585 585
             
586 586
             $filterNames = $controller->getFilterNames();
587
-            if(count($filterNames) > 0){
587
+            if (count($filterNames) > 0) {
588 588
                 // $this->select = $W->Menu(null, $W->VBoxItems());
589 589
                 // $this->select->setButtonClass('widget-link icon actions-list-filter');
590 590
                 // $this->select->setButtonLabel($App->translate('Saved filters'));
591 591
                 // $this->select->addClass(\Func_Icons::ICON_LEFT_16);
592 592
                 
593
-                foreach ($filterNames as $filterName){
594
-                    $filter = $W->getUserConfiguration($controller->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false);
593
+                foreach ($filterNames as $filterName) {
594
+                    $filter = $W->getUserConfiguration($controller->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false);
595 595
                     
596 596
                     // $this->select->addItem(
597 597
                     // $W->Link(
@@ -664,39 +664,39 @@  discard block
 block discarded – undo
664 664
         
665 665
         $filterPanel = $W->Filter();
666 666
         $filterPanel->setLayout($W->VBoxLayout());
667
-        if(isset($name)){
667
+        if (isset($name)) {
668 668
             $filterPanel->setName($name);
669 669
         }
670 670
         
671 671
         $pageLength = $this->getPageLength();
672
-        if(null === $pageLength){
672
+        if (null === $pageLength) {
673 673
             $pageLength = 15;
674 674
         }
675 675
         
676 676
         $pageNumber = $this->getCurrentPage();
677
-        if(null === $pageNumber){
677
+        if (null === $pageNumber) {
678 678
             $pageNumber = 0;
679 679
         }
680 680
         
681 681
         $this->setPageLength(isset($filter['pageSize']) ? $filter['pageSize'] : $pageLength);
682 682
         // $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber);
683 683
         
684
-        if(isset($name)){
685
-            $this->sortParameterName = $name . '[filter][sort]';
684
+        if (isset($name)) {
685
+            $this->sortParameterName = $name.'[filter][sort]';
686 686
         }
687
-        else{
687
+        else {
688 688
             $this->sortParameterName = 'filter[sort]';
689 689
         }
690 690
         
691
-        if(isset($filter['sort'])){
691
+        if (isset($filter['sort'])) {
692 692
             $this->setSortField($filter['sort']);
693 693
         }
694
-        elseif(! isset($this->sortField)){
694
+        elseif (!isset($this->sortField)) {
695 695
             
696
-            if(method_exists($this, 'getDefaultSortField')){
696
+            if (method_exists($this, 'getDefaultSortField')) {
697 697
                 $this->setSortField($this->getDefaultSortField());
698 698
             }
699
-            else{
699
+            else {
700 700
                 $columns = $this->getVisibleColumns();
701 701
                 $sortField = key($columns);
702 702
                 $this->setSortField($sortField);
@@ -705,14 +705,14 @@  discard block
 block discarded – undo
705 705
         
706 706
         $form = $this->getAdvancedFilterForm(null, $filter);
707 707
         
708
-        if(isset($filter)){
709
-            if(isset($name)){
708
+        if (isset($filter)) {
709
+            if (isset($name)) {
710 710
                 $path = array(
711 711
                     $name,
712 712
                     'filter'
713 713
                 );
714 714
             }
715
-            else{
715
+            else {
716 716
                 $path = array(
717 717
                     'filter'
718 718
                 );
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
      */
750 750
     public function getRecordControllerProxy()
751 751
     {
752
-        if(! isset($this->recordControllerProxy)){
752
+        if (!isset($this->recordControllerProxy)) {
753 753
             $this->recordControllerProxy = $this->getRecordController()->proxy();
754 754
         }
755 755
         return $this->recordControllerProxy;
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
  */
765 765
 function app_TableModelViewColumn($field, $description = null)
766 766
 {
767
-    if(null === $field){
767
+    if (null === $field) {
768 768
         return null;
769 769
     }
770 770
     
771
-    if(! isset($description) && $field instanceof ORMField){
771
+    if (!isset($description) && $field instanceof ORMField) {
772 772
         $App = $field->getParentSet()->App();
773 773
         $description = $App->translate($field->getDescription());
774 774
     }
Please login to merge, or discard this patch.
Braces   +14 added lines, -27 removed lines patch added patch discarded remove patch
@@ -140,16 +140,14 @@  discard block
 block discarded – undo
140 140
                 $isSearchable = false;
141 141
                 $isSortable = false;
142 142
                 $columnItem = $W->FlexItems($this->toggleCheckAllBox);
143
-            }
144
-            elseif(isset($this->sortParameterName) && self::getRecordSetField($set, $columnPath) && $isSortable){
143
+            } elseif(isset($this->sortParameterName) && self::getRecordSetField($set, $columnPath) && $isSortable){
145 144
                 if(! isset($this->sortBaseUrl)){
146 145
                     $this->sortBaseUrl = \bab_url::request_gp();
147 146
                 }
148 147
                 
149 148
                 if($this->sortField === $columnPath && $this->sortAscending){
150 149
                     $direction = ':down';
151
-                }
152
-                else{
150
+                } else{
153 151
                     $direction = ':up';
154 152
                 }
155 153
                 
@@ -166,8 +164,7 @@  discard block
 block discarded – undo
166 164
                     $columnItem->setAjaxAction($this->sortAjaxAction->setParameter('sort', $columnPath . $direction), '');
167 165
                 }
168 166
                 $columnItem = $W->FlexItems($columnItem);
169
-            }
170
-            else{
167
+            } else{
171 168
                 $columnItem = $W->FlexItems($W->Label($columnLabel), $W->Label(''));
172 169
             }
173 170
             
@@ -299,20 +296,17 @@  discard block
 block discarded – undo
299 296
         
300 297
         if(isset($name)){
301 298
             $this->sortParameterName = $name . '[filter][sort]';
302
-        }
303
-        else{
299
+        } else{
304 300
             $this->sortParameterName = 'filter[sort]';
305 301
         }
306 302
         
307 303
         if(isset($filter['sort'])){
308 304
             $this->setSortField($filter['sort']);
309
-        }
310
-        elseif(! isset($this->sortField)){
305
+        } elseif(! isset($this->sortField)){
311 306
             
312 307
             if(method_exists($this, 'getDefaultSortField')){
313 308
                 $this->setSortField($this->getDefaultSortField());
314
-            }
315
-            else{
309
+            } else{
316 310
                 $columns = $this->getVisibleColumns();
317 311
                 $sortField = key($columns);
318 312
                 $this->setSortField($sortField);
@@ -327,8 +321,7 @@  discard block
 block discarded – undo
327 321
                     $name,
328 322
                     'filter'
329 323
                 );
330
-            }
331
-            else{
324
+            } else{
332 325
                 $path = array(
333 326
                     'filter'
334 327
                 );
@@ -389,8 +382,7 @@  discard block
 block discarded – undo
389 382
             $pos = strrpos($setName, '\\');
390 383
             if($pos === false){
391 384
                 list (, $appSetName) = explode('_', $setName);
392
-            }
393
-            else{
385
+            } else{
394 386
                 list (, $appSetName) = array(
395 387
                     substr($setName, 0, $pos),
396 388
                     substr($setName, $pos + 1)
@@ -409,7 +401,7 @@  discard block
 block discarded – undo
409 401
             if($values->count()>15){
410 402
                 $widget = bab_Widgets()->select2();
411 403
                 $widget->setDataSource($set->getController()->search());
412
-            }else{
404
+            } else{
413 405
                 $widget = $W->Select();
414 406
                 $widget->addOption('', '');
415 407
                 foreach ($values as $record){
@@ -549,8 +541,7 @@  discard block
 block discarded – undo
549 541
                         ->addClass('icon', \Func_Icons::STATUS_DIALOG_ERROR)
550 542
                         ->addAttribute('data-removefor', $column->getFieldPath()))
551 543
                         ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_ITEMS_FLEX_END));
552
-                }
553
-                elseif($displayAdvancedForm){
544
+                } elseif($displayAdvancedForm){
554 545
                     $formItem->setSizePolicy('col-lg-2 col-md-3 col-sm-6 col-xs-12');
555 546
                     $filterBox->addItem($formItem);
556 547
                 }
@@ -683,20 +674,17 @@  discard block
 block discarded – undo
683 674
         
684 675
         if(isset($name)){
685 676
             $this->sortParameterName = $name . '[filter][sort]';
686
-        }
687
-        else{
677
+        } else{
688 678
             $this->sortParameterName = 'filter[sort]';
689 679
         }
690 680
         
691 681
         if(isset($filter['sort'])){
692 682
             $this->setSortField($filter['sort']);
693
-        }
694
-        elseif(! isset($this->sortField)){
683
+        } elseif(! isset($this->sortField)){
695 684
             
696 685
             if(method_exists($this, 'getDefaultSortField')){
697 686
                 $this->setSortField($this->getDefaultSortField());
698
-            }
699
-            else{
687
+            } else{
700 688
                 $columns = $this->getVisibleColumns();
701 689
                 $sortField = key($columns);
702 690
                 $this->setSortField($sortField);
@@ -711,8 +699,7 @@  discard block
 block discarded – undo
711 699
                     $name,
712 700
                     'filter'
713 701
                 );
714
-            }
715
-            else{
702
+            } else{
716 703
                 $path = array(
717 704
                     'filter'
718 705
                 );
Please login to merge, or discard this patch.
programs/Ui/AppExportSelectEditor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         
43 43
         $this->tableview = $tableview;
44 44
         
45
-        if(isset($filter)){
45
+        if (isset($filter)) {
46 46
             $this->setHiddenValues('filter', $filter);
47 47
         }
48 48
         $this->setHiddenValue('tg', $App->controllerTg);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $W = bab_Widgets();
57 57
         $this->addItem($W->VBoxItems($W->FlexItems($this->format(), $this->charset())
58
-            ->addClass('customsection-field-box customsection-fieldsgroup-box'), $this->columns())->setVerticalSpacing(2,'em'));
58
+            ->addClass('customsection-field-box customsection-fieldsgroup-box'), $this->columns())->setVerticalSpacing(2, 'em'));
59 59
     }
60 60
     
61 61
     protected function format()
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
         
110 110
         $columns = $this->tableview->getVisibleColumns();
111 111
         
112
-        foreach ($columns as $path => $column){
113
-            if(! $column->isExportable()){
112
+        foreach ($columns as $path => $column) {
113
+            if (!$column->isExportable()) {
114 114
                 continue;
115 115
             }
116 116
             $columnList->addItem($W->FlexItems($W->LabelledWidget($column->getSelectableName(), $checkbox = $W->CheckBox()
Please login to merge, or discard this patch.
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/Ui/Page/AppPage.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         
60 60
         /** @var \Func_Icons  $I */
61 61
         $I = \bab_Functionality::get('Icons');
62
-        if($I){
62
+        if ($I) {
63 63
             $I->includeCss();
64 64
         }
65 65
         
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function addItem(WidgetDisplayableInterface $item = null, $order = null)
108 108
     {
109
-        if(! isset($this->mainPanel)){
109
+        if (!isset($this->mainPanel)) {
110 110
             $W = bab_widgets();
111 111
             $this->mainPanel = $W->VBoxLayout();
112 112
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     {
128 128
         $W = bab_widgets();
129 129
         
130
-        if(null === $this->context){
130
+        if (null === $this->context) {
131 131
             
132 132
             $isAjaxRequest = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
133 133
             $contextPanelId = $isAjaxRequest ? null : 'app_context_panel';
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
             $this->context = $W->Frame($contextPanelId, $W->VBoxLayout()
136 136
                 ->setVerticalSpacing(2, 'em'));
137 137
         }
138
-        if(isset($title)){
138
+        if (isset($title)) {
139 139
             $this->context->addItem($W->Section($title, $item, 4), $position);
140 140
         }
141
-        else{
141
+        else {
142 142
             $this->context->addItem($item, $position);
143 143
         }
144 144
         return $this;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $W = bab_widgets();
156 156
         
157
-        if(null === $this->toolbars){
157
+        if (null === $this->toolbars) {
158 158
             $this->toolbars = $W->Frame(null, $W->VBoxItems());
159 159
         }
160 160
         $this->toolbars->addItem($item);
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
         $W = bab_widgets();
168 168
         
169 169
         $mainPanel = $W->Frame(null, $this->mainPanel);
170
-        if(bab_isAjaxRequest()){
170
+        if (bab_isAjaxRequest()) {
171 171
             $mainPanel->addClass('app_main_panel');
172 172
         }
173
-        else{
173
+        else {
174 174
             $mainPanel->setId('app_main_panel');
175 175
         }
176 176
         
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     {
188 188
         $mainPanel = $this->getMainPanel();
189 189
         
190
-        if($this->context){
190
+        if ($this->context) {
191 191
             
192 192
             $W = bab_widgets();
193 193
             
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     
205 205
     protected function addToolbars(WidgetItem $mainPanel)
206 206
     {
207
-        if($this->toolbars){
207
+        if ($this->toolbars) {
208 208
             
209 209
             $W = bab_widgets();
210 210
             $this->toolbars->setSizePolicy('app-toolbars');
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function addMessageInfo()
246 246
     {
247
-        if(isset($_SESSION['app_msginfo'])){
247
+        if (isset($_SESSION['app_msginfo'])) {
248 248
             
249 249
             // all widget have static id to not change id of others widgets in page
250 250
             
251 251
             $infoMessages = $_SESSION['app_msginfo'];
252
-            foreach ($infoMessages as $infoLine){
252
+            foreach ($infoMessages as $infoLine) {
253 253
                 $this->App()
254 254
                     ->Controller()
255 255
                     ->addMessage($infoLine);
Please login to merge, or discard this patch.