@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (null === $url) { |
113 | 113 | $script = '<script type="text/javascript">'; |
114 | 114 | if (isset($message)) { |
115 | - $script .= 'alert("' . bab_toHtml($message, BAB_HTML_JS) . '");'; |
|
115 | + $script .= 'alert("'.bab_toHtml($message, BAB_HTML_JS).'");'; |
|
116 | 116 | } |
117 | 117 | $script .= 'history.back();'; |
118 | 118 | $script .= '</script>'; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $url = $url->url(); |
125 | 125 | } |
126 | 126 | if (!empty($babBody->msgerror)) { |
127 | - $url .= '&msgerror=' . urlencode($babBody->msgerror); |
|
127 | + $url .= '&msgerror='.urlencode($babBody->msgerror); |
|
128 | 128 | } |
129 | 129 | if (isset($message)) { |
130 | 130 | $lines = explode("\n", $message); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - header('Location: ' . $url); |
|
136 | + header('Location: '.$url); |
|
137 | 137 | die; |
138 | 138 | } |
139 | 139 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | function app_fileUploadError($error) |
167 | 167 | { |
168 | - switch($error) { |
|
168 | + switch ($error) { |
|
169 | 169 | case UPLOAD_ERR_OK: |
170 | 170 | return null; |
171 | 171 |
@@ -21,9 +21,9 @@ |
||
21 | 21 | * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr}) |
22 | 22 | */ |
23 | 23 | |
24 | -define('APP_PHP_PATH', dirname(__FILE__) . '/'); |
|
25 | -define('APP_SET_PATH', dirname(__FILE__) . '/'); |
|
26 | -define('APP_UI_PATH', dirname(__FILE__) . '/ui/'); |
|
27 | -define('APP_WIDGETS_PATH', APP_UI_PATH . 'widgets/'); |
|
28 | -define('APP_CTRL_PATH', dirname(__FILE__) . '/'); |
|
29 | -define('APP_PORTLET_PATH', APP_PHP_PATH . 'portlet/'); |
|
30 | 24 | \ No newline at end of file |
25 | +define('APP_PHP_PATH', dirname(__FILE__).'/'); |
|
26 | +define('APP_SET_PATH', dirname(__FILE__).'/'); |
|
27 | +define('APP_UI_PATH', dirname(__FILE__).'/ui/'); |
|
28 | +define('APP_WIDGETS_PATH', APP_UI_PATH.'widgets/'); |
|
29 | +define('APP_CTRL_PATH', dirname(__FILE__).'/'); |
|
30 | +define('APP_PORTLET_PATH', APP_PHP_PATH.'portlet/'); |
|
31 | 31 | \ No newline at end of file |
@@ -109,9 +109,9 @@ |
||
109 | 109 | public function isUpdatable() |
110 | 110 | { |
111 | 111 | return $this->all(); |
112 | - if($this->App() |
|
112 | + if ($this->App() |
|
113 | 113 | ->Access() |
114 | - ->administer()){ |
|
114 | + ->administer()) { |
|
115 | 115 | return $this->all(); |
116 | 116 | } |
117 | 117 | return $this->none(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $App = app_App(); |
64 | 64 | static $fieldsLayouts = null; |
65 | 65 | |
66 | - if(! isset($fieldsLayouts)){ |
|
66 | + if (!isset($fieldsLayouts)) { |
|
67 | 67 | $fieldsLayouts = array( |
68 | 68 | self::FIELDS_LAYOUT_VERTICAL_LABEL => $App->translate('Vertical label'), |
69 | 69 | self::FIELDS_LAYOUT_HORIZONTAL_LABEL => $App->translate('Horizontal label'), |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getRawFields() |
82 | 82 | { |
83 | - if(empty($this->fields)){ |
|
83 | + if (empty($this->fields)) { |
|
84 | 84 | return array(); |
85 | 85 | } |
86 | 86 | return explode(',', $this->fields); |
@@ -105,29 +105,29 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function getFields() |
107 | 107 | { |
108 | - if(empty($this->fields)){ |
|
108 | + if (empty($this->fields)) { |
|
109 | 109 | return array(); |
110 | 110 | } |
111 | 111 | $fields = json_decode($this->fields, true); |
112 | - if(json_last_error() === JSON_ERROR_NONE){ |
|
112 | + if (json_last_error() === JSON_ERROR_NONE) { |
|
113 | 113 | return $fields; |
114 | 114 | } |
115 | 115 | |
116 | 116 | $fields = array(); |
117 | 117 | $rawFields = $this->getRawFields(); |
118 | - foreach ($rawFields as $rawField){ |
|
119 | - if(empty($rawField)){ |
|
118 | + foreach ($rawFields as $rawField) { |
|
119 | + if (empty($rawField)) { |
|
120 | 120 | continue; |
121 | 121 | } |
122 | 122 | $params = array(); |
123 | 123 | |
124 | - if(strpos($rawField, ':') === false){ |
|
124 | + if (strpos($rawField, ':') === false) { |
|
125 | 125 | $fieldName = $rawField; |
126 | 126 | } |
127 | - else{ |
|
127 | + else { |
|
128 | 128 | list ($fieldName, $parameters) = explode(':', $rawField); |
129 | 129 | $parameters = explode(';', $parameters); |
130 | - foreach ($parameters as $parameter){ |
|
130 | + foreach ($parameters as $parameter) { |
|
131 | 131 | list ($key, $value) = explode('=', $parameter); |
132 | 132 | $params[$key] = $value; |
133 | 133 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function getField($searchedFieldName) |
162 | 162 | { |
163 | - if(empty($this->fields)){ |
|
163 | + if (empty($this->fields)) { |
|
164 | 164 | return null; |
165 | 165 | } |
166 | 166 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function addField($fieldName, $parameters = null) |
178 | 178 | { |
179 | 179 | $fields = $this->getFields(); |
180 | - if(! isset($parameters)){ |
|
180 | + if (!isset($parameters)) { |
|
181 | 181 | $fields[$fieldName] = array( |
182 | 182 | 'block' => '' |
183 | 183 | ); |
@@ -211,24 +211,24 @@ discard block |
||
211 | 211 | { |
212 | 212 | $isFieldsGroup = false; |
213 | 213 | $fields = $this->getFields(); |
214 | - if(strpos($updatedFieldName, '_fieldsGroup') !== false){ |
|
214 | + if (strpos($updatedFieldName, '_fieldsGroup') !== false) { |
|
215 | 215 | $isFieldsGroup = true; |
216 | 216 | list (, $groupPos) = explode('_fieldsGroup', $updatedFieldName); |
217 | - if(! isset($groupPos) || empty($groupPos)){ |
|
217 | + if (!isset($groupPos) || empty($groupPos)) { |
|
218 | 218 | $groupPos = 0; |
219 | 219 | } |
220 | 220 | } |
221 | - if(! isset($fields[$updatedFieldName])){ |
|
222 | - if($isFieldsGroup){ |
|
223 | - while (isset($fields[$updatedFieldName . $groupPos])){ |
|
224 | - $groupPos ++; |
|
221 | + if (!isset($fields[$updatedFieldName])) { |
|
222 | + if ($isFieldsGroup) { |
|
223 | + while (isset($fields[$updatedFieldName.$groupPos])) { |
|
224 | + $groupPos++; |
|
225 | 225 | } |
226 | 226 | $updatedFieldName .= $groupPos; |
227 | 227 | } |
228 | 228 | $this->addField($updatedFieldName, $parameters); |
229 | 229 | return $this; |
230 | 230 | } |
231 | - if(! isset($parameters)){ |
|
231 | + if (!isset($parameters)) { |
|
232 | 232 | $fields[$updatedFieldName] = array( |
233 | 233 | 'block' => '' |
234 | 234 | ); |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | public function addFieldToGroup($fieldGroupName, $fieldName, $parameters = null) |
244 | 244 | { |
245 | 245 | $fields = $this->getFields(); |
246 | - if(! isset($fields[$fieldGroupName])){ |
|
246 | + if (!isset($fields[$fieldGroupName])) { |
|
247 | 247 | return $this; |
248 | 248 | } |
249 | 249 | $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array(); |
250 | - if(! isset($parameters)){ |
|
250 | + if (!isset($parameters)) { |
|
251 | 251 | $groupFields[$fieldName] = array( |
252 | 252 | 'block' => '' |
253 | 253 | ); |
@@ -281,15 +281,15 @@ discard block |
||
281 | 281 | public function updateFieldGroup($fieldGroupName, $updatedFieldName, $parameters = null) |
282 | 282 | { |
283 | 283 | $fields = $this->getFields(); |
284 | - if(! isset($fields[$fieldGroupName])){ |
|
284 | + if (!isset($fields[$fieldGroupName])) { |
|
285 | 285 | return $this; |
286 | 286 | } |
287 | 287 | $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array(); |
288 | - if(! isset($groupFields[$updatedFieldName])){ |
|
288 | + if (!isset($groupFields[$updatedFieldName])) { |
|
289 | 289 | $this->addFieldToGroup($fieldGroupName, $updatedFieldName, $parameters); |
290 | 290 | return $this; |
291 | 291 | } |
292 | - if(! isset($parameters)){ |
|
292 | + if (!isset($parameters)) { |
|
293 | 293 | $groupFields[$updatedFieldName] = array( |
294 | 294 | 'block' => '' |
295 | 295 | ); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function isVisibleForRecord(AppRecord $record) |
311 | 311 | { |
312 | - if(empty($this->visibilityCriteria)){ |
|
312 | + if (empty($this->visibilityCriteria)) { |
|
313 | 313 | return true; |
314 | 314 | } |
315 | 315 | |
@@ -318,36 +318,36 @@ discard block |
||
318 | 318 | |
319 | 319 | $arrCriteria = json_decode($this->visibilityCriteria, true); |
320 | 320 | |
321 | - foreach ($arrCriteria as $fieldName => $condition){ |
|
322 | - if(strpos($fieldName, '/') !== false){ |
|
321 | + foreach ($arrCriteria as $fieldName => $condition) { |
|
322 | + if (strpos($fieldName, '/') !== false) { |
|
323 | 323 | list ($oneField, $foreignField) = explode('/', $fieldName); |
324 | 324 | $field = $recordSet->$oneField()->$foreignField; |
325 | 325 | } |
326 | - else{ |
|
326 | + else { |
|
327 | 327 | $field = $recordSet->$fieldName; |
328 | 328 | } |
329 | - foreach ($condition as $op => $value){ |
|
330 | - if(! is_array($value)){ |
|
329 | + foreach ($condition as $op => $value) { |
|
330 | + if (!is_array($value)) { |
|
331 | 331 | $criteria = $field->$op($value); |
332 | 332 | } |
333 | - else{ |
|
334 | - foreach ($value as $foreignClassName => $foreignValues){ |
|
335 | - $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set'; |
|
333 | + else { |
|
334 | + foreach ($value as $foreignClassName => $foreignValues) { |
|
335 | + $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set'; |
|
336 | 336 | $foreignSet = $App->$foreignClassName(); |
337 | 337 | $foreignField = ''; |
338 | 338 | $foreignCondition = ''; |
339 | - foreach ($foreignValues as $foreignFieldName => $foreignConditions){ |
|
340 | - if($foreignFieldName === '_foreignField'){ |
|
339 | + foreach ($foreignValues as $foreignFieldName => $foreignConditions) { |
|
340 | + if ($foreignFieldName === '_foreignField') { |
|
341 | 341 | $foreignField = $foreignConditions; |
342 | 342 | } |
343 | - else{ |
|
344 | - foreach ($foreignConditions as $key => $val){ |
|
343 | + else { |
|
344 | + foreach ($foreignConditions as $key => $val) { |
|
345 | 345 | $foreignCondition = $foreignSet->$foreignFieldName->$key($val); |
346 | 346 | } |
347 | 347 | } |
348 | 348 | } |
349 | 349 | } |
350 | - if(method_exists($foreignSet, 'getDefaultCriteria')){ |
|
350 | + if (method_exists($foreignSet, 'getDefaultCriteria')) { |
|
351 | 351 | $foreignCondition = $foreignCondition->_AND_($foreignSet->getDefaultCriteria()); |
352 | 352 | } |
353 | 353 | $criteria = $field->in($foreignCondition, $foreignField); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | public function selectUserSSE($user = null) |
62 | 62 | { |
63 | - if(!isset($user)){ |
|
63 | + if (!isset($user)) { |
|
64 | 64 | $App = $this->App(); |
65 | 65 | $user = $App->getCurrentUser(); |
66 | 66 | } |
@@ -82,29 +82,29 @@ discard block |
||
82 | 82 | $userSSEReloads = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_RELOAD_SELECTOR))); |
83 | 83 | $reloadSelectors = array(); |
84 | 84 | $now = date('Y-m-d H:i:s'); |
85 | - foreach ($userSSEReloads as $sseMsg){ |
|
85 | + foreach ($userSSEReloads as $sseMsg) { |
|
86 | 86 | $reloadSelectors[] = $sseMsg->data; |
87 | - if($delete && $now > date($sseMsg->deleteOn)){ |
|
87 | + if ($delete && $now > date($sseMsg->deleteOn)) { |
|
88 | 88 | $sseMsg->delete(); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - if(!empty($reloadSelectors)){ |
|
92 | + if (!empty($reloadSelectors)) { |
|
93 | 93 | $sseData .= '"reloadSelector":'.bab_json_encode($reloadSelectors); |
94 | 94 | $hasData = true; |
95 | 95 | } |
96 | 96 | |
97 | 97 | $userSSEBrowserNotifications = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_BROWSER_NOTIFICATION))); |
98 | 98 | $browserNotifications = array(); |
99 | - foreach ($userSSEBrowserNotifications as $sseMsg){ |
|
99 | + foreach ($userSSEBrowserNotifications as $sseMsg) { |
|
100 | 100 | $browserNotifications[] = $sseMsg->data; |
101 | - if($delete){ |
|
101 | + if ($delete) { |
|
102 | 102 | $sseMsg->delete(); |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - if(!empty($browserNotifications)){ |
|
107 | - if($hasData){ |
|
106 | + if (!empty($browserNotifications)) { |
|
107 | + if ($hasData) { |
|
108 | 108 | $sseData .= ', '; |
109 | 109 | } |
110 | 110 | $sseData .= '"browserNotifications":'.bab_json_encode($browserNotifications); |
@@ -125,20 +125,20 @@ discard block |
||
125 | 125 | { |
126 | 126 | $App = $this->App(); |
127 | 127 | $users = array(); |
128 | - if(!isset($for)){ |
|
128 | + if (!isset($for)) { |
|
129 | 129 | $users[] = $App->getCurrentUser(); |
130 | 130 | } |
131 | - else if(!is_array($for)){ |
|
132 | - if($for === 'all'){ |
|
131 | + else if (!is_array($for)) { |
|
132 | + if ($for === 'all') { |
|
133 | 133 | $users = $App->getLoggedUsers(); |
134 | 134 | } |
135 | - else{ |
|
135 | + else { |
|
136 | 136 | $users[] = $for; |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | 140 | $deleteOn = self::getDeleteOn(); |
141 | - foreach ($users as $user){ |
|
141 | + foreach ($users as $user) { |
|
142 | 142 | $record = $this->newRecord(); |
143 | 143 | $record->user = $user; |
144 | 144 | $record->data = $reloadSelector; |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | { |
165 | 165 | $App = $this->App(); |
166 | 166 | $users = array(); |
167 | - if(!isset($for)){ |
|
167 | + if (!isset($for)) { |
|
168 | 168 | $users[] = $App->getCurrentUser(); |
169 | 169 | } |
170 | - else if(!is_array($for)){ |
|
171 | - if($for === 'all'){ |
|
170 | + else if (!is_array($for)) { |
|
171 | + if ($for === 'all') { |
|
172 | 172 | $users = $App->getLoggedUsers(); |
173 | 173 | } |
174 | - else{ |
|
174 | + else { |
|
175 | 175 | $users[] = $for; |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | 179 | $deleteOn = self::getDeleteOn(); |
180 | - foreach ($users as $user){ |
|
180 | + foreach ($users as $user) { |
|
181 | 181 | $record = $this->newRecord(); |
182 | 182 | $record->user = $user; |
183 | 183 | $record->data = bab_json_encode($data); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function getSource() |
46 | 46 | { |
47 | 47 | $App = $this->App(); |
48 | - return $App->getRecordByRef($this->sourceClass . ':' . $this->sourceId); |
|
48 | + return $App->getRecordByRef($this->sourceClass.':'.$this->sourceId); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function getTarget() |
55 | 55 | { |
56 | 56 | $App = $this->App(); |
57 | - return $App->getRecordByRef($this->targetClass . ':' . $this->targetId); |
|
57 | + return $App->getRecordByRef($this->targetClass.':'.$this->targetId); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | |
66 | 66 | public function selectUserNotifications($user = null, $seen = false) |
67 | 67 | { |
68 | - if(! isset($user)){ |
|
68 | + if (!isset($user)) { |
|
69 | 69 | $App = $this->App(); |
70 | 70 | $user = $App->getCurrentUser(); |
71 | 71 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function joinSource($sourceClass) |
104 | 104 | { |
105 | - if(! $this->sourceId instanceof $sourceClass){ |
|
106 | - $this->hasOne('sourceId', $sourceClass . 'Set'); |
|
105 | + if (!$this->sourceId instanceof $sourceClass) { |
|
106 | + $this->hasOne('sourceId', $sourceClass.'Set'); |
|
107 | 107 | $this->join('sourceId'); |
108 | 108 | } |
109 | 109 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function joinTarget($targetClass = null) |
115 | 115 | { |
116 | - if(! $this->targetId instanceof $targetClass){ |
|
117 | - $this->hasOne('targetId', $targetClass . 'Set'); |
|
116 | + if (!$this->targetId instanceof $targetClass) { |
|
117 | + $this->hasOne('targetId', $targetClass.'Set'); |
|
118 | 118 | $this->join('targetId'); |
119 | 119 | } |
120 | 120 | } |
@@ -162,21 +162,21 @@ discard block |
||
162 | 162 | { |
163 | 163 | $criteria = $this->sourceIs($object); |
164 | 164 | |
165 | - if(isset($targetClass)){ |
|
165 | + if (isset($targetClass)) { |
|
166 | 166 | $this->joinTarget($targetClass); |
167 | 167 | $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
168 | 168 | } |
169 | 169 | |
170 | - if(isset($linkType)){ |
|
171 | - if(is_array($linkType)){ |
|
170 | + if (isset($linkType)) { |
|
171 | + if (is_array($linkType)) { |
|
172 | 172 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
173 | 173 | } |
174 | - else{ |
|
174 | + else { |
|
175 | 175 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - if(is_a($this->targetId, 'app_TraceableRecordSet')){ |
|
179 | + if (is_a($this->targetId, 'app_TraceableRecordSet')) { |
|
180 | 180 | $criteria = $criteria->_AND_($this->targetId->deleted->is(false)); |
181 | 181 | } |
182 | 182 | |
@@ -191,24 +191,24 @@ discard block |
||
191 | 191 | $sourceClass = null; |
192 | 192 | $sourceIds = array(); |
193 | 193 | |
194 | - foreach ($objects as $obj){ |
|
195 | - if(is_null($sourceClass)){ |
|
194 | + foreach ($objects as $obj) { |
|
195 | + if (is_null($sourceClass)) { |
|
196 | 196 | $sourceClass = $obj->getClassName(); |
197 | 197 | } |
198 | 198 | $sourceIds[] = $obj->id; |
199 | 199 | } |
200 | 200 | $criteria = $this->sourceId->in($sourceIds)->_AND_($this->sourceClass->is($sourceClass)); |
201 | 201 | |
202 | - if(isset($targetClass)){ |
|
202 | + if (isset($targetClass)) { |
|
203 | 203 | $this->joinTarget($targetClass); |
204 | 204 | $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
205 | 205 | } |
206 | 206 | |
207 | - if(isset($linkType)){ |
|
208 | - if(is_array($linkType)){ |
|
207 | + if (isset($linkType)) { |
|
208 | + if (is_array($linkType)) { |
|
209 | 209 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
210 | 210 | } |
211 | - else{ |
|
211 | + else { |
|
212 | 212 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
213 | 213 | } |
214 | 214 | } |
@@ -222,16 +222,16 @@ discard block |
||
222 | 222 | { |
223 | 223 | $criteria = $this->targetIs($object); |
224 | 224 | |
225 | - if(isset($sourceClass)){ |
|
225 | + if (isset($sourceClass)) { |
|
226 | 226 | $this->joinSource($sourceClass); |
227 | 227 | $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
228 | 228 | } |
229 | 229 | |
230 | - if(isset($linkType)){ |
|
231 | - if(is_array($linkType)){ |
|
230 | + if (isset($linkType)) { |
|
231 | + if (is_array($linkType)) { |
|
232 | 232 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
233 | 233 | } |
234 | - else{ |
|
234 | + else { |
|
235 | 235 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
236 | 236 | } |
237 | 237 | } |
@@ -247,24 +247,24 @@ discard block |
||
247 | 247 | $targetClass = null; |
248 | 248 | $targetIds = array(); |
249 | 249 | |
250 | - foreach ($objects as $obj){ |
|
251 | - if(is_null($targetClass)){ |
|
250 | + foreach ($objects as $obj) { |
|
251 | + if (is_null($targetClass)) { |
|
252 | 252 | $targetClass = $obj->getClassName(); |
253 | 253 | } |
254 | 254 | $targetIds[] = $obj->id; |
255 | 255 | } |
256 | 256 | $criteria = $this->targetId->in($targetIds)->_AND_($this->targetClass->is($targetClass)); |
257 | 257 | |
258 | - if(isset($sourceClass)){ |
|
258 | + if (isset($sourceClass)) { |
|
259 | 259 | $this->joinSource($sourceClass); |
260 | 260 | $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
261 | 261 | } |
262 | 262 | |
263 | - if(isset($linkType)){ |
|
264 | - if(is_array($linkType)){ |
|
263 | + if (isset($linkType)) { |
|
264 | + if (is_array($linkType)) { |
|
265 | 265 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
266 | 266 | } |
267 | - else{ |
|
267 | + else { |
|
268 | 268 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
269 | 269 | } |
270 | 270 | } |
@@ -288,17 +288,17 @@ discard block |
||
288 | 288 | |
289 | 289 | $criteria = $set->sourceId->is($object->id)->_AND_($set->sourceClass->is($object->getClassName())); |
290 | 290 | |
291 | - if(null !== $targetClass){ |
|
291 | + if (null !== $targetClass) { |
|
292 | 292 | $criteria = $criteria->_AND_($set->targetClass->is($targetClass)); |
293 | 293 | } |
294 | - if(null !== $linkType){ |
|
294 | + if (null !== $linkType) { |
|
295 | 295 | $criteria = $criteria->_AND_($set->type->is($linkType)); |
296 | 296 | } |
297 | 297 | |
298 | - if($deleteTarget){ |
|
299 | - foreach ($set->select($criteria) as $link){ |
|
298 | + if ($deleteTarget) { |
|
299 | + foreach ($set->select($criteria) as $link) { |
|
300 | 300 | |
301 | - $className = $link->targetClass . 'Set'; |
|
301 | + $className = $link->targetClass.'Set'; |
|
302 | 302 | |
303 | 303 | // remove prefix |
304 | 304 | |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | ->_AND_($this->sourceClass->is($source->getClassName())) |
327 | 327 | ->_AND_($this->targetId->is($target->id)) |
328 | 328 | ->_AND_($this->targetClass->is($target->getClassName())); |
329 | - if(isset($linkType)){ |
|
330 | - if(is_array($linkType)){ |
|
329 | + if (isset($linkType)) { |
|
330 | + if (is_array($linkType)) { |
|
331 | 331 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
332 | 332 | } |
333 | - else{ |
|
333 | + else { |
|
334 | 334 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
335 | 335 | } |
336 | 336 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | static $layouts = null; |
55 | 55 | |
56 | - if(! isset($layouts)){ |
|
56 | + if (!isset($layouts)) { |
|
57 | 57 | $layouts = array( |
58 | 58 | self::LAYOUT_VERTICAL_BOX => app_translate('Vertical box'), |
59 | 59 | self::LAYOUT_HORIZONTAL_BOX => app_translate('Horizontal box'), |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function isVisibleForRecord(AppRecord $record) |
72 | 72 | { |
73 | - if(empty($this->visibilityCriteria)){ |
|
73 | + if (empty($this->visibilityCriteria)) { |
|
74 | 74 | return true; |
75 | 75 | } |
76 | 76 | |
@@ -79,36 +79,36 @@ discard block |
||
79 | 79 | |
80 | 80 | $arrCriteria = json_decode($this->visibilityCriteria, true); |
81 | 81 | |
82 | - foreach ($arrCriteria as $fieldName => $condition){ |
|
83 | - if(strpos($fieldName, '/') !== false){ |
|
82 | + foreach ($arrCriteria as $fieldName => $condition) { |
|
83 | + if (strpos($fieldName, '/') !== false) { |
|
84 | 84 | list ($oneField, $foreignField) = explode('/', $fieldName); |
85 | 85 | $field = $recordSet->$oneField()->$foreignField; |
86 | 86 | } |
87 | - else{ |
|
87 | + else { |
|
88 | 88 | $field = $recordSet->$fieldName; |
89 | 89 | } |
90 | - foreach ($condition as $op => $value){ |
|
91 | - if(! is_array($value)){ |
|
90 | + foreach ($condition as $op => $value) { |
|
91 | + if (!is_array($value)) { |
|
92 | 92 | $criteria = $field->$op($value); |
93 | 93 | } |
94 | - else{ |
|
95 | - foreach ($value as $foreignClassName => $foreignValues){ |
|
96 | - $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set'; |
|
94 | + else { |
|
95 | + foreach ($value as $foreignClassName => $foreignValues) { |
|
96 | + $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set'; |
|
97 | 97 | $foreignSet = $App->$foreignClassName(); |
98 | 98 | $foreignField = ''; |
99 | 99 | $foreignCondition = ''; |
100 | - foreach ($foreignValues as $foreignFieldName => $foreignConditions){ |
|
101 | - if($foreignFieldName === '_foreignField'){ |
|
100 | + foreach ($foreignValues as $foreignFieldName => $foreignConditions) { |
|
101 | + if ($foreignFieldName === '_foreignField') { |
|
102 | 102 | $foreignField = $foreignConditions; |
103 | 103 | } |
104 | - else{ |
|
105 | - foreach ($foreignConditions as $key => $val){ |
|
104 | + else { |
|
105 | + foreach ($foreignConditions as $key => $val) { |
|
106 | 106 | $foreignCondition = $foreignSet->$foreignFieldName->$key($val); |
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
111 | - if(method_exists($foreignSet, 'getDefaultCriteria')){ |
|
111 | + if (method_exists($foreignSet, 'getDefaultCriteria')) { |
|
112 | 112 | $foreignCondition = $foreignCondition->_AND_($foreignSet->getDefaultCriteria()); |
113 | 113 | } |
114 | 114 | $criteria = $field->in($foreignCondition, $foreignField); |