Passed
Branchdevelop (be7e3f)
by Robin
11:00 queued 14s
created
programs/customsection.class.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
             return array();
231 231
         }
232 232
         $fields = json_decode($this->fields, true);
233
-        if(json_last_error() === JSON_ERROR_NONE){
233
+        if (json_last_error() === JSON_ERROR_NONE) {
234 234
             return $fields;
235 235
         }
236 236
         
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     public function addField($fieldName, $parameters = null)
300 300
     {
301 301
         $fields = $this->getFields();
302
-        if(!isset($parameters)){
302
+        if (!isset($parameters)) {
303 303
             $fields[$fieldName] = array(
304 304
                 'block' => ''
305 305
             );
@@ -334,16 +334,16 @@  discard block
 block discarded – undo
334 334
     {
335 335
         $isFieldsGroup = false;
336 336
         $fields = $this->getFields();
337
-        if(strpos($updatedFieldName, '_fieldsGroup') !== false){
337
+        if (strpos($updatedFieldName, '_fieldsGroup') !== false) {
338 338
             $isFieldsGroup = true;
339 339
             list(, $groupPos) = explode('_fieldsGroup', $updatedFieldName);
340
-            if(!isset($groupPos) || empty($groupPos)){
340
+            if (!isset($groupPos) || empty($groupPos)) {
341 341
                 $groupPos = 0;
342 342
             }
343 343
         }
344
-        if(!isset($fields[$updatedFieldName])){
345
-            if($isFieldsGroup){
346
-                while(isset($fields[$updatedFieldName.$groupPos])){
344
+        if (!isset($fields[$updatedFieldName])) {
345
+            if ($isFieldsGroup) {
346
+                while (isset($fields[$updatedFieldName.$groupPos])) {
347 347
                     $groupPos++;
348 348
                 }
349 349
                 $updatedFieldName .= $groupPos;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             $this->addField($updatedFieldName, $parameters);
352 352
             return $this;
353 353
         }
354
-        if(!isset($parameters)){
354
+        if (!isset($parameters)) {
355 355
             $fields[$updatedFieldName] = array(
356 356
                 'block' => ''
357 357
             );
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
     public function addFieldToGroup($fieldGroupName, $fieldName, $parameters = null)
367 367
     {
368 368
         $fields = $this->getFields();
369
-        if(!isset($fields[$fieldGroupName])){
369
+        if (!isset($fields[$fieldGroupName])) {
370 370
             return $this;
371 371
         }
372 372
         $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array();
373
-        if(!isset($parameters)){
373
+        if (!isset($parameters)) {
374 374
             $groupFields[$fieldName] = array(
375 375
                 'block' => ''
376 376
             );
@@ -405,15 +405,15 @@  discard block
 block discarded – undo
405 405
     public function updateFieldGroup($fieldGroupName, $updatedFieldName, $parameters = null)
406 406
     {
407 407
         $fields = $this->getFields();
408
-        if(!isset($fields[$fieldGroupName])){
408
+        if (!isset($fields[$fieldGroupName])) {
409 409
             return $this;
410 410
         }
411 411
         $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array();
412
-        if(!isset($groupFields[$updatedFieldName])){
412
+        if (!isset($groupFields[$updatedFieldName])) {
413 413
             $this->addFieldToGroup($fieldGroupName, $updatedFieldName, $parameters);
414 414
             return $this;
415 415
         }
416
-        if(!isset($parameters)){
416
+        if (!isset($parameters)) {
417 417
             $groupFields[$updatedFieldName] = array(
418 418
                 'block' => ''
419 419
             );
@@ -445,35 +445,35 @@  discard block
 block discarded – undo
445 445
         $arrCriteria = json_decode($this->visibilityCriteria, true);
446 446
         
447 447
         foreach ($arrCriteria as $fieldName => $condition) {
448
-            if(strpos($fieldName, '/') !== false){
448
+            if (strpos($fieldName, '/') !== false) {
449 449
                 list($oneField, $foreignField) = explode('/', $fieldName);
450 450
                 $field = $recordSet->$oneField()->$foreignField;
451 451
             }
452
-            else{
452
+            else {
453 453
                 $field = $recordSet->$fieldName;
454 454
             }
455 455
             foreach ($condition as $op => $value) {
456
-                if(!is_array($value)){
456
+                if (!is_array($value)) {
457 457
                     $criteria = $field->$op($value);
458 458
                 }
459
-                else{
460
-                    foreach ($value as $foreignClassName => $foreignValues){
459
+                else {
460
+                    foreach ($value as $foreignClassName => $foreignValues) {
461 461
                         $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set';
462 462
                         $foreignSet = $App->$foreignClassName();
463 463
                         $foreignField = '';
464 464
                         $foreignCondition = '';
465
-                        foreach ($foreignValues as $foreignFieldName => $foreignConditions){
466
-                            if($foreignFieldName === '_foreignField'){
465
+                        foreach ($foreignValues as $foreignFieldName => $foreignConditions) {
466
+                            if ($foreignFieldName === '_foreignField') {
467 467
                                 $foreignField = $foreignConditions;
468 468
                             }
469
-                            else{
470
-                                foreach ($foreignConditions as $key => $val){
469
+                            else {
470
+                                foreach ($foreignConditions as $key => $val) {
471 471
                                     $foreignCondition = $foreignSet->$foreignFieldName->$key($val);
472 472
                                 }
473 473
                             }
474 474
                         }
475 475
                     }
476
-                    if(method_exists($foreignSet, 'getDefaultCriteria')){
476
+                    if (method_exists($foreignSet, 'getDefaultCriteria')) {
477 477
                         $foreignCondition = $foreignCondition->_AND_($foreignSet->getDefaultCriteria());
478 478
                         
479 479
                     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -448,15 +448,13 @@  discard block
 block discarded – undo
448 448
             if(strpos($fieldName, '/') !== false){
449 449
                 list($oneField, $foreignField) = explode('/', $fieldName);
450 450
                 $field = $recordSet->$oneField()->$foreignField;
451
-            }
452
-            else{
451
+            } else{
453 452
                 $field = $recordSet->$fieldName;
454 453
             }
455 454
             foreach ($condition as $op => $value) {
456 455
                 if(!is_array($value)){
457 456
                     $criteria = $field->$op($value);
458
-                }
459
-                else{
457
+                } else{
460 458
                     foreach ($value as $foreignClassName => $foreignValues){
461 459
                         $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set';
462 460
                         $foreignSet = $App->$foreignClassName();
@@ -465,8 +463,7 @@  discard block
 block discarded – undo
465 463
                         foreach ($foreignValues as $foreignFieldName => $foreignConditions){
466 464
                             if($foreignFieldName === '_foreignField'){
467 465
                                 $foreignField = $foreignConditions;
468
-                            }
469
-                            else{
466
+                            } else{
470 467
                                 foreach ($foreignConditions as $key => $val){
471 468
                                     $foreignCondition = $foreignSet->$foreignFieldName->$key($val);
472 469
                                 }
Please login to merge, or discard this patch.
programs/portlet/base.portlet.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -66,63 +66,63 @@  discard block
 block discarded – undo
66 66
         return $this->addon->getIconPath();
67 67
     }
68 68
 
69
-	/**
70
-	 * Portlet definition ID
71
-	 *
72
-	 * @example lcrm/MyTasks
73
-	 * @return string
74
-	 */
75
-	public function getId()
76
-	{
77
-	    $App = $this->App();
78
-	    $app_path = explode('_', get_class($App));
79
-	    unset($app_path[0]); // remove Func
69
+    /**
70
+     * Portlet definition ID
71
+     *
72
+     * @example lcrm/MyTasks
73
+     * @return string
74
+     */
75
+    public function getId()
76
+    {
77
+        $App = $this->App();
78
+        $app_path = explode('_', get_class($App));
79
+        unset($app_path[0]); // remove Func
80 80
 
81
-		$portlet_path = explode('_',get_class($this));
81
+        $portlet_path = explode('_',get_class($this));
82 82
 
83
-		return implode('/', $app_path).'/'.$portlet_path[count($portlet_path) - 1];
84
-	}
83
+        return implode('/', $app_path).'/'.$portlet_path[count($portlet_path) - 1];
84
+    }
85 85
 
86 86
 
87
-	/**
88
-	 * @return App_PortletUi
89
-	 */
90
-	public function getPortlet()
91
-	{
92
-		$classname = get_class($this);
93
-		$suffix = mb_substr($classname, mb_strlen('App_PortletDefinition_'));
94
-		$classname = 'App_PortletUi_'.$suffix;
87
+    /**
88
+     * @return App_PortletUi
89
+     */
90
+    public function getPortlet()
91
+    {
92
+        $classname = get_class($this);
93
+        $suffix = mb_substr($classname, mb_strlen('App_PortletDefinition_'));
94
+        $classname = 'App_PortletUi_'.$suffix;
95 95
 
96
-		return new $classname($this->App());
97
-	}
96
+        return new $classname($this->App());
97
+    }
98 98
 
99 99
 
100
-	/**
101
-	 * @return array
102
-	 */
103
-	public function getPreferenceFields()
104
-	{
105
-		return array();
106
-	}
100
+    /**
101
+     * @return array
102
+     */
103
+    public function getPreferenceFields()
104
+    {
105
+        return array();
106
+    }
107 107
 
108 108
 
109 109
 
110
-	public function getConfigurationActions()
111
-	{
112
-		return array();
113
-	}
110
+    public function getConfigurationActions()
111
+    {
112
+        return array();
113
+    }
114 114
 
115 115
 
116 116
 
117 117
 
118
-	/**
119
-	 * Get thumbnail URL
120
-	 * max 120x60
121
-	 */
122
-	public function getThumbnail()
123
-	{
124
-		return '';
125
-	}
118
+    /**
119
+     * Get thumbnail URL
120
+     * max 120x60
121
+     */
122
+    public function getThumbnail()
123
+    {
124
+        return '';
125
+    }
126 126
 }
127 127
 
128 128
 
@@ -131,44 +131,44 @@  discard block
 block discarded – undo
131 131
 
132 132
 class App_PortletUi extends app_UiObject
133 133
 {
134
-	protected $options = array();
135
-
136
-
137
-	/**
138
-	 * @return string
139
-	 */
140
-	public function getName()
141
-	{
142
-		$classname = get_class($this);
143
-		return mb_substr($classname, 1 + mb_strlen(__CLASS__));
144
-	}
145
-
146
-
147
-	/**
148
-	 * @return App_PortletDefinition
149
-	 */
150
-	public function getPortletDefinition()
151
-	{
152
-	    $App = $this->App();
153
-	    $portlet = $App->Portlet();
154
-		$classname = get_class($this);
155
-		$method = mb_substr($classname, 1 + mb_strlen(__CLASS__));
156
-		return $portlet->$method();
157
-	}
158
-
159
-
160
-	public function setPreferences(array $configuration)
161
-	{
162
-		$this->options = $configuration;
163
-	}
164
-
165
-	public function setPreference($name, $value)
166
-	{
167
-		$this->options[$name] = $value;
168
-	}
169
-
170
-	public function setPortletId($id)
171
-	{
134
+    protected $options = array();
135
+
136
+
137
+    /**
138
+     * @return string
139
+     */
140
+    public function getName()
141
+    {
142
+        $classname = get_class($this);
143
+        return mb_substr($classname, 1 + mb_strlen(__CLASS__));
144
+    }
145
+
146
+
147
+    /**
148
+     * @return App_PortletDefinition
149
+     */
150
+    public function getPortletDefinition()
151
+    {
152
+        $App = $this->App();
153
+        $portlet = $App->Portlet();
154
+        $classname = get_class($this);
155
+        $method = mb_substr($classname, 1 + mb_strlen(__CLASS__));
156
+        return $portlet->$method();
157
+    }
158
+
159
+
160
+    public function setPreferences(array $configuration)
161
+    {
162
+        $this->options = $configuration;
163
+    }
164
+
165
+    public function setPreference($name, $value)
166
+    {
167
+        $this->options[$name] = $value;
168
+    }
169
+
170
+    public function setPortletId($id)
171
+    {
172 172
         $this->portletId = $id;
173
-	}
173
+    }
174 174
 }
175 175
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 	    $app_path = explode('_', get_class($App));
79 79
 	    unset($app_path[0]); // remove Func
80 80
 
81
-		$portlet_path = explode('_',get_class($this));
81
+		$portlet_path = explode('_', get_class($this));
82 82
 
83 83
 		return implode('/', $app_path).'/'.$portlet_path[count($portlet_path) - 1];
84 84
 	}
Please login to merge, or discard this patch.
programs/portlet/notifications.portlet.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
  */
23 23
 include_once 'base.php';
24 24
 
25
-require_once dirname(__FILE__) . '/../functions.php';
25
+require_once dirname(__FILE__).'/../functions.php';
26 26
 
27
-require_once dirname(__FILE__) . '/base.portlet.php';
27
+require_once dirname(__FILE__).'/base.portlet.php';
28 28
 
29 29
 
30 30
 
Please login to merge, or discard this patch.
programs/configuration.ctrl.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@
 block discarded – undo
191 191
         foreach ($definitions as $packageName => $definition){
192 192
             /* @var $definition app_ComponentDefinition */
193 193
             if(!method_exists($definition, 'getConfiguration')){
194
-               continue; 
194
+                continue; 
195 195
             }
196 196
             $configurationItems[$packageName] = array(
197 197
                 'tabTitle' => $packageName,
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @copyright Copyright (c) 2022 by CapWelton ({@link https://www.capwelton.com})
22 22
  */
23 23
 
24
-require_once dirname(__FILE__) . '/controller.class.php';
24
+require_once dirname(__FILE__).'/controller.class.php';
25 25
 
26 26
 
27 27
 /**
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
     public function __construct(Func_App $app = null)
35 35
     {
36 36
         parent::__construct($app);
37
-        if(!bab_isUserAdministrator()){
37
+        if (!bab_isUserAdministrator()) {
38 38
             $action = Widget_Action::fromRequest();
39 39
             list(, $method) = explode('.', $action->getMethod());
40
-            if($method !== 'denied'){
40
+            if ($method !== 'denied') {
41 41
                 $this->redirect($this->proxy()->denied());
42 42
             }
43 43
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $box->addClass('reload-configuration-page');
101 101
         $box->addClass('widget-100pc');
102 102
         
103
-        if(!isset($itemId)){
103
+        if (!isset($itemId)) {
104 104
             $this->resetCurrentTab();
105 105
         }
106 106
         
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
         $navBoxHtml = '<ul class="nav nav-tabs">';
111 111
         $htmlCanvas = $W->HtmlCanvas();
112 112
         
113
-        foreach ($configurationItems as $tabId => $tab){
113
+        foreach ($configurationItems as $tabId => $tab) {
114 114
             $tabLink = $W->Link(
115 115
                 $tab['tabTitle'],
116 116
                 $this->proxy()->setDisplayTab($tabId)
117 117
             )->setOpenMode(Widget_Link::OPEN_DIALOG);
118 118
             $tabLinkHtml = '<li role="configuration"';
119
-            if($tabId == $currentTab){
119
+            if ($tabId == $currentTab) {
120 120
                 $tabLinkHtml .= ' class="active"';
121 121
             }
122 122
             $tabLinkHtml .= '>';
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
         $configBox = $W->VBoxItems()->addClass('panel-body')->addClass('icon-left icon-48x48 icon-left-48');
146 146
         $box->addItem($configBox);
147 147
         
148
-        if(!isset($configurationItems[$currentTab])){      
148
+        if (!isset($configurationItems[$currentTab])) {      
149 149
             return $box;
150 150
         }
151 151
         
152 152
         $tab = $configurationItems[$currentTab];
153 153
         
154
-        foreach ($tab['tabContent'] as $tabSection){
155
-            if(!isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])){
154
+        foreach ($tab['tabContent'] as $tabSection) {
155
+            if (!isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])) {
156 156
                 continue;
157 157
             }
158 158
             $configBox->addItem(
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                     $sectionContentBox = $W->HBoxItems()
162 162
                 )->setFoldable(true)
163 163
             );
164
-            foreach ($tabSection['sectionContent'] as $tabSection){
164
+            foreach ($tabSection['sectionContent'] as $tabSection) {
165 165
                 $sectionContentBox->addItem($tabSection);
166 166
             }
167 167
         }
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
         );
189 189
         
190 190
         $definitions = $App->getComponentDefinitions();
191
-        foreach ($definitions as $packageName => $definition){
191
+        foreach ($definitions as $packageName => $definition) {
192 192
             /* @var $definition app_ComponentDefinition */
193
-            if(!method_exists($definition, 'getConfiguration')){
193
+            if (!method_exists($definition, 'getConfiguration')) {
194 194
                continue; 
195 195
             }
196 196
             $configurationItems[$packageName] = array(
Please login to merge, or discard this patch.
programs/component.class.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @copyright Copyright (c) 2019 by CapWelton ({@link http://www.capwelton.com})
22 22
  */
23 23
 
24
-require_once dirname(__FILE__). '/record.ctrl.php';
24
+require_once dirname(__FILE__).'/record.ctrl.php';
25 25
 
26 26
 class app_Component 
27 27
 {
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $main = new ReflectionClass($this->set);
60 60
         $dependencies = array();
61
-        if($main->hasMethod('getRequiredComponents')){
61
+        if ($main->hasMethod('getRequiredComponents')) {
62 62
             $requiredComponents = $this->recordSet()->getRequiredComponents();
63
-            foreach ($requiredComponents as $requiredComponent){
63
+            foreach ($requiredComponents as $requiredComponent) {
64 64
                 $dependencies['requiredComponents'][] = $requiredComponent;
65 65
             }
66 66
         }
67
-        if($main->hasMethod('getOptionalComponents')){
67
+        if ($main->hasMethod('getOptionalComponents')) {
68 68
             $optionalComponents = $this->recordSet()->getOptionalComponents();
69
-            foreach ($optionalComponents as $optionalComponent){
69
+            foreach ($optionalComponents as $optionalComponent) {
70 70
                 $dependencies['optionalComponents'][] = $optionalComponent;
71 71
             }
72 72
         }
@@ -82,20 +82,20 @@  discard block
 block discarded – undo
82 82
     
83 83
     public function getPackageName()
84 84
     {
85
-        if(!isset($this->packageName) || empty($this->packageName)){
85
+        if (!isset($this->packageName) || empty($this->packageName)) {
86 86
             $packageName = '';
87 87
             $setRc = new ReflectionClass($this->set);
88 88
             //Tries to automatically retrieve the package name from the definition.json
89
-            if($setRc){
89
+            if ($setRc) {
90 90
                 //Get definition file path
91 91
                 $definitionPathParts = explode('/', $setRc->getFileName());
92 92
                 $definitionPath = implode('/', (array_splice($definitionPathParts, 0, -3)));
93 93
                 $definitionPath .= '/definition.json';
94 94
                 $definitionContent = file_get_contents($definitionPath);
95
-                if($definitionContent){
95
+                if ($definitionContent) {
96 96
                     //Get definition.json content
97
-                    $definitionContent = json_decode($definitionContent,true);
98
-                    if($definitionContent && isset($definitionContent['name'])){
97
+                    $definitionContent = json_decode($definitionContent, true);
98
+                    if ($definitionContent && isset($definitionContent['name'])) {
99 99
                         //Get name in definition.json
100 100
                         $definitionNameParts = explode('/', $definitionContent['name']);
101 101
                         $packageName = $definitionNameParts[count($definitionNameParts) - 1];
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     public function onUpdate()
116 116
     {
117 117
         $main = new ReflectionClass($this->set);
118
-        if($main->hasMethod('onUpdate')){
118
+        if ($main->hasMethod('onUpdate')) {
119 119
             $this->recordSet()->onUpdate();
120 120
         }
121 121
     }
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function controller($proxy = true)
127 127
     {
128
-        if(!isset($this->controllerObject)){
128
+        if (!isset($this->controllerObject)) {
129 129
             $this->app->includeRecordController();
130 130
             $ctrl = $this->controller;
131 131
             $this->controllerObject = new $ctrl($this->app, $this);
132 132
         }
133
-        if($proxy){
133
+        if ($proxy) {
134 134
             return $this->controllerObject->proxy();
135 135
         }
136 136
         return $this->controllerObject;
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
     public function ui()
151 151
     {
152 152
         $this->app->includeUi();
153
-        if(!isset($this->uiObject)){
153
+        if (!isset($this->uiObject)) {
154 154
             $ui = $this->ui;
155
-            if(!isset($ui)){
155
+            if (!isset($ui)) {
156 156
                 return null;
157 157
             }
158 158
             $this->uiObject = new $ui($this->app);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     public function getSetClassName()
170 170
     {
171 171
         $reflectionClass = new ReflectionClass($this->set);
172
-        return $this->app->classPrefix . $reflectionClass->getShortName();
172
+        return $this->app->classPrefix.$reflectionClass->getShortName();
173 173
     }
174 174
     
175 175
     public function getRecordClassName()
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     public function getLangPath()
196 196
     {
197 197
         $def = $this->getDefinition();
198
-        if($def){
198
+        if ($def) {
199 199
             return $def->getLangPath($this->app);
200 200
         }
201 201
         return null;
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     public function getStylePath()
205 205
     {
206 206
         $def = $this->getDefinition();
207
-        if($def){
207
+        if ($def) {
208 208
             return $def->getStylePath($this->app);
209 209
         }
210 210
         return null;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     public function getScriptPath()
214 214
     {
215 215
         $def = $this->getDefinition();
216
-        if($def){
216
+        if ($def) {
217 217
             return $def->getScriptPath($this->app);
218 218
         }
219 219
         return null;
Please login to merge, or discard this patch.
programs/customcontainer.class.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -179,35 +179,35 @@
 block discarded – undo
179 179
 
180 180
 
181 181
         foreach ($arrCriteria as $fieldName => $condition) {
182
-            if(strpos($fieldName, '/') !== false){
182
+            if (strpos($fieldName, '/') !== false) {
183 183
                 list($oneField, $foreignField) = explode('/', $fieldName);
184 184
                 $field = $recordSet->$oneField()->$foreignField;
185 185
             }
186
-            else{
186
+            else {
187 187
                 $field = $recordSet->$fieldName;
188 188
             }
189 189
             foreach ($condition as $op => $value) {
190
-                if(!is_array($value)){
190
+                if (!is_array($value)) {
191 191
                     $criteria = $field->$op($value);
192 192
                 }
193
-                else{
194
-                    foreach ($value as $foreignClassName => $foreignValues){
193
+                else {
194
+                    foreach ($value as $foreignClassName => $foreignValues) {
195 195
                         $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set';
196 196
                         $foreignSet = $App->$foreignClassName();
197 197
                         $foreignField = '';
198 198
                         $foreignCondition = '';
199
-                        foreach ($foreignValues as $foreignFieldName => $foreignConditions){
200
-                            if($foreignFieldName === '_foreignField'){
199
+                        foreach ($foreignValues as $foreignFieldName => $foreignConditions) {
200
+                            if ($foreignFieldName === '_foreignField') {
201 201
                                 $foreignField = $foreignConditions;
202 202
                             }
203
-                            else{
204
-                                foreach ($foreignConditions as $key => $val){
203
+                            else {
204
+                                foreach ($foreignConditions as $key => $val) {
205 205
                                     $foreignCondition = $foreignSet->$foreignFieldName->$key($val);
206 206
                                 }
207 207
                             }
208 208
                         }
209 209
                     }
210
-                    if(method_exists($foreignSet, 'getDefaultCriteria')){
210
+                    if (method_exists($foreignSet, 'getDefaultCriteria')) {
211 211
                         $foreignCondition = $foreignCondition->_AND_($foreignSet->getDefaultCriteria());
212 212
                         
213 213
                     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -182,15 +182,13 @@  discard block
 block discarded – undo
182 182
             if(strpos($fieldName, '/') !== false){
183 183
                 list($oneField, $foreignField) = explode('/', $fieldName);
184 184
                 $field = $recordSet->$oneField()->$foreignField;
185
-            }
186
-            else{
185
+            } else{
187 186
                 $field = $recordSet->$fieldName;
188 187
             }
189 188
             foreach ($condition as $op => $value) {
190 189
                 if(!is_array($value)){
191 190
                     $criteria = $field->$op($value);
192
-                }
193
-                else{
191
+                } else{
194 192
                     foreach ($value as $foreignClassName => $foreignValues){
195 193
                         $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set';
196 194
                         $foreignSet = $App->$foreignClassName();
@@ -199,8 +197,7 @@  discard block
 block discarded – undo
199 197
                         foreach ($foreignValues as $foreignFieldName => $foreignConditions){
200 198
                             if($foreignFieldName === '_foreignField'){
201 199
                                 $foreignField = $foreignConditions;
202
-                            }
203
-                            else{
200
+                            } else{
204 201
                                 foreach ($foreignConditions as $key => $val){
205 202
                                     $foreignCondition = $foreignSet->$foreignFieldName->$key($val);
206 203
                                 }
Please login to merge, or discard this patch.
programs/sse.ctrl.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,19 +55,19 @@
 block discarded – undo
55 55
             ob_end_flush();
56 56
             flush();
57 57
             sleep($refreshFrequency);
58
-    	}
59
-	}
58
+        }
59
+    }
60 60
 	
61
-	private function getRefreshFrequency()
62
-	{
63
-	    if(!isset($this->refreshFrequency)){
64
-	        $registry = app_getRegistry();
65
-	        $registry->changeDirectory('configuration');
66
-	        $registry->changeDirectory('SSE');
67
-	        $this->refreshFrequency = $registry->getValue('refreshFrequency', 3);
68
-	    }
69
-	    return $this->refreshFrequency;
70
-	}
61
+    private function getRefreshFrequency()
62
+    {
63
+        if(!isset($this->refreshFrequency)){
64
+            $registry = app_getRegistry();
65
+            $registry->changeDirectory('configuration');
66
+            $registry->changeDirectory('SSE');
67
+            $this->refreshFrequency = $registry->getValue('refreshFrequency', 3);
68
+        }
69
+        return $this->refreshFrequency;
70
+    }
71 71
         
72 72
     private function getSSEData()
73 73
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 
25
-require_once dirname(__FILE__) . '/controller.class.php';
25
+require_once dirname(__FILE__).'/controller.class.php';
26 26
 
27 27
 
28 28
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     {
40 40
         session_write_close();
41 41
         
42
-        header("Content-Type: text/event-stream");header('Cache-Control: no-cache');
42
+        header("Content-Type: text/event-stream"); header('Cache-Control: no-cache');
43 43
         header('Connection: keep-alive');
44 44
         header('X-Accel-Buffering: no');
45 45
         
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
         
48 48
         while (1) {
49 49
             $data = $this->getSSEData();
50
-            if($data != '{}'){
50
+            if ($data != '{}') {
51 51
                 echo "event: ping\n";
52 52
                 echo "\n\n";
53
-                echo 'data: ' . $this->getSSEData() . "\n\n";
53
+                echo 'data: '.$this->getSSEData()."\n\n";
54 54
             }        
55 55
             ob_end_flush();
56 56
             flush();
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	
61 61
 	private function getRefreshFrequency()
62 62
 	{
63
-	    if(!isset($this->refreshFrequency)){
63
+	    if (!isset($this->refreshFrequency)) {
64 64
 	        $registry = app_getRegistry();
65 65
 	        $registry->changeDirectory('configuration');
66 66
 	        $registry->changeDirectory('SSE');
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     
80 80
     private function getCurrentUser()
81 81
     {
82
-        if(isset($this->currentUser)){
82
+        if (isset($this->currentUser)) {
83 83
             return $this->currentUser;
84 84
         }
85 85
         
Please login to merge, or discard this patch.
programs/customcontainer.ctrl.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 
25
-require_once APP_CTRL_PATH . '/record.ctrl.php';
25
+require_once APP_CTRL_PATH.'/record.ctrl.php';
26 26
 
27 27
 
28 28
 /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         foreach ($allViewSections as $viewSection) {
59 59
             $fields = $viewSection->getFields();
60 60
             foreach ($fields as $field) {
61
-                $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id;
61
+                $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id;
62 62
             }
63 63
         }
64 64
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         bab_Sort::asort($availableFields, 'description', bab_Sort::CASE_INSENSITIVE);
82 82
 
83 83
         foreach ($availableFields as $field) {
84
-            $fieldName =  $field['name'];
84
+            $fieldName = $field['name'];
85 85
             $fieldDescription = $field['description'];
86 86
 
87 87
             $used = isset($allViewFieldNames[$fieldName]);
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
         $record = $recordSet->request($id);
389 389
         
390 390
         $object = $record->object;
391
-        if(empty($object)){
391
+        if (empty($object)) {
392 392
             $object = $record->container()->object;
393 393
         }
394
-        if(strpos($object, $App->classPrefix) !== false){
394
+        if (strpos($object, $App->classPrefix) !== false) {
395 395
             $object = str_replace($App->classPrefix, '', $object);
396 396
         }
397 397
         $object .= 'Set';
@@ -415,16 +415,16 @@  discard block
 block discarded – undo
415 415
                 foreach ($operation as $condition => $value) {
416 416
                     $data['condition']['default'] = $condition;
417 417
                     $data['condition']['bool'] = $condition;
418
-                    if(is_array($value)){
419
-                        foreach ($value as $key => $subValue){
420
-                            foreach ($manySets as $manyFieldName => $manyRelation){
421
-                                if($key.'Set' == $manyRelation->getForeignSetClassName()){
422
-                                    foreach ($subValue as $subFieldName => $subConditions){
423
-                                        if($subFieldName === '_foreignField'){
418
+                    if (is_array($value)) {
419
+                        foreach ($value as $key => $subValue) {
420
+                            foreach ($manySets as $manyFieldName => $manyRelation) {
421
+                                if ($key.'Set' == $manyRelation->getForeignSetClassName()) {
422
+                                    foreach ($subValue as $subFieldName => $subConditions) {
423
+                                        if ($subFieldName === '_foreignField') {
424 424
                                             continue;
425 425
                                         }
426 426
                                         $data['field'] = "{$manyFieldName}/{$subFieldName}";
427
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
427
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
428 428
                                             $data['condition']['default'] = $subCondition;
429 429
                                             $data['condition']['bool'] = $subCondition;
430 430
                                             $value = $subConditionValue;
@@ -433,14 +433,14 @@  discard block
 block discarded – undo
433 433
                                     break;
434 434
                                 }
435 435
                             }
436
-                            foreach ($oneSets as $oneFieldName => $oneRelation){
437
-                                if($key.'Set' == $oneRelation->getForeignSetClassName()){
438
-                                    foreach ($subValue as $subFieldName => $subConditions){
439
-                                        if($subFieldName === '_foreignField'){
436
+                            foreach ($oneSets as $oneFieldName => $oneRelation) {
437
+                                if ($key.'Set' == $oneRelation->getForeignSetClassName()) {
438
+                                    foreach ($subValue as $subFieldName => $subConditions) {
439
+                                        if ($subFieldName === '_foreignField') {
440 440
                                             continue;
441 441
                                         }
442 442
                                         $data['field'] = "{$oneFieldName}/{$subFieldName}";
443
-                                        foreach ($subConditions as $subCondition => $subConditionValue){
443
+                                        foreach ($subConditions as $subCondition => $subConditionValue) {
444 444
                                             $data['condition']['default'] = $subCondition;
445 445
                                             $data['condition']['bool'] = $subCondition;
446 446
                                             $value = $subConditionValue;
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
     protected function preSave(ORM_Record $record, $data)
486 486
     {
487 487
         parent::preSave($record, $data);
488
-        if(!isset($record->id) || empty($record->id)){
488
+        if (!isset($record->id) || empty($record->id)) {
489 489
             $set = $record->getParentSet();
490 490
             $nbContainers = $set->select(
491 491
                 $set->all(
@@ -525,10 +525,10 @@  discard block
 block discarded – undo
525 525
         $record = $recordSet->request($data['id']);
526 526
         
527 527
         $object = $record->object;
528
-        if(empty($object)){
528
+        if (empty($object)) {
529 529
             $object = $record->container()->object;
530 530
         }
531
-        if(strpos($object, $App->classPrefix) !== false){
531
+        if (strpos($object, $App->classPrefix) !== false) {
532 532
             $object = str_replace($App->classPrefix, '', $object);
533 533
         }
534 534
         $object .= 'Set';
@@ -539,14 +539,14 @@  discard block
 block discarded – undo
539 539
         $field = $data['field'];
540 540
         $condition = $data['condition'];
541 541
         
542
-        if(strpos($field, '/') !== false){
542
+        if (strpos($field, '/') !== false) {
543 543
             //The selected field is a hasMany or a hasOne relation
544 544
             list($selectedRelation, $selectedField) = explode('/', $field);
545 545
             $classPrefix = $App->classPrefix;
546 546
             
547 547
             $manyRelations = $objectRecordSet->getHasManyRelations();
548
-            foreach($manyRelations as $manyRelation){
549
-                if($selectedRelation != $manyRelation->getOwnerSetFieldName()){
548
+            foreach ($manyRelations as $manyRelation) {
549
+                if ($selectedRelation != $manyRelation->getOwnerSetFieldName()) {
550 550
                     continue;
551 551
                 }
552 552
                 $foreignSetName = str_replace($classPrefix, '', $manyRelation->getForeignSetClassName());
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                 
555 555
                 $visibilityCriteria = '';
556 556
                 
557
-                if($foreignSet){
557
+                if ($foreignSet) {
558 558
                     $selectedManyField = $foreignSet->$selectedField;
559 559
                     
560 560
                     if ($selectedManyField instanceof ORM_BoolInterface) {
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
             }
575 575
             
576 576
             $oneRelations = $objectRecordSet->getHasOneRelations();
577
-            foreach($oneRelations as $oneRelation){
577
+            foreach ($oneRelations as $oneRelation) {
578 578
                 /* @var $oneRelation ORM_OneRelation*/
579
-                if($selectedRelation != $oneRelation->getOwnerSetFieldName()){
579
+                if ($selectedRelation != $oneRelation->getOwnerSetFieldName()) {
580 580
                     continue;
581 581
                 }
582 582
                 $foreignSetClassName = $oneRelation->getForeignSetClassName();
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
                 
586 586
                 $visibilityCriteria = '';
587 587
                 
588
-                if($foreignSet){
588
+                if ($foreignSet) {
589 589
                     $selectedOneField = $foreignSet->$selectedField;
590 590
                     
591 591
                     if ($selectedOneField instanceof ORM_BoolInterface) {
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
                 break;
601 601
             }
602 602
         }
603
-        else{
603
+        else {
604 604
             
605 605
             $field = $objectRecordSet->$field;
606 606
             
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
             
613 613
             $visibilityCriteria = '';
614 614
             
615
-            if(!empty($condition)){
615
+            if (!empty($condition)) {
616 616
                 $criteria = $field->{$condition}($data['value']);
617 617
                 $visibilityCriteria = $criteria->toJson();
618 618
             }
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
             $menu->setSizePolicy(Func_Icons::ICON_LEFT_16);
687 687
             
688 688
             $hasVisibilityBox = $W->FlowItems()->addClass('widget-100');
689
-            if(!empty($customContainer->visibilityCriteria)){
689
+            if (!empty($customContainer->visibilityCriteria)) {
690 690
                 $hasVisibilityBox->addItem(
691 691
                     $W->HBoxItems(
692 692
                         $W->Label($App->translate('This container has a visibility condition'))
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
             $customSections = $customSectionSet->select(
752 752
                 $customSectionSet->container->is($customContainer->id)
753 753
             );
754
-            foreach ($customSections as $customSection){
754
+            foreach ($customSections as $customSection) {
755 755
                 $customSectionValues = $customSection->getValues();
756 756
                 unset($customSectionValues['id']);
757 757
                 unset($customSectionValues['uuid']);
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
         }
771 771
 
772 772
         header('Content-type: application/json');
773
-        header('Content-Disposition: attachment; filename="' . $object . '.' . ($view === '' ? 'default' : $view) . '.json"'."\n");
773
+        header('Content-Disposition: attachment; filename="'.$object.'.'.($view === '' ? 'default' : $view).'.json"'."\n");
774 774
 
775 775
         $json = bab_json_encode($containersValues);
776 776
         $json = bab_convertStringFromDatabase($json, bab_charset::UTF_8);
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
             $customContainer->object = $object;
876 876
             $customContainer->view = $view;
877 877
             $customContainer->save();
878
-            foreach ($containerValues['customSections'] as $sectionValues){
878
+            foreach ($containerValues['customSections'] as $sectionValues) {
879 879
                 $customSection = $customSectionSet->newRecord();
880 880
                 $sectionValues['fields'] = json_encode($sectionValues['fields']);
881 881
                 $customSection->setValues($sectionValues);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -599,8 +599,7 @@
 block discarded – undo
599 599
                 }
600 600
                 break;
601 601
             }
602
-        }
603
-        else{
602
+        } else{
604 603
             
605 604
             $field = $objectRecordSet->$field;
606 605
             
Please login to merge, or discard this patch.
programs/record.class.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     {
192 192
         $App = $this->App();
193 193
 
194
-        $customFieldSet= $App->CustomFieldSet();
194
+        $customFieldSet = $App->CustomFieldSet();
195 195
         $object = mb_substr(get_class($this), mb_strlen($App->classPrefix), -mb_strlen('Set'));
196 196
 
197 197
         $customFields = $customFieldSet->select($customFieldSet->object->is($object));
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         $recordClassName = $this->getRecordClassName();
320 320
         $linkSet->hasOne('sourceId', $recordClassName);
321 321
 
322
-        $criteria =	$linkSet->targetClass->is($target->getClassName())
322
+        $criteria = $linkSet->targetClass->is($target->getClassName())
323 323
             ->_AND_($linkSet->targetId->is($target->id))
324 324
             ->_AND_($linkSet->sourceClass->is($this->newRecord()->getClassName()));
325 325
         if (isset($linkType)) {
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $recordClassName = $this->getRecordClassName();
352 352
         $linkSet->hasOne('targetId', $recordClassName);
353 353
         
354
-        $criteria =	$linkSet->sourceClass->is($source->getClassName())
354
+        $criteria = $linkSet->sourceClass->is($source->getClassName())
355 355
             ->_AND_($linkSet->sourceId->is($source->id))
356 356
             ->_AND_($linkSet->targetClass->is($this->newRecord()->getClassName()));
357 357
         if (isset($linkType)) {
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
             $sourcesCriteria[] = $linkSet->sourceClass->is($sourceClass)->_AND_($linkSet->sourceId->in($sourceIds));
398 398
         }
399 399
 
400
-        $criteria =	$linkSet->all(
400
+        $criteria = $linkSet->all(
401 401
             $linkSet->targetClass->is($this->newRecord()->getClassName()),
402 402
             $linkSet->any($sourcesCriteria)
403 403
         );
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
             $targetsCriteria[] = $linkSet->targetClass->is($targetClass)->_AND_($linkSet->targetId->in($targetIds));
445 445
         }
446 446
 
447
-        $criteria =	$linkSet->all(
447
+        $criteria = $linkSet->all(
448 448
             $linkSet->sourceClass->is($this->newRecord()->getClassName()),
449 449
             $linkSet->any($targetsCriteria)
450 450
         );
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
     {
600 600
         $fields = $this->getFields();
601 601
         $manyRelations = $this->getHasManyRelations();
602
-        foreach ($manyRelations as $fieldName => $manyRelation){
602
+        foreach ($manyRelations as $fieldName => $manyRelation) {
603 603
             $fields[$fieldName] = $manyRelation;
604 604
         }
605 605
         return $fields;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
         $App = $this->App();
692 692
         $rClass = new ReflectionClass(get_class($this));
693 693
         $component = $App->getComponentByName($rClass->getShortName());
694
-        if(isset($component)){
694
+        if (isset($component)) {
695 695
             return $component->getRecordClassName();
696 696
 //             list(, $classname) = explode('_', $component->getRecordClassName());
697 697
 //             return $classname;
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
             throw new app_Exception('Trying to get the reference string of a record without an id.');
713 713
         }
714 714
         $classname = $this->getClassName();
715
-        return $classname . ':' . $this->id;
715
+        return $classname.':'.$this->id;
716 716
     }
717 717
 
718 718
 
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
         $App = $this->App();
956 956
         $linkSet = $App->LinkSet();
957 957
 
958
-        $criteria =	$linkSet->sourceClass->is($source->getClassName())
958
+        $criteria = $linkSet->sourceClass->is($source->getClassName())
959 959
         ->_AND_($linkSet->sourceId->is($source->id))
960 960
         ->_AND_($linkSet->targetClass->is($this->getClassName()))
961 961
         ->_AND_($linkSet->targetId->is($this->id));
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
         $App = $this->App();
987 987
         $linkSet = $App->LinkSet();
988 988
 
989
-        $criteria =	$linkSet->all(
989
+        $criteria = $linkSet->all(
990 990
             $linkSet->targetClass->is($target->getClassName()),
991 991
             $linkSet->targetId->is($target->id),
992 992
             $linkSet->sourceClass->is($this->getClassName()),
@@ -1081,13 +1081,13 @@  discard block
 block discarded – undo
1081 1081
      */
1082 1082
     protected function importDate($name, $value)
1083 1083
     {
1084
-        if (preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/',$value)) {
1084
+        if (preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)) {
1085 1085
             return $this->importProperty($name, $value);
1086 1086
         }
1087 1087
 
1088 1088
         // try in DD/MM/YYYY format
1089 1089
 
1090
-        if (preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/',$value, $matches)) {
1090
+        if (preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)) {
1091 1091
 
1092 1092
             $value = sprintf('%04d-%02d-%02d', (int) $matches['year'], (int) $matches['month'], (int) $matches['day']);
1093 1093
 
Please login to merge, or discard this patch.