@@ -76,18 +76,18 @@ |
||
76 | 76 | public function __call($name, $arguments) |
77 | 77 | { |
78 | 78 | // We delegate all undefined methods to the $item object. |
79 | - if(isset($this->item)){ |
|
79 | + if (isset($this->item)) { |
|
80 | 80 | $returnedValue = call_user_func_array(array( |
81 | 81 | $this->item, |
82 | 82 | $name |
83 | 83 | ), $arguments); |
84 | - if($returnedValue === $this->item){ |
|
84 | + if ($returnedValue === $this->item) { |
|
85 | 85 | $returnedValue = $this; |
86 | 86 | } |
87 | 87 | return $returnedValue; |
88 | 88 | } |
89 | - else{ |
|
90 | - trigger_error('the method ' . $name . ' does not exists on ' . get_class($this) . ' and there is no widget defined with the setInheritedItem method'); |
|
89 | + else { |
|
90 | + trigger_error('the method '.$name.' does not exists on '.get_class($this).' and there is no widget defined with the setInheritedItem method'); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 |
@@ -85,8 +85,7 @@ |
||
85 | 85 | $returnedValue = $this; |
86 | 86 | } |
87 | 87 | return $returnedValue; |
88 | - } |
|
89 | - else{ |
|
88 | + } else{ |
|
90 | 89 | trigger_error('the method ' . $name . ' does not exists on ' . get_class($this) . ' and there is no widget defined with the setInheritedItem method'); |
91 | 90 | } |
92 | 91 | } |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | |
51 | 51 | $this->setHiddenValue('tg', $App->controllerTg); |
52 | 52 | |
53 | - if(isset($customfield)){ |
|
53 | + if (isset($customfield)) { |
|
54 | 54 | $this->setHiddenValue('customfield[id]', $customfield->id); |
55 | 55 | $values = $customfield->getValues(); |
56 | 56 | |
57 | - if(! empty($this->customfield->enumvalues)){ |
|
57 | + if (!empty($this->customfield->enumvalues)) { |
|
58 | 58 | $values['enumvalues'] = unserialize($this->customfield->enumvalues); |
59 | 59 | } |
60 | - else{ |
|
60 | + else { |
|
61 | 61 | $values['enumvalues'] = array( |
62 | 62 | '0' => '' |
63 | 63 | ); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $this->addItem($this->searchable()); |
83 | 83 | $this->addItem($this->visible()); |
84 | 84 | $this->addItem($this->importable()); |
85 | - if($App->onlineShop){ |
|
85 | + if ($App->onlineShop) { |
|
86 | 86 | $this->addItem($this->visible_in_shop()); |
87 | 87 | } |
88 | 88 | } |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | $fieldValuesItem->addItem($W->Label($App->translate('List of available values'))); |
176 | 176 | $values = array(); |
177 | 177 | |
178 | - if(isset($this->customfield) && ! empty($this->customfield->enumvalues)){ |
|
178 | + if (isset($this->customfield) && !empty($this->customfield->enumvalues)) { |
|
179 | 179 | $values = unserialize($this->customfield->enumvalues); |
180 | 180 | |
181 | - foreach ($values as $name => $text){ |
|
181 | + foreach ($values as $name => $text) { |
|
182 | 182 | $fieldValuesItem->addItem($W->LineEdit() |
183 | 183 | ->setName((string) $name)); |
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - if(empty($values)){ |
|
187 | + if (empty($values)) { |
|
188 | 188 | $fieldValuesItem->addItem($W->LineEdit() |
189 | 189 | ->setName('1')); |
190 | 190 | } |
@@ -56,8 +56,7 @@ |
||
56 | 56 | |
57 | 57 | if(! empty($this->customfield->enumvalues)){ |
58 | 58 | $values['enumvalues'] = unserialize($this->customfield->enumvalues); |
59 | - } |
|
60 | - else{ |
|
59 | + } else{ |
|
61 | 60 | $values['enumvalues'] = array( |
62 | 61 | '0' => '' |
63 | 62 | ); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $row = $W->Items()->setSizePolicy('row'); |
277 | 277 | foreach ($customSections as $customSection) { |
278 | 278 | |
279 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
279 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
280 | 280 | |
281 | 281 | if ($currentColumn + $nbCol > 12) { |
282 | 282 | $this->addItem($row); |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $parameters = $displayField['parameters']; |
304 | 304 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; |
305 | 305 | $label = isset($parameters['label']) ? $parameters['label'] : ''; |
306 | - $displayFieldMethod = '_' . $displayFieldName; |
|
306 | + $displayFieldMethod = '_'.$displayFieldName; |
|
307 | 307 | |
308 | 308 | if (method_exists($this, $displayFieldMethod)) { |
309 | 309 | $value = $this->$displayFieldMethod($customSection, $label); |
@@ -96,14 +96,14 @@ |
||
96 | 96 | |
97 | 97 | $html = "<div class='chip'>"; |
98 | 98 | |
99 | - if(isset($this->labelIcon)){ |
|
99 | + if (isset($this->labelIcon)) { |
|
100 | 100 | $icon = $W->Label('')->setIconFormat(16, 'left')->setIcon($this->labelIcon); |
101 | 101 | $html .= $icon->display($W->HtmlCanvas()); |
102 | 102 | } |
103 | 103 | |
104 | 104 | $html .= $this->label; |
105 | 105 | |
106 | - if(isset($this->action)){ |
|
106 | + if (isset($this->action)) { |
|
107 | 107 | $icon = $W->Link('', $this->action)->setIconFormat(16, 'left')->setOpenMode(WidgetLink::OPEN_DIALOG_AND_RELOAD); |
108 | 108 | $icon->setIcon(isset($this->actionIcon) ? $this->actionIcon : \Func_Icons::ACTIONS_DIALOG_CANCEL); |
109 | 109 | $icon->addClass('chip-right-action'); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | protected function getShapeHtml() |
30 | 30 | { |
31 | - $path = "M{$this->size} {$this->size} " . number_format($this->size / 2, 1) . ' ' . number_format($this->size / 6, 1) . " L0 {$this->size} Z"; |
|
31 | + $path = "M{$this->size} {$this->size} ".number_format($this->size / 2, 1).' '.number_format($this->size / 6, 1)." L0 {$this->size} Z"; |
|
32 | 32 | return "<svg height='{$this->size}' width='{$this->size}'> |
33 | 33 | <path d='{$path}' fill='{$this->color}'/> |
34 | 34 | </svg>"; |
@@ -62,7 +62,7 @@ |
||
62 | 62 | if(isset($componentUi) && method_exists($componentUi, $name)){ |
63 | 63 | return call_user_func_array(array($componentUi, $name), $arguments); |
64 | 64 | } |
65 | - }catch(\Exception $e){} |
|
65 | + } catch(\Exception $e){} |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $rc = new \ReflectionClass($this); |
@@ -47,22 +47,22 @@ discard block |
||
47 | 47 | { |
48 | 48 | $App = $this->App(); |
49 | 49 | $Ui = $App->Ui(); |
50 | - if(strpos($name, $App->classPrefix) !== false){ |
|
50 | + if (strpos($name, $App->classPrefix) !== false) { |
|
51 | 51 | list(, $name) = explode($App->classPrefix, $name); |
52 | 52 | } |
53 | 53 | |
54 | - if(method_exists($Ui, $name)){ |
|
54 | + if (method_exists($Ui, $name)) { |
|
55 | 55 | return call_user_func_array(array($Ui, $name), $arguments); |
56 | 56 | } |
57 | 57 | |
58 | 58 | $components = $App->getComponents(); |
59 | - foreach ($components as $component){ |
|
60 | - try{ |
|
59 | + foreach ($components as $component) { |
|
60 | + try { |
|
61 | 61 | $componentUi = $component->ui(); |
62 | - if(isset($componentUi) && method_exists($componentUi, $name)){ |
|
62 | + if (isset($componentUi) && method_exists($componentUi, $name)) { |
|
63 | 63 | return call_user_func_array(array($componentUi, $name), $arguments); |
64 | 64 | } |
65 | - }catch(\Exception $e){} |
|
65 | + } catch (\Exception $e) {} |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $rc = new \ReflectionClass($this); |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | $page->addMessageInfo(); |
84 | 84 | |
85 | 85 | $addon = $App->getAddon(); |
86 | - if($addon){ |
|
86 | + if ($addon) { |
|
87 | 87 | $components = $App->getComponents(); |
88 | - foreach ($components as $component){ |
|
88 | + foreach ($components as $component) { |
|
89 | 89 | $stylePath = $component->getStylePath(); |
90 | - if($stylePath){ |
|
90 | + if ($stylePath) { |
|
91 | 91 | $page->addStyleSheet($stylePath.'style.css'); |
92 | 92 | } |
93 | 93 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function __construct($id = null, WidgetLayout $layout = null) |
38 | 38 | { |
39 | - if(! isset($layout)){ |
|
39 | + if (!isset($layout)) { |
|
40 | 40 | $W = bab_Widgets(); |
41 | 41 | $layout = $W->FlowLayout()->setHorizontalSpacing(1, 'em'); |
42 | 42 | $layout->setVerticalAlign('top'); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | $W = bab_Widgets(); |
58 | 58 | $button = $W->Link($labelText, $action, $id); |
59 | - if(isset($iconName)){ |
|
59 | + if (isset($iconName)) { |
|
60 | 60 | $button->addClass('icon', $iconName); |
61 | 61 | } |
62 | 62 | |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | public function addInstantForm(WidgetDisplayableInterface $form, $labelText = null, $iconName = null, $action = null, $id = null) |
69 | 69 | { |
70 | 70 | $W = bab_Widgets(); |
71 | - if(isset($iconName)){ |
|
71 | + if (isset($iconName)) { |
|
72 | 72 | $content = $W->Icon($labelText, $iconName); |
73 | 73 | } |
74 | - else{ |
|
74 | + else { |
|
75 | 75 | $content = $labelText; |
76 | 76 | } |
77 | 77 | $button = $W->Link($content, $action, $id); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $this->addItem($W->VBoxItems($button->addClass('widget-instant-button'), $form->addClass('widget-instant-form')) |
80 | 80 | ->addClass('widget-instant-container')); |
81 | 81 | |
82 | - if($form->getTitle() === null){ |
|
82 | + if ($form->getTitle() === null) { |
|
83 | 83 | $form->setTitle($labelText); |
84 | 84 | } |
85 | 85 | |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | |
89 | 89 | public function display(WidgetCanvas $canvas) |
90 | 90 | { |
91 | - if(! $this->local){ |
|
91 | + if (!$this->local) { |
|
92 | 92 | $this->addClass('widget-toolbar'); |
93 | 93 | } |
94 | - else{ |
|
94 | + else { |
|
95 | 95 | $this->addClass('app-toolbar'); |
96 | 96 | } |
97 | 97 | $this->addClass(\Func_Icons::ICON_LEFT_16); |
@@ -70,8 +70,7 @@ discard block |
||
70 | 70 | $W = bab_Widgets(); |
71 | 71 | if(isset($iconName)){ |
72 | 72 | $content = $W->Icon($labelText, $iconName); |
73 | - } |
|
74 | - else{ |
|
73 | + } else{ |
|
75 | 74 | $content = $labelText; |
76 | 75 | } |
77 | 76 | $button = $W->Link($content, $action, $id); |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | { |
91 | 90 | if(! $this->local){ |
92 | 91 | $this->addClass('widget-toolbar'); |
93 | - } |
|
94 | - else{ |
|
92 | + } else{ |
|
95 | 93 | $this->addClass('app-toolbar'); |
96 | 94 | } |
97 | 95 | $this->addClass(\Func_Icons::ICON_LEFT_16); |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | continue; |
304 | 304 | } |
305 | 305 | |
306 | - list(, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
306 | + list(,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
307 | 307 | |
308 | 308 | if ($currentColumn + $nbCol > 12) { |
309 | 309 | $container->addItem($row); |
@@ -359,19 +359,19 @@ discard block |
||
359 | 359 | $sizePolicy .= isset($parameters['sizePolicy']) ? $parameters['sizePolicy'] : ''; |
360 | 360 | $sizePolicy .= isset($parameters['transparentBackground']) && $parameters['transparentBackground'] ? 'customsection-field-box-transparentBackground' : ''; |
361 | 361 | |
362 | - $displayFieldMethod = '_' . $displayFieldName; |
|
362 | + $displayFieldMethod = '_'.$displayFieldName; |
|
363 | 363 | if (!$isGroupField && method_exists($this, $displayFieldMethod)) { |
364 | 364 | $item = $this->$displayFieldMethod($customSection, $label); |
365 | 365 | } |
366 | 366 | else { |
367 | - if($isGroupField){ |
|
367 | + if ($isGroupField) { |
|
368 | 368 | list(, $groupId) = explode('_fieldsGroup', $displayFieldId); |
369 | 369 | if (method_exists($this, '__fieldsGroup')) { |
370 | 370 | $item = $this->__fieldsGroup($customSection, $groupId, $label); |
371 | 371 | } |
372 | 372 | $sizePolicy .= ' customsection-fieldsgroup-box'; |
373 | 373 | } |
374 | - else{ |
|
374 | + else { |
|
375 | 375 | try { |
376 | 376 | $field = $this->recordSet->getField($displayFieldName); |
377 | 377 | $value = $this->fieldOutput($field, $this->record, $displayFieldName); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
402 | - if ($currentColumn + $nbCol> 0) { |
|
402 | + if ($currentColumn + $nbCol > 0) { |
|
403 | 403 | $container->addItem($row); |
404 | 404 | } |
405 | 405 | } |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | $groupField = $customSection->getField('_fieldsGroup'.$groupId); |
432 | 432 | $originalFieldsLayout = $customSection->fieldsLayout; |
433 | 433 | $customSection->fieldsLayout = AppCustomSection::FIELDS_LAYOUT_VERTICAL_LABEL; |
434 | - if(isset($groupField['fields'])){ |
|
435 | - foreach ($groupField['fields'] as $field){ |
|
434 | + if (isset($groupField['fields'])) { |
|
435 | + foreach ($groupField['fields'] as $field) { |
|
436 | 436 | $item = null; |
437 | 437 | $parameters = $field['parameters']; |
438 | 438 | $labelField = isset($parameters['label']) ? $parameters['label'] : ''; |
@@ -442,11 +442,11 @@ discard block |
||
442 | 442 | |
443 | 443 | $displayFieldName = $field['fieldname']; |
444 | 444 | |
445 | - $displayFieldMethod = '_' . $displayFieldName; |
|
445 | + $displayFieldMethod = '_'.$displayFieldName; |
|
446 | 446 | if (method_exists($this, $displayFieldMethod)) { |
447 | 447 | $item = $this->$displayFieldMethod($customSection, $labelField); |
448 | 448 | } |
449 | - else{ |
|
449 | + else { |
|
450 | 450 | try { |
451 | 451 | $field = $this->recordSet->getField($displayFieldName); |
452 | 452 | $value = $this->fieldOutput($field, $this->record, $displayFieldName); |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $item = null; |
463 | 463 | } |
464 | 464 | } |
465 | - if(isset($item)){ |
|
465 | + if (isset($item)) { |
|
466 | 466 | $item->addClass('app-customsection-groupedfield'); |
467 | 467 | $item->addClass($itemClass); |
468 | 468 | } |
@@ -362,16 +362,14 @@ discard block |
||
362 | 362 | $displayFieldMethod = '_' . $displayFieldName; |
363 | 363 | if (!$isGroupField && method_exists($this, $displayFieldMethod)) { |
364 | 364 | $item = $this->$displayFieldMethod($customSection, $label); |
365 | - } |
|
366 | - else { |
|
365 | + } else { |
|
367 | 366 | if($isGroupField){ |
368 | 367 | list(, $groupId) = explode('_fieldsGroup', $displayFieldId); |
369 | 368 | if (method_exists($this, '__fieldsGroup')) { |
370 | 369 | $item = $this->__fieldsGroup($customSection, $groupId, $label); |
371 | 370 | } |
372 | 371 | $sizePolicy .= ' customsection-fieldsgroup-box'; |
373 | - } |
|
374 | - else{ |
|
372 | + } else{ |
|
375 | 373 | try { |
376 | 374 | $field = $this->recordSet->getField($displayFieldName); |
377 | 375 | $value = $this->fieldOutput($field, $this->record, $displayFieldName); |
@@ -445,8 +443,7 @@ discard block |
||
445 | 443 | $displayFieldMethod = '_' . $displayFieldName; |
446 | 444 | if (method_exists($this, $displayFieldMethod)) { |
447 | 445 | $item = $this->$displayFieldMethod($customSection, $labelField); |
448 | - } |
|
449 | - else{ |
|
446 | + } else{ |
|
450 | 447 | try { |
451 | 448 | $field = $this->recordSet->getField($displayFieldName); |
452 | 449 | $value = $this->fieldOutput($field, $this->record, $displayFieldName); |
@@ -137,8 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | if(isset($title)){ |
139 | 139 | $this->context->addItem($W->Section($title, $item, 4), $position); |
140 | - } |
|
141 | - else{ |
|
140 | + } else{ |
|
142 | 141 | $this->context->addItem($item, $position); |
143 | 142 | } |
144 | 143 | return $this; |
@@ -169,8 +168,7 @@ discard block |
||
169 | 168 | $mainPanel = $W->Frame(null, $this->mainPanel); |
170 | 169 | if(bab_isAjaxRequest()){ |
171 | 170 | $mainPanel->addClass('app_main_panel'); |
172 | - } |
|
173 | - else{ |
|
171 | + } else{ |
|
174 | 172 | $mainPanel->setId('app_main_panel'); |
175 | 173 | } |
176 | 174 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | /** @var \Func_Icons $I */ |
61 | 61 | $I = \bab_Functionality::get('Icons'); |
62 | - if($I){ |
|
62 | + if ($I) { |
|
63 | 63 | $I->includeCss(); |
64 | 64 | } |
65 | 65 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function addItem(WidgetDisplayableInterface $item = null, $order = null) |
108 | 108 | { |
109 | - if(! isset($this->mainPanel)){ |
|
109 | + if (!isset($this->mainPanel)) { |
|
110 | 110 | $W = bab_widgets(); |
111 | 111 | $this->mainPanel = $W->VBoxLayout(); |
112 | 112 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $W = bab_widgets(); |
129 | 129 | |
130 | - if(null === $this->context){ |
|
130 | + if (null === $this->context) { |
|
131 | 131 | |
132 | 132 | $isAjaxRequest = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); |
133 | 133 | $contextPanelId = $isAjaxRequest ? null : 'app_context_panel'; |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | $this->context = $W->Frame($contextPanelId, $W->VBoxLayout() |
136 | 136 | ->setVerticalSpacing(2, 'em')); |
137 | 137 | } |
138 | - if(isset($title)){ |
|
138 | + if (isset($title)) { |
|
139 | 139 | $this->context->addItem($W->Section($title, $item, 4), $position); |
140 | 140 | } |
141 | - else{ |
|
141 | + else { |
|
142 | 142 | $this->context->addItem($item, $position); |
143 | 143 | } |
144 | 144 | return $this; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | { |
155 | 155 | $W = bab_widgets(); |
156 | 156 | |
157 | - if(null === $this->toolbars){ |
|
157 | + if (null === $this->toolbars) { |
|
158 | 158 | $this->toolbars = $W->Frame(null, $W->VBoxItems()); |
159 | 159 | } |
160 | 160 | $this->toolbars->addItem($item); |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | $W = bab_widgets(); |
168 | 168 | |
169 | 169 | $mainPanel = $W->Frame(null, $this->mainPanel); |
170 | - if(bab_isAjaxRequest()){ |
|
170 | + if (bab_isAjaxRequest()) { |
|
171 | 171 | $mainPanel->addClass('app_main_panel'); |
172 | 172 | } |
173 | - else{ |
|
173 | + else { |
|
174 | 174 | $mainPanel->setId('app_main_panel'); |
175 | 175 | } |
176 | 176 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | $mainPanel = $this->getMainPanel(); |
189 | 189 | |
190 | - if($this->context){ |
|
190 | + if ($this->context) { |
|
191 | 191 | |
192 | 192 | $W = bab_widgets(); |
193 | 193 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | protected function addToolbars(WidgetItem $mainPanel) |
206 | 206 | { |
207 | - if($this->toolbars){ |
|
207 | + if ($this->toolbars) { |
|
208 | 208 | |
209 | 209 | $W = bab_widgets(); |
210 | 210 | $this->toolbars->setSizePolicy('app-toolbars'); |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function addMessageInfo() |
246 | 246 | { |
247 | - if(isset($_SESSION['app_msginfo'])){ |
|
247 | + if (isset($_SESSION['app_msginfo'])) { |
|
248 | 248 | |
249 | 249 | // all widget have static id to not change id of others widgets in page |
250 | 250 | |
251 | 251 | $infoMessages = $_SESSION['app_msginfo']; |
252 | - foreach ($infoMessages as $infoLine){ |
|
252 | + foreach ($infoMessages as $infoLine) { |
|
253 | 253 | $this->App() |
254 | 254 | ->Controller() |
255 | 255 | ->addMessage($infoLine); |