@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | |
65 | 65 | bab_Widgets(); |
66 | 66 | |
67 | -require_once dirname(__FILE__) . '/define.php'; |
|
68 | -require_once dirname(__FILE__) . '/functions.php'; |
|
67 | +require_once dirname(__FILE__).'/define.php'; |
|
68 | +require_once dirname(__FILE__).'/functions.php'; |
|
69 | 69 | |
70 | 70 | $libappAddon = bab_getAddonInfosInstance('libapp'); |
71 | 71 | $libappPhpPath = $libappAddon->getPhpPath(); |
72 | 72 | |
73 | -require_once $libappPhpPath . '../vendor/autoload.php'; |
|
73 | +require_once $libappPhpPath.'../vendor/autoload.php'; |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Provides extensible functionalities to manage an application. |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | $this->addonPrefix = 'app'; |
107 | 107 | |
108 | 108 | $this->classPrefix = 'App'; |
109 | - $this->controllerTg = 'addon/' . $this->addonName . '/main'; |
|
109 | + $this->controllerTg = 'addon/'.$this->addonName.'/main'; |
|
110 | 110 | |
111 | 111 | $addon = bab_getAddonInfosInstance($this->addonName); |
112 | 112 | $this->phpPath = $addon->getPhpPath(); |
113 | 113 | $this->recordSetPath = $this->phpPath; |
114 | 114 | $this->ctrlPath = $this->phpPath; |
115 | - $this->uiPath = $this->phpPath . 'ui/'; |
|
115 | + $this->uiPath = $this->phpPath.'ui/'; |
|
116 | 116 | |
117 | 117 | $babDB = bab_GetDatabaseInstance(); |
118 | 118 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | if (class_exists($componentDefinitionObjectName)) { |
130 | 130 | $componentDefinition = new $componentDefinitionObjectName; |
131 | 131 | $components = $componentDefinition->getComponents($this); |
132 | - foreach ($components as $singleName => $singleComponent){ |
|
132 | + foreach ($components as $singleName => $singleComponent) { |
|
133 | 133 | $this->addComponent($singleName, $singleComponent); |
134 | 134 | } |
135 | 135 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $nbElem = count($componentName); |
159 | 159 | $componentName = $componentName[$nbElem - 1]; |
160 | 160 | $componentName = strtoupper($componentName); |
161 | - if(isset($this->components[$componentName])){ |
|
161 | + if (isset($this->components[$componentName])) { |
|
162 | 162 | return $this->components[$componentName]; |
163 | 163 | } |
164 | 164 | return null; |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | |
188 | 188 | public function __get($componentName) |
189 | 189 | { |
190 | - if(isset($this->components[$componentName])){ |
|
190 | + if (isset($this->components[$componentName])) { |
|
191 | 191 | return $this->components[$componentName]; |
192 | - }else{ |
|
192 | + } else { |
|
193 | 193 | return null; |
194 | 194 | } |
195 | 195 | } |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | |
209 | 209 | $messages = array(); |
210 | 210 | |
211 | - foreach ($components as $componentName => $component){ |
|
211 | + foreach ($components as $componentName => $component) { |
|
212 | 212 | $dependencies = $component->checkDependencies(); |
213 | - foreach($dependencies['requiredComponents'] as $requiredComponent){ |
|
213 | + foreach ($dependencies['requiredComponents'] as $requiredComponent) { |
|
214 | 214 | $messages['requiredComponents'][$componentName][] = $requiredComponent; |
215 | 215 | } |
216 | - foreach($dependencies['optionalComponents'] as $optionalComponent){ |
|
216 | + foreach ($dependencies['optionalComponents'] as $optionalComponent) { |
|
217 | 217 | $messages['optionalComponents'][$componentName][] = $optionalComponent; |
218 | 218 | } |
219 | 219 | } |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | { |
226 | 226 | $components = $this->getComponents(); |
227 | 227 | $componentDefinitions = array(); |
228 | - foreach ($components as $component){ |
|
228 | + foreach ($components as $component) { |
|
229 | 229 | $packageName = $component->getPackageName(); |
230 | - if(isset($componentDefinitions[$packageName]) && !empty($componentDefinitions[$packageName])){ |
|
230 | + if (isset($componentDefinitions[$packageName]) && !empty($componentDefinitions[$packageName])) { |
|
231 | 231 | continue; |
232 | 232 | } |
233 | 233 | $componentDefinitions[$packageName] = $component->getDefinition(); |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | public function getRecordSetPathname($class) |
271 | 271 | { |
272 | 272 | // $App->MyRecordSet() -> myrecord.class.php |
273 | - $file = strtolower(substr($class, strlen($this->classPrefix), -3)) . '.class.php'; |
|
274 | - return $this->recordSetPath . $file; |
|
273 | + $file = strtolower(substr($class, strlen($this->classPrefix), -3)).'.class.php'; |
|
274 | + return $this->recordSetPath.$file; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | public function getRecordPathname($class) |
284 | 284 | { |
285 | 285 | // $App->MyRecord() -> myrecord.class.php |
286 | - $file = strtolower(substr($class, strlen($this->classPrefix))) . '.class.php'; |
|
287 | - return $this->recordSetPath . $file; |
|
286 | + $file = strtolower(substr($class, strlen($this->classPrefix))).'.class.php'; |
|
287 | + return $this->recordSetPath.$file; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -379,12 +379,12 @@ discard block |
||
379 | 379 | $mysqlbackend = new ORMMySqlBackend($GLOBALS['babDB']); |
380 | 380 | $sql = 'SET FOREIGN_KEY_CHECKS=0; |
381 | 381 | '; |
382 | - $temp =get_class_methods($this); |
|
382 | + $temp = get_class_methods($this); |
|
383 | 383 | foreach ($temp as $method) { |
384 | 384 | |
385 | 385 | if (substr($method, 0, 7) === 'include' && substr($method, -3) === 'Set') { |
386 | 386 | $incl = $method; |
387 | - $classNameMethod = substr($method, strlen('include')) . 'ClassName'; |
|
387 | + $classNameMethod = substr($method, strlen('include')).'ClassName'; |
|
388 | 388 | |
389 | 389 | |
390 | 390 | $classname = $this->$classNameMethod(); |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | // We need to revert to multilang fields before synchronizing. |
407 | 407 | $set->useLang(false); |
408 | 408 | } |
409 | - $sql .= $mysqlbackend->setToSql($set) . "\n"; |
|
409 | + $sql .= $mysqlbackend->setToSql($set)."\n"; |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | } |
@@ -424,20 +424,20 @@ discard block |
||
424 | 424 | { |
425 | 425 | $methods = array(); |
426 | 426 | $doc = (new ReflectionClass($this))->getDocComment(); |
427 | - if(empty($doc)){ |
|
427 | + if (empty($doc)) { |
|
428 | 428 | return $methods; |
429 | 429 | } |
430 | 430 | |
431 | - $lines = array_map(function($line){ |
|
431 | + $lines = array_map(function($line) { |
|
432 | 432 | return trim($line, " *"); |
433 | 433 | }, explode("\n", $doc)); |
434 | 434 | |
435 | - $lines = array_filter($lines, function($line){ |
|
435 | + $lines = array_filter($lines, function($line) { |
|
436 | 436 | return strpos($line, "@method") === 0; |
437 | 437 | }); |
438 | 438 | |
439 | 439 | |
440 | - foreach($lines as $line){ |
|
440 | + foreach ($lines as $line) { |
|
441 | 441 | list(, $value) = explode(' ', $line, 2); |
442 | 442 | $value = trim(substr($value, strpos($value, ' '))); |
443 | 443 | $methods[] = $value; |
@@ -457,9 +457,9 @@ discard block |
||
457 | 457 | '; |
458 | 458 | |
459 | 459 | $noPackageNames = array(); |
460 | - foreach ($this->components as $component){ |
|
460 | + foreach ($this->components as $component) { |
|
461 | 461 | /* @var $component AppComponent */ |
462 | - try{ |
|
462 | + try { |
|
463 | 463 | /* @var $set ORMRecordSet */ |
464 | 464 | $set = $component->recordSet(); |
465 | 465 | //Check if the component is not overriden by the addon |
@@ -467,26 +467,26 @@ discard block |
||
467 | 467 | //In case the set has been overriden, we simply do nothing here, as it will be instanciated by the synchronizeSql method |
468 | 468 | $cmprc = new \ReflectionClass($set); |
469 | 469 | $componentSetClass = $cmprc->getShortName(); |
470 | - if(method_exists($this, $componentSetClass)){ |
|
470 | + if (method_exists($this, $componentSetClass)) { |
|
471 | 471 | continue; |
472 | 472 | } |
473 | - if(method_exists($set, 'useLang')){ |
|
473 | + if (method_exists($set, 'useLang')) { |
|
474 | 474 | // This is necessary if the recordSet constructor uses a setLang(). |
475 | 475 | // We need to revert to multilang fields before synchronizing. |
476 | 476 | $set->useLang(false); |
477 | 477 | } |
478 | - $sql .= $mysqlbackend->setToSql($set) . "\n"; |
|
478 | + $sql .= $mysqlbackend->setToSql($set)."\n"; |
|
479 | 479 | |
480 | - if(empty($component->getPackageName())){ |
|
480 | + if (empty($component->getPackageName())) { |
|
481 | 481 | $noPackageNames[] = $component->getName(); |
482 | 482 | } |
483 | 483 | } |
484 | - catch (\Exception $e){ |
|
484 | + catch (\Exception $e) { |
|
485 | 485 | |
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
489 | - if(!empty($noPackageNames)){ |
|
489 | + if (!empty($noPackageNames)) { |
|
490 | 490 | $errorMessage = implode(', ', $noPackageNames); |
491 | 491 | babinstallWindow::message( |
492 | 492 | sprintf( |
@@ -509,18 +509,18 @@ discard block |
||
509 | 509 | $synchronize->fromSqlString($sql); |
510 | 510 | |
511 | 511 | $dependencies = $this->checkComponentsDependencies(); |
512 | - foreach ($dependencies['requiredComponents'] as $componentName => $requiredComponents){ |
|
513 | - foreach ($requiredComponents as $requiredComponent){ |
|
512 | + foreach ($dependencies['requiredComponents'] as $componentName => $requiredComponents) { |
|
513 | + foreach ($requiredComponents as $requiredComponent) { |
|
514 | 514 | $hasComponent = $this->getComponentByName($requiredComponent); |
515 | - if(!$hasComponent){ |
|
515 | + if (!$hasComponent) { |
|
516 | 516 | BabInstallWindow::message(sprintf($this->translate('The component %s is required for the component %s to work. You will encounter fatal errors'), $requiredComponent, $componentName)); |
517 | 517 | } |
518 | 518 | } |
519 | 519 | } |
520 | - foreach ($dependencies['optionalComponents'] as $componentName => $optionalComponents){ |
|
521 | - foreach ($optionalComponents as $optionalComponent){ |
|
520 | + foreach ($dependencies['optionalComponents'] as $componentName => $optionalComponents) { |
|
521 | + foreach ($optionalComponents as $optionalComponent) { |
|
522 | 522 | $hasComponent = $this->getComponentByName($optionalComponent); |
523 | - if(!$hasComponent){ |
|
523 | + if (!$hasComponent) { |
|
524 | 524 | BabInstallWindow::message(sprintf($this->translate('The optional component %s has not been added. The component %s may have reduced functionalities'), $optionalComponent, $componentName)); |
525 | 525 | } |
526 | 526 | } |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | { |
534 | 534 | $components = $this->getComponents(); |
535 | 535 | |
536 | - foreach ($components as $component){ |
|
536 | + foreach ($components as $component) { |
|
537 | 537 | $component->onUpdate(); |
538 | 538 | } |
539 | 539 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | if (substr($method, 0, strlen('include')) === 'include' && substr($method, -strlen('Set')) === 'Set') { |
556 | 556 | $incl = $method; |
557 | - $classNameMethod = substr($method, strlen('include')) . 'ClassName'; |
|
557 | + $classNameMethod = substr($method, strlen('include')).'ClassName'; |
|
558 | 558 | |
559 | 559 | $classname = $this->$classNameMethod(); |
560 | 560 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | |
569 | 569 | if (class_exists($classname) && method_exists($this, $call)) { |
570 | 570 | $set = $this->$call(); |
571 | - $sql .= $mysqlbackend->setToSql($set) . "\n"; |
|
571 | + $sql .= $mysqlbackend->setToSql($set)."\n"; |
|
572 | 572 | } |
573 | 573 | } |
574 | 574 | } |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | |
583 | 583 | public function includeBase() |
584 | 584 | { |
585 | - require_once APP_PHP_PATH . 'base.class.php'; |
|
585 | + require_once APP_PHP_PATH.'base.class.php'; |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | /** |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | public function getRecordSetByRef($recordClassname) |
630 | 630 | { |
631 | 631 | $recordClassname = str_replace($this->classPrefix, '', $recordClassname); |
632 | - $classSet = $recordClassname . 'Set'; |
|
632 | + $classSet = $recordClassname.'Set'; |
|
633 | 633 | $set = $this->$classSet(); |
634 | 634 | return $set; |
635 | 635 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | list($recordClassname, $id) = $refParts; |
651 | 651 | $set = $this->getRecordSetByRef($recordClassname); |
652 | 652 | if (isset($set)) { |
653 | - if($noDefaultCriteria){ |
|
653 | + if ($noDefaultCriteria) { |
|
654 | 654 | $set->setDefaultCriteria(null); |
655 | 655 | } |
656 | 656 | return $set->get($id); |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | { |
670 | 670 | $fullClassName = get_class($record); |
671 | 671 | list(, $className) = explode('_', $fullClassName); |
672 | - return $className . ':' . $record->id; |
|
672 | + return $className.':'.$record->id; |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | |
726 | 726 | //Then, check if current component has a translation |
727 | 727 | if ($translation === $str) { |
728 | - if($currentComponent = $this->getCurrentComponent()){ |
|
728 | + if ($currentComponent = $this->getCurrentComponent()) { |
|
729 | 729 | $translator->setAddonName($currentComponent->getPackageName()); |
730 | 730 | $translator->setLangPath($currentComponent->getLangPath()); |
731 | 731 | $translation = $translator->translate($str, $str_plurals, $number); |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | } |
735 | 735 | //Then, check if libapp has a translation |
736 | 736 | if ($translation === $str) { |
737 | - $translator->setLangPath(null);//Reset lang path |
|
737 | + $translator->setLangPath(null); //Reset lang path |
|
738 | 738 | $translator->setAddonName('libapp'); |
739 | 739 | $translation = $translator->translate($str, $str_plurals, $number); |
740 | 740 | } |
@@ -782,16 +782,16 @@ discard block |
||
782 | 782 | */ |
783 | 783 | public function mailTo($addr, $subject = null, $body = null) |
784 | 784 | { |
785 | - $mailTo = 'mailto:' . $addr; |
|
785 | + $mailTo = 'mailto:'.$addr; |
|
786 | 786 | $parameters = array(); |
787 | 787 | if (isset($subject)) { |
788 | - $parameters[] = 'subject=' . $subject; |
|
788 | + $parameters[] = 'subject='.$subject; |
|
789 | 789 | } |
790 | 790 | if (isset($body)) { |
791 | - $parameters[] = 'body=' . $body; |
|
791 | + $parameters[] = 'body='.$body; |
|
792 | 792 | } |
793 | 793 | if (!empty($parameters)) { |
794 | - $mailTo .= '?' . implode('&', $parameters); |
|
794 | + $mailTo .= '?'.implode('&', $parameters); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | return $mailTo; |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | } |
843 | 843 | |
844 | 844 | $number = number_format($number, $decimals, ',', ' '); |
845 | - return str_replace(' ', bab_nbsp(), $number . ' ' . $prefix . $unitSymbol); |
|
845 | + return str_replace(' ', bab_nbsp(), $number.' '.$prefix.$unitSymbol); |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | } |
863 | 863 | |
864 | 864 | if (!isset($format)) { |
865 | - $format = BabRegistry::get('/' . $this->addonName . '/numberFormat', $PhoneNumber->getDefaultFormat()); |
|
865 | + $format = BabRegistry::get('/'.$this->addonName.'/numberFormat', $PhoneNumber->getDefaultFormat()); |
|
866 | 866 | } |
867 | 867 | $phoneNumberUtil = $PhoneNumber->PhoneNumberUtil(); |
868 | 868 | |
@@ -904,12 +904,12 @@ discard block |
||
904 | 904 | $rc = new \ReflectionClass($this); |
905 | 905 | $namespace = $rc->getNamespaceName(); |
906 | 906 | $prefix = ''; |
907 | - if(!empty($namespace)){ |
|
907 | + if (!empty($namespace)) { |
|
908 | 908 | $namespaces = explode('\\', $namespace); |
909 | 909 | $prefix = $namespaces[0].'\\'.$namespaces[1].'\Ctrl\\'; |
910 | 910 | } |
911 | 911 | $this->includeController(); |
912 | - return bab_getInstance($prefix.$this->classPrefix . 'Controller')->setApp($this); |
|
912 | + return bab_getInstance($prefix.$this->classPrefix.'Controller')->setApp($this); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | |
@@ -950,12 +950,12 @@ discard block |
||
950 | 950 | $rc = new \ReflectionClass($this); |
951 | 951 | $namespace = $rc->getNamespaceName(); |
952 | 952 | $prefix = ''; |
953 | - if(!empty($namespace)){ |
|
953 | + if (!empty($namespace)) { |
|
954 | 954 | $namespaces = explode('\\', $namespace); |
955 | 955 | $prefix = $namespaces[0].'\\'.$namespaces[1].'\Ui\\'; |
956 | 956 | } |
957 | 957 | $this->includeUi(); |
958 | - return bab_getInstance($prefix.$this->classPrefix . 'Ui')->setApp($this); |
|
958 | + return bab_getInstance($prefix.$this->classPrefix.'Ui')->setApp($this); |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | /** |
@@ -982,40 +982,40 @@ discard block |
||
982 | 982 | |
983 | 983 | case substr($name, -strlen('SetClassName')) === 'SetClassName': |
984 | 984 | $className = substr($name, 0, strlen($name) - strlen('SetClassName')); |
985 | - if($component = $this->getComponentByName($className)){ |
|
985 | + if ($component = $this->getComponentByName($className)) { |
|
986 | 986 | return $component->getSetClassName(); |
987 | 987 | } |
988 | 988 | $setName = $className.'Set'; |
989 | - return $this->classPrefix . $setName; |
|
989 | + return $this->classPrefix.$setName; |
|
990 | 990 | |
991 | 991 | case substr($name, -strlen('ClassName')) === 'ClassName': |
992 | 992 | $recordName = substr($name, 0, strlen($name) - strlen('ClassName')); |
993 | - if($component = $this->getComponentByName($recordName)){ |
|
993 | + if ($component = $this->getComponentByName($recordName)) { |
|
994 | 994 | return $component->getRecordClassName(); |
995 | 995 | } |
996 | - return $this->classPrefix . $recordName; |
|
996 | + return $this->classPrefix.$recordName; |
|
997 | 997 | |
998 | 998 | case substr($name, 0, strlen('include')) === 'include' && substr($name, -strlen('Set')) === 'Set': |
999 | 999 | $fileNameBase = strtolower(substr(substr($name, 0, strlen($name) - strlen('Set')), strlen('include'))); |
1000 | - if($this->getComponentByName($fileNameBase)){ |
|
1000 | + if ($this->getComponentByName($fileNameBase)) { |
|
1001 | 1001 | return; |
1002 | 1002 | } |
1003 | - $path = APP_SET_PATH . $fileNameBase . '.class.php'; |
|
1004 | - if(is_file($path)){ |
|
1003 | + $path = APP_SET_PATH.$fileNameBase.'.class.php'; |
|
1004 | + if (is_file($path)) { |
|
1005 | 1005 | require_once $path; |
1006 | 1006 | } |
1007 | 1007 | return; |
1008 | 1008 | |
1009 | 1009 | case substr($name, -strlen('Set')) === 'Set': |
1010 | - try{ |
|
1010 | + try { |
|
1011 | 1011 | $sClassName = str_replace($this->classPrefix, '', $name); |
1012 | - if(method_exists($this, $sClassName)){ |
|
1012 | + if (method_exists($this, $sClassName)) { |
|
1013 | 1013 | return $this->$sClassName(); |
1014 | 1014 | } |
1015 | 1015 | throw new Exception("Class '{$sClassName}' not found"); |
1016 | 1016 | } |
1017 | - catch(Exception $e){ |
|
1018 | - if($component = $this->getComponentByName(substr($name, 0, strlen($name) -strlen('Set')))){ |
|
1017 | + catch (Exception $e) { |
|
1018 | + if ($component = $this->getComponentByName(substr($name, 0, strlen($name) - strlen('Set')))) { |
|
1019 | 1019 | return $component->recordSet(); |
1020 | 1020 | } |
1021 | 1021 | throw $e; |
@@ -1024,8 +1024,8 @@ discard block |
||
1024 | 1024 | case ($component = $this->getComponentByName($name)) != false: |
1025 | 1025 | return $component; |
1026 | 1026 | default: |
1027 | - $setName = $name . 'Set'; |
|
1028 | - $recordClassNameMethod = $name . 'ClassName'; |
|
1027 | + $setName = $name.'Set'; |
|
1028 | + $recordClassNameMethod = $name.'ClassName'; |
|
1029 | 1029 | $recordClassName = $this->$recordClassNameMethod(); |
1030 | 1030 | if (isset($arguments[0])) { |
1031 | 1031 | if ($arguments[0] instanceof $recordClassName) { |
@@ -1039,38 +1039,38 @@ discard block |
||
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | |
1042 | - public function LinkSet(){ |
|
1042 | + public function LinkSet() { |
|
1043 | 1043 | return $this->AppLinkSet(); |
1044 | 1044 | } |
1045 | - public function AppLinkSet(){ |
|
1045 | + public function AppLinkSet() { |
|
1046 | 1046 | return new AppLinkSet($this); |
1047 | 1047 | } |
1048 | 1048 | |
1049 | - public function CustomFieldSet(){ |
|
1049 | + public function CustomFieldSet() { |
|
1050 | 1050 | return $this->AppCustomFieldSet(); |
1051 | 1051 | } |
1052 | - public function AppCustomFieldSet(){ |
|
1052 | + public function AppCustomFieldSet() { |
|
1053 | 1053 | return new AppCustomFieldSet($this); |
1054 | 1054 | } |
1055 | 1055 | |
1056 | - public function CustomContainerSet(){ |
|
1056 | + public function CustomContainerSet() { |
|
1057 | 1057 | return $this->AppCustomContainerSet(); |
1058 | 1058 | } |
1059 | - public function AppCustomContainerSet(){ |
|
1059 | + public function AppCustomContainerSet() { |
|
1060 | 1060 | return new AppCustomContainerSet($this); |
1061 | 1061 | } |
1062 | 1062 | |
1063 | - public function CustomSectionSet(){ |
|
1063 | + public function CustomSectionSet() { |
|
1064 | 1064 | return $this->AppCustomSectionSet(); |
1065 | 1065 | } |
1066 | - public function AppCustomSectionSet(){ |
|
1066 | + public function AppCustomSectionSet() { |
|
1067 | 1067 | return new AppCustomSectionSet($this); |
1068 | 1068 | } |
1069 | 1069 | |
1070 | - public function LogSet(){ |
|
1070 | + public function LogSet() { |
|
1071 | 1071 | return $this->AppLogSet(); |
1072 | 1072 | } |
1073 | - public function AppLogSet(){ |
|
1073 | + public function AppLogSet() { |
|
1074 | 1074 | return new AppLogSet($this); |
1075 | 1075 | } |
1076 | 1076 | |
@@ -1204,9 +1204,9 @@ discard block |
||
1204 | 1204 | { |
1205 | 1205 | $sets = array(); |
1206 | 1206 | |
1207 | - foreach ($this->components as $component){ |
|
1207 | + foreach ($this->components as $component) { |
|
1208 | 1208 | /* @var $component AppComponent */ |
1209 | - try{ |
|
1209 | + try { |
|
1210 | 1210 | /* @var $set ORMRecordSet */ |
1211 | 1211 | $set = $component->recordSet(); |
1212 | 1212 | //Check if the component is not overriden by the addon |
@@ -1214,13 +1214,13 @@ discard block |
||
1214 | 1214 | //In case the set has been overriden, we simply do nothing here, as it will be instanciated by the synchronizeSql method |
1215 | 1215 | $cmprc = new \ReflectionClass($set); |
1216 | 1216 | $componentSetClass = $cmprc->getShortName(); |
1217 | - if(method_exists($this, $componentSetClass)){ |
|
1217 | + if (method_exists($this, $componentSetClass)) { |
|
1218 | 1218 | continue; |
1219 | 1219 | } |
1220 | 1220 | |
1221 | 1221 | $sets[$componentSetClass] = $set; |
1222 | 1222 | } |
1223 | - catch (\Exception $e){ |
|
1223 | + catch (\Exception $e) { |
|
1224 | 1224 | |
1225 | 1225 | } |
1226 | 1226 | } |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | |
1232 | 1232 | if (substr($method, 0, 7) === 'include' && substr($method, -3) === 'Set') { |
1233 | 1233 | $incl = $method; |
1234 | - $classNameMethod = substr($method, strlen('include')) . 'ClassName'; |
|
1234 | + $classNameMethod = substr($method, strlen('include')).'ClassName'; |
|
1235 | 1235 | |
1236 | 1236 | |
1237 | 1237 | $classname = $this->$classNameMethod(); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | if(isset($this->components[$componentName])){ |
191 | 191 | return $this->components[$componentName]; |
192 | - }else{ |
|
192 | + } else{ |
|
193 | 193 | return null; |
194 | 194 | } |
195 | 195 | } |
@@ -480,8 +480,7 @@ discard block |
||
480 | 480 | if(empty($component->getPackageName())){ |
481 | 481 | $noPackageNames[] = $component->getName(); |
482 | 482 | } |
483 | - } |
|
484 | - catch (\Exception $e){ |
|
483 | + } catch (\Exception $e){ |
|
485 | 484 | |
486 | 485 | } |
487 | 486 | } |
@@ -1013,8 +1012,7 @@ discard block |
||
1013 | 1012 | return $this->$sClassName(); |
1014 | 1013 | } |
1015 | 1014 | throw new Exception("Class '{$sClassName}' not found"); |
1016 | - } |
|
1017 | - catch(Exception $e){ |
|
1015 | + } catch(Exception $e){ |
|
1018 | 1016 | if($component = $this->getComponentByName(substr($name, 0, strlen($name) -strlen('Set')))){ |
1019 | 1017 | return $component->recordSet(); |
1020 | 1018 | } |
@@ -1219,8 +1217,7 @@ discard block |
||
1219 | 1217 | } |
1220 | 1218 | |
1221 | 1219 | $sets[$componentSetClass] = $set; |
1222 | - } |
|
1223 | - catch (\Exception $e){ |
|
1220 | + } catch (\Exception $e){ |
|
1224 | 1221 | |
1225 | 1222 | } |
1226 | 1223 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $customSection = $customSectionSet->request($customSectionSet->id->is($section)); |
75 | 75 | |
76 | 76 | $object = $customSection->container->object; |
77 | - if(strpos($object, $App->classPrefix) !== false){ |
|
77 | + if (strpos($object, $App->classPrefix) !== false) { |
|
78 | 78 | list (, $object) = explode($App->classPrefix, $object); |
79 | 79 | } |
80 | 80 | $objectCtrl = $App->Controller()->$object(false); |
@@ -83,20 +83,20 @@ discard block |
||
83 | 83 | ->_AND_($customSectionSet->object->is($customSection->object))); |
84 | 84 | |
85 | 85 | $allViewFieldNames = array(); |
86 | - foreach ($allViewSections as $viewSection){ |
|
86 | + foreach ($allViewSections as $viewSection) { |
|
87 | 87 | $fields = $viewSection->getFields(); |
88 | - foreach ($fields as $field){ |
|
89 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
90 | - if(isset($field["fields"])){ |
|
91 | - foreach ($field['fields'] as $subField){ |
|
92 | - $allViewFieldNames[$subField['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
88 | + foreach ($fields as $field) { |
|
89 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
90 | + if (isset($field["fields"])) { |
|
91 | + foreach ($field['fields'] as $subField) { |
|
92 | + $allViewFieldNames[$subField['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | 98 | $box = $W->VBoxItems(); |
99 | - if(isset($itemId)){ |
|
99 | + if (isset($itemId)) { |
|
100 | 100 | $box->setId($itemId); |
101 | 101 | } |
102 | 102 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | BabSort::asort($availableFields, 'description', BabSort::CASE_INSENSITIVE); |
113 | 113 | |
114 | - foreach ($availableFields as $field){ |
|
114 | + foreach ($availableFields as $field) { |
|
115 | 115 | $fieldName = $field['name']; |
116 | 116 | $fieldDescription = $field['description']; |
117 | 117 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | $field = $customSection->getField($fieldName); |
168 | 168 | |
169 | - if(! isset($field)){ |
|
169 | + if (!isset($field)) { |
|
170 | 170 | return null; |
171 | 171 | } |
172 | 172 | |
@@ -181,20 +181,20 @@ discard block |
||
181 | 181 | |
182 | 182 | $availableFields = $objectCtrl->getAvailableDisplayFields(); |
183 | 183 | |
184 | - if(isset($availableFields[$fieldName])){ |
|
184 | + if (isset($availableFields[$fieldName])) { |
|
185 | 185 | $field = $availableFields[$fieldName]; |
186 | 186 | $fieldDescription = $field['description']; |
187 | 187 | } |
188 | - if(substr($fieldName, 0, 1) !== '_'){ |
|
188 | + if (substr($fieldName, 0, 1) !== '_') { |
|
189 | 189 | $fieldDescription = $App->translate($fieldDescription); |
190 | 190 | } |
191 | 191 | |
192 | - if(empty($field)){ |
|
192 | + if (empty($field)) { |
|
193 | 193 | // continue; |
194 | 194 | } |
195 | 195 | |
196 | 196 | $page = $App->Ui()->Page(); |
197 | - if(!empty($fieldDescription)){ |
|
197 | + if (!empty($fieldDescription)) { |
|
198 | 198 | $page->setTitle($fieldDescription); |
199 | 199 | } |
200 | 200 | |
@@ -262,45 +262,45 @@ discard block |
||
262 | 262 | $subGroups = explode('/', $fieldGroupName); |
263 | 263 | $nbEntryInSubGroup = count($subGroups); |
264 | 264 | |
265 | - if($nbEntryInSubGroup == 1){ |
|
265 | + if ($nbEntryInSubGroup == 1) { |
|
266 | 266 | $groupField = $customSection->getField($fieldGroupName); |
267 | 267 | } |
268 | - elseif($nbEntryInSubGroup == 2){ |
|
268 | + elseif ($nbEntryInSubGroup == 2) { |
|
269 | 269 | $groupField = $customSection->getField($subGroups[0]); |
270 | - if(isset($groupField['fields'][$subGroups[1]])){ |
|
270 | + if (isset($groupField['fields'][$subGroups[1]])) { |
|
271 | 271 | $groupField = $groupField['fields'][$subGroups[1]]; |
272 | 272 | } |
273 | - else{ |
|
273 | + else { |
|
274 | 274 | return $this; |
275 | 275 | } |
276 | 276 | } |
277 | - elseif($nbEntryInSubGroup == 3){ |
|
277 | + elseif ($nbEntryInSubGroup == 3) { |
|
278 | 278 | $groupField = $customSection->getField($subGroups[0]); |
279 | - if(isset($groupField['fields'][$subGroups[1]]['fields'][$subGroups[2]])){ |
|
279 | + if (isset($groupField['fields'][$subGroups[1]]['fields'][$subGroups[2]])) { |
|
280 | 280 | $groupField = $groupField['fields'][$subGroups[1]]['fields'][$subGroups[2]]; |
281 | 281 | } |
282 | - else{ |
|
282 | + else { |
|
283 | 283 | return $this; |
284 | 284 | } |
285 | 285 | } |
286 | - else{ |
|
286 | + else { |
|
287 | 287 | return $this; |
288 | 288 | } |
289 | 289 | |
290 | 290 | |
291 | - if(! isset($groupField)){ |
|
291 | + if (!isset($groupField)) { |
|
292 | 292 | return null; |
293 | 293 | } |
294 | 294 | |
295 | 295 | $isSubGroup = false; |
296 | - if(isset($groupField['fields'][$fieldName])){ |
|
296 | + if (isset($groupField['fields'][$fieldName])) { |
|
297 | 297 | $field = $groupField['fields'][$fieldName]; |
298 | 298 | } |
299 | - else{ |
|
299 | + else { |
|
300 | 300 | return null; |
301 | 301 | } |
302 | 302 | |
303 | - if(! isset($field)){ |
|
303 | + if (!isset($field)) { |
|
304 | 304 | return null; |
305 | 305 | } |
306 | 306 | |
@@ -319,22 +319,22 @@ discard block |
||
319 | 319 | 'description' => sprintf('[%s]', $App->translate('Sub section')) |
320 | 320 | ); |
321 | 321 | |
322 | - if(strpos($fieldName, '_subSection') !== false){ |
|
322 | + if (strpos($fieldName, '_subSection') !== false) { |
|
323 | 323 | $field = $availableFields['_subSection']; |
324 | 324 | } |
325 | - elseif(strpos($fieldName, '_fieldsGroup') !== false){ |
|
325 | + elseif (strpos($fieldName, '_fieldsGroup') !== false) { |
|
326 | 326 | $field = $availableFields['_fieldsGroup']; |
327 | 327 | } |
328 | - else{ |
|
328 | + else { |
|
329 | 329 | $field = $availableFields[$fieldName]; |
330 | 330 | } |
331 | 331 | |
332 | 332 | $fieldDescription = $field['description']; |
333 | - if(substr($fieldName, 0, 1) !== '_'){ |
|
333 | + if (substr($fieldName, 0, 1) !== '_') { |
|
334 | 334 | $fieldDescription = $App->translate($fieldDescription); |
335 | 335 | } |
336 | 336 | |
337 | - if(empty($field)){ |
|
337 | + if (empty($field)) { |
|
338 | 338 | // continue; |
339 | 339 | } |
340 | 340 | |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | |
424 | 424 | $inSubGroup = false; |
425 | 425 | |
426 | - if($nbEntryInSubGroup == 1 && !isset($fields[$fieldGroupName])){ |
|
426 | + if ($nbEntryInSubGroup == 1 && !isset($fields[$fieldGroupName])) { |
|
427 | 427 | throw new AppException($App->translate('This fields group does not seem to exist')); |
428 | 428 | } |
429 | - elseif($nbEntryInSubGroup == 3){ |
|
429 | + elseif ($nbEntryInSubGroup == 3) { |
|
430 | 430 | $inSubGroup = true; |
431 | 431 | $currentFieldToCheck = $fields; |
432 | - foreach($subGroups as $subGroup){ |
|
433 | - if(!isset($currentFieldToCheck[$subGroup])){ |
|
432 | + foreach ($subGroups as $subGroup) { |
|
433 | + if (!isset($currentFieldToCheck[$subGroup])) { |
|
434 | 434 | throw new AppException($App->translate('This fields group does not seem to exist')); |
435 | 435 | } |
436 | - if(!isset($currentFieldToCheck[$subGroup]['fields'])){ |
|
436 | + if (!isset($currentFieldToCheck[$subGroup]['fields'])) { |
|
437 | 437 | $currentFieldToCheck[$subGroup]['fields'] = array(); |
438 | 438 | } |
439 | 439 | $currentFieldToCheck = $currentFieldToCheck[$subGroup]['fields']; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | |
444 | 444 | $object = $customSection->container->object; |
445 | - if(strpos($object, $App->classPrefix) !== false){ |
|
445 | + if (strpos($object, $App->classPrefix) !== false) { |
|
446 | 446 | list (, $object) = explode($App->classPrefix, $object); |
447 | 447 | } |
448 | 448 | |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | ->_AND_($customSectionSet->object->is($customSection->object))); |
453 | 453 | |
454 | 454 | $allViewFieldNames = array(); |
455 | - foreach ($allViewSections as $viewSection){ |
|
455 | + foreach ($allViewSections as $viewSection) { |
|
456 | 456 | $fields = $viewSection->getFields(); |
457 | - foreach ($fields as $field){ |
|
458 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
459 | - if(isset($field["fields"])){ |
|
460 | - foreach ($field['fields'] as $subField){ |
|
461 | - $allViewFieldNames[$subField['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
457 | + foreach ($fields as $field) { |
|
458 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
459 | + if (isset($field["fields"])) { |
|
460 | + foreach ($field['fields'] as $subField) { |
|
461 | + $allViewFieldNames[$subField['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
467 | 467 | $box = $W->VBoxItems(); |
468 | - if(isset($itemId)){ |
|
468 | + if (isset($itemId)) { |
|
469 | 469 | $box->setId($itemId); |
470 | 470 | } |
471 | 471 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | unset($availableFields['_fieldsGroup']); |
481 | 481 | unset($availableFields['_spacer']); |
482 | 482 | |
483 | - if(!$inSubGroup){ |
|
483 | + if (!$inSubGroup) { |
|
484 | 484 | $availableFields['_subSection'] = array( |
485 | 485 | 'name' => '_subSection', |
486 | 486 | 'description' => sprintf('[%s]', $App->translate('Sub section')) |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | BabSort::asort($availableFields, 'description', BabSort::CASE_INSENSITIVE); |
491 | 491 | |
492 | - foreach ($availableFields as $field){ |
|
492 | + foreach ($availableFields as $field) { |
|
493 | 493 | $fieldName = $field['name']; |
494 | 494 | $fieldDescription = $field['description']; |
495 | 495 | |
@@ -527,12 +527,12 @@ discard block |
||
527 | 527 | |
528 | 528 | $customSection = $customSectionSet->request($customSectionSet->id->is($section)); |
529 | 529 | $fields = $customSection->getFields(); |
530 | - if(!isset($fields[$fieldGroupName]['fields'][$subSectionName])){ |
|
530 | + if (!isset($fields[$fieldGroupName]['fields'][$subSectionName])) { |
|
531 | 531 | throw new AppException($App->translate('This fields group or sub section does not seem to exist')); |
532 | 532 | } |
533 | 533 | |
534 | 534 | $object = $customSection->container->object; |
535 | - if(strpos($object, $App->classPrefix) !== false){ |
|
535 | + if (strpos($object, $App->classPrefix) !== false) { |
|
536 | 536 | list (, $object) = explode($App->classPrefix, $object); |
537 | 537 | } |
538 | 538 | |
@@ -542,20 +542,20 @@ discard block |
||
542 | 542 | ->_AND_($customSectionSet->object->is($customSection->object))); |
543 | 543 | |
544 | 544 | $allViewFieldNames = array(); |
545 | - foreach ($allViewSections as $viewSection){ |
|
545 | + foreach ($allViewSections as $viewSection) { |
|
546 | 546 | $fields = $viewSection->getFields(); |
547 | - foreach ($fields as $field){ |
|
548 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
549 | - if(isset($field["fields"])){ |
|
550 | - foreach ($field['fields'] as $subField){ |
|
551 | - $allViewFieldNames[$subField['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
547 | + foreach ($fields as $field) { |
|
548 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
549 | + if (isset($field["fields"])) { |
|
550 | + foreach ($field['fields'] as $subField) { |
|
551 | + $allViewFieldNames[$subField['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
552 | 552 | } |
553 | 553 | } |
554 | 554 | } |
555 | 555 | } |
556 | 556 | |
557 | 557 | $box = $W->VBoxItems(); |
558 | - if(isset($itemId)){ |
|
558 | + if (isset($itemId)) { |
|
559 | 559 | $box->setId($itemId); |
560 | 560 | } |
561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | |
565 | 565 | BabSort::asort($availableFields, 'description', BabSort::CASE_INSENSITIVE); |
566 | 566 | |
567 | - foreach ($availableFields as $field){ |
|
567 | + foreach ($availableFields as $field) { |
|
568 | 568 | $fieldName = $field['name']; |
569 | 569 | $fieldDescription = $field['description']; |
570 | 570 | |
@@ -680,10 +680,10 @@ discard block |
||
680 | 680 | $container = $customContainerSet->request($customContainerSet->id->is($container)); |
681 | 681 | |
682 | 682 | $customSectionSet = $App->CustomSectionSet(); |
683 | - if(isset($id)){ |
|
683 | + if (isset($id)) { |
|
684 | 684 | $record = $customSectionSet->request($id); |
685 | 685 | } |
686 | - else{ |
|
686 | + else { |
|
687 | 687 | $record = $customSectionSet->newRecord(); |
688 | 688 | $record->container = $container->id; |
689 | 689 | } |
@@ -725,10 +725,10 @@ discard block |
||
725 | 725 | $record = $recordSet->request($id); |
726 | 726 | |
727 | 727 | $object = $record->object; |
728 | - if(empty($object)){ |
|
728 | + if (empty($object)) { |
|
729 | 729 | $object = $record->container()->object; |
730 | 730 | } |
731 | - if(strpos($object, $App->classPrefix) !== false){ |
|
731 | + if (strpos($object, $App->classPrefix) !== false) { |
|
732 | 732 | $object = str_replace($App->classPrefix, '', $object); |
733 | 733 | } |
734 | 734 | $object .= 'Set'; |
@@ -743,25 +743,25 @@ discard block |
||
743 | 743 | $manySets = $objectRecordSet->getHasManyRelations(); |
744 | 744 | $oneSets = $objectRecordSet->getHasOneRelations(); |
745 | 745 | |
746 | - if(! empty($record->visibilityCriteria)){ |
|
746 | + if (!empty($record->visibilityCriteria)) { |
|
747 | 747 | $arrCriteria = json_decode($record->visibilityCriteria, true); |
748 | 748 | |
749 | 749 | $data = array(); |
750 | - foreach ($arrCriteria as $fieldName => $operation){ |
|
750 | + foreach ($arrCriteria as $fieldName => $operation) { |
|
751 | 751 | $data['field'] = $fieldName; |
752 | - foreach ($operation as $condition => $value){ |
|
752 | + foreach ($operation as $condition => $value) { |
|
753 | 753 | $data['condition']['default'] = $condition; |
754 | 754 | $data['condition']['bool'] = $condition; |
755 | - if(is_array($value)){ |
|
756 | - foreach ($value as $key => $subValue){ |
|
757 | - foreach ($manySets as $manyFieldName => $manyRelation){ |
|
758 | - if($key . 'Set' == $manyRelation->getForeignSetClassName()){ |
|
759 | - foreach ($subValue as $subFieldName => $subConditions){ |
|
760 | - if($subFieldName === '_foreignField'){ |
|
755 | + if (is_array($value)) { |
|
756 | + foreach ($value as $key => $subValue) { |
|
757 | + foreach ($manySets as $manyFieldName => $manyRelation) { |
|
758 | + if ($key.'Set' == $manyRelation->getForeignSetClassName()) { |
|
759 | + foreach ($subValue as $subFieldName => $subConditions) { |
|
760 | + if ($subFieldName === '_foreignField') { |
|
761 | 761 | continue; |
762 | 762 | } |
763 | 763 | $data['field'] = "{$manyFieldName}/{$subFieldName}"; |
764 | - foreach ($subConditions as $subCondition => $subConditionValue){ |
|
764 | + foreach ($subConditions as $subCondition => $subConditionValue) { |
|
765 | 765 | $data['condition']['default'] = $subCondition; |
766 | 766 | $data['condition']['bool'] = $subCondition; |
767 | 767 | $value = $subConditionValue; |
@@ -770,14 +770,14 @@ discard block |
||
770 | 770 | break; |
771 | 771 | } |
772 | 772 | } |
773 | - foreach ($oneSets as $oneFieldName => $oneRelation){ |
|
774 | - if($key . 'Set' == $oneRelation->getForeignSetClassName()){ |
|
775 | - foreach ($subValue as $subFieldName => $subConditions){ |
|
776 | - if($subFieldName === '_foreignField'){ |
|
773 | + foreach ($oneSets as $oneFieldName => $oneRelation) { |
|
774 | + if ($key.'Set' == $oneRelation->getForeignSetClassName()) { |
|
775 | + foreach ($subValue as $subFieldName => $subConditions) { |
|
776 | + if ($subFieldName === '_foreignField') { |
|
777 | 777 | continue; |
778 | 778 | } |
779 | 779 | $data['field'] = "{$oneFieldName}/{$subFieldName}"; |
780 | - foreach ($subConditions as $subCondition => $subConditionValue){ |
|
780 | + foreach ($subConditions as $subCondition => $subConditionValue) { |
|
781 | 781 | $data['condition']['default'] = $subCondition; |
782 | 782 | $data['condition']['bool'] = $subCondition; |
783 | 783 | $value = $subConditionValue; |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | */ |
813 | 813 | public function save($data = null) |
814 | 814 | { |
815 | - if(! isset($data['id']) && isset($data['container']) && $data['container'] != 0 && ! isset($data['rank'])){ |
|
815 | + if (!isset($data['id']) && isset($data['container']) && $data['container'] != 0 && !isset($data['rank'])) { |
|
816 | 816 | $set = $this->getRecordSet(); |
817 | 817 | $data['rank'] = $set->select($set->container->is($data['container'])) |
818 | 818 | ->count(); |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | return true; |
825 | 825 | } |
826 | 826 | |
827 | - protected function postSave(ORMRecord &$record, $data) |
|
827 | + protected function postSave(ORMRecord & $record, $data) |
|
828 | 828 | { |
829 | 829 | parent::postSave($record, $data); |
830 | 830 | $set = $record->getParentSet(); |
@@ -845,11 +845,11 @@ discard block |
||
845 | 845 | $set->rank->greaterThanOrEqual($record->rank) |
846 | 846 | ))); |
847 | 847 | |
848 | - $position ++; |
|
849 | - foreach ($afterSections as $afterSection){ |
|
848 | + $position++; |
|
849 | + foreach ($afterSections as $afterSection) { |
|
850 | 850 | $afterSection->rank = $position; |
851 | 851 | $afterSection->save(); |
852 | - $position ++; |
|
852 | + $position++; |
|
853 | 853 | } |
854 | 854 | } |
855 | 855 | |
@@ -877,10 +877,10 @@ discard block |
||
877 | 877 | $record = $recordSet->request($data['id']); |
878 | 878 | |
879 | 879 | $object = $record->object; |
880 | - if(empty($object)){ |
|
880 | + if (empty($object)) { |
|
881 | 881 | $object = $record->container()->object; |
882 | 882 | } |
883 | - if(strpos($object, $App->classPrefix) !== false){ |
|
883 | + if (strpos($object, $App->classPrefix) !== false) { |
|
884 | 884 | $object = str_replace($App->classPrefix, '', $object); |
885 | 885 | } |
886 | 886 | $object .= 'Set'; |
@@ -890,14 +890,14 @@ discard block |
||
890 | 890 | $field = $data['field']; |
891 | 891 | $condition = $data['condition']; |
892 | 892 | |
893 | - if(strpos($field, '/') !== false){ |
|
893 | + if (strpos($field, '/') !== false) { |
|
894 | 894 | // The selected field is a hasMany or a hasOne relation |
895 | 895 | list ($selectedRelation, $selectedField) = explode('/', $field); |
896 | 896 | $classPrefix = $App->classPrefix; |
897 | 897 | |
898 | 898 | $manyRelations = $objectRecordSet->getHasManyRelations(); |
899 | - foreach ($manyRelations as $manyRelation){ |
|
900 | - if($selectedRelation != $manyRelation->getOwnerSetFieldName()){ |
|
899 | + foreach ($manyRelations as $manyRelation) { |
|
900 | + if ($selectedRelation != $manyRelation->getOwnerSetFieldName()) { |
|
901 | 901 | continue; |
902 | 902 | } |
903 | 903 | $foreignSetName = str_replace($classPrefix, '', $manyRelation->getForeignSetClassName()); |
@@ -905,13 +905,13 @@ discard block |
||
905 | 905 | |
906 | 906 | $visibilityCriteria = ''; |
907 | 907 | |
908 | - if($foreignSet){ |
|
908 | + if ($foreignSet) { |
|
909 | 909 | $selectedManyField = $foreignSet->$selectedField; |
910 | 910 | |
911 | - if($selectedManyField instanceof ORMBoolInterface){ |
|
911 | + if ($selectedManyField instanceof ORMBoolInterface) { |
|
912 | 912 | $condition = $condition['bool']; |
913 | 913 | } |
914 | - else{ |
|
914 | + else { |
|
915 | 915 | $condition = $condition['default']; |
916 | 916 | } |
917 | 917 | |
@@ -923,9 +923,9 @@ discard block |
||
923 | 923 | } |
924 | 924 | |
925 | 925 | $oneRelations = $objectRecordSet->getHasOneRelations(); |
926 | - foreach ($oneRelations as $oneRelation){ |
|
926 | + foreach ($oneRelations as $oneRelation) { |
|
927 | 927 | /* @var $oneRelation ORMOneRelation*/ |
928 | - if($selectedRelation != $oneRelation->getOwnerSetFieldName()){ |
|
928 | + if ($selectedRelation != $oneRelation->getOwnerSetFieldName()) { |
|
929 | 929 | continue; |
930 | 930 | } |
931 | 931 | $foreignSetClassName = $oneRelation->getForeignSetClassName(); |
@@ -934,13 +934,13 @@ discard block |
||
934 | 934 | |
935 | 935 | $visibilityCriteria = ''; |
936 | 936 | |
937 | - if($foreignSet){ |
|
937 | + if ($foreignSet) { |
|
938 | 938 | $selectedOneField = $foreignSet->$selectedField; |
939 | 939 | |
940 | - if($selectedOneField instanceof ORMBoolInterface){ |
|
940 | + if ($selectedOneField instanceof ORMBoolInterface) { |
|
941 | 941 | $condition = $condition['bool']; |
942 | 942 | } |
943 | - else{ |
|
943 | + else { |
|
944 | 944 | $condition = $condition['default']; |
945 | 945 | } |
946 | 946 | |
@@ -950,20 +950,20 @@ discard block |
||
950 | 950 | break; |
951 | 951 | } |
952 | 952 | } |
953 | - else{ |
|
953 | + else { |
|
954 | 954 | |
955 | 955 | $field = $objectRecordSet->$field; |
956 | 956 | |
957 | - if($field instanceof ORMBoolInterface){ |
|
957 | + if ($field instanceof ORMBoolInterface) { |
|
958 | 958 | $condition = $condition['bool']; |
959 | 959 | } |
960 | - else{ |
|
960 | + else { |
|
961 | 961 | $condition = $condition['default']; |
962 | 962 | } |
963 | 963 | |
964 | 964 | $visibilityCriteria = ''; |
965 | 965 | |
966 | - if(! empty($condition)){ |
|
966 | + if (!empty($condition)) { |
|
967 | 967 | $criteria = $field->{$condition}($data['value']); |
968 | 968 | $visibilityCriteria = $criteria->toJson(); |
969 | 969 | } |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | $customContainer = $customContainerSet->request($container); |
993 | 993 | |
994 | 994 | $object = $customContainer->object; |
995 | - if(strpos($object, $App->classPrefix) !== false){ |
|
995 | + if (strpos($object, $App->classPrefix) !== false) { |
|
996 | 996 | list (, $object) = explode($App->classPrefix, $object); |
997 | 997 | } |
998 | 998 | |
@@ -1024,16 +1024,16 @@ discard block |
||
1024 | 1024 | |
1025 | 1025 | $nbCol = 0; |
1026 | 1026 | |
1027 | - foreach ($customSections as $customSection){ |
|
1027 | + foreach ($customSections as $customSection) { |
|
1028 | 1028 | $nbCol = $customSection->getNbColFromSizePolicy(); |
1029 | 1029 | |
1030 | 1030 | $currentColumn += $nbCol; |
1031 | 1031 | |
1032 | - $sectionSection = $W->Section($customSection->name . ' (' . $customSection->rank . ')', $sectionBox = $W->VBoxItems($W->Hidden() |
|
1033 | - ->setName('#' . $customSection->id))); |
|
1032 | + $sectionSection = $W->Section($customSection->name.' ('.$customSection->rank.')', $sectionBox = $W->VBoxItems($W->Hidden() |
|
1033 | + ->setName('#'.$customSection->id))); |
|
1034 | 1034 | $sectionSection->addClass('app-custom-section'); |
1035 | 1035 | $sectionSection->addClass($customSection->classname); |
1036 | - $sectionSection->setSizePolicy($customSection->sizePolicy . ' widget-sameheight'); |
|
1036 | + $sectionSection->setSizePolicy($customSection->sizePolicy.' widget-sameheight'); |
|
1037 | 1037 | |
1038 | 1038 | $row->addItem($sectionSection); |
1039 | 1039 | |
@@ -1058,50 +1058,50 @@ discard block |
||
1058 | 1058 | ->addClass('icon', FuncIcons::ACTIONS_EDIT_DELETE) |
1059 | 1059 | ->setOpenMode(WidgetLink::OPEN_DIALOG) |
1060 | 1060 | ->setDialogClass('box red'))); |
1061 | - if(! empty($customSection->visibilityCriteria)){ |
|
1061 | + if (!empty($customSection->visibilityCriteria)) { |
|
1062 | 1062 | $sectionBox->addItem($W->HBoxItems($W->Label($App->translate('This section has a visibility condition'))) |
1063 | 1063 | ->setSizePolicy('alert alert-warning widget-100pc')); |
1064 | 1064 | } |
1065 | 1065 | $fields = $customSection->getFields(); |
1066 | - if(count($fields) == 0){ |
|
1066 | + if (count($fields) == 0) { |
|
1067 | 1067 | $sectionBox->addItem($W->HBoxItems($W->Label($App->translate('This section does not contain any field'))) |
1068 | 1068 | ->setSizePolicy('alert alert-warning')); |
1069 | 1069 | } |
1070 | - foreach ($fields as $fieldId => $field){ |
|
1071 | - if(empty($field)){ |
|
1070 | + foreach ($fields as $fieldId => $field) { |
|
1071 | + if (empty($field)) { |
|
1072 | 1072 | continue; |
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | $fieldName = $field['fieldname']; |
1076 | 1076 | |
1077 | 1077 | $isFieldsGroup = false; |
1078 | - if(strpos($fieldName, '_fieldsGroup') !== false){ |
|
1078 | + if (strpos($fieldName, '_fieldsGroup') !== false) { |
|
1079 | 1079 | $fieldName = '_fieldsGroup'; |
1080 | 1080 | $isFieldsGroup = true; |
1081 | 1081 | } |
1082 | 1082 | $isSpacer = false; |
1083 | - if(strpos($fieldName, '_spacer') !== false){ |
|
1083 | + if (strpos($fieldName, '_spacer') !== false) { |
|
1084 | 1084 | $fieldName = '_spacer'; |
1085 | 1085 | $isSpacer = true; |
1086 | 1086 | } |
1087 | 1087 | |
1088 | - if(!isset($availableFields[$fieldName])){ |
|
1088 | + if (!isset($availableFields[$fieldName])) { |
|
1089 | 1089 | $field = array(); |
1090 | 1090 | $fieldDescription = ""; |
1091 | - }else{ |
|
1091 | + } else { |
|
1092 | 1092 | $field = $availableFields[$fieldName]; |
1093 | 1093 | $fieldDescription = $field['description']; |
1094 | 1094 | } |
1095 | - if(substr($fieldName, 0, 1) !== '_'){ |
|
1095 | + if (substr($fieldName, 0, 1) !== '_') { |
|
1096 | 1096 | $fieldDescription = $App->translate($fieldDescription); |
1097 | 1097 | } |
1098 | 1098 | |
1099 | - if(empty($field)){ |
|
1099 | + if (empty($field)) { |
|
1100 | 1100 | continue; |
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | $fieldName = $field['name']; |
1104 | - if($isFieldsGroup || $isSpacer){ |
|
1104 | + if ($isFieldsGroup || $isSpacer) { |
|
1105 | 1105 | $fieldName = $fieldId; |
1106 | 1106 | } |
1107 | 1107 | |
@@ -1112,12 +1112,12 @@ discard block |
||
1112 | 1112 | ->setGrowable(true) |
1113 | 1113 | ->setWrap(WidgetFlexLayout::FLEX_WRAP_WRAP)) |
1114 | 1114 | ->setSizePolicy('maximum'), $btnBox = $W->HBoxItems($W->Hidden() |
1115 | - ->setName($customSection->id . '.' . $fieldId) |
|
1115 | + ->setName($customSection->id.'.'.$fieldId) |
|
1116 | 1116 | ->setValue($fieldName)) |
1117 | 1117 | ->addClass('widget-actions')) |
1118 | 1118 | ->setSizePolicy('widget-list-element widget-actions-target') |
1119 | 1119 | ->addClass(FuncIcons::ICON_LEFT_16); |
1120 | - if(strpos($field['name'], '_fieldsGroup') !== false){ |
|
1120 | + if (strpos($field['name'], '_fieldsGroup') !== false) { |
|
1121 | 1121 | $btnBox->addItem( |
1122 | 1122 | $W->Link( |
1123 | 1123 | '', |
@@ -1125,12 +1125,12 @@ discard block |
||
1125 | 1125 | )->addClass('icon', FuncIcons::ACTIONS_LIST_ADD)->setOpenMode(WidgetLink::OPEN_DIALOG) |
1126 | 1126 | ); |
1127 | 1127 | |
1128 | - if(isset($fields[$fieldName]["fields"])){ |
|
1128 | + if (isset($fields[$fieldName]["fields"])) { |
|
1129 | 1129 | $groupedFields = $fields[$fieldName]['fields']; |
1130 | - foreach ($groupedFields as $groupedField){ |
|
1130 | + foreach ($groupedFields as $groupedField) { |
|
1131 | 1131 | $groupedFieldName = $groupedField['fieldname']; |
1132 | 1132 | $isSubSubSection = false; |
1133 | - if(strpos($groupedFieldName, '_subSection') !== false){ |
|
1133 | + if (strpos($groupedFieldName, '_subSection') !== false) { |
|
1134 | 1134 | $groupedFieldName = '_subSection'; |
1135 | 1135 | $isSubSubSection = true; |
1136 | 1136 | } |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | $fieldGroupBox->addItem( |
1139 | 1139 | $flexField = $W->VBoxItems( |
1140 | 1140 | $W->HBoxItems( |
1141 | - $W->Hidden(null, array($customSection->id . '.fieldsGroups',$fieldName,$groupedField['fieldname']), $groupedField['fieldname']), |
|
1141 | + $W->Hidden(null, array($customSection->id.'.fieldsGroups', $fieldName, $groupedField['fieldname']), $groupedField['fieldname']), |
|
1142 | 1142 | $W->Label($groupedFieldDetails['description']), |
1143 | 1143 | $fieldMenu = $W->FlowItems( |
1144 | 1144 | $W->Link( |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | )->addClass('app-customsection-groupedfield') |
1155 | 1155 | )->addClass('app-customsection-groupedfields-edit'); |
1156 | 1156 | |
1157 | - if($isSubSubSection){ |
|
1157 | + if ($isSubSubSection) { |
|
1158 | 1158 | $fieldMenu->addItem( |
1159 | 1159 | $W->Link( |
1160 | 1160 | '', |
@@ -1169,15 +1169,15 @@ discard block |
||
1169 | 1169 | |
1170 | 1170 | $flexField->addClass('app-customsection-subSection-edit'); |
1171 | 1171 | |
1172 | - if(isset($groupedField['fields'])){ |
|
1172 | + if (isset($groupedField['fields'])) { |
|
1173 | 1173 | $subSectionFields = $groupedField['fields']; |
1174 | - foreach($subSectionFields as $subSectionField){ |
|
1174 | + foreach ($subSectionFields as $subSectionField) { |
|
1175 | 1175 | $groupFieldBox->addItem( |
1176 | 1176 | $groupFieldItemBox = $W->VBoxItems() |
1177 | 1177 | ); |
1178 | 1178 | $subSectionFieldName = $subSectionField['fieldname']; |
1179 | 1179 | $isFieldsGroupSubSection = false; |
1180 | - if(strpos($subSectionFieldName, '_fieldsGroup') !== false){ |
|
1180 | + if (strpos($subSectionFieldName, '_fieldsGroup') !== false) { |
|
1181 | 1181 | $subSectionFieldName = '_fieldsGroup'; |
1182 | 1182 | $isFieldsGroupSubSection = true; |
1183 | 1183 | } |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | ) |
1197 | 1197 | ) |
1198 | 1198 | ); |
1199 | - if($isFieldsGroupSubSection){ |
|
1199 | + if ($isFieldsGroupSubSection) { |
|
1200 | 1200 | $groupFieldItemMenu->addItem( |
1201 | 1201 | $W->Link( |
1202 | 1202 | '', |
@@ -1204,11 +1204,11 @@ discard block |
||
1204 | 1204 | )->addClass('icon', FuncIcons::ACTIONS_LIST_ADD)->setOpenMode(WidgetLink::OPEN_DIALOG), |
1205 | 1205 | 0 |
1206 | 1206 | ); |
1207 | - if(isset($subSectionField['fields'])){ |
|
1207 | + if (isset($subSectionField['fields'])) { |
|
1208 | 1208 | $groupFieldItemBox->addItem( |
1209 | 1209 | $groupFieldItemGroupBox = $W->FlexItems()->setJustifyContent(WidgetFlexLayout::FLEX_JUSTIFY_CONTENT_SPACE_BETWEEN) |
1210 | 1210 | ); |
1211 | - foreach($subSectionField['fields'] as $subSectionFieldGroupFields){ |
|
1211 | + foreach ($subSectionField['fields'] as $subSectionFieldGroupFields) { |
|
1212 | 1212 | $groupFieldItemGroupBox->addItem( |
1213 | 1213 | $W->FlowItems( |
1214 | 1214 | $W->Label($availableFields[$subSectionFieldGroupFields['fieldname']]['description']), |
@@ -1251,23 +1251,23 @@ discard block |
||
1251 | 1251 | $sectionsBoxes[] = $sectionBox; |
1252 | 1252 | } |
1253 | 1253 | |
1254 | - if($currentColumn + $nbCol > 0){ |
|
1254 | + if ($currentColumn + $nbCol > 0) { |
|
1255 | 1255 | $sectionsSection->addItem($row); |
1256 | 1256 | } |
1257 | 1257 | |
1258 | - foreach ($sectionsBoxes as $sectionsBox){ |
|
1258 | + foreach ($sectionsBoxes as $sectionsBox) { |
|
1259 | 1259 | $sectionsBox->sortable(true, $sectionsBoxes); |
1260 | 1260 | $sectionsBox->setMetadata('samePlaceholderSize', true); |
1261 | 1261 | } |
1262 | 1262 | |
1263 | - foreach ($rows as $row){ |
|
1263 | + foreach ($rows as $row) { |
|
1264 | 1264 | $row->sortable(true, $rows); |
1265 | 1265 | $row->setMetadata('samePlaceholderSize', true); |
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 | $form = $W->Form(); |
1269 | 1269 | |
1270 | - if(isset($itemId)){ |
|
1270 | + if (isset($itemId)) { |
|
1271 | 1271 | $form->setId($itemId); |
1272 | 1272 | } |
1273 | 1273 | $form->setHiddenValue('tg', $App->controllerTg); |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | $customSections = $customSectionSet->select($customSectionSet->container->is($container)); |
1295 | 1295 | |
1296 | 1296 | $sectionsValues = array(); |
1297 | - foreach ($customSections as $customSection){ |
|
1297 | + foreach ($customSections as $customSection) { |
|
1298 | 1298 | $values = $customSection->getValues(); |
1299 | 1299 | unset($values['id']); |
1300 | 1300 | unset($values['createdBy']); |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | header('Content-type: application/json'); |
1311 | - header('Content-Disposition: attachment; filename="' . $container->object . '.' . ($container->view === '' ? 'default' : $container->view) . '.' . $container->name . '.json"' . "\n"); |
|
1311 | + header('Content-Disposition: attachment; filename="'.$container->object.'.'.($container->view === '' ? 'default' : $container->view).'.'.$container->name.'.json"'."\n"); |
|
1312 | 1312 | |
1313 | 1313 | $json = bab_json_encode($sectionsValues); |
1314 | 1314 | $json = bab_convertStringFromDatabase($json, BabCharset::UTF_8); |
@@ -1360,12 +1360,12 @@ discard block |
||
1360 | 1360 | $files->push($sectionsfile['uid']); |
1361 | 1361 | |
1362 | 1362 | $data = null; |
1363 | - foreach ($files as $f){ |
|
1363 | + foreach ($files as $f) { |
|
1364 | 1364 | $data = file_get_contents($f->toString()); |
1365 | 1365 | break; |
1366 | 1366 | } |
1367 | 1367 | |
1368 | - if(! isset($data)){ |
|
1368 | + if (!isset($data)) { |
|
1369 | 1369 | $this->addError($App->translate('Unable to get file content')); |
1370 | 1370 | return true; |
1371 | 1371 | } |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | |
1378 | 1378 | $customSectionSet->delete($customSectionSet->container->is($container)); |
1379 | 1379 | |
1380 | - foreach ($sectionsValues as $sectionValues){ |
|
1380 | + foreach ($sectionsValues as $sectionValues) { |
|
1381 | 1381 | $customSection = $customSectionSet->newRecord(); |
1382 | 1382 | $customSection->setValues($sectionValues); |
1383 | 1383 | $customSection->container = $container; |
@@ -1455,59 +1455,59 @@ discard block |
||
1455 | 1455 | $ranks = array(); |
1456 | 1456 | $rank = 0; |
1457 | 1457 | |
1458 | - foreach ($sections as $key => $value){ |
|
1458 | + foreach ($sections as $key => $value) { |
|
1459 | 1459 | // Sections ids start with #, while section fields start with their original section id |
1460 | - if(substr($key, 0, 1) === '#'){ |
|
1460 | + if (substr($key, 0, 1) === '#') { |
|
1461 | 1461 | $currentSectionId = substr($key, 1); |
1462 | 1462 | $rawSectionData[$currentSectionId] = array(); |
1463 | - if(! isset($oldSectionId)){ |
|
1463 | + if (!isset($oldSectionId)) { |
|
1464 | 1464 | $oldSectionId = $currentSectionId; |
1465 | 1465 | } |
1466 | - if(isset($currentSection) && $oldSectionId != $currentSectionId){ |
|
1466 | + if (isset($currentSection) && $oldSectionId != $currentSectionId) { |
|
1467 | 1467 | $oldSectionId = $currentSectionId; |
1468 | 1468 | } |
1469 | 1469 | $ranks[$currentSectionId] = $rank; |
1470 | - $rank ++; |
|
1470 | + $rank++; |
|
1471 | 1471 | $currentSection = $customSectionSet->get($customSectionSet->id->is($currentSectionId)); |
1472 | 1472 | continue; |
1473 | 1473 | } |
1474 | - if(! isset($currentSection)){ |
|
1474 | + if (!isset($currentSection)) { |
|
1475 | 1475 | continue; |
1476 | 1476 | } |
1477 | 1477 | list ($fieldSectionId, $fieldName) = explode('.', $key); |
1478 | - if($fieldSectionId == $currentSectionId){ |
|
1478 | + if ($fieldSectionId == $currentSectionId) { |
|
1479 | 1479 | $field = $currentSection->getField($fieldName); |
1480 | - if(strpos($fieldName, '_fieldsGroup') !== false && isset($rawSectionData[$currentSectionId][$fieldName])){ |
|
1480 | + if (strpos($fieldName, '_fieldsGroup') !== false && isset($rawSectionData[$currentSectionId][$fieldName])) { |
|
1481 | 1481 | $rawSectionData[$currentSectionId][$fieldName]['block'] = $field['block']; |
1482 | 1482 | $rawSectionData[$currentSectionId][$fieldName]['fieldname'] = '_fieldsGroup'; |
1483 | 1483 | $rawSectionData[$currentSectionId][$fieldName]['parameters'] = $field['parameters']; |
1484 | - foreach ($sections[$currentSection->id . '.fieldsGroups'][$fieldName] as $subKey => $subValue){ |
|
1484 | + foreach ($sections[$currentSection->id.'.fieldsGroups'][$fieldName] as $subKey => $subValue) { |
|
1485 | 1485 | $rawSectionData[$currentSectionId][$fieldName]['fields'][$subKey] = $field['fields'][$subKey]; |
1486 | 1486 | } |
1487 | 1487 | } |
1488 | - elseif($fieldName != 'fieldsGroups'){ |
|
1488 | + elseif ($fieldName != 'fieldsGroups') { |
|
1489 | 1489 | $rawSectionData[$currentSectionId][$fieldName] = $field; |
1490 | 1490 | } |
1491 | 1491 | } |
1492 | - else{ |
|
1492 | + else { |
|
1493 | 1493 | $field = null; |
1494 | 1494 | $tmpSection = $customSectionSet->get($customSectionSet->id->is($fieldSectionId)); |
1495 | - if($tmpSection){ |
|
1495 | + if ($tmpSection) { |
|
1496 | 1496 | $field = $tmpSection->getField($fieldName); |
1497 | 1497 | } |
1498 | - if(isset($field)){ |
|
1498 | + if (isset($field)) { |
|
1499 | 1499 | $rawSectionData[$currentSectionId][$fieldName] = $field; |
1500 | 1500 | } |
1501 | 1501 | } |
1502 | 1502 | } |
1503 | 1503 | |
1504 | - foreach ($rawSectionData as $sectionId => $fields){ |
|
1504 | + foreach ($rawSectionData as $sectionId => $fields) { |
|
1505 | 1505 | $section = $customSectionSet->get($customSectionSet->id->is($sectionId)); |
1506 | - if($section){ |
|
1506 | + if ($section) { |
|
1507 | 1507 | $section->fields = json_encode($fields); |
1508 | 1508 | $section->rank = isset($ranks[$sectionId]) ? $ranks[$sectionId] : 0; |
1509 | 1509 | $section->save(); |
1510 | - $rank ++; |
|
1510 | + $rank++; |
|
1511 | 1511 | } |
1512 | 1512 | } |
1513 | 1513 |
@@ -264,26 +264,21 @@ discard block |
||
264 | 264 | |
265 | 265 | if($nbEntryInSubGroup == 1){ |
266 | 266 | $groupField = $customSection->getField($fieldGroupName); |
267 | - } |
|
268 | - elseif($nbEntryInSubGroup == 2){ |
|
267 | + } elseif($nbEntryInSubGroup == 2){ |
|
269 | 268 | $groupField = $customSection->getField($subGroups[0]); |
270 | 269 | if(isset($groupField['fields'][$subGroups[1]])){ |
271 | 270 | $groupField = $groupField['fields'][$subGroups[1]]; |
272 | - } |
|
273 | - else{ |
|
271 | + } else{ |
|
274 | 272 | return $this; |
275 | 273 | } |
276 | - } |
|
277 | - elseif($nbEntryInSubGroup == 3){ |
|
274 | + } elseif($nbEntryInSubGroup == 3){ |
|
278 | 275 | $groupField = $customSection->getField($subGroups[0]); |
279 | 276 | if(isset($groupField['fields'][$subGroups[1]]['fields'][$subGroups[2]])){ |
280 | 277 | $groupField = $groupField['fields'][$subGroups[1]]['fields'][$subGroups[2]]; |
281 | - } |
|
282 | - else{ |
|
278 | + } else{ |
|
283 | 279 | return $this; |
284 | 280 | } |
285 | - } |
|
286 | - else{ |
|
281 | + } else{ |
|
287 | 282 | return $this; |
288 | 283 | } |
289 | 284 | |
@@ -295,8 +290,7 @@ discard block |
||
295 | 290 | $isSubGroup = false; |
296 | 291 | if(isset($groupField['fields'][$fieldName])){ |
297 | 292 | $field = $groupField['fields'][$fieldName]; |
298 | - } |
|
299 | - else{ |
|
293 | + } else{ |
|
300 | 294 | return null; |
301 | 295 | } |
302 | 296 | |
@@ -321,11 +315,9 @@ discard block |
||
321 | 315 | |
322 | 316 | if(strpos($fieldName, '_subSection') !== false){ |
323 | 317 | $field = $availableFields['_subSection']; |
324 | - } |
|
325 | - elseif(strpos($fieldName, '_fieldsGroup') !== false){ |
|
318 | + } elseif(strpos($fieldName, '_fieldsGroup') !== false){ |
|
326 | 319 | $field = $availableFields['_fieldsGroup']; |
327 | - } |
|
328 | - else{ |
|
320 | + } else{ |
|
329 | 321 | $field = $availableFields[$fieldName]; |
330 | 322 | } |
331 | 323 | |
@@ -425,8 +417,7 @@ discard block |
||
425 | 417 | |
426 | 418 | if($nbEntryInSubGroup == 1 && !isset($fields[$fieldGroupName])){ |
427 | 419 | throw new AppException($App->translate('This fields group does not seem to exist')); |
428 | - } |
|
429 | - elseif($nbEntryInSubGroup == 3){ |
|
420 | + } elseif($nbEntryInSubGroup == 3){ |
|
430 | 421 | $inSubGroup = true; |
431 | 422 | $currentFieldToCheck = $fields; |
432 | 423 | foreach($subGroups as $subGroup){ |
@@ -682,8 +673,7 @@ discard block |
||
682 | 673 | $customSectionSet = $App->CustomSectionSet(); |
683 | 674 | if(isset($id)){ |
684 | 675 | $record = $customSectionSet->request($id); |
685 | - } |
|
686 | - else{ |
|
676 | + } else{ |
|
687 | 677 | $record = $customSectionSet->newRecord(); |
688 | 678 | $record->container = $container->id; |
689 | 679 | } |
@@ -910,8 +900,7 @@ discard block |
||
910 | 900 | |
911 | 901 | if($selectedManyField instanceof ORMBoolInterface){ |
912 | 902 | $condition = $condition['bool']; |
913 | - } |
|
914 | - else{ |
|
903 | + } else{ |
|
915 | 904 | $condition = $condition['default']; |
916 | 905 | } |
917 | 906 | |
@@ -939,8 +928,7 @@ discard block |
||
939 | 928 | |
940 | 929 | if($selectedOneField instanceof ORMBoolInterface){ |
941 | 930 | $condition = $condition['bool']; |
942 | - } |
|
943 | - else{ |
|
931 | + } else{ |
|
944 | 932 | $condition = $condition['default']; |
945 | 933 | } |
946 | 934 | |
@@ -949,15 +937,13 @@ discard block |
||
949 | 937 | } |
950 | 938 | break; |
951 | 939 | } |
952 | - } |
|
953 | - else{ |
|
940 | + } else{ |
|
954 | 941 | |
955 | 942 | $field = $objectRecordSet->$field; |
956 | 943 | |
957 | 944 | if($field instanceof ORMBoolInterface){ |
958 | 945 | $condition = $condition['bool']; |
959 | - } |
|
960 | - else{ |
|
946 | + } else{ |
|
961 | 947 | $condition = $condition['default']; |
962 | 948 | } |
963 | 949 | |
@@ -1088,7 +1074,7 @@ discard block |
||
1088 | 1074 | if(!isset($availableFields[$fieldName])){ |
1089 | 1075 | $field = array(); |
1090 | 1076 | $fieldDescription = ""; |
1091 | - }else{ |
|
1077 | + } else{ |
|
1092 | 1078 | $field = $availableFields[$fieldName]; |
1093 | 1079 | $fieldDescription = $field['description']; |
1094 | 1080 | } |
@@ -1484,12 +1470,10 @@ discard block |
||
1484 | 1470 | foreach ($sections[$currentSection->id . '.fieldsGroups'][$fieldName] as $subKey => $subValue){ |
1485 | 1471 | $rawSectionData[$currentSectionId][$fieldName]['fields'][$subKey] = $field['fields'][$subKey]; |
1486 | 1472 | } |
1487 | - } |
|
1488 | - elseif($fieldName != 'fieldsGroups'){ |
|
1473 | + } elseif($fieldName != 'fieldsGroups'){ |
|
1489 | 1474 | $rawSectionData[$currentSectionId][$fieldName] = $field; |
1490 | 1475 | } |
1491 | - } |
|
1492 | - else{ |
|
1476 | + } else{ |
|
1493 | 1477 | $field = null; |
1494 | 1478 | $tmpSection = $customSectionSet->get($customSectionSet->id->is($fieldSectionId)); |
1495 | 1479 | if($tmpSection){ |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | |
105 | 105 | $recordClassname = $this->getRecordClassName(); |
106 | - $recordSetClassname = $recordClassname . 'Set'; |
|
106 | + $recordSetClassname = $recordClassname.'Set'; |
|
107 | 107 | |
108 | 108 | $recordSet = $App->$recordSetClassname(); |
109 | 109 | return $recordSet; |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | if ($showLabel) { |
152 | 152 | $text = $actions->getTitle(); |
153 | 153 | } |
154 | - $html = '<li><a class="icon ' . $actions->getIcon() . '" href="' . $actions->url() . '">' . $text . '</a></li>'; |
|
154 | + $html = '<li><a class="icon '.$actions->getIcon().'" href="'.$actions->url().'">'.$text.'</a></li>'; |
|
155 | 155 | } elseif ($actions instanceof WidgetDisplayableInterface) { |
156 | - $html = '<li>' . $actions->display($canvas) . '</li>'; |
|
156 | + $html = '<li>'.$actions->display($canvas).'</li>'; |
|
157 | 157 | } elseif (is_array($actions)) { |
158 | 158 | if (isset($actions['items'])) { |
159 | 159 | $items = $actions['items']; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | if (isset($actions['icon'])) { |
167 | 167 | |
168 | - $html = '<li class="dropdown">' . '<a href="#" class="' . $actions['icon'] . ' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' . ($actions['icon'] === 'actions-context-menu'/*FuncIcons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>') . '</a>' . '<ul class="dropdown-menu dropdown-menu-right ' . FuncIcons::ICON_LEFT_SYMBOLIC . '">' . $html . '</ul>'; |
|
168 | + $html = '<li class="dropdown">'.'<a href="#" class="'.$actions['icon'].' icon dropdown-toogle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.($actions['icon'] === 'actions-context-menu'/*FuncIcons::ACTIONS_CONTEXT_MENU*/ ? '' : '<span class="caret"></span>').'</a>'.'<ul class="dropdown-menu dropdown-menu-right '.FuncIcons::ICON_LEFT_SYMBOLIC.'">'.$html.'</ul>'; |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | foreach ($methods as $index => $method) { |
215 | 215 | try { |
216 | - $methodName = $recordClassname . $method['method']; |
|
216 | + $methodName = $recordClassname.$method['method']; |
|
217 | 217 | if ($Ui->$methodName()) { |
218 | 218 | $types[$index] = array( |
219 | 219 | 'classname' => $methodName, |
@@ -299,11 +299,11 @@ discard block |
||
299 | 299 | |
300 | 300 | if (isset($id)) { |
301 | 301 | $record = $recordSet->request($id); |
302 | - if (! $record->isUpdatable()) { |
|
302 | + if (!$record->isUpdatable()) { |
|
303 | 303 | throw new AppAccessException($App->translate('You do not have access to this page')); |
304 | 304 | } |
305 | 305 | } else { |
306 | - if (! $recordSet->isCreatable()) { |
|
306 | + if (!$recordSet->isCreatable()) { |
|
307 | 307 | throw new AppAccessException($App->translate('You do not have access to this page')); |
308 | 308 | } |
309 | 309 | $record = $recordSet->newRecord(); |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | $W = bab_Widgets(); |
332 | 332 | |
333 | 333 | $recordClassname = $this->getRecordClassName(); |
334 | - $editorClassname = $recordClassname . 'SectionEditor'; |
|
334 | + $editorClassname = $recordClassname.'SectionEditor'; |
|
335 | 335 | |
336 | 336 | /* @var $editor AppRecordEditor */ |
337 | 337 | $editor = $Ui->$editorClassname($record); |
338 | - if (! isset($itemId)) { |
|
339 | - $itemId = $this->getClass() . '_' . __FUNCTION__; |
|
338 | + if (!isset($itemId)) { |
|
339 | + $itemId = $this->getClass().'_'.__FUNCTION__; |
|
340 | 340 | } |
341 | 341 | $editor->setId($itemId); |
342 | 342 | $editor->setController($this); |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function getModelViewDefaultId($itemId = null) |
367 | 367 | { |
368 | - if (! isset($itemId)) { |
|
369 | - $itemId = $this->getClass() . '_modelView'; |
|
368 | + if (!isset($itemId)) { |
|
369 | + $itemId = $this->getClass().'_modelView'; |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | return $itemId; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | |
395 | 395 | $itemId = $this->getModelViewDefaultId($itemId); |
396 | 396 | |
397 | - if (! isset($type)) { |
|
397 | + if (!isset($type)) { |
|
398 | 398 | $type = $this->getFilteredViewType($itemId); |
399 | 399 | } |
400 | 400 | |
@@ -402,24 +402,24 @@ discard block |
||
402 | 402 | |
403 | 403 | switch ($type) { |
404 | 404 | case 'cards': |
405 | - $tableviewClassname = $recordClassname . 'CardsView'; |
|
405 | + $tableviewClassname = $recordClassname.'CardsView'; |
|
406 | 406 | break; |
407 | 407 | |
408 | 408 | case 'map': |
409 | - $tableviewClassname = $recordClassname . 'MapView'; |
|
409 | + $tableviewClassname = $recordClassname.'MapView'; |
|
410 | 410 | break; |
411 | 411 | |
412 | 412 | case 'calendar': |
413 | - $tableviewClassname = $recordClassname . 'CalendarView'; |
|
413 | + $tableviewClassname = $recordClassname.'CalendarView'; |
|
414 | 414 | break; |
415 | 415 | |
416 | 416 | case 'statistics': |
417 | - $tableviewClassname = $recordClassname . 'StatisticsView'; |
|
417 | + $tableviewClassname = $recordClassname.'StatisticsView'; |
|
418 | 418 | break; |
419 | 419 | |
420 | 420 | case 'table': |
421 | 421 | default: |
422 | - $tableviewClassname = $recordClassname . 'TableView'; |
|
422 | + $tableviewClassname = $recordClassname.'TableView'; |
|
423 | 423 | break; |
424 | 424 | } |
425 | 425 | /* @var $tableview WidgetTableModelView */ |
@@ -475,11 +475,11 @@ discard block |
||
475 | 475 | $App = $this->App(); |
476 | 476 | $Ui = $App->Ui(); |
477 | 477 | $recordClassname = $this->getRecordClassName(); |
478 | - $editorClassname = $recordClassname . 'Editor'; |
|
478 | + $editorClassname = $recordClassname.'Editor'; |
|
479 | 479 | $editor = $Ui->$editorClassname(); |
480 | 480 | |
481 | - if (! isset($itemId)) { |
|
482 | - $itemId = $this->getClass() . '_' . __FUNCTION__; |
|
481 | + if (!isset($itemId)) { |
|
482 | + $itemId = $this->getClass().'_'.__FUNCTION__; |
|
483 | 483 | } |
484 | 484 | $editor->setId($itemId); |
485 | 485 | $editor->setHiddenValue('tg', $App->controllerTg); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | |
533 | 533 | foreach ($viewTypes as $viewTypeId => $viewType) { |
534 | 534 | $viewsBox->addItem($W->Link('', $proxy->setFilteredViewType($tableView->getId(), $viewTypeId)) |
535 | - ->addClass('icon', $viewType['icon'] . ($filteredViewType === $viewTypeId ? ' active' : '')) |
|
535 | + ->addClass('icon', $viewType['icon'].($filteredViewType === $viewTypeId ? ' active' : '')) |
|
536 | 536 | -> |
537 | 537 | // ->setSizePolicy('btn btn-xs btn-default ' . ($filteredViewType === $viewTypeId ? 'active' : '')) |
538 | 538 | setTitle($viewType['label']) |
@@ -565,8 +565,8 @@ discard block |
||
565 | 565 | $W = bab_Widgets(); |
566 | 566 | |
567 | 567 | $filterVisibility = $this->getFilterVisibility($itemId); |
568 | - $filterVisibility = ! $filterVisibility; |
|
569 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility); |
|
568 | + $filterVisibility = !$filterVisibility; |
|
569 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility); |
|
570 | 570 | |
571 | 571 | return true; |
572 | 572 | } |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | protected function getFilterVisibility($itemId) |
579 | 579 | { |
580 | 580 | $W = bab_Widgets(); |
581 | - $filterVisibility = $W->getUserConfiguration($itemId . '/filterVisibility'); |
|
582 | - if (! isset($filterVisibility)) { |
|
581 | + $filterVisibility = $W->getUserConfiguration($itemId.'/filterVisibility'); |
|
582 | + if (!isset($filterVisibility)) { |
|
583 | 583 | $filterVisibility = false; |
584 | - $W->setUserConfiguration($itemId . '/filterVisibility', $filterVisibility); |
|
584 | + $W->setUserConfiguration($itemId.'/filterVisibility', $filterVisibility); |
|
585 | 585 | } |
586 | 586 | return $filterVisibility; |
587 | 587 | } |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | protected function getFilteredViewType($itemId) |
597 | 597 | { |
598 | 598 | $W = bab_Widgets(); |
599 | - $type = $W->getUserConfiguration($itemId . '/viewType'); |
|
600 | - if (! isset($type)) { |
|
599 | + $type = $W->getUserConfiguration($itemId.'/viewType'); |
|
600 | + if (!isset($type)) { |
|
601 | 601 | $type = 'table'; |
602 | 602 | } |
603 | 603 | return $type; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | public function setFilteredViewType($itemId, $type = null) |
615 | 615 | { |
616 | 616 | $W = bab_Widgets(); |
617 | - $W->setUserConfiguration($itemId . '/viewType', $type); |
|
617 | + $W->setUserConfiguration($itemId.'/viewType', $type); |
|
618 | 618 | |
619 | 619 | return true; |
620 | 620 | } |
@@ -699,13 +699,13 @@ discard block |
||
699 | 699 | $sessionOnly = isset($data['inSession']) ? $data['inSession'] : false; |
700 | 700 | |
701 | 701 | if (isset($data['pageLength'])) { |
702 | - $W->setUserConfiguration($tableModelViewId . '/pageLength', $data['pageLength'], 'widgets', $sessionOnly); |
|
702 | + $W->setUserConfiguration($tableModelViewId.'/pageLength', $data['pageLength'], 'widgets', $sessionOnly); |
|
703 | 703 | } |
704 | 704 | if (isset($data['displaySubTotalRow'])) { |
705 | - $W->setUserConfiguration($tableModelViewId . '/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly); |
|
705 | + $W->setUserConfiguration($tableModelViewId.'/displaySubTotalRow', $data['displaySubTotalRow'], 'widgets', $sessionOnly); |
|
706 | 706 | } |
707 | 707 | if (isset($data['columns'])) { |
708 | - $W->setUserConfiguration($tableModelViewId . '/columns', $data['columns'], 'widgets', $sessionOnly); |
|
708 | + $W->setUserConfiguration($tableModelViewId.'/columns', $data['columns'], 'widgets', $sessionOnly); |
|
709 | 709 | } |
710 | 710 | |
711 | 711 | $this->addReloadSelector("#{$tableModelViewId}"); |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | $tableModelViewId = $data['tableModelViewId']; |
721 | 721 | $sessionOnly = isset($data['inSession']) ? $data['inSession'] : false; |
722 | 722 | |
723 | - $W->deleteUserConfiguration($data['tableModelViewId'] . '/columns', 'widgets', $sessionOnly); |
|
723 | + $W->deleteUserConfiguration($data['tableModelViewId'].'/columns', 'widgets', $sessionOnly); |
|
724 | 724 | |
725 | 725 | $this->addReloadSelector("#{$tableModelViewId}"); |
726 | 726 | return true; |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | $columns = $tableview->getVisibleColumns(); |
823 | 823 | $column = isset($columns[$col]) ? $columns[$col] : null; |
824 | 824 | |
825 | - if (! isset($column)) { |
|
825 | + if (!isset($column)) { |
|
826 | 826 | return true; |
827 | 827 | } |
828 | 828 | |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | $labelledWidget->getLabelWidget()->addClass($label->getClasses()); |
840 | 840 | $labelledWidget->getInputWidget()->addClass($widget->getClasses()); |
841 | 841 | |
842 | - $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false); |
|
842 | + $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false); |
|
843 | 843 | if (isset($filter[$col])) { |
844 | 844 | $widget->setValue($filter[$col]); |
845 | 845 | } |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | |
857 | 857 | $key = $data['key']; |
858 | 858 | |
859 | - $filter = $W->getUserConfiguration($key . '/filter', 'widgets', false); |
|
859 | + $filter = $W->getUserConfiguration($key.'/filter', 'widgets', false); |
|
860 | 860 | if (isset($data['moreCriteria']) && $data['moreCriteria']) { |
861 | 861 | $filter = array(); |
862 | 862 | } |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | $filter[$filterName] = $filterValue; |
869 | 869 | } |
870 | 870 | } |
871 | - $W->setUserConfiguration($key . '/filter', $filter, 'widgets', false); |
|
871 | + $W->setUserConfiguration($key.'/filter', $filter, 'widgets', false); |
|
872 | 872 | |
873 | 873 | |
874 | 874 | if (session_status() == PHP_SESSION_NONE) { |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | unset($_SESSION['modelViewMoreCriterias'][$key]); |
879 | 879 | session_write_close(); |
880 | 880 | |
881 | - $this->addReloadSelector('.depends-' . $key . ':not(.widget-tableview-clone)'); |
|
881 | + $this->addReloadSelector('.depends-'.$key.':not(.widget-tableview-clone)'); |
|
882 | 882 | |
883 | 883 | return true; |
884 | 884 | } |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | $Ui = $App->Ui(); |
890 | 890 | |
891 | 891 | $page = $Ui->Page(); |
892 | - $page->addClass('depends-modelViewMoreCriterias-' . $key); |
|
892 | + $page->addClass('depends-modelViewMoreCriterias-'.$key); |
|
893 | 893 | |
894 | 894 | $page->setTitle($App->translate('Search')); |
895 | 895 | |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | $editor = $Ui->BasicEditor($itemId, $W->VBoxLayout()); |
910 | 910 | $editor->setReloadAction($this->proxy() |
911 | 911 | ->getDisplayListMoreCriteriaEditor($key, $editor->getId())); |
912 | - $editor->addClass('depends-modelViewMoreCriterias-' . $key); |
|
912 | + $editor->addClass('depends-modelViewMoreCriterias-'.$key); |
|
913 | 913 | $editor->addClass('widget-no-close'); |
914 | 914 | $editor->setIconFormat(); |
915 | 915 | $editor->isAjax = true; |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | $columns = $tableview->getVisibleColumns(); |
925 | 925 | $filter = $tableview->getFilterValues(); |
926 | 926 | |
927 | - if (! isset($itemId)) { |
|
927 | + if (!isset($itemId)) { |
|
928 | 928 | $editor->setSaveAction($this->proxy() |
929 | 929 | ->saveDisplayListFilter(), $App->translate('Search')); |
930 | 930 | $editor->setCancelAction($this->proxy() |
@@ -935,13 +935,13 @@ discard block |
||
935 | 935 | if (empty($value)) { |
936 | 936 | continue; |
937 | 937 | } |
938 | - if (! isset($columns[$fieldName])) { |
|
938 | + if (!isset($columns[$fieldName])) { |
|
939 | 939 | continue; |
940 | 940 | } |
941 | 941 | |
942 | 942 | $column = $columns[$fieldName]; |
943 | 943 | |
944 | - if (! $column->isSearchable()) { |
|
944 | + if (!$column->isSearchable()) { |
|
945 | 945 | continue; |
946 | 946 | } |
947 | 947 | |
@@ -962,12 +962,12 @@ discard block |
||
962 | 962 | $nbAlreadyAdded = 0; |
963 | 963 | |
964 | 964 | foreach ($fields as $fieldName => $fieldValue) { |
965 | - if (! isset($columns[$fieldName])) { |
|
965 | + if (!isset($columns[$fieldName])) { |
|
966 | 966 | continue; |
967 | 967 | } |
968 | 968 | $column = $columns[$fieldName]; |
969 | 969 | |
970 | - if (! $column->isSearchable()) { |
|
970 | + if (!$column->isSearchable()) { |
|
971 | 971 | continue; |
972 | 972 | } |
973 | 973 | |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | $alreadyFilteredBox = null; |
979 | 979 | } |
980 | 980 | |
981 | - if (! isset($alreadyFilteredBox)) { |
|
981 | + if (!isset($alreadyFilteredBox)) { |
|
982 | 982 | $editor->addItem($alreadyFilteredBox = $W->FlexItems() |
983 | 983 | ->setSizePolicy('customsection-field-box customsection-fieldsgroup-box')); |
984 | 984 | } |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | ); |
1012 | 1012 | |
1013 | 1013 | foreach ($columns as $fieldName => $column) { |
1014 | - if (! $column->isSearchable()) { |
|
1014 | + if (!$column->isSearchable()) { |
|
1015 | 1015 | continue; |
1016 | 1016 | } |
1017 | 1017 | |
@@ -1048,12 +1048,12 @@ discard block |
||
1048 | 1048 | session_start(); |
1049 | 1049 | } |
1050 | 1050 | $fields = isset($data['filter']) ? $data['filter'] : array(); |
1051 | - if (isset($data['newField']) && ! empty($data['newField'])) { |
|
1051 | + if (isset($data['newField']) && !empty($data['newField'])) { |
|
1052 | 1052 | $newField = $data['newField']; |
1053 | 1053 | unset($data['key']); |
1054 | 1054 | unset($data['moreCriteria']); |
1055 | 1055 | $fields[$newField] = ''; |
1056 | - $this->addReloadSelector('.depends-modelViewMoreCriterias-' . $key); |
|
1056 | + $this->addReloadSelector('.depends-modelViewMoreCriterias-'.$key); |
|
1057 | 1057 | } |
1058 | 1058 | $_SESSION['modelViewMoreCriterias'][$key] = $fields; |
1059 | 1059 | return true; |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | } |
1070 | 1070 | $_SESSION['modelViewMoreCriterias'][$key] = $fields; |
1071 | 1071 | } |
1072 | - $this->addReloadSelector('.depends-modelViewMoreCriterias-' . $key); |
|
1072 | + $this->addReloadSelector('.depends-modelViewMoreCriterias-'.$key); |
|
1073 | 1073 | return true; |
1074 | 1074 | } |
1075 | 1075 | |
@@ -1125,17 +1125,17 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | switch ($format) { |
1127 | 1127 | case 'xlsx': |
1128 | - $tableview->downloadXlsx($filename . '.xlsx'); |
|
1128 | + $tableview->downloadXlsx($filename.'.xlsx'); |
|
1129 | 1129 | break; |
1130 | 1130 | case 'xls': |
1131 | - $tableview->downloadExcel($filename . '.xls'); |
|
1131 | + $tableview->downloadExcel($filename.'.xls'); |
|
1132 | 1132 | break; |
1133 | 1133 | case 'ssv': |
1134 | - $tableview->downloadCsv($filename . '.csv', ';', $inline, 'Windows-1252'); |
|
1134 | + $tableview->downloadCsv($filename.'.csv', ';', $inline, 'Windows-1252'); |
|
1135 | 1135 | break; |
1136 | 1136 | case 'csv': |
1137 | 1137 | default: |
1138 | - $tableview->downloadCsv($filename . '.csv', ',', $inline, BabCharset::getIso()); |
|
1138 | + $tableview->downloadCsv($filename.'.csv', ',', $inline, BabCharset::getIso()); |
|
1139 | 1139 | break; |
1140 | 1140 | } |
1141 | 1141 | } |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $recordSet = $this->getRecordSet(); |
1202 | 1202 | |
1203 | 1203 | $record = $recordSet->request($id); |
1204 | - if (! $record->isReadable()) { |
|
1204 | + if (!$record->isReadable()) { |
|
1205 | 1205 | throw new AppAccessException($App->translate('You do not have access to this page')); |
1206 | 1206 | } |
1207 | 1207 | |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | $recordClassname = $this->getRecordClassName(); |
1211 | 1211 | |
1212 | - $viewClassname = $recordClassname . 'FullFrame'; |
|
1212 | + $viewClassname = $recordClassname.'FullFrame'; |
|
1213 | 1213 | |
1214 | 1214 | $fullFrame = $Ui->$viewClassname($record); |
1215 | 1215 | $fullFrame->setView($view); |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | if (isset($itemId)) { |
1225 | 1225 | $page->setId($itemId); |
1226 | 1226 | } |
1227 | - $page->addClass('depends-' . $this->getRecordClassName()); |
|
1227 | + $page->addClass('depends-'.$this->getRecordClassName()); |
|
1228 | 1228 | |
1229 | 1229 | $page->addToolbar($mainMenu); |
1230 | 1230 | |
@@ -1265,11 +1265,11 @@ discard block |
||
1265 | 1265 | |
1266 | 1266 | if (isset($id)) { |
1267 | 1267 | $record = $recordSet->request($id); |
1268 | - if (! $record->isUpdatable()) { |
|
1268 | + if (!$record->isUpdatable()) { |
|
1269 | 1269 | throw new AppAccessException($App->translate('You do not have access to this page')); |
1270 | 1270 | } |
1271 | 1271 | } else { |
1272 | - if (! $recordSet->isCreatable()) { |
|
1272 | + if (!$recordSet->isCreatable()) { |
|
1273 | 1273 | throw new AppAccessException($App->translate('You do not have access to this page')); |
1274 | 1274 | } |
1275 | 1275 | $record = $recordSet->newRecord(); |
@@ -1306,12 +1306,12 @@ discard block |
||
1306 | 1306 | |
1307 | 1307 | if (isset($id)) { |
1308 | 1308 | $record = $recordSet->request($id); |
1309 | - if (! $record->isUpdatable()) { |
|
1309 | + if (!$record->isUpdatable()) { |
|
1310 | 1310 | throw new AppAccessException($App->translate('You do not have access to this page')); |
1311 | 1311 | } |
1312 | 1312 | $editor->setRecord($record); |
1313 | 1313 | } else { |
1314 | - if (! $recordSet->isCreatable()) { |
|
1314 | + if (!$recordSet->isCreatable()) { |
|
1315 | 1315 | throw new AppAccessException($App->translate('You do not have access to this page')); |
1316 | 1316 | } |
1317 | 1317 | $record = $recordSet->newRecord(); |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | |
1357 | 1357 | $recordTitle = $record->getRecordTitle(); |
1358 | 1358 | |
1359 | - $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'); |
|
1359 | + $message = sprintf($App->translate('%s has been deleted'), $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'); |
|
1360 | 1360 | return $message; |
1361 | 1361 | } |
1362 | 1362 | |
@@ -1387,14 +1387,14 @@ discard block |
||
1387 | 1387 | * |
1388 | 1388 | * @param AppRecord $record |
1389 | 1389 | */ |
1390 | - protected function preSave(ORMRecord &$record, $data) {} |
|
1390 | + protected function preSave(ORMRecord & $record, $data) {} |
|
1391 | 1391 | |
1392 | 1392 | /** |
1393 | 1393 | * Method for post save actions on record |
1394 | 1394 | * |
1395 | 1395 | * @param AppRecord $record |
1396 | 1396 | */ |
1397 | - protected function postSave(ORMRecord &$record, $data) {} |
|
1397 | + protected function postSave(ORMRecord & $record, $data) {} |
|
1398 | 1398 | |
1399 | 1399 | public function saveDraft($data = null) |
1400 | 1400 | { |
@@ -1426,12 +1426,12 @@ discard block |
||
1426 | 1426 | $pk = $recordSet->getPrimaryKey(); |
1427 | 1427 | $message = null; |
1428 | 1428 | |
1429 | - if (! empty($data[$pk])) { |
|
1429 | + if (!empty($data[$pk])) { |
|
1430 | 1430 | $record = $recordSet->request($data[$pk]); |
1431 | 1431 | $record->deleted = AppTraceableRecord::DELETED_STATUS_EXISTING; |
1432 | 1432 | unset($data[$pk]); |
1433 | 1433 | |
1434 | - if (! $record->isUpdatable()) { |
|
1434 | + if (!$record->isUpdatable()) { |
|
1435 | 1435 | throw new AppAccessException('Access denied'); |
1436 | 1436 | } |
1437 | 1437 | |
@@ -1440,18 +1440,18 @@ discard block |
||
1440 | 1440 | |
1441 | 1441 | $record = $recordSet->newRecord(); |
1442 | 1442 | |
1443 | - if (! $recordSet->isCreatable()) { |
|
1443 | + if (!$recordSet->isCreatable()) { |
|
1444 | 1444 | throw new AppAccessException('Access denied'); |
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | $message = $this->getCreatedMessage(); |
1448 | 1448 | } |
1449 | 1449 | |
1450 | - if (! isset($record)) { |
|
1450 | + if (!isset($record)) { |
|
1451 | 1451 | throw new AppSaveException($App->translate('The record does not exists')); |
1452 | 1452 | } |
1453 | 1453 | |
1454 | - if (! isset($data)) { |
|
1454 | + if (!isset($data)) { |
|
1455 | 1455 | throw new AppSaveException($App->translate('Nothing to save')); |
1456 | 1456 | } |
1457 | 1457 | |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | $this->addToast($message); |
1465 | 1465 | } |
1466 | 1466 | |
1467 | - $this->addReloadSelector('.depends-' . $this->getRecordClassName()); |
|
1467 | + $this->addReloadSelector('.depends-'.$this->getRecordClassName()); |
|
1468 | 1468 | return true; |
1469 | 1469 | } |
1470 | 1470 | |
@@ -1487,7 +1487,7 @@ discard block |
||
1487 | 1487 | |
1488 | 1488 | $record = $recordSet->request($id); |
1489 | 1489 | |
1490 | - if (! $record->isDeletable()) { |
|
1490 | + if (!$record->isDeletable()) { |
|
1491 | 1491 | throw new AppAccessException('Sorry, You are not allowed to perform this operation'); |
1492 | 1492 | } |
1493 | 1493 | $deletedMessage = $this->getDeletedMessage($record); |
@@ -1496,7 +1496,7 @@ discard block |
||
1496 | 1496 | $this->addToast($deletedMessage); |
1497 | 1497 | } |
1498 | 1498 | |
1499 | - $this->addReloadSelector('.depends-' . $record->getClassName()); |
|
1499 | + $this->addReloadSelector('.depends-'.$record->getClassName()); |
|
1500 | 1500 | |
1501 | 1501 | return true; |
1502 | 1502 | } |
@@ -1520,7 +1520,7 @@ discard block |
||
1520 | 1520 | $page->addClass('app-page-editor'); |
1521 | 1521 | $page->setTitle($App->translate('Deletion')); |
1522 | 1522 | |
1523 | - if (! isset($record)) { |
|
1523 | + if (!isset($record)) { |
|
1524 | 1524 | $page->addItem($W->Label($App->translate('This element does not exists.'))); |
1525 | 1525 | $page->addClass('alert', 'alert-warning'); |
1526 | 1526 | return $page; |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | |
1534 | 1534 | $recordTitle = $record->getRecordTitle(); |
1535 | 1535 | |
1536 | - $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'; |
|
1536 | + $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'; |
|
1537 | 1537 | $form->addItem($W->Title($subTitle, 5)); |
1538 | 1538 | |
1539 | 1539 | $form->addItem($W->Title($App->translate('Confirm delete?'), 6)); |
@@ -1572,7 +1572,7 @@ discard block |
||
1572 | 1572 | |
1573 | 1573 | $record = $recordSet->request($id); |
1574 | 1574 | |
1575 | - if (! $record->isRemovable()) { |
|
1575 | + if (!$record->isRemovable()) { |
|
1576 | 1576 | throw new AppAccessException('Sorry, You are not allowed to perform this operation'); |
1577 | 1577 | } |
1578 | 1578 | |
@@ -1585,7 +1585,7 @@ discard block |
||
1585 | 1585 | } |
1586 | 1586 | } |
1587 | 1587 | |
1588 | - $this->addReloadSelector('.depends-' . $record->getClassName()); |
|
1588 | + $this->addReloadSelector('.depends-'.$record->getClassName()); |
|
1589 | 1589 | |
1590 | 1590 | return true; |
1591 | 1591 | } |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | |
1614 | 1614 | $recordTitle = $record->getRecordTitle(); |
1615 | 1615 | |
1616 | - $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'; |
|
1616 | + $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'; |
|
1617 | 1617 | $form->addItem($W->Title($subTitle, 5)); |
1618 | 1618 | |
1619 | 1619 | $form->addItem($W->Title($App->translate('Confirm delete?'), 6)); |
@@ -1655,10 +1655,10 @@ discard block |
||
1655 | 1655 | $record = null; |
1656 | 1656 | foreach ($records as $record) { |
1657 | 1657 | } |
1658 | - if (! isset($record)) { |
|
1658 | + if (!isset($record)) { |
|
1659 | 1659 | throw new AppAccessException('Sorry, You are not allowed to perform this operation'); |
1660 | 1660 | } |
1661 | - if (! $record->isRestorable()) { |
|
1661 | + if (!$record->isRestorable()) { |
|
1662 | 1662 | throw new AppAccessException('Sorry, You are not allowed to perform this operation'); |
1663 | 1663 | } |
1664 | 1664 | |
@@ -1669,7 +1669,7 @@ discard block |
||
1669 | 1669 | $record->save(); |
1670 | 1670 | $this->addToast($deletedMessage); |
1671 | 1671 | |
1672 | - $this->addReloadSelector('.depends-' . $record->getClassName()); |
|
1672 | + $this->addReloadSelector('.depends-'.$record->getClassName()); |
|
1673 | 1673 | |
1674 | 1674 | return true; |
1675 | 1675 | } |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | $record = null; |
1692 | 1692 | foreach ($records as $record) { |
1693 | 1693 | } |
1694 | - if (! isset($record)) { |
|
1694 | + if (!isset($record)) { |
|
1695 | 1695 | throw new AppAccessException('Sorry, You are not allowed to perform this operation'); |
1696 | 1696 | } |
1697 | 1697 | |
@@ -1704,7 +1704,7 @@ discard block |
||
1704 | 1704 | |
1705 | 1705 | $recordTitle = $record->getRecordTitle(); |
1706 | 1706 | |
1707 | - $subTitle = $App->translate($recordSet->getDescription()) . ' "' . $recordTitle . '"'; |
|
1707 | + $subTitle = $App->translate($recordSet->getDescription()).' "'.$recordTitle.'"'; |
|
1708 | 1708 | $form->addItem($W->Title($subTitle, 5)); |
1709 | 1709 | |
1710 | 1710 | $confirmedAction = $this->proxy()->restore($id); |
@@ -1814,14 +1814,14 @@ discard block |
||
1814 | 1814 | $registry = bab_getRegistryInstance(); |
1815 | 1815 | |
1816 | 1816 | $userId = '0'; |
1817 | - $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id . '/filters'); |
|
1817 | + $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters'); |
|
1818 | 1818 | |
1819 | 1819 | while ($filterName = $registry->fetchChildKey()) { |
1820 | 1820 | $filters[] = $filterName; |
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | $userId = bab_getUserId(); |
1824 | - $registry->changeDirectory('/widgets/user/' . $userId . '/' . $id . '/filters'); |
|
1824 | + $registry->changeDirectory('/widgets/user/'.$userId.'/'.$id.'/filters'); |
|
1825 | 1825 | |
1826 | 1826 | while ($filterName = $registry->fetchChildKey()) { |
1827 | 1827 | $filters[] = $filterName; |
@@ -1840,15 +1840,15 @@ discard block |
||
1840 | 1840 | { |
1841 | 1841 | $W = bab_Widgets(); |
1842 | 1842 | $tableview = $this->modelView(null, 'table'); |
1843 | - $W->setUserConfiguration($tableview->getId() . '/currentFilterName', $filterName, 'widgets', false); |
|
1843 | + $W->setUserConfiguration($tableview->getId().'/currentFilterName', $filterName, 'widgets', false); |
|
1844 | 1844 | |
1845 | 1845 | $registry = bab_getRegistryInstance(); |
1846 | 1846 | $userId = '0'; |
1847 | - $registry->changeDirectory('/widgets/user/' . $userId . '/' . $tableview->getId() . '/filters'); |
|
1847 | + $registry->changeDirectory('/widgets/user/'.$userId.'/'.$tableview->getId().'/filters'); |
|
1848 | 1848 | $filterValues = $registry->getValue($filterName); |
1849 | 1849 | |
1850 | - if (! $filterValues) { |
|
1851 | - $filterValues = $W->getUserConfiguration($tableview->getId() . '/filters/' . $filterName, 'widgets', false); |
|
1850 | + if (!$filterValues) { |
|
1851 | + $filterValues = $W->getUserConfiguration($tableview->getId().'/filters/'.$filterName, 'widgets', false); |
|
1852 | 1852 | } |
1853 | 1853 | |
1854 | 1854 | $tableview = $this->modelView($filterValues, 'table'); |
@@ -1864,7 +1864,7 @@ discard block |
||
1864 | 1864 | { |
1865 | 1865 | $W = bab_Widgets(); |
1866 | 1866 | $id = $this->getModelViewDefaultId(); |
1867 | - $filter = $W->getUserConfiguration($id . '/currentFilterName', 'widgets', false); |
|
1867 | + $filter = $W->getUserConfiguration($id.'/currentFilterName', 'widgets', false); |
|
1868 | 1868 | |
1869 | 1869 | return $filter; |
1870 | 1870 | } |
@@ -1877,7 +1877,7 @@ discard block |
||
1877 | 1877 | if (isset($name)) { |
1878 | 1878 | $W = bab_Widgets(); |
1879 | 1879 | // @TODO : fix missing parameters |
1880 | - $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false); |
|
1880 | + $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false); |
|
1881 | 1881 | $filterValues = $filter['values']; |
1882 | 1882 | } else { |
1883 | 1883 | $filterValues = null; |
@@ -1914,7 +1914,7 @@ discard block |
||
1914 | 1914 | 'values' => $filterValues |
1915 | 1915 | ); |
1916 | 1916 | |
1917 | - $W->setUserConfiguration($tableview->getId() . '/filters/' . $name, $data, 'widgets', false); |
|
1917 | + $W->setUserConfiguration($tableview->getId().'/filters/'.$name, $data, 'widgets', false); |
|
1918 | 1918 | |
1919 | 1919 | return true; |
1920 | 1920 | } |
@@ -1931,7 +1931,7 @@ discard block |
||
1931 | 1931 | $Ui = $App->Ui(); |
1932 | 1932 | |
1933 | 1933 | $currentFilterName = $this->getCurrentFilterName(); |
1934 | - $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $currentFilterName, 'widgets', false); |
|
1934 | + $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$currentFilterName, 'widgets', false); |
|
1935 | 1935 | |
1936 | 1936 | $page = $Ui->Page(); |
1937 | 1937 | |
@@ -1974,7 +1974,7 @@ discard block |
||
1974 | 1974 | $App = $this->App(); |
1975 | 1975 | $Ui = $App->Ui(); |
1976 | 1976 | |
1977 | - $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false); |
|
1977 | + $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false); |
|
1978 | 1978 | |
1979 | 1979 | $page = $Ui->Page(); |
1980 | 1980 | |
@@ -2022,7 +2022,7 @@ discard block |
||
2022 | 2022 | |
2023 | 2023 | $filterNames = $this->getFilterNames(); |
2024 | 2024 | foreach ($filterNames as $filterName) { |
2025 | - $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false); |
|
2025 | + $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false); |
|
2026 | 2026 | |
2027 | 2027 | $filterBox = $W->HBoxItems() |
2028 | 2028 | ->setVerticalAlign('middle') |
@@ -2061,7 +2061,7 @@ discard block |
||
2061 | 2061 | $App = $this->App(); |
2062 | 2062 | $Ui = $App->Ui(); |
2063 | 2063 | |
2064 | - $filter = $W->getUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false); |
|
2064 | + $filter = $W->getUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false); |
|
2065 | 2065 | |
2066 | 2066 | $page = $Ui->Page(); |
2067 | 2067 | |
@@ -2093,7 +2093,7 @@ discard block |
||
2093 | 2093 | $this->requireDeleteMethod(); |
2094 | 2094 | |
2095 | 2095 | $W = bab_Widgets(); |
2096 | - $W->deleteUserConfiguration($this->getModelViewDefaultId() . '/filters/' . $name, 'widgets', false); |
|
2096 | + $W->deleteUserConfiguration($this->getModelViewDefaultId().'/filters/'.$name, 'widgets', false); |
|
2097 | 2097 | |
2098 | 2098 | return true; |
2099 | 2099 | } |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | $modelView = $this->modelView(); |
2104 | 2104 | $modelView->setHighlightedRows($ids); |
2105 | 2105 | |
2106 | - $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords'); |
|
2106 | + $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords'); |
|
2107 | 2107 | |
2108 | 2108 | return true; |
2109 | 2109 | } |
@@ -2113,7 +2113,7 @@ discard block |
||
2113 | 2113 | $modelView = $this->modelView(); |
2114 | 2114 | $modelView->clearHighlightedRows(); |
2115 | 2115 | |
2116 | - $this->addReloadSelector('.depends-' . $modelView->getId() . '-HighlightedRecords'); |
|
2116 | + $this->addReloadSelector('.depends-'.$modelView->getId().'-HighlightedRecords'); |
|
2117 | 2117 | |
2118 | 2118 | return true; |
2119 | 2119 | } |
@@ -2133,7 +2133,7 @@ discard block |
||
2133 | 2133 | $W = bab_Widgets(); |
2134 | 2134 | $inSession = false; |
2135 | 2135 | // $inSession = true; |
2136 | - $highlightedRows = $W->getUserConfiguration($modelViewId . '/highlightedRows', 'widgets', $inSession); |
|
2136 | + $highlightedRows = $W->getUserConfiguration($modelViewId.'/highlightedRows', 'widgets', $inSession); |
|
2137 | 2137 | |
2138 | 2138 | |
2139 | 2139 | $recordSet = $this->getRecordSet(); |
@@ -2154,7 +2154,7 @@ discard block |
||
2154 | 2154 | // else{ |
2155 | 2155 | $Ui = $App->Ui(); |
2156 | 2156 | $recordClassname = $this->getRecordClassName(); |
2157 | - $viewClassname = $recordClassname . 'FullFrame'; |
|
2157 | + $viewClassname = $recordClassname.'FullFrame'; |
|
2158 | 2158 | // } |
2159 | 2159 | |
2160 | 2160 | if ($records->count() > 0) { |
@@ -2162,7 +2162,7 @@ discard block |
||
2162 | 2162 | ->clearHighlightedRecords()) |
2163 | 2163 | ->setAjaxAction(null, false) |
2164 | 2164 | ->addClass('icon', FuncIcons::ACTIONS_ARROW_RIGHT_DOUBLE, "app_closeHighlightButton") |
2165 | - ->setSizePolicy(FuncIcons::ICON_LEFT_32 . ' pull-right')); |
|
2165 | + ->setSizePolicy(FuncIcons::ICON_LEFT_32.' pull-right')); |
|
2166 | 2166 | |
2167 | 2167 | foreach ($records as $record) { |
2168 | 2168 | |
@@ -2181,7 +2181,7 @@ discard block |
||
2181 | 2181 | $box->addClass('box', 'shadow'); |
2182 | 2182 | } |
2183 | 2183 | |
2184 | - $box->addClass('depends-' . $modelViewId . '-HighlightedRecords'); |
|
2184 | + $box->addClass('depends-'.$modelViewId.'-HighlightedRecords'); |
|
2185 | 2185 | $box->setReloadAction($this->proxy() |
2186 | 2186 | ->previewHighlightedRecords($view)); |
2187 | 2187 | return $box; |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | public function __construct(FuncApp $app = null) |
49 | 49 | { |
50 | 50 | parent::__construct($app); |
51 | - if(!$this->isAdmin()){ |
|
51 | + if (!$this->isAdmin()) { |
|
52 | 52 | $action = WidgetAction::fromRequest(); |
53 | 53 | list (, $method) = explode('.', $action->getMethod()); |
54 | - if($method !== 'accessDenied'){ |
|
54 | + if ($method !== 'accessDenied') { |
|
55 | 55 | /** |
56 | 56 | * @var WidgetAction |
57 | 57 | */ |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $box->addClass('reload-configuration-page'); |
115 | 115 | $box->addClass('widget-100pc'); |
116 | 116 | |
117 | - if(! isset($itemId)){ |
|
117 | + if (!isset($itemId)) { |
|
118 | 118 | $this->resetCurrentTab(); |
119 | 119 | } |
120 | 120 | |
@@ -124,16 +124,16 @@ discard block |
||
124 | 124 | $navBoxHtml = '<ul class="nav nav-tabs">'; |
125 | 125 | $htmlCanvas = $W->HtmlCanvas(); |
126 | 126 | |
127 | - foreach ($configurationItems as $tabId => $tab){ |
|
127 | + foreach ($configurationItems as $tabId => $tab) { |
|
128 | 128 | $tabLink = $W->Link($tab['tabTitle'], $this->proxy() |
129 | 129 | ->setDisplayTab($tabId)) |
130 | 130 | ->setOpenMode(WidgetLink::OPEN_DIALOG); |
131 | 131 | $tabLinkHtml = '<li role="configuration"'; |
132 | - if($tabId == $currentTab){ |
|
132 | + if ($tabId == $currentTab) { |
|
133 | 133 | $tabLinkHtml .= ' class="active"'; |
134 | 134 | } |
135 | 135 | $tabLinkHtml .= '>'; |
136 | - $tabLinkHtml .= $tabLink->display($htmlCanvas) . '</li>'; |
|
136 | + $tabLinkHtml .= $tabLink->display($htmlCanvas).'</li>'; |
|
137 | 137 | $navBoxHtml .= $tabLinkHtml; |
138 | 138 | } |
139 | 139 | |
@@ -162,19 +162,19 @@ discard block |
||
162 | 162 | ->addClass('icon-left icon-48x48 icon-left-48'); |
163 | 163 | $box->addItem($configBox); |
164 | 164 | |
165 | - if(! isset($configurationItems[$currentTab])){ |
|
165 | + if (!isset($configurationItems[$currentTab])) { |
|
166 | 166 | return $box; |
167 | 167 | } |
168 | 168 | |
169 | 169 | $tab = $configurationItems[$currentTab]; |
170 | 170 | |
171 | - foreach ($tab['tabContent'] as $tabSection){ |
|
172 | - if(! isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])){ |
|
171 | + foreach ($tab['tabContent'] as $tabSection) { |
|
172 | + if (!isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])) { |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | $configBox->addItem($W->Section($tabSection['sectionName'], $sectionContentBox = $W->HBoxItems()) |
176 | 176 | ->setFoldable(true)); |
177 | - foreach ($tabSection['sectionContent'] as $tabSection){ |
|
177 | + foreach ($tabSection['sectionContent'] as $tabSection) { |
|
178 | 178 | $sectionContentBox->addItem($tabSection); |
179 | 179 | } |
180 | 180 | } |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | ); |
200 | 200 | |
201 | 201 | $definitions = $App->getComponentDefinitions(); |
202 | - foreach ($definitions as $packageName => $definition){ |
|
202 | + foreach ($definitions as $packageName => $definition) { |
|
203 | 203 | /* @var $definition AppComponentDefinition */ |
204 | - if(! method_exists($definition, 'getConfiguration')){ |
|
204 | + if (!method_exists($definition, 'getConfiguration')) { |
|
205 | 205 | continue; |
206 | 206 | } |
207 | 207 | $configurationItems[$packageName] = array( |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | use function Cofy\Utilities\User\bab_isUserAdministrator; |
65 | 65 | use function Cofy\Utilities\User\bab_isUserLogged; |
66 | 66 | |
67 | -require_once dirname(__FILE__) . '/../functions.php'; |
|
67 | +require_once dirname(__FILE__).'/../functions.php'; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @method self proxy() |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function isAjaxRequest() |
241 | 241 | { |
242 | - if (! isset($this->isAjaxRequest)) { |
|
242 | + if (!isset($this->isAjaxRequest)) { |
|
243 | 243 | $this->isAjaxRequest = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); |
244 | 244 | } |
245 | 245 | return $this->isAjaxRequest; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $authType = ''; |
258 | 258 | } |
259 | 259 | |
260 | - if (! isset($message)) { |
|
260 | + if (!isset($message)) { |
|
261 | 261 | $message = $this->App()->translate('You must be logged in to access this page.'); |
262 | 262 | } |
263 | 263 | |
@@ -281,10 +281,10 @@ discard block |
||
281 | 281 | list($prefix) = explode('_', __CLASS__); |
282 | 282 | $functionalityName = ucwords($prefix); |
283 | 283 | /** @var FuncApp */ |
284 | - $App = BabFunctionality::get('App/' . $functionalityName); |
|
284 | + $App = BabFunctionality::get('App/'.$functionalityName); |
|
285 | 285 | |
286 | 286 | if (!$App) { |
287 | - throw new AppException('Faild to autodetect functionality App/' . $functionalityName . ', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
287 | + throw new AppException('Faild to autodetect functionality App/'.$functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | $controller = $App->ControllerProxy($classname, $proxy); |
@@ -302,14 +302,14 @@ discard block |
||
302 | 302 | static function getProxyInstance(BabFunctionality $App = null, $classname) |
303 | 303 | { |
304 | 304 | $class = new \ReflectionClass($classname); |
305 | - $proxyClassname = $class->getShortName() . self::PROXY_CLASS_SUFFIX; |
|
306 | - $finalProxyClassname = $class->getNamespaceName() . "\\" . $proxyClassname; |
|
307 | - if (! class_exists($finalProxyClassname)) { |
|
305 | + $proxyClassname = $class->getShortName().self::PROXY_CLASS_SUFFIX; |
|
306 | + $finalProxyClassname = $class->getNamespaceName()."\\".$proxyClassname; |
|
307 | + if (!class_exists($finalProxyClassname)) { |
|
308 | 308 | $classStr = ""; |
309 | 309 | if ($class->getNamespaceName() != "") { |
310 | - $classStr .= " namespace " . $class->getNamespaceName() . "; "; |
|
310 | + $classStr .= " namespace ".$class->getNamespaceName()."; "; |
|
311 | 311 | } |
312 | - $classStr .= 'class ' . $proxyClassname . ' extends ' . $class->getShortName() . ' {' . "\n"; |
|
312 | + $classStr .= 'class '.$proxyClassname.' extends '.$class->getShortName().' {'."\n"; |
|
313 | 313 | $methods = $class->getMethods(); |
314 | 314 | |
315 | 315 | $classStr .= ' public function __construct($App) { |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | }' . "\n"; |
318 | 318 | |
319 | 319 | foreach ($methods as $method) { |
320 | - if ($method->name === '__construct' || ! $method->isPublic() || $method->isStatic() || $method->isFinal() || $method->name === 'setApp' || $method->name === 'App' || $method->name === 'setCrm' || $method->name === 'Crm') { |
|
320 | + if ($method->name === '__construct' || !$method->isPublic() || $method->isStatic() || $method->isFinal() || $method->name === 'setApp' || $method->name === 'App' || $method->name === 'setCrm' || $method->name === 'Crm') { |
|
321 | 321 | continue; |
322 | 322 | } |
323 | 323 | |
324 | - $classStr .= ' public function ' . $method->name . '('; |
|
324 | + $classStr .= ' public function '.$method->name.'('; |
|
325 | 325 | $types = array(); |
326 | 326 | if ($type = $method->getReturnType()) { |
327 | 327 | if ($type instanceof ReflectionUnionType) { |
@@ -341,22 +341,22 @@ discard block |
||
341 | 341 | $reference = "&"; |
342 | 342 | } |
343 | 343 | if ($parameter->isDefaultValueAvailable()) { |
344 | - $parametersStr[] = $reference . '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true); |
|
344 | + $parametersStr[] = $reference.'$'.$parameter->name.' = '.var_export($parameter->getDefaultValue(), true); |
|
345 | 345 | } else { |
346 | - $parametersStr[] = $reference . '$' . $parameter->name; |
|
346 | + $parametersStr[] = $reference.'$'.$parameter->name; |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | $classStr .= implode(', ', $parametersStr); |
350 | 350 | $classStr .= ')'; |
351 | 351 | if (count($types) != 0) { |
352 | - $classStr .= ':' . implode('|', $types); |
|
352 | + $classStr .= ':'.implode('|', $types); |
|
353 | 353 | } |
354 | - $classStr .= '{' . "\n"; |
|
355 | - $classStr .= ' $args = func_get_args();' . "\n"; |
|
356 | - $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);' . "\n"; |
|
357 | - $classStr .= ' }' . "\n"; |
|
354 | + $classStr .= '{'."\n"; |
|
355 | + $classStr .= ' $args = func_get_args();'."\n"; |
|
356 | + $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);'."\n"; |
|
357 | + $classStr .= ' }'."\n"; |
|
358 | 358 | } |
359 | - $classStr .= '}' . "\n"; |
|
359 | + $classStr .= '}'."\n"; |
|
360 | 360 | // We define the proxy class |
361 | 361 | eval($classStr); |
362 | 362 | } |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | |
432 | 432 | $rc = new \ReflectionClass($fullClassName); |
433 | 433 | |
434 | - if (! $rc->hasMethod($methodName)) { |
|
435 | - throw new BabInvalidActionException($fullClassName . '::' . $methodName); |
|
434 | + if (!$rc->hasMethod($methodName)) { |
|
435 | + throw new BabInvalidActionException($fullClassName.'::'.$methodName); |
|
436 | 436 | } |
437 | 437 | $method = new \ReflectionMethod($fullClassName, $methodName); |
438 | 438 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | |
456 | 456 | $action = new WidgetAction(); |
457 | 457 | |
458 | - $action->setMethod($this->getControllerTg(), $objectName . '.' . $methodName, $actionParams); |
|
458 | + $action->setMethod($this->getControllerTg(), $objectName.'.'.$methodName, $actionParams); |
|
459 | 459 | |
460 | 460 | $docComment = $method->getDocComment(); |
461 | 461 | if (strpos($docComment, '@ajax') !== false) { |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | |
496 | 496 | list(,, $file) = explode('/', $App->controllerTg); |
497 | 497 | |
498 | - $action->setParameter('addon', $App->getAddonName() . '.' . $file); |
|
498 | + $action->setParameter('addon', $App->getAddonName().'.'.$file); |
|
499 | 499 | $action->setParameter('idx', $idx); |
500 | 500 | |
501 | 501 | return $action; |
@@ -513,13 +513,13 @@ discard block |
||
513 | 513 | |
514 | 514 | $method = $action->getMethod(); |
515 | 515 | $returnedValue = null; |
516 | - if (! isset($method) || '' === $method) { |
|
516 | + if (!isset($method) || '' === $method) { |
|
517 | 517 | return false; |
518 | 518 | } |
519 | 519 | |
520 | 520 | list($objectName,) = explode('.', $method); |
521 | 521 | |
522 | - if (! method_exists($this, $objectName)) { |
|
522 | + if (!method_exists($this, $objectName)) { |
|
523 | 523 | /* @var $component AppComponent */ |
524 | 524 | $component = $this->app->getComponentByName($objectName); |
525 | 525 | if ($component) { |
@@ -531,9 +531,9 @@ discard block |
||
531 | 531 | } |
532 | 532 | } |
533 | 533 | |
534 | - if (! isset($component)) { |
|
534 | + if (!isset($component)) { |
|
535 | 535 | $objectController = $this->{$objectName}(false); |
536 | - if (! ($objectController instanceof AppController)) { |
|
536 | + if (!($objectController instanceof AppController)) { |
|
537 | 537 | return false; |
538 | 538 | } |
539 | 539 | } |
@@ -542,12 +542,12 @@ discard block |
||
542 | 542 | $returnedValue = $objectController->execAction($action); |
543 | 543 | } catch (AppAccessException $e) { |
544 | 544 | |
545 | - if (! bab_isUserLogged() && $e->requireCredential) { |
|
545 | + if (!bab_isUserLogged() && $e->requireCredential) { |
|
546 | 546 | bab_requireCredential($e->getMessage()); |
547 | 547 | } else { |
548 | 548 | if ($this->isAjaxRequest()) { |
549 | 549 | |
550 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
550 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
551 | 551 | |
552 | 552 | die(bab_json_encode(array( |
553 | 553 | 'exception' => 'app_AccessException', |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | } catch (AppSaveException $e) { |
561 | 561 | |
562 | 562 | if ($this->isAjaxRequest()) { |
563 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
563 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
564 | 564 | header('Cache-Control: no-cache, must-revalidate'); |
565 | 565 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
566 | 566 | header('Content-type: application/json'); |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | |
586 | 586 | if ($returnedValue instanceof WidgetDisplayableInterface) { |
587 | 587 | |
588 | - if ($returnedValue instanceof WidgetBabPage && ! $this->isAjaxRequest()) { |
|
588 | + if ($returnedValue instanceof WidgetBabPage && !$this->isAjaxRequest()) { |
|
589 | 589 | |
590 | 590 | // If the action returned a page, we display it. |
591 | 591 | $returnedValue->displayHtml(); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | if (method_exists($htmlCanvas, 'sendPageTitle')) { |
612 | 612 | $htmlCanvas->sendPageTitle($pageTitle); |
613 | 613 | } else { |
614 | - header('X-Cto-PageTitle: ' . $pageTitle); |
|
614 | + header('X-Cto-PageTitle: '.$pageTitle); |
|
615 | 615 | } |
616 | 616 | } |
617 | 617 | $html = $returnedValue->display($htmlCanvas); |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | protected function deletedItemPage(WidgetAction $action, AppDeletedRecordException $e) |
678 | 678 | { |
679 | 679 | if ($this->isAjaxRequest()) { |
680 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
680 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
681 | 681 | header('Cache-Control: no-cache, must-revalidate'); |
682 | 682 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
683 | 683 | header('Content-type: application/json'); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | ) |
691 | 691 | )); |
692 | 692 | } |
693 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
693 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
694 | 694 | |
695 | 695 | $App = app_App(); |
696 | 696 | $W = bab_Widgets(); |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | protected function notFoundPage(WidgetAction $action, AppNotFoundException $e) |
723 | 723 | { |
724 | 724 | if ($this->isAjaxRequest()) { |
725 | - $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle() . ' (' . $e->getId() . ')'); |
|
725 | + $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle().' ('.$e->getId().')'); |
|
726 | 726 | $json = array( |
727 | 727 | 'messages' => array( |
728 | 728 | array( |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | echo bab_json_encode($json); |
735 | 735 | die(); |
736 | 736 | } |
737 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
737 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
738 | 738 | header('Cache-Control: no-cache, must-revalidate'); |
739 | 739 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
740 | 740 | |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | protected function unexpectedErrorPage(\Exception $e) |
765 | 765 | { |
766 | 766 | if ($this->isAjaxRequest()) { |
767 | - $message = sprintf(app_translate('An unexpected error occured') . ':' . '%s', $e->getMessage()); |
|
767 | + $message = sprintf(app_translate('An unexpected error occured').':'.'%s', $e->getMessage()); |
|
768 | 768 | $json = array( |
769 | 769 | 'messages' => array( |
770 | 770 | array( |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | echo bab_json_encode($json); |
777 | 777 | die(); |
778 | 778 | } |
779 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500); |
|
779 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500); |
|
780 | 780 | header('Cache-Control: no-cache, must-revalidate'); |
781 | 781 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
782 | 782 | |
@@ -800,11 +800,11 @@ discard block |
||
800 | 800 | ->addClass('widget-50pc alert alert-danger') |
801 | 801 | ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL)); |
802 | 802 | |
803 | - $logCode = '#' . hrtime(true); |
|
803 | + $logCode = '#'.hrtime(true); |
|
804 | 804 | $message = addcslashes($e->getMessage(), "\000..\037\177..\377\\"); |
805 | 805 | $trace = addcslashes($e->getTraceAsString(), "\000..\037\177..\377\\"); |
806 | 806 | |
807 | - error_log(sprintf('Error %s : %s', $logCode, $message) . PHP_EOL . $trace); |
|
807 | + error_log(sprintf('Error %s : %s', $logCode, $message).PHP_EOL.$trace); |
|
808 | 808 | |
809 | 809 | $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))); |
810 | 810 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | protected function errorPage(\Exception $e) |
828 | 828 | { |
829 | 829 | if ($this->isAjaxRequest()) { |
830 | - $message = sprintf(app_translate('An unexpected error occured') . ':' . '%s', $e->getMessage()); |
|
830 | + $message = sprintf(app_translate('An unexpected error occured').':'.'%s', $e->getMessage()); |
|
831 | 831 | $json = array( |
832 | 832 | 'messages' => array( |
833 | 833 | array( |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | echo bab_json_encode($json); |
840 | 840 | die(); |
841 | 841 | } |
842 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500); |
|
842 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500); |
|
843 | 843 | header('Cache-Control: no-cache, must-revalidate'); |
844 | 844 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
845 | 845 | |
@@ -863,11 +863,11 @@ discard block |
||
863 | 863 | ->addClass('widget-50pc alert alert-danger') |
864 | 864 | ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL)); |
865 | 865 | |
866 | - $logCode = '#' . hrtime(true); |
|
866 | + $logCode = '#'.hrtime(true); |
|
867 | 867 | $message = addcslashes($e->getMessage(), "\000..\037\177..\377\\"); |
868 | 868 | $trace = addcslashes($e->getTraceAsString(), "\000..\037\177..\377\\"); |
869 | 869 | |
870 | - error_log(sprintf('Error %s : %s', $logCode, $message) . PHP_EOL . $trace); |
|
870 | + error_log(sprintf('Error %s : %s', $logCode, $message).PHP_EOL.$trace); |
|
871 | 871 | |
872 | 872 | $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))); |
873 | 873 | |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | echo bab_json_encode($json); |
903 | 903 | die(); |
904 | 904 | } |
905 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
905 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
906 | 906 | header('Cache-Control: no-cache, must-revalidate'); |
907 | 907 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
908 | 908 | |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | 'position' => $position |
987 | 987 | ); |
988 | 988 | $babBody = bab_getBody(); |
989 | - if (! isset($babBody->messages['toasts'])) { |
|
989 | + if (!isset($babBody->messages['toasts'])) { |
|
990 | 990 | $babBody->messages['toasts'] = array(); |
991 | 991 | } |
992 | 992 | $babBody->messages['toasts'][] = $toast; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | use function Cofy\Utilities\bab_GetDatabaseInstance; |
40 | 40 | use function Cofy\Utilities\User\bab_isUserLogged; |
41 | 41 | |
42 | -require_once dirname(__FILE__). '/functions.php'; |
|
42 | +require_once dirname(__FILE__).'/functions.php'; |
|
43 | 43 | |
44 | 44 | |
45 | 45 | function LibApp_upgrade($sVersionBase, $sVersionIni) |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | |
96 | 96 | $babBody = bab_getBody(); |
97 | 97 | $addon = bab_getAddonInfosInstance('libapp'); |
98 | - $babBody->addStyleSheet($addon->getStylePath() . '/libapp.min.css'); |
|
99 | - $babBody->addJavascriptFile($addon->getTemplatePath() . 'libapp.js'); |
|
98 | + $babBody->addStyleSheet($addon->getStylePath().'/libapp.min.css'); |
|
99 | + $babBody->addJavascriptFile($addon->getTemplatePath().'libapp.js'); |
|
100 | 100 | $App = app_App(); |
101 | - if($App && $App->isSSEEnabled()){ |
|
102 | - $babBody->addJavascriptFile($addon->getTemplatePath() . 'notification.js'); |
|
103 | - if(bab_isUserLogged()){ |
|
101 | + if ($App && $App->isSSEEnabled()) { |
|
102 | + $babBody->addJavascriptFile($addon->getTemplatePath().'notification.js'); |
|
103 | + if (bab_isUserLogged()) { |
|
104 | 104 | $babBody->babecho('<script>window.libapp={"sseServerUrl": "'.$App->Controller()->SSE()->server()->url().'"}</script>'); |
105 | 105 | $babBody->addJavascriptFile($addon->getTemplatePath().'sse.js'); |
106 | 106 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | @BabFunctionality::includefile('Portletbackend'); |
123 | 123 | if (class_exists('FuncPortletbackend')) { |
124 | 124 | $addon = bab_getAddonInfosInstance('libapp'); |
125 | - $path = APP_PORTLET_PATH. '/FuncPortletbackendApp.php'; |
|
125 | + $path = APP_PORTLET_PATH.'/FuncPortletbackendApp.php'; |
|
126 | 126 | require_once $path; |
127 | 127 | $functionalities = new BabFunctionalities(); |
128 | 128 | $functionalities->register('Portletbackend/App',); |
@@ -26,10 +26,10 @@ |
||
26 | 26 | * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL) |
27 | 27 | * @copyright Copyright (c) 2023 by SI-4YOU ({@link https://www.siforyou.com}) |
28 | 28 | */ |
29 | -define('APP_PHP_PATH', dirname(__FILE__) . '/'); |
|
30 | -define('APP_SET_PATH', dirname(__FILE__) . '/'); |
|
31 | -define('APP_UI_PATH', dirname(__FILE__) . '/ui/'); |
|
32 | -define('APP_WIDGETS_PATH', APP_UI_PATH . 'widgets/'); |
|
33 | -define('APP_CTRL_PATH', dirname(__FILE__) . '/'); |
|
34 | -define('APP_PORTLET_PATH', APP_PHP_PATH . 'Portlet/'); |
|
29 | +define('APP_PHP_PATH', dirname(__FILE__).'/'); |
|
30 | +define('APP_SET_PATH', dirname(__FILE__).'/'); |
|
31 | +define('APP_UI_PATH', dirname(__FILE__).'/ui/'); |
|
32 | +define('APP_WIDGETS_PATH', APP_UI_PATH.'widgets/'); |
|
33 | +define('APP_CTRL_PATH', dirname(__FILE__).'/'); |
|
34 | +define('APP_PORTLET_PATH', APP_PHP_PATH.'Portlet/'); |
|
35 | 35 | define('APP_SSE_DEFAULT_REFRESH_FREQUENCY', 5); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $sourceClass = (new \ReflectionClass($sourceClass))->getShortName(); |
128 | 128 | } |
129 | 129 | if (!$this->sourceId instanceof $sourceClass) { |
130 | - $this->hasOne('sourceId', $sourceClass . 'Set'); |
|
130 | + $this->hasOne('sourceId', $sourceClass.'Set'); |
|
131 | 131 | $this->join('sourceId'); |
132 | 132 | } |
133 | 133 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
142 | 142 | } |
143 | 143 | if (!$this->targetId instanceof $targetClass) { |
144 | - $this->hasOne('targetId', $targetClass . 'Set'); |
|
144 | + $this->hasOne('targetId', $targetClass.'Set'); |
|
145 | 145 | $this->join('targetId'); |
146 | 146 | } |
147 | 147 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | if ($deleteTarget) { |
344 | 344 | foreach ($set->select($criteria) as $link) { |
345 | 345 | |
346 | - $className = $link->targetClass . 'Set'; |
|
346 | + $className = $link->targetClass.'Set'; |
|
347 | 347 | |
348 | 348 | // remove prefix |
349 | 349 |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | if (!empty($reloadSelectors)) { |
115 | - $sseData .= '"reloadSelector":' . bab_json_encode($reloadSelectors); |
|
115 | + $sseData .= '"reloadSelector":'.bab_json_encode($reloadSelectors); |
|
116 | 116 | $hasData = true; |
117 | 117 | } |
118 | 118 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | if ($hasData) { |
130 | 130 | $sseData .= ', '; |
131 | 131 | } |
132 | - $sseData .= '"browserNotifications":' . bab_json_encode($browserNotifications); |
|
132 | + $sseData .= '"browserNotifications":'.bab_json_encode($browserNotifications); |
|
133 | 133 | $hasData = true; |
134 | 134 | } |
135 | 135 |