@@ -42,7 +42,6 @@ |
||
42 | 42 | /** |
43 | 43 | * @method FuncApp App() |
44 | 44 | * @method AppCustomFieldSet getParentSet() |
45 | - |
|
46 | 45 | * @property string $name |
47 | 46 | * @property string $fieldname |
48 | 47 | * @property string $description |
@@ -83,7 +83,7 @@ |
||
83 | 83 | break; |
84 | 84 | |
85 | 85 | default: |
86 | - $function = 'Capwelton\LibOrm\ORM_' . $this->fieldtype . 'Field'; |
|
86 | + $function = 'Capwelton\LibOrm\ORM_'.$this->fieldtype.'Field'; |
|
87 | 87 | $field = $function($this->fieldname); |
88 | 88 | break; |
89 | 89 | } |
@@ -52,7 +52,6 @@ |
||
52 | 52 | * @method AppCustomField request(mixed $criteria) |
53 | 53 | * @method AppCustomField[]|ORMIterator select(ORMCriteria $criteria) |
54 | 54 | * @method AppCustomField newRecord() |
55 | - |
|
56 | 55 | * @property ORMStringField $name |
57 | 56 | * @property ORMStringField $fieldname |
58 | 57 | * @property ORMTextField $description |
@@ -129,7 +129,7 @@ |
||
129 | 129 | throw new AppSaveException($this->App()->translate('The name is mandatory')); |
130 | 130 | } |
131 | 131 | |
132 | - return '_' . $name; |
|
132 | + return '_'.$name; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | { |
69 | 69 | $value = $this->oParentSet->getBackend()->getRecordValue($this, $sFieldName); |
70 | 70 | $field = $this->oParentSet->$sFieldName; |
71 | - if(! is_null($value) && $field instanceof ORMFkField){ |
|
71 | + if (!is_null($value) && $field instanceof ORMFkField) { |
|
72 | 72 | |
73 | 73 | $sClassName = $field->getForeignSetName(); |
74 | - if($field instanceof AppFkField){ |
|
74 | + if ($field instanceof AppFkField) { |
|
75 | 75 | $App = $field->App(); |
76 | - }else{ |
|
76 | + } else { |
|
77 | 77 | $App = $this->App(); |
78 | 78 | } |
79 | 79 | $set = $App->$sClassName(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function App() |
108 | 108 | { |
109 | - if(! isset($this->app)){ |
|
109 | + if (!isset($this->app)) { |
|
110 | 110 | // If the app object was not specified (through the setApp() method), |
111 | 111 | // we set it as parent set's App. |
112 | 112 | $this->setApp($this->getParentSet() |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | $rClass = new \ReflectionClass(get_class($this)); |
129 | 129 | $component = $App->getComponentByName($rClass->getShortName()); |
130 | 130 | $classname = $rClass->getShortName(); |
131 | - if(isset($component)){ |
|
131 | + if (isset($component)) { |
|
132 | 132 | return $component->getRecordClassName(); |
133 | 133 | // list(, $classname) = explode('_', $component->getRecordClassName()); |
134 | 134 | // return $classname; |
135 | 135 | } |
136 | - if(str_contains($classname,'_')){ |
|
136 | + if (str_contains($classname, '_')) { |
|
137 | 137 | list (, $classname) = explode('_', get_class($this)); |
138 | 138 | } |
139 | 139 | return $classname; |
@@ -146,18 +146,18 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function getRef() |
148 | 148 | { |
149 | - if(! isset($this->id)){ |
|
149 | + if (!isset($this->id)) { |
|
150 | 150 | throw new AppException('Trying to get the reference string of a record without an id.'); |
151 | 151 | } |
152 | 152 | $classname = $this->getClassName(); |
153 | - return $classname . ':' . $this->id; |
|
153 | + return $classname.':'.$this->id; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | public function getFrontRef() |
157 | 157 | { |
158 | - if($this->getParentSet()->usesWebIdTrait() && isset($this->webId)){ |
|
158 | + if ($this->getParentSet()->usesWebIdTrait() && isset($this->webId)) { |
|
159 | 159 | $classname = $this->getClassName(); |
160 | - return $classname . ':' . $this->webId; |
|
160 | + return $classname.':'.$this->webId; |
|
161 | 161 | } |
162 | 162 | return $this->getRef(); |
163 | 163 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | { |
187 | 187 | $App = $this->App(); |
188 | 188 | |
189 | - if(! isset($deletedStatus)){ |
|
189 | + if (!isset($deletedStatus)) { |
|
190 | 190 | $deletedStatus = AppTraceableRecord::DELETED_STATUS_DELETED; |
191 | 191 | } |
192 | 192 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | // referenced elements. |
199 | 199 | $manyRelations = $set->getHasManyRelations(); |
200 | 200 | |
201 | - foreach ($manyRelations as $manyRelation){ |
|
201 | + foreach ($manyRelations as $manyRelation) { |
|
202 | 202 | /* @var $manyRelation ORMManyRelation */ |
203 | 203 | |
204 | 204 | $foreignSetClassName = $manyRelation->getForeignSetClassName(); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId)); |
214 | 214 | |
215 | - foreach ($foreignRecords as $foreignRecord){ |
|
215 | + foreach ($foreignRecords as $foreignRecord) { |
|
216 | 216 | $foreignRecord->$foreignSetFieldName = 0; |
217 | 217 | $foreignRecord->save(); |
218 | 218 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId)); |
225 | 225 | |
226 | - foreach ($foreignRecords as $foreignRecord){ |
|
226 | + foreach ($foreignRecords as $foreignRecord) { |
|
227 | 227 | $foreignRecord->delete(); |
228 | 228 | } |
229 | 229 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | // referenced elements. |
270 | 270 | $manyRelations = $set->getHasManyRelations(); |
271 | 271 | |
272 | - foreach ($manyRelations as $manyRelation){ |
|
272 | + foreach ($manyRelations as $manyRelation) { |
|
273 | 273 | /* @var $manyRelation ORMManyRelation */ |
274 | 274 | |
275 | 275 | $foreignSetClassName = $manyRelation->getForeignSetClassName(); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // $foreignSet = new $foreignSetClassName($App); |
280 | 280 | $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId)); |
281 | 281 | |
282 | - foreach ($foreignRecords as $foreignRecord){ |
|
282 | + foreach ($foreignRecords as $foreignRecord) { |
|
283 | 283 | $foreignRecord->$foreignSetFieldName = $id; |
284 | 284 | $foreignRecord->save(); |
285 | 285 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $links = $linkSet->select($linkSet->sourceClass->is($recordClassName) |
293 | 293 | ->_AND_($linkSet->sourceId->is($recordId))); |
294 | 294 | |
295 | - foreach ($links as $link){ |
|
295 | + foreach ($links as $link) { |
|
296 | 296 | $link->sourceId = $id; |
297 | 297 | $link->save(); |
298 | 298 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $links = $linkSet->select($linkSet->targetClass->is($recordClassName) |
301 | 301 | ->_AND_($linkSet->targetId->is($recordId))); |
302 | 302 | |
303 | - foreach ($links as $link){ |
|
303 | + foreach ($links as $link) { |
|
304 | 304 | $link->targetId = $id; |
305 | 305 | $link->save(); |
306 | 306 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | $relatedRecords = array(); |
327 | 327 | |
328 | - foreach ($manyRelations as $manyRelation){ |
|
328 | + foreach ($manyRelations as $manyRelation) { |
|
329 | 329 | /* @var $manyRelation ORMManyRelation */ |
330 | 330 | |
331 | 331 | $foreignSetClassName = $manyRelation->getForeignSetClassName(); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | // $foreignSet = new $foreignSetClassName($App); |
337 | 337 | $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId)); |
338 | 338 | |
339 | - if($foreignRecords->count() > 0){ |
|
339 | + if ($foreignRecords->count() > 0) { |
|
340 | 340 | $relatedRecords[$foreignSetClassName] = $foreignRecords; |
341 | 341 | } |
342 | 342 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | { |
354 | 354 | $path = $this->App()->uploadPath(); |
355 | 355 | |
356 | - if(null === $path){ |
|
356 | + if (null === $path) { |
|
357 | 357 | throw new \Exception('Missing upload path information'); |
358 | 358 | return null; |
359 | 359 | } |
@@ -373,12 +373,12 @@ discard block |
||
373 | 373 | $linkSet = $App->LinkSet(); |
374 | 374 | |
375 | 375 | $sourceClass = $source->getClassName(); |
376 | - if(strpos($sourceClass, '\\')){ |
|
376 | + if (strpos($sourceClass, '\\')) { |
|
377 | 377 | $targetClass = (new \ReflectionClass($sourceClass))->getShortName(); |
378 | 378 | } |
379 | 379 | |
380 | 380 | $targetClass = $this->getClassName(); |
381 | - if(strpos($targetClass, '\\')){ |
|
381 | + if (strpos($targetClass, '\\')) { |
|
382 | 382 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
383 | 383 | } |
384 | 384 | |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | ->_AND_($linkSet->sourceId->is($source->id)) |
387 | 387 | ->_AND_($linkSet->targetClass->is($targetClass)) |
388 | 388 | ->_AND_($linkSet->targetId->is($this->id)); |
389 | - if(isset($linkType)){ |
|
390 | - if(is_array($linkType)){ |
|
389 | + if (isset($linkType)) { |
|
390 | + if (is_array($linkType)) { |
|
391 | 391 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
392 | 392 | } |
393 | - else{ |
|
393 | + else { |
|
394 | 394 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
395 | 395 | } |
396 | 396 | } |
@@ -413,22 +413,22 @@ discard block |
||
413 | 413 | $linkSet = $App->LinkSet(); |
414 | 414 | |
415 | 415 | $sourceClass = $this->getClassName(); |
416 | - if(strpos($sourceClass, '\\')){ |
|
416 | + if (strpos($sourceClass, '\\')) { |
|
417 | 417 | $targetClass = (new \ReflectionClass($sourceClass))->getShortName(); |
418 | 418 | } |
419 | 419 | |
420 | 420 | $targetClass = $target->getClassName(); |
421 | - if(strpos($targetClass, '\\')){ |
|
421 | + if (strpos($targetClass, '\\')) { |
|
422 | 422 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
423 | 423 | } |
424 | 424 | |
425 | 425 | $criteria = $linkSet->all($linkSet->targetClass->is($targetClass), $linkSet->targetId->is($target->id), $linkSet->sourceClass->is($sourceClass), $linkSet->sourceId->is($this->id)); |
426 | 426 | |
427 | - if(isset($linkType)){ |
|
428 | - if(is_array($linkType)){ |
|
427 | + if (isset($linkType)) { |
|
428 | + if (is_array($linkType)) { |
|
429 | 429 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
430 | 430 | } |
431 | - else{ |
|
431 | + else { |
|
432 | 432 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
433 | 433 | } |
434 | 434 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | protected function importProperty($name, $value) |
492 | 492 | { |
493 | - if(((string) $this->$name) !== ((string) $value)){ |
|
493 | + if (((string) $this->$name) !== ((string) $value)) { |
|
494 | 494 | $this->$name = $value; |
495 | 495 | return 1; |
496 | 496 | } |
@@ -510,13 +510,13 @@ discard block |
||
510 | 510 | */ |
511 | 511 | protected function importDate($name, $value) |
512 | 512 | { |
513 | - if(preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)){ |
|
513 | + if (preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)) { |
|
514 | 514 | return $this->importProperty($name, $value); |
515 | 515 | } |
516 | 516 | |
517 | 517 | // try in DD/MM/YYYY format |
518 | 518 | |
519 | - if(preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)){ |
|
519 | + if (preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)) { |
|
520 | 520 | |
521 | 521 | $value = sprintf('%04d-%02d-%02d', (int) $matches['year'], (int) $matches['month'], (int) $matches['day']); |
522 | 522 | |
@@ -536,11 +536,11 @@ discard block |
||
536 | 536 | $customContainers->groupBy($customContainerSet->view); |
537 | 537 | |
538 | 538 | $views = array(); |
539 | - foreach ($customContainers as $customContainer){ |
|
539 | + foreach ($customContainers as $customContainer) { |
|
540 | 540 | $views[] = $customContainer->view; |
541 | 541 | } |
542 | 542 | |
543 | - if(empty($views)){ |
|
543 | + if (empty($views)) { |
|
544 | 544 | $views[] = ''; |
545 | 545 | } |
546 | 546 | |
@@ -624,9 +624,9 @@ discard block |
||
624 | 624 | */ |
625 | 625 | public function requireReadable($message = null) |
626 | 626 | { |
627 | - if(! $this->isReadable()){ |
|
627 | + if (!$this->isReadable()) { |
|
628 | 628 | $App = $this->App(); |
629 | - if(! isset($message)){ |
|
629 | + if (!isset($message)) { |
|
630 | 630 | $message = $App->translate('Access denied'); |
631 | 631 | } |
632 | 632 | throw new AppAccessException($message); |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | */ |
643 | 643 | public function requireUpdatable($message = null) |
644 | 644 | { |
645 | - if(! $this->isUpdatable()){ |
|
645 | + if (!$this->isUpdatable()) { |
|
646 | 646 | $App = $this->App(); |
647 | - if(! isset($message)){ |
|
647 | + if (!isset($message)) { |
|
648 | 648 | $message = $App->translate('Access denied'); |
649 | 649 | } |
650 | 650 | throw new AppAccessException($message); |
@@ -660,9 +660,9 @@ discard block |
||
660 | 660 | */ |
661 | 661 | public function requireDeletable($message = null) |
662 | 662 | { |
663 | - if(! $this->isDeletable()){ |
|
663 | + if (!$this->isDeletable()) { |
|
664 | 664 | $App = $this->App(); |
665 | - if(! isset($message)){ |
|
665 | + if (!isset($message)) { |
|
666 | 666 | $message = $App->translate('Access denied'); |
667 | 667 | } |
668 | 668 | throw new AppAccessException($message); |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | |
672 | 672 | public function getFrontId() |
673 | 673 | { |
674 | - if($this->getParentSet()->usesWebIdTrait()){ |
|
674 | + if ($this->getParentSet()->usesWebIdTrait()) { |
|
675 | 675 | return $this->webId; |
676 | 676 | } |
677 | 677 | return $this->id; |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | public function getFormOutputValues() |
687 | 687 | { |
688 | 688 | $values = parent::getFormOutputValues(); |
689 | - if($this->getParentSet()->usesWebIdTrait()){ |
|
689 | + if ($this->getParentSet()->usesWebIdTrait()) { |
|
690 | 690 | $values['id'] = $this->webId; |
691 | 691 | unset($values['webId']); |
692 | 692 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $sClassName = $field->getForeignSetName(); |
74 | 74 | if($field instanceof AppFkField){ |
75 | 75 | $App = $field->App(); |
76 | - }else{ |
|
76 | + } else{ |
|
77 | 77 | $App = $this->App(); |
78 | 78 | } |
79 | 79 | $set = $App->$sClassName(); |
@@ -389,8 +389,7 @@ discard block |
||
389 | 389 | if(isset($linkType)){ |
390 | 390 | if(is_array($linkType)){ |
391 | 391 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
392 | - } |
|
393 | - else{ |
|
392 | + } else{ |
|
394 | 393 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
395 | 394 | } |
396 | 395 | } |
@@ -427,8 +426,7 @@ discard block |
||
427 | 426 | if(isset($linkType)){ |
428 | 427 | if(is_array($linkType)){ |
429 | 428 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
430 | - } |
|
431 | - else{ |
|
429 | + } else{ |
|
432 | 430 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
433 | 431 | } |
434 | 432 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $App = $this->App(); |
56 | 56 | $sseSet = $App->SSESet(); |
57 | - $sseSet->newReloadSelector('.' . self::NOTIFICATION_PORTLET_CLASS); |
|
57 | + $sseSet->newReloadSelector('.'.self::NOTIFICATION_PORTLET_CLASS); |
|
58 | 58 | $sseSet->newBrowserNotification(array( |
59 | 59 | 'title' => $this->title, |
60 | 60 | 'body' => $this->description, |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->seen = true; |
70 | 70 | $this->save(); |
71 | 71 | $sseSet = $this->App()->SSESet(); |
72 | - $sseSet->newReloadSelector('.' . self::NOTIFICATION_PORTLET_CLASS); |
|
72 | + $sseSet->newReloadSelector('.'.self::NOTIFICATION_PORTLET_CLASS); |
|
73 | 73 | return true; |
74 | 74 | } |
75 | 75 | } |
@@ -107,7 +107,7 @@ |
||
107 | 107 | $criteria = $field->$op($value); |
108 | 108 | } else { |
109 | 109 | foreach ($value as $foreignClassName => $foreignValues) { |
110 | - $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set'; |
|
110 | + $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set'; |
|
111 | 111 | $foreignSet = $App->$foreignClassName(); |
112 | 112 | $foreignField = ''; |
113 | 113 | $foreignCondition = ''; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $displayFieldName = $displayField['fieldname']; |
347 | 347 | $parameters = $displayField['parameters']; |
348 | 348 | $label = isset($parameters['label']) && !empty($parameters['label']) ? $parameters['label'] : null; |
349 | - $displayFieldMethod = '_' . $displayFieldName; |
|
349 | + $displayFieldMethod = '_'.$displayFieldName; |
|
350 | 350 | if (!$isGroupField && method_exists($this, $displayFieldMethod)) { |
351 | 351 | $item = $this->$displayFieldMethod($customSection, $label); |
352 | 352 | } else { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | '', |
413 | 413 | $this->record->getController()->editSection($this->record->getFrontId(), $customSection->id) |
414 | 414 | )->addClass('widget-actionbutton', 'section-button', 'icon', FuncIcons::ACTIONS_DOCUMENT_EDIT) |
415 | - ->setOpenMode(WidgetLink::OPEN_DIALOG)->setDialogClass('customSectionEditorDialog ' . $customSection->classname . ' '.$customSection->editDialogClass) |
|
415 | + ->setOpenMode(WidgetLink::OPEN_DIALOG)->setDialogClass('customSectionEditorDialog '.$customSection->classname.' '.$customSection->editDialogClass) |
|
416 | 416 | ); |
417 | 417 | } |
418 | 418 | |
@@ -603,9 +603,9 @@ discard block |
||
603 | 603 | |
604 | 604 | $displayFieldName = $field['fieldname']; |
605 | 605 | |
606 | - $displayFieldMethod = '_' . $displayFieldName; |
|
606 | + $displayFieldMethod = '_'.$displayFieldName; |
|
607 | 607 | |
608 | - if(strpos($displayFieldMethod, '__subSection') !== false){ |
|
608 | + if (strpos($displayFieldMethod, '__subSection') !== false) { |
|
609 | 609 | $item = $this->__subSection($customSection, $field); |
610 | 610 | } elseif (method_exists($this, $displayFieldMethod)) { |
611 | 611 | $item = $this->$displayFieldMethod($customSection, $labelField); |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | $box = $W->FlexItems()->setGrowable(true)->setWrap(WidgetFlexLayout::FLEX_WRAP_WRAP)->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL); |
647 | 647 | |
648 | - if(isset($fieldDefinition['fields'])){ |
|
648 | + if (isset($fieldDefinition['fields'])) { |
|
649 | 649 | foreach ($fieldDefinition['fields'] as $field) { |
650 | 650 | $item = null; |
651 | 651 | $parameters = $field['parameters']; |
@@ -656,9 +656,9 @@ discard block |
||
656 | 656 | |
657 | 657 | $displayFieldName = $field['fieldname']; |
658 | 658 | |
659 | - $displayFieldMethod = '_' . $displayFieldName; |
|
659 | + $displayFieldMethod = '_'.$displayFieldName; |
|
660 | 660 | |
661 | - if(strpos($displayFieldMethod, '__fieldsGroup') !== false){ |
|
661 | + if (strpos($displayFieldMethod, '__fieldsGroup') !== false) { |
|
662 | 662 | $item = $this->__fieldsGroup($customSection, $field); |
663 | 663 | } elseif (method_exists($this, $displayFieldMethod)) { |
664 | 664 | $item = $this->$displayFieldMethod($customSection, $labelField); |
@@ -61,22 +61,22 @@ discard block |
||
61 | 61 | $App = $this->App(); |
62 | 62 | $Ui = $App->Ui(); |
63 | 63 | |
64 | - if(strpos($name, $App->classPrefix) !== false){ |
|
64 | + if (strpos($name, $App->classPrefix) !== false) { |
|
65 | 65 | list(, $name) = explode($App->classPrefix, $name); |
66 | 66 | } |
67 | 67 | |
68 | - if(method_exists($Ui, $name)){ |
|
68 | + if (method_exists($Ui, $name)) { |
|
69 | 69 | return call_user_func_array(array($Ui, $name), $arguments); |
70 | 70 | } |
71 | 71 | |
72 | 72 | $components = $App->getComponents(); |
73 | - foreach ($components as $component){ |
|
74 | - try{ |
|
73 | + foreach ($components as $component) { |
|
74 | + try { |
|
75 | 75 | $componentUi = $component->ui(); |
76 | - if(isset($componentUi) && method_exists($componentUi, $name)){ |
|
76 | + if (isset($componentUi) && method_exists($componentUi, $name)) { |
|
77 | 77 | return call_user_func_array(array($componentUi, $name), $arguments); |
78 | 78 | } |
79 | - }catch(Exception $e){} |
|
79 | + } catch (Exception $e) {} |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $rc = new \ReflectionClass($this); |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | $page->addMessageInfo(); |
98 | 98 | |
99 | 99 | $addon = $App->getAddon(); |
100 | - if($addon){ |
|
100 | + if ($addon) { |
|
101 | 101 | $components = $App->getComponents(); |
102 | - foreach ($components as $component){ |
|
102 | + foreach ($components as $component) { |
|
103 | 103 | $stylePath = $component->getStylePath(); |
104 | - if($stylePath){ |
|
104 | + if ($stylePath) { |
|
105 | 105 | $page->addStyleSheet($stylePath.'style.css'); |
106 | 106 | } |
107 | 107 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | if(isset($componentUi) && method_exists($componentUi, $name)){ |
77 | 77 | return call_user_func_array(array($componentUi, $name), $arguments); |
78 | 78 | } |
79 | - }catch(Exception $e){} |
|
79 | + } catch(Exception $e){} |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $rc = new \ReflectionClass($this); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | class AppRecordEditor extends AppEditor |
48 | 48 | { |
49 | - public function __construct(FuncApp $app, $id = null, WidgetLayout $layout = null,AppRecord $record = null) |
|
49 | + public function __construct(FuncApp $app, $id = null, WidgetLayout $layout = null, AppRecord $record = null) |
|
50 | 50 | { |
51 | 51 | $this->record = $record; |
52 | 52 | parent::__construct($app, $id, $layout); |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | |
55 | 55 | public function __call($name, $arguments) |
56 | 56 | { |
57 | - if (substr($name, 0, 1) !== '_'){ |
|
57 | + if (substr($name, 0, 1) !== '_') { |
|
58 | 58 | return parent::__call($name, $arguments); |
59 | 59 | } |
60 | 60 | |
61 | - try{ |
|
61 | + try { |
|
62 | 62 | $App = $this->App(); |
63 | 63 | |
64 | 64 | $customSection = $arguments[0]; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | return $item; |
85 | 85 | } |
86 | - catch(Exception $e){ |
|
86 | + catch (Exception $e) { |
|
87 | 87 | return null; |
88 | 88 | } |
89 | 89 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | protected function getRecordSet() |
102 | 102 | { |
103 | - if(!isset($this->recordSet)){ |
|
103 | + if (!isset($this->recordSet)) { |
|
104 | 104 | $this->recordSet = parent::getRecordSet(); |
105 | 105 | } |
106 | 106 | return $this->recordSet; |
@@ -316,14 +316,14 @@ discard block |
||
316 | 316 | $sizePolicy = 'customsection-field-box '; |
317 | 317 | $sizePolicy .= isset($parameters['sizePolicy']) ? $parameters['sizePolicy'] : ''; |
318 | 318 | $sizePolicy .= isset($parameters['transparentBackground']) && $parameters['transparentBackground'] ? 'customsection-field-box-transparentBackground' : ''; |
319 | - $displayFieldMethod = '_' . $displayFieldName; |
|
319 | + $displayFieldMethod = '_'.$displayFieldName; |
|
320 | 320 | |
321 | 321 | if (!$isGroupField && method_exists($this, $displayFieldMethod)) { |
322 | 322 | $widget = $this->$displayFieldMethod($customSection, $label); |
323 | 323 | $item = $widget; |
324 | 324 | } |
325 | 325 | else { |
326 | - if($isGroupField){ |
|
326 | + if ($isGroupField) { |
|
327 | 327 | if (method_exists($this, '__fieldsGroup')) { |
328 | 328 | $customSection->fieldsLayout = $groupFieldsLayout; |
329 | 329 | $item = $this->__fieldsGroup($customSection, $displayField); |
@@ -331,14 +331,14 @@ discard block |
||
331 | 331 | } |
332 | 332 | $sizePolicy .= ' customsection-fieldsgroup-box'; |
333 | 333 | } |
334 | - elseif($isSpacerField){ |
|
334 | + elseif ($isSpacerField) { |
|
335 | 335 | list(, $spacerId) = explode('_spacer', $displayFieldId); |
336 | 336 | if (method_exists($this, '__spacer')) { |
337 | 337 | $item = $this->__spacer($customSection, $spacerId, $label); |
338 | 338 | } |
339 | 339 | } |
340 | - else{ |
|
341 | - try{ |
|
340 | + else { |
|
341 | + try { |
|
342 | 342 | $field = $recordSet->getField($displayFieldName); |
343 | 343 | if ($label === '' || $label === '__') { |
344 | 344 | $label = $field->getDescription(); |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | $parameters = $displayField['parameters']; |
401 | 401 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
402 | 402 | $label = isset($parameters['label']) && !empty($parameters['label']) && $parameters['label'] !== '__' ? $parameters['label'] : null; |
403 | - $displayFieldMethod = '_' . $displayFieldName; |
|
403 | + $displayFieldMethod = '_'.$displayFieldName; |
|
404 | 404 | $sizePolicy = 'customsection-field-box '; |
405 | 405 | $sizePolicy .= isset($parameters['sizePolicy']) ? $parameters['sizePolicy'] : ''; |
406 | 406 | if (!$isGroupField && method_exists($this, $displayFieldMethod)) { |
407 | 407 | $item = $this->$displayFieldMethod($customSection, $label); |
408 | 408 | } |
409 | - else{ |
|
410 | - if($isGroupField){ |
|
409 | + else { |
|
410 | + if ($isGroupField) { |
|
411 | 411 | if (method_exists($this, '__fieldsGroup')) { |
412 | 412 | $customSection->fieldsLayout = $groupFieldsLayout; |
413 | 413 | $item = $this->__fieldsGroup($customSection, $displayField); |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | } |
416 | 416 | $sizePolicy .= ' customsection-fieldsgroup-box'; |
417 | 417 | } |
418 | - else{ |
|
418 | + else { |
|
419 | 419 | try { |
420 | 420 | $field = $this->recordSet->getField($displayFieldName); |
421 | 421 | if (!isset($label) || empty($label)) { |
@@ -462,17 +462,17 @@ discard block |
||
462 | 462 | $box = $W->FlexItems()->setGrowable(true)->setWrap(WidgetFlexLayout::FLEX_WRAP_WRAP); |
463 | 463 | $recordSet = $this->getRecordSet(); |
464 | 464 | |
465 | - if(isset($fieldDefinition['fields'])){ |
|
466 | - foreach ($fieldDefinition['fields'] as $field){ |
|
465 | + if (isset($fieldDefinition['fields'])) { |
|
466 | + foreach ($fieldDefinition['fields'] as $field) { |
|
467 | 467 | $item = null; |
468 | 468 | |
469 | 469 | $labelField = isset($field['parameters']['label']) ? $field['parameters']['label'] : ''; |
470 | 470 | $itemClass = isset($field['parameters']['classname']) ? $field['parameters']['classname'] : ''; |
471 | 471 | $displayFieldName = $field['fieldname']; |
472 | - $displayFieldMethod = '_' . $displayFieldName; |
|
473 | - if(strpos($displayFieldMethod, '__subSection') !== false){ |
|
472 | + $displayFieldMethod = '_'.$displayFieldName; |
|
473 | + if (strpos($displayFieldMethod, '__subSection') !== false) { |
|
474 | 474 | $item = $this->__subSection($customSection, $field); |
475 | - if(!isset($item) || count($item->getItems()) == 0){ |
|
475 | + if (!isset($item) || count($item->getItems()) == 0) { |
|
476 | 476 | continue; |
477 | 477 | } |
478 | 478 | }elseif (method_exists($this, $displayFieldMethod)) { |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | } |
493 | 493 | $item = $this->getValueItem($customSection, $field, $labelField, $item); |
494 | 494 | } |
495 | - if(isset($item)){ |
|
495 | + if (isset($item)) { |
|
496 | 496 | $item->addClass('app-customsection-groupedfield'); |
497 | 497 | $item->addClass($itemClass); |
498 | 498 | $box->addItem($item); |
@@ -511,17 +511,17 @@ discard block |
||
511 | 511 | $box = $W->FlexItems()->setGrowable(true)->setWrap(WidgetFlexLayout::FLEX_WRAP_WRAP); |
512 | 512 | $recordSet = $this->getRecordSet(); |
513 | 513 | |
514 | - if(isset($fieldDefinition['fields'])){ |
|
515 | - foreach ($fieldDefinition['fields'] as $field){ |
|
514 | + if (isset($fieldDefinition['fields'])) { |
|
515 | + foreach ($fieldDefinition['fields'] as $field) { |
|
516 | 516 | $item = null; |
517 | 517 | |
518 | 518 | $labelField = isset($field['parameters']['label']) ? $field['parameters']['label'] : ''; |
519 | 519 | $itemClass = isset($field['parameters']['classname']) ? $field['parameters']['classname'] : ''; |
520 | 520 | $displayFieldName = $field['fieldname']; |
521 | - $displayFieldMethod = '_' . $displayFieldName; |
|
522 | - if(strpos($displayFieldMethod, '__fieldsGroup') !== false){ |
|
521 | + $displayFieldMethod = '_'.$displayFieldName; |
|
522 | + if (strpos($displayFieldMethod, '__fieldsGroup') !== false) { |
|
523 | 523 | $item = $this->__fieldsGroup($customSection, $field); |
524 | - if(count($item->getItems()) == 0){ |
|
524 | + if (count($item->getItems()) == 0) { |
|
525 | 525 | continue; |
526 | 526 | } |
527 | 527 | }elseif (method_exists($this, $displayFieldMethod)) { |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | } |
542 | 542 | $item = $this->getValueItem($customSection, $field, $labelField, $item); |
543 | 543 | } |
544 | - if(isset($item)){ |
|
544 | + if (isset($item)) { |
|
545 | 545 | $item->addClass('app-customsection-subsectionfield'); |
546 | 546 | $item->addClass($itemClass); |
547 | 547 | $box->addItem($item); |
@@ -82,8 +82,7 @@ discard block |
||
82 | 82 | $item = $this->getValueItem($customSection, array(), $label, $widget); |
83 | 83 | |
84 | 84 | return $item; |
85 | - } |
|
86 | - catch(Exception $e){ |
|
85 | + } catch(Exception $e){ |
|
87 | 86 | return null; |
88 | 87 | } |
89 | 88 | |
@@ -321,8 +320,7 @@ discard block |
||
321 | 320 | if (!$isGroupField && method_exists($this, $displayFieldMethod)) { |
322 | 321 | $widget = $this->$displayFieldMethod($customSection, $label); |
323 | 322 | $item = $widget; |
324 | - } |
|
325 | - else { |
|
323 | + } else { |
|
326 | 324 | if($isGroupField){ |
327 | 325 | if (method_exists($this, '__fieldsGroup')) { |
328 | 326 | $customSection->fieldsLayout = $groupFieldsLayout; |
@@ -330,14 +328,12 @@ discard block |
||
330 | 328 | $customSection->fieldsLayout = $originalFieldsLayout; |
331 | 329 | } |
332 | 330 | $sizePolicy .= ' customsection-fieldsgroup-box'; |
333 | - } |
|
334 | - elseif($isSpacerField){ |
|
331 | + } elseif($isSpacerField){ |
|
335 | 332 | list(, $spacerId) = explode('_spacer', $displayFieldId); |
336 | 333 | if (method_exists($this, '__spacer')) { |
337 | 334 | $item = $this->__spacer($customSection, $spacerId, $label); |
338 | 335 | } |
339 | - } |
|
340 | - else{ |
|
336 | + } else{ |
|
341 | 337 | try{ |
342 | 338 | $field = $recordSet->getField($displayFieldName); |
343 | 339 | if ($label === '' || $label === '__') { |
@@ -405,8 +401,7 @@ discard block |
||
405 | 401 | $sizePolicy .= isset($parameters['sizePolicy']) ? $parameters['sizePolicy'] : ''; |
406 | 402 | if (!$isGroupField && method_exists($this, $displayFieldMethod)) { |
407 | 403 | $item = $this->$displayFieldMethod($customSection, $label); |
408 | - } |
|
409 | - else{ |
|
404 | + } else{ |
|
410 | 405 | if($isGroupField){ |
411 | 406 | if (method_exists($this, '__fieldsGroup')) { |
412 | 407 | $customSection->fieldsLayout = $groupFieldsLayout; |
@@ -414,8 +409,7 @@ discard block |
||
414 | 409 | $customSection->fieldsLayout = $wantedFieldsLayout; |
415 | 410 | } |
416 | 411 | $sizePolicy .= ' customsection-fieldsgroup-box'; |
417 | - } |
|
418 | - else{ |
|
412 | + } else{ |
|
419 | 413 | try { |
420 | 414 | $field = $this->recordSet->getField($displayFieldName); |
421 | 415 | if (!isset($label) || empty($label)) { |
@@ -475,10 +469,9 @@ discard block |
||
475 | 469 | if(!isset($item) || count($item->getItems()) == 0){ |
476 | 470 | continue; |
477 | 471 | } |
478 | - }elseif (method_exists($this, $displayFieldMethod)) { |
|
472 | + } elseif (method_exists($this, $displayFieldMethod)) { |
|
479 | 473 | $item = $this->$displayFieldMethod($customSection, $labelField); |
480 | - } |
|
481 | - else if ($recordSet->fieldExist($displayFieldName)) { |
|
474 | + } else if ($recordSet->fieldExist($displayFieldName)) { |
|
482 | 475 | $field = $recordSet->getField($displayFieldName); |
483 | 476 | if ($labelField === '') { |
484 | 477 | $labelField = $field->getDescription(); |
@@ -524,10 +517,9 @@ discard block |
||
524 | 517 | if(count($item->getItems()) == 0){ |
525 | 518 | continue; |
526 | 519 | } |
527 | - }elseif (method_exists($this, $displayFieldMethod)) { |
|
520 | + } elseif (method_exists($this, $displayFieldMethod)) { |
|
528 | 521 | $item = $this->$displayFieldMethod($customSection, $labelField); |
529 | - } |
|
530 | - else if ($recordSet->fieldExist($displayFieldName)) { |
|
522 | + } else if ($recordSet->fieldExist($displayFieldName)) { |
|
531 | 523 | $field = $recordSet->getField($displayFieldName); |
532 | 524 | if ($labelField === '') { |
533 | 525 | $labelField = $field->getDescription(); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $this->record = $record; |
204 | 204 | if ($name = $this->getName()) { |
205 | 205 | $values = $record->getFormOutputValues(); |
206 | - if($record->getParentSet()->usesWebIdTrait()){ |
|
206 | + if ($record->getParentSet()->usesWebIdTrait()) { |
|
207 | 207 | $values['id'] = $record->getFrontId(); |
208 | 208 | } |
209 | 209 | $this->setValues($values, array($name)); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | ); |
355 | 355 | } |
356 | 356 | |
357 | - foreach($this->btnInfos as $btnInfo){ |
|
357 | + foreach ($this->btnInfos as $btnInfo) { |
|
358 | 358 | $this->addButton($btnInfo['label']); |
359 | 359 | $this->addButton($btnInfo['button']); |
360 | 360 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | $submitButton = $W->SubmitButton() |
369 | 369 | ->setAction($action) |
370 | 370 | ->setLabel($label); |
371 | - if(!empty($class)){ |
|
371 | + if (!empty($class)) { |
|
372 | 372 | $submitButton->addClass($class); |
373 | 373 | } |
374 | 374 | if ($this->isAjax) { |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $label = $W->Label($label); |
378 | 378 | $label->setAssociatedWidget($submitButton); |
379 | 379 | $label->addClass($submitButton->getClasses()); |
380 | - if(!empty($icon)){ |
|
380 | + if (!empty($icon)) { |
|
381 | 381 | $label->setIcon($icon); |
382 | 382 | } |
383 | 383 | $submitButton->addAttribute('style', 'display:none'); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $this->appendFields(); |
511 | 511 | $this->appendButtons(); |
512 | 512 | |
513 | - if(!empty($this->submitToastInfos)){ |
|
513 | + if (!empty($this->submitToastInfos)) { |
|
514 | 514 | $this->item->setMetadata('submitToastInfos', $this->submitToastInfos); |
515 | 515 | } |
516 | 516 | |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | return $display; |
523 | 523 | } |
524 | 524 | |
525 | - public function setAjaxMode($isAjax = true){ |
|
525 | + public function setAjaxMode($isAjax = true) { |
|
526 | 526 | $this->isAjax = $isAjax; |
527 | 527 | return $this; |
528 | 528 | } |