@@ -136,7 +136,7 @@ |
||
136 | 136 | |
137 | 137 | $displayable = $field->output($value); |
138 | 138 | |
139 | - switch(true) { |
|
139 | + switch (true) { |
|
140 | 140 | case ($field instanceof ORMTextField): |
141 | 141 | $displayable = $W->RichText($displayable)->setRenderingOptions(BAB_HTML_ALL ^ BAB_HTML_P); |
142 | 142 | break; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected function initHeaderRow(ORMRecordSet $set) |
87 | 87 | { |
88 | - require_once $GLOBALS['babInstallPath'] . 'utilit/urlincl.php'; |
|
88 | + require_once $GLOBALS['babInstallPath'].'utilit/urlincl.php'; |
|
89 | 89 | |
90 | 90 | \bab_functionality::includefile('Icons'); |
91 | 91 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | $sizePolicy = 'widget-actions-target'; |
118 | 118 | |
119 | 119 | if ($this->isMultiSelect() && $columnPath === '_select_') { |
120 | - $this->toggleCheckAllBox = $W->CheckBox(); |
|
120 | + $this->toggleCheckAllBox = $W->CheckBox(); |
|
121 | 121 | $this->toggleCheckAllBox->setName('toggleCheckAllBox'); |
122 | 122 | $this->toggleCheckAllBox->setTitle(widget_translate('Select all on page')); |
123 | 123 | $this->toggleCheckAllBox->setSizePolicy('condensed'); |
124 | 124 | $this->toggleCheckAllBox->setCheckedValue(true); |
125 | - if(isset($_SESSION['toggleCheckAllBox'][$this->getId()]) && !empty($_SESSION['toggleCheckAllBox'][$this->getId()]) && $_SESSION['toggleCheckAllBox'][$this->getId()] == 'on'){ |
|
125 | + if (isset($_SESSION['toggleCheckAllBox'][$this->getId()]) && !empty($_SESSION['toggleCheckAllBox'][$this->getId()]) && $_SESSION['toggleCheckAllBox'][$this->getId()] == 'on') { |
|
126 | 126 | $this->toggleCheckAllBox->setValue(true); |
127 | 127 | } |
128 | 128 | $isSearchable = false; |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | $direction = ':up'; |
140 | 140 | } |
141 | 141 | |
142 | - $url = \bab_url::mod($this->sortBaseUrl, $this->sortParameterName, $columnPath . $direction); |
|
142 | + $url = \bab_url::mod($this->sortBaseUrl, $this->sortParameterName, $columnPath.$direction); |
|
143 | 143 | if ($anchor = $this->getAnchor()) { |
144 | - $url .= '#' . urlencode($anchor); |
|
144 | + $url .= '#'.urlencode($anchor); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | $columnItem = $W->Link( |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | )->addClass('widget-table-column-sorting-action'); |
154 | 154 | if ($this->sortAjaxAction) { |
155 | 155 | $columnItem->setAjaxAction( |
156 | - $this->sortAjaxAction->setParameter('sort', $columnPath . $direction), |
|
156 | + $this->sortAjaxAction->setParameter('sort', $columnPath.$direction), |
|
157 | 157 | '' |
158 | 158 | ); |
159 | 159 | } |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | $columnItem->addClass('icon', $columnIcon)->setSizePolicy(\Func_Icons::ICON_LEFT_16); |
175 | 175 | } |
176 | 176 | |
177 | - if($isSortable){ |
|
177 | + if ($isSortable) { |
|
178 | 178 | $sizePolicy .= ' widget-table-column-sortable'; |
179 | 179 | } |
180 | - if($isSearchable){ |
|
180 | + if ($isSearchable) { |
|
181 | 181 | if (!isset($this->filterBaseUrl)) { |
182 | 182 | $this->filterBaseUrl = $this->getRecordControllerProxy()->displayListFilter(); |
183 | 183 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | 0 |
193 | 193 | ); |
194 | 194 | $sizePolicy .= ' widget-table-column-searchable'; |
195 | - if(isset($filterValues[$columnPath]) && !empty($filterValues[$columnPath])){ |
|
195 | + if (isset($filterValues[$columnPath]) && !empty($filterValues[$columnPath])) { |
|
196 | 196 | $sizePolicy .= ' widget-table-column-searched'; |
197 | 197 | } |
198 | 198 | } |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
210 | - protected function initRow($record, $row){ |
|
211 | - if($this->highlightRows == null){ |
|
210 | + protected function initRow($record, $row) { |
|
211 | + if ($this->highlightRows == null) { |
|
212 | 212 | $this->highlightRows = $this->getHighlightedRows(); |
213 | 213 | } |
214 | 214 | |
215 | - if(in_array($record->id,$this->highlightRows)){ |
|
215 | + if (in_array($record->id, $this->highlightRows)) { |
|
216 | 216 | $this->addRowClass($row, "app_highlightRow"); |
217 | 217 | } |
218 | 218 | $this->addRowClass($row, "app_highlightAvailable"); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | // we try to select one according to the classname prefix. |
243 | 243 | list($prefix) = explode('_', get_class($this)); |
244 | 244 | $functionalityName = ucwords($prefix); |
245 | - $this->app = @\bab_functionality::get('App/' . $functionalityName); |
|
245 | + $this->app = @\bab_functionality::get('App/'.$functionalityName); |
|
246 | 246 | if (!$this->app) { |
247 | 247 | $this->app = @\bab_functionality::get('App'); |
248 | 248 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber); |
304 | 304 | |
305 | 305 | if (isset($name)) { |
306 | - $this->sortParameterName = $name . '[filter][sort]'; |
|
306 | + $this->sortParameterName = $name.'[filter][sort]'; |
|
307 | 307 | } else { |
308 | 308 | $this->sortParameterName = 'filter[sort]'; |
309 | 309 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | $values = $set->select(); |
410 | 410 | foreach ($values as $record) { |
411 | - $widget->addOption($record->id, (string)$record->name); |
|
411 | + $widget->addOption($record->id, (string) $record->name); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | return $widget; |
@@ -516,11 +516,11 @@ discard block |
||
516 | 516 | |
517 | 517 | foreach ($columns as $fieldName => $column) { |
518 | 518 | $field = $column->getField(); |
519 | - if (! $column->isSearchable()) { |
|
519 | + if (!$column->isSearchable()) { |
|
520 | 520 | continue; |
521 | 521 | } |
522 | 522 | |
523 | - if (! ($field instanceof ORMField)) { |
|
523 | + if (!($field instanceof ORMField)) { |
|
524 | 524 | $field = null; |
525 | 525 | } |
526 | 526 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | $formItem = $this->handleFilterLabel($label, $input); |
538 | 538 | |
539 | 539 | // $formItem = $W->Section($label->getText(), $input, 7)->setFoldable(true, true); |
540 | - $formItem->addClass('compact', 'field_' . $fieldName); |
|
540 | + $formItem->addClass('compact', 'field_'.$fieldName); |
|
541 | 541 | |
542 | 542 | $mainSearch = (method_exists($column, 'isMainSearch') && $column->isMainSearch()); |
543 | 543 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | $W->Link('', $removeColumnsAction) |
562 | 562 | ->setAjaxAction() |
563 | 563 | ->addClass('icon', \Func_Icons::STATUS_DIALOG_ERROR) |
564 | - ->addAttribute('data-removefor', $column->getFieldPath()) |
|
564 | + ->addAttribute('data-removefor', $column->getFieldPath()) |
|
565 | 565 | )->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_ITEMS_FLEX_END) |
566 | 566 | ); |
567 | 567 | } else { |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | |
575 | - if (! $this->submit) { |
|
575 | + if (!$this->submit) { |
|
576 | 576 | $this->submit = $W->SubmitButton(); |
577 | 577 | $this->submit->setLabel(Widget_translate('Apply filter')); |
578 | 578 | } |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | |
612 | 612 | |
613 | 613 | foreach ($filterNames as $filterName) { |
614 | - $filter = $W->getUserConfiguration($controller->getModelViewDefaultId() . '/filters/' . $filterName, 'widgets', false); |
|
614 | + $filter = $W->getUserConfiguration($controller->getModelViewDefaultId().'/filters/'.$filterName, 'widgets', false); |
|
615 | 615 | |
616 | 616 | // $this->select->addItem( |
617 | 617 | // $W->Link( |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $form->setReadOnly(true); |
666 | 666 | $form->setName('filter'); |
667 | 667 | $form->colon(); |
668 | - $form->checkUnsaved(false,null); |
|
668 | + $form->checkUnsaved(false, null); |
|
669 | 669 | |
670 | 670 | $form->setLayout( |
671 | 671 | $W->FlowItems( |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | // $this->setCurrentPage(isset($filter['pageNumber']) ? $filter['pageNumber'] : $pageNumber); |
728 | 728 | |
729 | 729 | if (isset($name)) { |
730 | - $this->sortParameterName = $name . '[filter][sort]'; |
|
730 | + $this->sortParameterName = $name.'[filter][sort]'; |
|
731 | 731 | } else { |
732 | 732 | $this->sortParameterName = 'filter[sort]'; |
733 | 733 | } |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getRecordSet() |
73 | 73 | { |
74 | - if(isset($this->recordSet)){ |
|
74 | + if (isset($this->recordSet)) { |
|
75 | 75 | return $this->recordSet; |
76 | 76 | } |
77 | 77 | |
78 | 78 | $parentField = $this->criteria->getField(); |
79 | 79 | |
80 | - if(! isset($parentField)){ |
|
80 | + if (!isset($parentField)) { |
|
81 | 81 | return null; |
82 | 82 | } |
83 | 83 | |
84 | - do{ |
|
84 | + do { |
|
85 | 85 | $field = $parentField; |
86 | 86 | $parentField = $field->getParentSet(); |
87 | 87 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | |
135 | 135 | $classPrefix = $App->classPrefix; |
136 | 136 | |
137 | - foreach ($recordSetFields as $fieldName => $recordSetField){ |
|
138 | - if($recordSetField instanceof ORMManyRelation){ |
|
137 | + foreach ($recordSetFields as $fieldName => $recordSetField) { |
|
138 | + if ($recordSetField instanceof ORMManyRelation) { |
|
139 | 139 | /* @var $recordSetField ORMManyRelation */ |
140 | 140 | $fieldDescription = $fieldName; |
141 | 141 | $path = $fieldName; |
@@ -144,28 +144,28 @@ discard block |
||
144 | 144 | $foreignRecordSet = $App->$foreignSetName(); |
145 | 145 | $foreignRecordSetFields = $foreignRecordSet->getVisibilityCriteriaFields(); |
146 | 146 | |
147 | - foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField){ |
|
147 | + foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField) { |
|
148 | 148 | $foreignFieldName = $foreignRecordSetField->getName(); |
149 | 149 | $foreignFieldDescription = $foreignRecordSetField->getDescription(); |
150 | - if(substr($foreignFieldName, 0, 1) !== '_'){ |
|
150 | + if (substr($foreignFieldName, 0, 1) !== '_') { |
|
151 | 151 | $foreignFieldDescription = $App->translate($foreignFieldDescription); |
152 | 152 | } |
153 | - if(empty($foreignFieldDescription)){ |
|
153 | + if (empty($foreignFieldDescription)) { |
|
154 | 154 | $foreignFieldDescription = $foreignFieldName; |
155 | 155 | } |
156 | - $foreignPath = $path . '/' . $foreignRecordSetField->getPath(); |
|
156 | + $foreignPath = $path.'/'.$foreignRecordSetField->getPath(); |
|
157 | 157 | |
158 | 158 | $recordSetFieldSelect->addOption($foreignPath, $foreignFieldDescription, $fieldName); |
159 | 159 | |
160 | - if($foreignRecordSetField instanceof ORMBoolInterface){ |
|
160 | + if ($foreignRecordSetField instanceof ORMBoolInterface) { |
|
161 | 161 | $booleanFieldPathes[] = $foreignPath; |
162 | 162 | } |
163 | - else{ |
|
163 | + else { |
|
164 | 164 | $defaultFieldPathes[] = $foreignPath; |
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | - elseif($recordSetField instanceof ORMFkField){ |
|
168 | + elseif ($recordSetField instanceof ORMFkField) { |
|
169 | 169 | /* @var $recordSetField ORMFkField */ |
170 | 170 | $fieldDescription = $fieldName; |
171 | 171 | $path = $fieldName; |
@@ -174,38 +174,38 @@ discard block |
||
174 | 174 | $foreignRecordSet = $App->$foreignSetName(); |
175 | 175 | $foreignRecordSetFields = $foreignRecordSet->getVisibilityCriteriaFields(); |
176 | 176 | |
177 | - foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField){ |
|
177 | + foreach ($foreignRecordSetFields as $foreignFieldName => $foreignRecordSetField) { |
|
178 | 178 | $foreignFieldDescription = $foreignFieldName; |
179 | - $foreignPath = $path . '/' . $foreignFieldName; |
|
179 | + $foreignPath = $path.'/'.$foreignFieldName; |
|
180 | 180 | |
181 | 181 | $recordSetFieldSelect->addOption($foreignPath, $foreignFieldDescription, $fieldName); |
182 | 182 | |
183 | - if($foreignRecordSetField instanceof ORMBoolInterface){ |
|
183 | + if ($foreignRecordSetField instanceof ORMBoolInterface) { |
|
184 | 184 | $booleanFieldPathes[] = $foreignPath; |
185 | 185 | } |
186 | - else{ |
|
186 | + else { |
|
187 | 187 | $defaultFieldPathes[] = $foreignPath; |
188 | 188 | } |
189 | 189 | } |
190 | 190 | } |
191 | - else{ |
|
191 | + else { |
|
192 | 192 | /* @var $recordSetField ORMField */ |
193 | 193 | $fieldName = $recordSetField->getName(); |
194 | 194 | $fieldDescription = $recordSetField->getDescription(); |
195 | - if(substr($fieldName, 0, 1) !== '_'){ |
|
195 | + if (substr($fieldName, 0, 1) !== '_') { |
|
196 | 196 | $fieldDescription = $App->translate($fieldDescription); |
197 | 197 | } |
198 | - if(empty($fieldDescription)){ |
|
198 | + if (empty($fieldDescription)) { |
|
199 | 199 | $fieldDescription = $fieldName; |
200 | 200 | } |
201 | 201 | $path = $recordSetField->getPath(); |
202 | 202 | |
203 | 203 | $recordSetFieldSelect->addOption($path, $fieldDescription); |
204 | 204 | |
205 | - if($recordSetField instanceof ORMBoolInterface){ |
|
205 | + if ($recordSetField instanceof ORMBoolInterface) { |
|
206 | 206 | $booleanFieldPathes[] = $path; |
207 | 207 | } |
208 | - else{ |
|
208 | + else { |
|
209 | 209 | $defaultFieldPathes[] = $path; |
210 | 210 | } |
211 | 211 | } |
@@ -159,13 +159,11 @@ discard block |
||
159 | 159 | |
160 | 160 | if($foreignRecordSetField instanceof ORMBoolInterface){ |
161 | 161 | $booleanFieldPathes[] = $foreignPath; |
162 | - } |
|
163 | - else{ |
|
162 | + } else{ |
|
164 | 163 | $defaultFieldPathes[] = $foreignPath; |
165 | 164 | } |
166 | 165 | } |
167 | - } |
|
168 | - elseif($recordSetField instanceof ORMFkField){ |
|
166 | + } elseif($recordSetField instanceof ORMFkField){ |
|
169 | 167 | /* @var $recordSetField ORMFkField */ |
170 | 168 | $fieldDescription = $fieldName; |
171 | 169 | $path = $fieldName; |
@@ -182,13 +180,11 @@ discard block |
||
182 | 180 | |
183 | 181 | if($foreignRecordSetField instanceof ORMBoolInterface){ |
184 | 182 | $booleanFieldPathes[] = $foreignPath; |
185 | - } |
|
186 | - else{ |
|
183 | + } else{ |
|
187 | 184 | $defaultFieldPathes[] = $foreignPath; |
188 | 185 | } |
189 | 186 | } |
190 | - } |
|
191 | - else{ |
|
187 | + } else{ |
|
192 | 188 | /* @var $recordSetField ORMField */ |
193 | 189 | $fieldName = $recordSetField->getName(); |
194 | 190 | $fieldDescription = $recordSetField->getDescription(); |
@@ -204,8 +200,7 @@ discard block |
||
204 | 200 | |
205 | 201 | if($recordSetField instanceof ORMBoolInterface){ |
206 | 202 | $booleanFieldPathes[] = $path; |
207 | - } |
|
208 | - else{ |
|
203 | + } else{ |
|
209 | 204 | $defaultFieldPathes[] = $path; |
210 | 205 | } |
211 | 206 | } |
@@ -64,15 +64,15 @@ discard block |
||
64 | 64 | ->_AND_($customSectionSet->object->is($customSection->object))); |
65 | 65 | |
66 | 66 | $allViewFieldNames = array(); |
67 | - foreach ($allViewSections as $viewSection){ |
|
67 | + foreach ($allViewSections as $viewSection) { |
|
68 | 68 | $fields = $viewSection->getFields(); |
69 | - foreach ($fields as $field){ |
|
70 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
69 | + foreach ($fields as $field) { |
|
70 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
74 | 74 | $box = $W->VBoxItems(); |
75 | - if(isset($itemId)){ |
|
75 | + if (isset($itemId)) { |
|
76 | 76 | $box->setId($itemId); |
77 | 77 | } |
78 | 78 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | \bab_Sort::asort($availableFields, 'description', \bab_Sort::CASE_INSENSITIVE); |
89 | 89 | |
90 | - foreach ($availableFields as $field){ |
|
90 | + foreach ($availableFields as $field) { |
|
91 | 91 | $fieldName = $field['name']; |
92 | 92 | $fieldDescription = $field['description']; |
93 | 93 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | $field = $customSection->getField($fieldName); |
143 | 143 | |
144 | - if(! isset($field)){ |
|
144 | + if (!isset($field)) { |
|
145 | 145 | return null; |
146 | 146 | } |
147 | 147 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | |
158 | 158 | $field = $availableFields[$fieldName]; |
159 | 159 | $fieldDescription = $field['description']; |
160 | - if(substr($fieldName, 0, 1) !== '_'){ |
|
160 | + if (substr($fieldName, 0, 1) !== '_') { |
|
161 | 161 | $fieldDescription = $App->translate($fieldDescription); |
162 | 162 | } |
163 | 163 | |
164 | - if(empty($field)){ |
|
164 | + if (empty($field)) { |
|
165 | 165 | // continue; |
166 | 166 | } |
167 | 167 | |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | $W = bab_Widgets(); |
263 | 263 | |
264 | 264 | $customSectionSet = $App->CustomContainerSet(); |
265 | - if(isset($id)){ |
|
265 | + if (isset($id)) { |
|
266 | 266 | $record = $customSectionSet->request($id); |
267 | 267 | } |
268 | - else{ |
|
268 | + else { |
|
269 | 269 | $record = $customSectionSet->newRecord(); |
270 | 270 | $record->object = $object; |
271 | 271 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $editor = new AppEditor($App); |
279 | 279 | $editor->setHiddenValue('tg', $App->controllerTg); |
280 | 280 | $editor->setHiddenValue('data[view]', $view); |
281 | - if($record->id){ |
|
281 | + if ($record->id) { |
|
282 | 282 | $editor->setHiddenValue('data[id]', $record->id); |
283 | 283 | } |
284 | 284 | $editor->setName('data'); |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | $record = $recordSet->request($id); |
357 | 357 | |
358 | 358 | $object = $record->object; |
359 | - if(empty($object)){ |
|
359 | + if (empty($object)) { |
|
360 | 360 | $object = $record->container()->object; |
361 | 361 | } |
362 | - if(strpos($object, $App->classPrefix) !== false){ |
|
362 | + if (strpos($object, $App->classPrefix) !== false) { |
|
363 | 363 | $object = str_replace($App->classPrefix, '', $object); |
364 | 364 | } |
365 | 365 | $object .= 'Set'; |
@@ -374,25 +374,25 @@ discard block |
||
374 | 374 | $manySets = $objectRecordSet->getHasManyRelations(); |
375 | 375 | $oneSets = $objectRecordSet->getHasOneRelations(); |
376 | 376 | |
377 | - if(! empty($record->visibilityCriteria)){ |
|
377 | + if (!empty($record->visibilityCriteria)) { |
|
378 | 378 | $arrCriteria = json_decode($record->visibilityCriteria, true); |
379 | 379 | |
380 | 380 | $data = array(); |
381 | - foreach ($arrCriteria as $fieldName => $operation){ |
|
381 | + foreach ($arrCriteria as $fieldName => $operation) { |
|
382 | 382 | $data['field'] = $fieldName; |
383 | - foreach ($operation as $condition => $value){ |
|
383 | + foreach ($operation as $condition => $value) { |
|
384 | 384 | $data['condition']['default'] = $condition; |
385 | 385 | $data['condition']['bool'] = $condition; |
386 | - if(is_array($value)){ |
|
387 | - foreach ($value as $key => $subValue){ |
|
388 | - foreach ($manySets as $manyFieldName => $manyRelation){ |
|
389 | - if($key . 'Set' == $manyRelation->getForeignSetClassName()){ |
|
390 | - foreach ($subValue as $subFieldName => $subConditions){ |
|
391 | - if($subFieldName === '_foreignField'){ |
|
386 | + if (is_array($value)) { |
|
387 | + foreach ($value as $key => $subValue) { |
|
388 | + foreach ($manySets as $manyFieldName => $manyRelation) { |
|
389 | + if ($key.'Set' == $manyRelation->getForeignSetClassName()) { |
|
390 | + foreach ($subValue as $subFieldName => $subConditions) { |
|
391 | + if ($subFieldName === '_foreignField') { |
|
392 | 392 | continue; |
393 | 393 | } |
394 | 394 | $data['field'] = "{$manyFieldName}/{$subFieldName}"; |
395 | - foreach ($subConditions as $subCondition => $subConditionValue){ |
|
395 | + foreach ($subConditions as $subCondition => $subConditionValue) { |
|
396 | 396 | $data['condition']['default'] = $subCondition; |
397 | 397 | $data['condition']['bool'] = $subCondition; |
398 | 398 | $value = $subConditionValue; |
@@ -401,14 +401,14 @@ discard block |
||
401 | 401 | break; |
402 | 402 | } |
403 | 403 | } |
404 | - foreach ($oneSets as $oneFieldName => $oneRelation){ |
|
405 | - if($key . 'Set' == $oneRelation->getForeignSetClassName()){ |
|
406 | - foreach ($subValue as $subFieldName => $subConditions){ |
|
407 | - if($subFieldName === '_foreignField'){ |
|
404 | + foreach ($oneSets as $oneFieldName => $oneRelation) { |
|
405 | + if ($key.'Set' == $oneRelation->getForeignSetClassName()) { |
|
406 | + foreach ($subValue as $subFieldName => $subConditions) { |
|
407 | + if ($subFieldName === '_foreignField') { |
|
408 | 408 | continue; |
409 | 409 | } |
410 | 410 | $data['field'] = "{$oneFieldName}/{$subFieldName}"; |
411 | - foreach ($subConditions as $subCondition => $subConditionValue){ |
|
411 | + foreach ($subConditions as $subCondition => $subConditionValue) { |
|
412 | 412 | $data['condition']['default'] = $subCondition; |
413 | 413 | $data['condition']['bool'] = $subCondition; |
414 | 414 | $value = $subConditionValue; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | protected function preSave(ORMRecord $record, $data) |
454 | 454 | { |
455 | 455 | parent::preSave($record, $data); |
456 | - if(! isset($record->id) || empty($record->id)){ |
|
456 | + if (!isset($record->id) || empty($record->id)) { |
|
457 | 457 | $set = $record->getParentSet(); |
458 | 458 | $nbContainers = $set->select($set->all(array( |
459 | 459 | $set->object->is($record->object), |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | $record = $recordSet->request($data['id']); |
489 | 489 | |
490 | 490 | $object = $record->object; |
491 | - if(empty($object)){ |
|
491 | + if (empty($object)) { |
|
492 | 492 | $object = $record->container()->object; |
493 | 493 | } |
494 | - if(strpos($object, $App->classPrefix) !== false){ |
|
494 | + if (strpos($object, $App->classPrefix) !== false) { |
|
495 | 495 | $object = str_replace($App->classPrefix, '', $object); |
496 | 496 | } |
497 | 497 | $object .= 'Set'; |
@@ -502,14 +502,14 @@ discard block |
||
502 | 502 | $field = $data['field']; |
503 | 503 | $condition = $data['condition']; |
504 | 504 | |
505 | - if(strpos($field, '/') !== false){ |
|
505 | + if (strpos($field, '/') !== false) { |
|
506 | 506 | // The selected field is a hasMany or a hasOne relation |
507 | 507 | list ($selectedRelation, $selectedField) = explode('/', $field); |
508 | 508 | $classPrefix = $App->classPrefix; |
509 | 509 | |
510 | 510 | $manyRelations = $objectRecordSet->getHasManyRelations(); |
511 | - foreach ($manyRelations as $manyRelation){ |
|
512 | - if($selectedRelation != $manyRelation->getOwnerSetFieldName()){ |
|
511 | + foreach ($manyRelations as $manyRelation) { |
|
512 | + if ($selectedRelation != $manyRelation->getOwnerSetFieldName()) { |
|
513 | 513 | continue; |
514 | 514 | } |
515 | 515 | $foreignSetName = str_replace($classPrefix, '', $manyRelation->getForeignSetClassName()); |
@@ -517,13 +517,13 @@ discard block |
||
517 | 517 | |
518 | 518 | $visibilityCriteria = ''; |
519 | 519 | |
520 | - if($foreignSet){ |
|
520 | + if ($foreignSet) { |
|
521 | 521 | $selectedManyField = $foreignSet->$selectedField; |
522 | 522 | |
523 | - if($selectedManyField instanceof ORMBoolInterface){ |
|
523 | + if ($selectedManyField instanceof ORMBoolInterface) { |
|
524 | 524 | $condition = $condition['bool']; |
525 | 525 | } |
526 | - else{ |
|
526 | + else { |
|
527 | 527 | $condition = $condition['default']; |
528 | 528 | } |
529 | 529 | |
@@ -535,9 +535,9 @@ discard block |
||
535 | 535 | } |
536 | 536 | |
537 | 537 | $oneRelations = $objectRecordSet->getHasOneRelations(); |
538 | - foreach ($oneRelations as $oneRelation){ |
|
538 | + foreach ($oneRelations as $oneRelation) { |
|
539 | 539 | /* @var $oneRelation ORMOneRelation*/ |
540 | - if($selectedRelation != $oneRelation->getOwnerSetFieldName()){ |
|
540 | + if ($selectedRelation != $oneRelation->getOwnerSetFieldName()) { |
|
541 | 541 | continue; |
542 | 542 | } |
543 | 543 | $foreignSetClassName = $oneRelation->getForeignSetClassName(); |
@@ -546,13 +546,13 @@ discard block |
||
546 | 546 | |
547 | 547 | $visibilityCriteria = ''; |
548 | 548 | |
549 | - if($foreignSet){ |
|
549 | + if ($foreignSet) { |
|
550 | 550 | $selectedOneField = $foreignSet->$selectedField; |
551 | 551 | |
552 | - if($selectedOneField instanceof ORMBoolInterface){ |
|
552 | + if ($selectedOneField instanceof ORMBoolInterface) { |
|
553 | 553 | $condition = $condition['bool']; |
554 | 554 | } |
555 | - else{ |
|
555 | + else { |
|
556 | 556 | $condition = $condition['default']; |
557 | 557 | } |
558 | 558 | |
@@ -562,20 +562,20 @@ discard block |
||
562 | 562 | break; |
563 | 563 | } |
564 | 564 | } |
565 | - else{ |
|
565 | + else { |
|
566 | 566 | |
567 | 567 | $field = $objectRecordSet->$field; |
568 | 568 | |
569 | - if($field instanceof ORMBoolInterface){ |
|
569 | + if ($field instanceof ORMBoolInterface) { |
|
570 | 570 | $condition = $condition['bool']; |
571 | 571 | } |
572 | - else{ |
|
572 | + else { |
|
573 | 573 | $condition = $condition['default']; |
574 | 574 | } |
575 | 575 | |
576 | 576 | $visibilityCriteria = ''; |
577 | 577 | |
578 | - if(! empty($condition)){ |
|
578 | + if (!empty($condition)) { |
|
579 | 579 | $criteria = $field->{$condition}($data['value']); |
580 | 580 | $visibilityCriteria = $criteria->toJson(); |
581 | 581 | } |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | |
611 | 611 | $containerBoxes = $W->Items(); |
612 | 612 | |
613 | - foreach ($customContainers as $customContainer){ |
|
613 | + foreach ($customContainers as $customContainer) { |
|
614 | 614 | |
615 | 615 | $menu = $W->HBoxItems($W->Link('', $customSectionCtrl->edit($customContainer->id)) |
616 | 616 | ->addClass('icon', \Func_Icons::ACTIONS_LIST_ADD) |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | $menu->setSizePolicy(\Func_Icons::ICON_LEFT_16); |
626 | 626 | |
627 | 627 | $hasVisibilityBox = $W->FlowItems()->addClass('widget-100'); |
628 | - if(! empty($customContainer->visibilityCriteria)){ |
|
628 | + if (!empty($customContainer->visibilityCriteria)) { |
|
629 | 629 | $hasVisibilityBox->addItem($W->HBoxItems($W->Label($App->translate('This container has a visibility condition'))) |
630 | 630 | ->setSizePolicy('alert alert-warning widget-100pc')); |
631 | 631 | } |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | ->addClass($customContainer->classname)); |
637 | 637 | } |
638 | 638 | |
639 | - if(isset($itemId)){ |
|
639 | + if (isset($itemId)) { |
|
640 | 640 | $containerBoxes->setId($itemId); |
641 | 641 | } |
642 | 642 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | $customSectionSet = $App->CustomSectionSet(); |
663 | 663 | |
664 | 664 | $containersValues = array(); |
665 | - foreach ($customContainers as $customContainer){ |
|
665 | + foreach ($customContainers as $customContainer) { |
|
666 | 666 | $values = $customContainer->getValues(); |
667 | 667 | unset($values['id']); |
668 | 668 | unset($values['uuid']); |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | unset($values['deleted']); |
676 | 676 | $values['customSections'] = array(); |
677 | 677 | $customSections = $customSectionSet->select($customSectionSet->container->is($customContainer->id)); |
678 | - foreach ($customSections as $customSection){ |
|
678 | + foreach ($customSections as $customSection) { |
|
679 | 679 | $customSectionValues = $customSection->getValues(); |
680 | 680 | unset($customSectionValues['id']); |
681 | 681 | unset($customSectionValues['uuid']); |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | } |
695 | 695 | |
696 | 696 | header('Content-type: application/json'); |
697 | - header('Content-Disposition: attachment; filename="' . $object . '.' . ($view === '' ? 'default' : $view) . '.json"' . "\n"); |
|
697 | + header('Content-Disposition: attachment; filename="'.$object.'.'.($view === '' ? 'default' : $view).'.json"'."\n"); |
|
698 | 698 | |
699 | 699 | $json = bab_json_encode($containersValues); |
700 | 700 | $json = bab_convertStringFromDatabase($json, \bab_charset::UTF_8); |
@@ -752,12 +752,12 @@ discard block |
||
752 | 752 | $files->push($containersfile['uid']); |
753 | 753 | |
754 | 754 | $data = null; |
755 | - foreach ($files as $f){ |
|
755 | + foreach ($files as $f) { |
|
756 | 756 | $data = file_get_contents($f->toString()); |
757 | 757 | break; |
758 | 758 | } |
759 | 759 | |
760 | - if(! isset($data)){ |
|
760 | + if (!isset($data)) { |
|
761 | 761 | $this->addError($App->translate('Unable to get file content')); |
762 | 762 | return true; |
763 | 763 | } |
@@ -773,13 +773,13 @@ discard block |
||
773 | 773 | $customContainerSet->delete($customContainerSet->view->is($view) |
774 | 774 | ->_AND_($customContainerSet->object->is($object))); |
775 | 775 | |
776 | - foreach ($containersValues as $containerValues){ |
|
776 | + foreach ($containersValues as $containerValues) { |
|
777 | 777 | $customContainer = $customContainerSet->newRecord(); |
778 | 778 | $customContainer->setValues($containerValues); |
779 | 779 | $customContainer->object = $object; |
780 | 780 | $customContainer->view = $view; |
781 | 781 | $customContainer->save(); |
782 | - foreach ($containerValues['customSections'] as $sectionValues){ |
|
782 | + foreach ($containerValues['customSections'] as $sectionValues) { |
|
783 | 783 | $customSection = $customSectionSet->newRecord(); |
784 | 784 | $sectionValues['fields'] = json_encode($sectionValues['fields']); |
785 | 785 | $customSection->setValues($sectionValues); |
@@ -913,9 +913,9 @@ discard block |
||
913 | 913 | |
914 | 914 | $rank = 0; |
915 | 915 | $currentContainerId = 0; |
916 | - foreach (array_keys($containers) as $containerFieldId){ |
|
916 | + foreach (array_keys($containers) as $containerFieldId) { |
|
917 | 917 | |
918 | - if(substr($containerFieldId, 0, 1) === '#'){ |
|
918 | + if (substr($containerFieldId, 0, 1) === '#') { |
|
919 | 919 | $currentContainerId = substr($containerFieldId, 1); |
920 | 920 | |
921 | 921 | $customContainer = $customContainerSet->request($customContainerSet->id->is($currentContainerId)); |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | $containersRawFields[$currentContainerId] = $customContainer->getRawFields(); |
925 | 925 | |
926 | 926 | $customContainer->rank = $rank; |
927 | - $rank ++; |
|
927 | + $rank++; |
|
928 | 928 | $customContainer->save(); |
929 | 929 | continue; |
930 | 930 | } |
@@ -932,18 +932,18 @@ discard block |
||
932 | 932 | $containersFields[$currentContainerId][] = $containerFieldId; |
933 | 933 | } |
934 | 934 | |
935 | - foreach ($containersFields as $containerId => $containerFieldIds){ |
|
936 | - foreach ($containerFieldIds as $containerFieldId){ |
|
935 | + foreach ($containersFields as $containerId => $containerFieldIds) { |
|
936 | + foreach ($containerFieldIds as $containerFieldId) { |
|
937 | 937 | list ($srcContainerId, $srcfieldId) = explode('.', $containerFieldId); |
938 | - if(! isset($containersRawFields[$srcContainerId][$srcfieldId])){ |
|
938 | + if (!isset($containersRawFields[$srcContainerId][$srcfieldId])) { |
|
939 | 939 | return true; |
940 | 940 | } |
941 | 941 | } |
942 | 942 | } |
943 | 943 | |
944 | - foreach ($containersFields as $containerId => $containerFieldIds){ |
|
944 | + foreach ($containersFields as $containerId => $containerFieldIds) { |
|
945 | 945 | $newRawFields = array(); |
946 | - foreach ($containerFieldIds as $containerFieldId){ |
|
946 | + foreach ($containerFieldIds as $containerFieldId) { |
|
947 | 947 | list ($srcContainerId, $srcfieldId) = explode('.', $containerFieldId); |
948 | 948 | $newRawFields[] = $containersRawFields[$srcContainerId][$srcfieldId]; |
949 | 949 | } |
@@ -264,8 +264,7 @@ discard block |
||
264 | 264 | $customSectionSet = $App->CustomContainerSet(); |
265 | 265 | if(isset($id)){ |
266 | 266 | $record = $customSectionSet->request($id); |
267 | - } |
|
268 | - else{ |
|
267 | + } else{ |
|
269 | 268 | $record = $customSectionSet->newRecord(); |
270 | 269 | $record->object = $object; |
271 | 270 | } |
@@ -522,8 +521,7 @@ discard block |
||
522 | 521 | |
523 | 522 | if($selectedManyField instanceof ORMBoolInterface){ |
524 | 523 | $condition = $condition['bool']; |
525 | - } |
|
526 | - else{ |
|
524 | + } else{ |
|
527 | 525 | $condition = $condition['default']; |
528 | 526 | } |
529 | 527 | |
@@ -551,8 +549,7 @@ discard block |
||
551 | 549 | |
552 | 550 | if($selectedOneField instanceof ORMBoolInterface){ |
553 | 551 | $condition = $condition['bool']; |
554 | - } |
|
555 | - else{ |
|
552 | + } else{ |
|
556 | 553 | $condition = $condition['default']; |
557 | 554 | } |
558 | 555 | |
@@ -561,15 +558,13 @@ discard block |
||
561 | 558 | } |
562 | 559 | break; |
563 | 560 | } |
564 | - } |
|
565 | - else{ |
|
561 | + } else{ |
|
566 | 562 | |
567 | 563 | $field = $objectRecordSet->$field; |
568 | 564 | |
569 | 565 | if($field instanceof ORMBoolInterface){ |
570 | 566 | $condition = $condition['bool']; |
571 | - } |
|
572 | - else{ |
|
567 | + } else{ |
|
573 | 568 | $condition = $condition['default']; |
574 | 569 | } |
575 | 570 |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | public function __construct(Func_App $app = null) |
41 | 41 | { |
42 | 42 | parent::__construct($app); |
43 | - if(! bab_isUserAdministrator()){ |
|
43 | + if (!bab_isUserAdministrator()) { |
|
44 | 44 | $action = WidgetAction::fromRequest(); |
45 | 45 | list (, $method) = explode('.', $action->getMethod()); |
46 | - if($method !== 'denied'){ |
|
46 | + if ($method !== 'denied') { |
|
47 | 47 | /** |
48 | 48 | * @var WidgetAction |
49 | 49 | */ |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $box->addClass('reload-configuration-page'); |
114 | 114 | $box->addClass('widget-100pc'); |
115 | 115 | |
116 | - if(! isset($itemId)){ |
|
116 | + if (!isset($itemId)) { |
|
117 | 117 | $this->resetCurrentTab(); |
118 | 118 | } |
119 | 119 | |
@@ -123,16 +123,16 @@ discard block |
||
123 | 123 | $navBoxHtml = '<ul class="nav nav-tabs">'; |
124 | 124 | $htmlCanvas = $W->HtmlCanvas(); |
125 | 125 | |
126 | - foreach ($configurationItems as $tabId => $tab){ |
|
126 | + foreach ($configurationItems as $tabId => $tab) { |
|
127 | 127 | $tabLink = $W->Link($tab['tabTitle'], $this->proxy() |
128 | 128 | ->setDisplayTab($tabId)) |
129 | 129 | ->setOpenMode(WidgetLink::OPEN_DIALOG); |
130 | 130 | $tabLinkHtml = '<li role="configuration"'; |
131 | - if($tabId == $currentTab){ |
|
131 | + if ($tabId == $currentTab) { |
|
132 | 132 | $tabLinkHtml .= ' class="active"'; |
133 | 133 | } |
134 | 134 | $tabLinkHtml .= '>'; |
135 | - $tabLinkHtml .= $tabLink->display($htmlCanvas) . '</li>'; |
|
135 | + $tabLinkHtml .= $tabLink->display($htmlCanvas).'</li>'; |
|
136 | 136 | $navBoxHtml .= $tabLinkHtml; |
137 | 137 | } |
138 | 138 | |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | ->addClass('icon-left icon-48x48 icon-left-48'); |
162 | 162 | $box->addItem($configBox); |
163 | 163 | |
164 | - if(! isset($configurationItems[$currentTab])){ |
|
164 | + if (!isset($configurationItems[$currentTab])) { |
|
165 | 165 | return $box; |
166 | 166 | } |
167 | 167 | |
168 | 168 | $tab = $configurationItems[$currentTab]; |
169 | 169 | |
170 | - foreach ($tab['tabContent'] as $tabSection){ |
|
171 | - if(! isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])){ |
|
170 | + foreach ($tab['tabContent'] as $tabSection) { |
|
171 | + if (!isset($tabSection['sectionContent']) || empty($tabSection['sectionContent'])) { |
|
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | $configBox->addItem($W->Section($tabSection['sectionName'], $sectionContentBox = $W->HBoxItems()) |
175 | 175 | ->setFoldable(true)); |
176 | - foreach ($tabSection['sectionContent'] as $tabSection){ |
|
176 | + foreach ($tabSection['sectionContent'] as $tabSection) { |
|
177 | 177 | $sectionContentBox->addItem($tabSection); |
178 | 178 | } |
179 | 179 | } |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | ); |
199 | 199 | |
200 | 200 | $definitions = $App->getComponentDefinitions(); |
201 | - foreach ($definitions as $packageName => $definition){ |
|
201 | + foreach ($definitions as $packageName => $definition) { |
|
202 | 202 | /* @var $definition AppComponentDefinition */ |
203 | - if(! method_exists($definition, 'getConfiguration')){ |
|
203 | + if (!method_exists($definition, 'getConfiguration')) { |
|
204 | 204 | continue; |
205 | 205 | } |
206 | 206 | $configurationItems[$packageName] = array( |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $customSection = $customSectionSet->request($customSectionSet->id->is($section)); |
61 | 61 | |
62 | 62 | $object = $customSection->container->object; |
63 | - if(strpos($object, $App->classPrefix) !== false){ |
|
63 | + if (strpos($object, $App->classPrefix) !== false) { |
|
64 | 64 | list (, $object) = explode($App->classPrefix, $object); |
65 | 65 | } |
66 | 66 | $objectCtrl = $App->Controller()->$object(false); |
@@ -69,18 +69,18 @@ discard block |
||
69 | 69 | ->_AND_($customSectionSet->object->is($customSection->object))); |
70 | 70 | |
71 | 71 | $allViewFieldNames = array(); |
72 | - foreach ($allViewSections as $viewSection){ |
|
72 | + foreach ($allViewSections as $viewSection) { |
|
73 | 73 | $fields = $viewSection->getFields(); |
74 | - foreach ($fields as $field){ |
|
75 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
76 | - foreach ($field['fields'] as $subField){ |
|
77 | - $allViewFieldNames[$subField['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
74 | + foreach ($fields as $field) { |
|
75 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
76 | + foreach ($field['fields'] as $subField) { |
|
77 | + $allViewFieldNames[$subField['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | 82 | $box = $W->VBoxItems(); |
83 | - if(isset($itemId)){ |
|
83 | + if (isset($itemId)) { |
|
84 | 84 | $box->setId($itemId); |
85 | 85 | } |
86 | 86 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | \bab_Sort::asort($availableFields, 'description', \bab_Sort::CASE_INSENSITIVE); |
97 | 97 | |
98 | - foreach ($availableFields as $field){ |
|
98 | + foreach ($availableFields as $field) { |
|
99 | 99 | $fieldName = $field['name']; |
100 | 100 | $fieldDescription = $field['description']; |
101 | 101 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $field = $customSection->getField($fieldName); |
152 | 152 | |
153 | - if(! isset($field)){ |
|
153 | + if (!isset($field)) { |
|
154 | 154 | return null; |
155 | 155 | } |
156 | 156 | |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | |
168 | 168 | $field = $availableFields[$fieldName]; |
169 | 169 | $fieldDescription = $field['description']; |
170 | - if(substr($fieldName, 0, 1) !== '_'){ |
|
170 | + if (substr($fieldName, 0, 1) !== '_') { |
|
171 | 171 | $fieldDescription = $App->translate($fieldDescription); |
172 | 172 | } |
173 | 173 | |
174 | - if(empty($field)){ |
|
174 | + if (empty($field)) { |
|
175 | 175 | // continue; |
176 | 176 | } |
177 | 177 | |
@@ -241,12 +241,12 @@ discard block |
||
241 | 241 | |
242 | 242 | $groupField = $customSection->getField($fieldGroupName); |
243 | 243 | |
244 | - if(! isset($groupField)){ |
|
244 | + if (!isset($groupField)) { |
|
245 | 245 | return null; |
246 | 246 | } |
247 | 247 | |
248 | 248 | $field = $groupField['fields'][$fieldName]; |
249 | - if(! isset($field)){ |
|
249 | + if (!isset($field)) { |
|
250 | 250 | return null; |
251 | 251 | } |
252 | 252 | |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | |
263 | 263 | $field = $availableFields[$fieldName]; |
264 | 264 | $fieldDescription = $field['description']; |
265 | - if(substr($fieldName, 0, 1) !== '_'){ |
|
265 | + if (substr($fieldName, 0, 1) !== '_') { |
|
266 | 266 | $fieldDescription = $App->translate($fieldDescription); |
267 | 267 | } |
268 | 268 | |
269 | - if(empty($field)){ |
|
269 | + if (empty($field)) { |
|
270 | 270 | // continue; |
271 | 271 | } |
272 | 272 | |
@@ -349,12 +349,12 @@ discard block |
||
349 | 349 | |
350 | 350 | $customSection = $customSectionSet->request($customSectionSet->id->is($section)); |
351 | 351 | $fields = $customSection->getFields(); |
352 | - if(! isset($fields[$fieldGroupName])){ |
|
352 | + if (!isset($fields[$fieldGroupName])) { |
|
353 | 353 | throw new AppException($App->translate('This fields group does not seem to exist')); |
354 | 354 | } |
355 | 355 | |
356 | 356 | $object = $customSection->container->object; |
357 | - if(strpos($object, $App->classPrefix) !== false){ |
|
357 | + if (strpos($object, $App->classPrefix) !== false) { |
|
358 | 358 | list (, $object) = explode($App->classPrefix, $object); |
359 | 359 | } |
360 | 360 | |
@@ -364,18 +364,18 @@ discard block |
||
364 | 364 | ->_AND_($customSectionSet->object->is($customSection->object))); |
365 | 365 | |
366 | 366 | $allViewFieldNames = array(); |
367 | - foreach ($allViewSections as $viewSection){ |
|
367 | + foreach ($allViewSections as $viewSection) { |
|
368 | 368 | $fields = $viewSection->getFields(); |
369 | - foreach ($fields as $field){ |
|
370 | - $allViewFieldNames[$field['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
371 | - foreach ($field['fields'] as $subField){ |
|
372 | - $allViewFieldNames[$subField['fieldname']] = $viewSection->view . ',' . $viewSection->rank . ',' . $viewSection->id; |
|
369 | + foreach ($fields as $field) { |
|
370 | + $allViewFieldNames[$field['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
371 | + foreach ($field['fields'] as $subField) { |
|
372 | + $allViewFieldNames[$subField['fieldname']] = $viewSection->view.','.$viewSection->rank.','.$viewSection->id; |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | 377 | $box = $W->VBoxItems(); |
378 | - if(isset($itemId)){ |
|
378 | + if (isset($itemId)) { |
|
379 | 379 | $box->setId($itemId); |
380 | 380 | } |
381 | 381 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | |
393 | 393 | \bab_Sort::asort($availableFields, 'description', \bab_Sort::CASE_INSENSITIVE); |
394 | 394 | |
395 | - foreach ($availableFields as $field){ |
|
395 | + foreach ($availableFields as $field) { |
|
396 | 396 | $fieldName = $field['name']; |
397 | 397 | $fieldDescription = $field['description']; |
398 | 398 | |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | $container = $customContainerSet->request($customContainerSet->id->is($container)); |
505 | 505 | |
506 | 506 | $customSectionSet = $App->CustomSectionSet(); |
507 | - if(isset($id)){ |
|
507 | + if (isset($id)) { |
|
508 | 508 | $record = $customSectionSet->request($id); |
509 | 509 | } |
510 | - else{ |
|
510 | + else { |
|
511 | 511 | $record = $customSectionSet->newRecord(); |
512 | 512 | $record->container = $container->id; |
513 | 513 | } |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | |
520 | 520 | $editor = new AppEditor($App); |
521 | 521 | $editor->setHiddenValue('tg', $App->controllerTg); |
522 | - if($record->id){ |
|
522 | + if ($record->id) { |
|
523 | 523 | $editor->setHiddenValue('data[id]', $record->id); |
524 | 524 | } |
525 | 525 | $editor->setName('data'); |
@@ -535,16 +535,16 @@ discard block |
||
535 | 535 | |
536 | 536 | $options = array(); |
537 | 537 | $rank = 1; |
538 | - foreach ($containers as $container){ |
|
538 | + foreach ($containers as $container) { |
|
539 | 539 | $options[$container->id] = sprintf('%d (%s)', $rank, $container->name); |
540 | - $rank ++; |
|
540 | + $rank++; |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | $containerSections = $customSectionSet->select($customSectionSet->container->is($container->id)) |
544 | 544 | ->orderDesc($customSectionSet->rank); |
545 | 545 | |
546 | 546 | $nbSections = 0; |
547 | - foreach ($containerSections as $containerSection){ |
|
547 | + foreach ($containerSections as $containerSection) { |
|
548 | 548 | $nbSections = $containerSection->rank + 1; |
549 | 549 | break; |
550 | 550 | } |
@@ -628,10 +628,10 @@ discard block |
||
628 | 628 | $record = $recordSet->request($id); |
629 | 629 | |
630 | 630 | $object = $record->object; |
631 | - if(empty($object)){ |
|
631 | + if (empty($object)) { |
|
632 | 632 | $object = $record->container()->object; |
633 | 633 | } |
634 | - if(strpos($object, $App->classPrefix) !== false){ |
|
634 | + if (strpos($object, $App->classPrefix) !== false) { |
|
635 | 635 | $object = str_replace($App->classPrefix, '', $object); |
636 | 636 | } |
637 | 637 | $object .= 'Set'; |
@@ -646,25 +646,25 @@ discard block |
||
646 | 646 | $manySets = $objectRecordSet->getHasManyRelations(); |
647 | 647 | $oneSets = $objectRecordSet->getHasOneRelations(); |
648 | 648 | |
649 | - if(! empty($record->visibilityCriteria)){ |
|
649 | + if (!empty($record->visibilityCriteria)) { |
|
650 | 650 | $arrCriteria = json_decode($record->visibilityCriteria, true); |
651 | 651 | |
652 | 652 | $data = array(); |
653 | - foreach ($arrCriteria as $fieldName => $operation){ |
|
653 | + foreach ($arrCriteria as $fieldName => $operation) { |
|
654 | 654 | $data['field'] = $fieldName; |
655 | - foreach ($operation as $condition => $value){ |
|
655 | + foreach ($operation as $condition => $value) { |
|
656 | 656 | $data['condition']['default'] = $condition; |
657 | 657 | $data['condition']['bool'] = $condition; |
658 | - if(is_array($value)){ |
|
659 | - foreach ($value as $key => $subValue){ |
|
660 | - foreach ($manySets as $manyFieldName => $manyRelation){ |
|
661 | - if($key . 'Set' == $manyRelation->getForeignSetClassName()){ |
|
662 | - foreach ($subValue as $subFieldName => $subConditions){ |
|
663 | - if($subFieldName === '_foreignField'){ |
|
658 | + if (is_array($value)) { |
|
659 | + foreach ($value as $key => $subValue) { |
|
660 | + foreach ($manySets as $manyFieldName => $manyRelation) { |
|
661 | + if ($key.'Set' == $manyRelation->getForeignSetClassName()) { |
|
662 | + foreach ($subValue as $subFieldName => $subConditions) { |
|
663 | + if ($subFieldName === '_foreignField') { |
|
664 | 664 | continue; |
665 | 665 | } |
666 | 666 | $data['field'] = "{$manyFieldName}/{$subFieldName}"; |
667 | - foreach ($subConditions as $subCondition => $subConditionValue){ |
|
667 | + foreach ($subConditions as $subCondition => $subConditionValue) { |
|
668 | 668 | $data['condition']['default'] = $subCondition; |
669 | 669 | $data['condition']['bool'] = $subCondition; |
670 | 670 | $value = $subConditionValue; |
@@ -673,14 +673,14 @@ discard block |
||
673 | 673 | break; |
674 | 674 | } |
675 | 675 | } |
676 | - foreach ($oneSets as $oneFieldName => $oneRelation){ |
|
677 | - if($key . 'Set' == $oneRelation->getForeignSetClassName()){ |
|
678 | - foreach ($subValue as $subFieldName => $subConditions){ |
|
679 | - if($subFieldName === '_foreignField'){ |
|
676 | + foreach ($oneSets as $oneFieldName => $oneRelation) { |
|
677 | + if ($key.'Set' == $oneRelation->getForeignSetClassName()) { |
|
678 | + foreach ($subValue as $subFieldName => $subConditions) { |
|
679 | + if ($subFieldName === '_foreignField') { |
|
680 | 680 | continue; |
681 | 681 | } |
682 | 682 | $data['field'] = "{$oneFieldName}/{$subFieldName}"; |
683 | - foreach ($subConditions as $subCondition => $subConditionValue){ |
|
683 | + foreach ($subConditions as $subCondition => $subConditionValue) { |
|
684 | 684 | $data['condition']['default'] = $subCondition; |
685 | 685 | $data['condition']['bool'] = $subCondition; |
686 | 686 | $value = $subConditionValue; |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | */ |
716 | 716 | public function save($data = null) |
717 | 717 | { |
718 | - if(! isset($data['id']) && isset($data['container']) && $data['container'] != 0 && ! isset($data['rank'])){ |
|
718 | + if (!isset($data['id']) && isset($data['container']) && $data['container'] != 0 && !isset($data['rank'])) { |
|
719 | 719 | $set = $this->getRecordSet(); |
720 | 720 | $data['rank'] = $set->select($set->container->is($data['container'])) |
721 | 721 | ->count(); |
@@ -748,11 +748,11 @@ discard block |
||
748 | 748 | $set->rank->greaterThanOrEqual($record->rank) |
749 | 749 | ))); |
750 | 750 | |
751 | - $position ++; |
|
752 | - foreach ($afterSections as $afterSection){ |
|
751 | + $position++; |
|
752 | + foreach ($afterSections as $afterSection) { |
|
753 | 753 | $afterSection->rank = $position; |
754 | 754 | $afterSection->save(); |
755 | - $position ++; |
|
755 | + $position++; |
|
756 | 756 | } |
757 | 757 | } |
758 | 758 | |
@@ -780,10 +780,10 @@ discard block |
||
780 | 780 | $record = $recordSet->request($data['id']); |
781 | 781 | |
782 | 782 | $object = $record->object; |
783 | - if(empty($object)){ |
|
783 | + if (empty($object)) { |
|
784 | 784 | $object = $record->container()->object; |
785 | 785 | } |
786 | - if(strpos($object, $App->classPrefix) !== false){ |
|
786 | + if (strpos($object, $App->classPrefix) !== false) { |
|
787 | 787 | $object = str_replace($App->classPrefix, '', $object); |
788 | 788 | } |
789 | 789 | $object .= 'Set'; |
@@ -793,14 +793,14 @@ discard block |
||
793 | 793 | $field = $data['field']; |
794 | 794 | $condition = $data['condition']; |
795 | 795 | |
796 | - if(strpos($field, '/') !== false){ |
|
796 | + if (strpos($field, '/') !== false) { |
|
797 | 797 | // The selected field is a hasMany or a hasOne relation |
798 | 798 | list ($selectedRelation, $selectedField) = explode('/', $field); |
799 | 799 | $classPrefix = $App->classPrefix; |
800 | 800 | |
801 | 801 | $manyRelations = $objectRecordSet->getHasManyRelations(); |
802 | - foreach ($manyRelations as $manyRelation){ |
|
803 | - if($selectedRelation != $manyRelation->getOwnerSetFieldName()){ |
|
802 | + foreach ($manyRelations as $manyRelation) { |
|
803 | + if ($selectedRelation != $manyRelation->getOwnerSetFieldName()) { |
|
804 | 804 | continue; |
805 | 805 | } |
806 | 806 | $foreignSetName = str_replace($classPrefix, '', $manyRelation->getForeignSetClassName()); |
@@ -808,13 +808,13 @@ discard block |
||
808 | 808 | |
809 | 809 | $visibilityCriteria = ''; |
810 | 810 | |
811 | - if($foreignSet){ |
|
811 | + if ($foreignSet) { |
|
812 | 812 | $selectedManyField = $foreignSet->$selectedField; |
813 | 813 | |
814 | - if($selectedManyField instanceof ORMBoolInterface){ |
|
814 | + if ($selectedManyField instanceof ORMBoolInterface) { |
|
815 | 815 | $condition = $condition['bool']; |
816 | 816 | } |
817 | - else{ |
|
817 | + else { |
|
818 | 818 | $condition = $condition['default']; |
819 | 819 | } |
820 | 820 | |
@@ -826,9 +826,9 @@ discard block |
||
826 | 826 | } |
827 | 827 | |
828 | 828 | $oneRelations = $objectRecordSet->getHasOneRelations(); |
829 | - foreach ($oneRelations as $oneRelation){ |
|
829 | + foreach ($oneRelations as $oneRelation) { |
|
830 | 830 | /* @var $oneRelation ORMOneRelation*/ |
831 | - if($selectedRelation != $oneRelation->getOwnerSetFieldName()){ |
|
831 | + if ($selectedRelation != $oneRelation->getOwnerSetFieldName()) { |
|
832 | 832 | continue; |
833 | 833 | } |
834 | 834 | $foreignSetClassName = $oneRelation->getForeignSetClassName(); |
@@ -837,13 +837,13 @@ discard block |
||
837 | 837 | |
838 | 838 | $visibilityCriteria = ''; |
839 | 839 | |
840 | - if($foreignSet){ |
|
840 | + if ($foreignSet) { |
|
841 | 841 | $selectedOneField = $foreignSet->$selectedField; |
842 | 842 | |
843 | - if($selectedOneField instanceof ORMBoolInterface){ |
|
843 | + if ($selectedOneField instanceof ORMBoolInterface) { |
|
844 | 844 | $condition = $condition['bool']; |
845 | 845 | } |
846 | - else{ |
|
846 | + else { |
|
847 | 847 | $condition = $condition['default']; |
848 | 848 | } |
849 | 849 | |
@@ -853,20 +853,20 @@ discard block |
||
853 | 853 | break; |
854 | 854 | } |
855 | 855 | } |
856 | - else{ |
|
856 | + else { |
|
857 | 857 | |
858 | 858 | $field = $objectRecordSet->$field; |
859 | 859 | |
860 | - if($field instanceof ORMBoolInterface){ |
|
860 | + if ($field instanceof ORMBoolInterface) { |
|
861 | 861 | $condition = $condition['bool']; |
862 | 862 | } |
863 | - else{ |
|
863 | + else { |
|
864 | 864 | $condition = $condition['default']; |
865 | 865 | } |
866 | 866 | |
867 | 867 | $visibilityCriteria = ''; |
868 | 868 | |
869 | - if(! empty($condition)){ |
|
869 | + if (!empty($condition)) { |
|
870 | 870 | $criteria = $field->{$condition}($data['value']); |
871 | 871 | $visibilityCriteria = $criteria->toJson(); |
872 | 872 | } |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | $customContainer = $customContainerSet->request($container); |
896 | 896 | |
897 | 897 | $object = $customContainer->object; |
898 | - if(strpos($object, $App->classPrefix) !== false){ |
|
898 | + if (strpos($object, $App->classPrefix) !== false) { |
|
899 | 899 | list (, $object) = explode($App->classPrefix, $object); |
900 | 900 | } |
901 | 901 | |
@@ -922,17 +922,17 @@ discard block |
||
922 | 922 | |
923 | 923 | $nbCol = 0; |
924 | 924 | |
925 | - foreach ($customSections as $customSection){ |
|
925 | + foreach ($customSections as $customSection) { |
|
926 | 926 | |
927 | - list (, , $nbCol) = explode('-', $customSection->sizePolicy); |
|
927 | + list (,, $nbCol) = explode('-', $customSection->sizePolicy); |
|
928 | 928 | |
929 | 929 | $currentColumn += $nbCol; |
930 | 930 | |
931 | - $sectionSection = $W->Section($customSection->name . ' (' . $customSection->rank . ')', $sectionBox = $W->VBoxItems($W->Hidden() |
|
932 | - ->setName('#' . $customSection->id))); |
|
931 | + $sectionSection = $W->Section($customSection->name.' ('.$customSection->rank.')', $sectionBox = $W->VBoxItems($W->Hidden() |
|
932 | + ->setName('#'.$customSection->id))); |
|
933 | 933 | $sectionSection->addClass('app-custom-section'); |
934 | 934 | $sectionSection->addClass($customSection->classname); |
935 | - $sectionSection->setSizePolicy($customSection->sizePolicy . ' widget-sameheight'); |
|
935 | + $sectionSection->setSizePolicy($customSection->sizePolicy.' widget-sameheight'); |
|
936 | 936 | |
937 | 937 | $row->addItem($sectionSection); |
938 | 938 | |
@@ -950,40 +950,40 @@ discard block |
||
950 | 950 | ->addClass('icon', \Func_Icons::ACTIONS_EDIT_DELETE) |
951 | 951 | ->setOpenMode(WidgetLink::OPEN_DIALOG) |
952 | 952 | ->setDialogClass('box red'))); |
953 | - if(! empty($customSection->visibilityCriteria)){ |
|
953 | + if (!empty($customSection->visibilityCriteria)) { |
|
954 | 954 | $sectionBox->addItem($W->HBoxItems($W->Label($App->translate('This section has a visibility condition'))) |
955 | 955 | ->setSizePolicy('alert alert-warning widget-100pc')); |
956 | 956 | } |
957 | 957 | $fields = $customSection->getFields(); |
958 | - if(count($fields) == 0){ |
|
958 | + if (count($fields) == 0) { |
|
959 | 959 | $sectionBox->addItem($W->HBoxItems($W->Label($App->translate('This section does not contain any field'))) |
960 | 960 | ->setSizePolicy('alert alert-warning')); |
961 | 961 | } |
962 | - foreach ($fields as $fieldId => $field){ |
|
963 | - if(empty($field)){ |
|
962 | + foreach ($fields as $fieldId => $field) { |
|
963 | + if (empty($field)) { |
|
964 | 964 | continue; |
965 | 965 | } |
966 | 966 | |
967 | 967 | $fieldName = $field['fieldname']; |
968 | 968 | |
969 | 969 | $isFieldsGroup = false; |
970 | - if(strpos($fieldName, '_fieldsGroup') !== false){ |
|
970 | + if (strpos($fieldName, '_fieldsGroup') !== false) { |
|
971 | 971 | $fieldName = '_fieldsGroup'; |
972 | 972 | $isFieldsGroup = true; |
973 | 973 | } |
974 | 974 | |
975 | 975 | $field = $availableFields[$fieldName]; |
976 | 976 | $fieldDescription = $field['description']; |
977 | - if(substr($fieldName, 0, 1) !== '_'){ |
|
977 | + if (substr($fieldName, 0, 1) !== '_') { |
|
978 | 978 | $fieldDescription = $App->translate($fieldDescription); |
979 | 979 | } |
980 | 980 | |
981 | - if(empty($field)){ |
|
981 | + if (empty($field)) { |
|
982 | 982 | continue; |
983 | 983 | } |
984 | 984 | |
985 | 985 | $fieldName = $field['name']; |
986 | - if($isFieldsGroup){ |
|
986 | + if ($isFieldsGroup) { |
|
987 | 987 | $fieldName = $fieldId; |
988 | 988 | } |
989 | 989 | |
@@ -994,20 +994,20 @@ discard block |
||
994 | 994 | ->setGrowable(true) |
995 | 995 | ->setWrap(WidgetFlexLayout::FLEX_WRAP_WRAP)) |
996 | 996 | ->setSizePolicy('maximum'), $btnBox = $W->HBoxItems($W->Hidden() |
997 | - ->setName($customSection->id . '.' . $fieldId) |
|
997 | + ->setName($customSection->id.'.'.$fieldId) |
|
998 | 998 | ->setValue($fieldName)) |
999 | 999 | ->addClass('widget-actions')) |
1000 | 1000 | ->setSizePolicy('widget-list-element widget-actions-target') |
1001 | 1001 | ->addClass(\Func_Icons::ICON_LEFT_16); |
1002 | - if(strpos($field['name'], '_fieldsGroup') !== false){ |
|
1002 | + if (strpos($field['name'], '_fieldsGroup') !== false) { |
|
1003 | 1003 | $btnBox->addItem($W->Link('', $customSectionCtrl->addDisplayFieldToGroup($customSection->id, $fieldName)) |
1004 | 1004 | ->addClass('icon', \Func_Icons::ACTIONS_LIST_ADD) |
1005 | 1005 | ->setOpenMode(WidgetLink::OPEN_DIALOG)); |
1006 | 1006 | $groupedFields = $fields[$fieldName]['fields']; |
1007 | - foreach ($groupedFields as $groupedField){ |
|
1007 | + foreach ($groupedFields as $groupedField) { |
|
1008 | 1008 | $groupedFieldDetails = $availableFields[$groupedField['fieldname']]; |
1009 | 1009 | $fieldGroupBox->addItem($flexField = $W->FlowItems($W->Hidden(null, array( |
1010 | - $customSection->id . '.fieldsGroups', |
|
1010 | + $customSection->id.'.fieldsGroups', |
|
1011 | 1011 | $fieldName, |
1012 | 1012 | $groupedField['fieldname'] |
1013 | 1013 | ), $groupedField['fieldname']), $W->Label($groupedFieldDetails['description']), $W->FlowItems($W->Link('', $customSectionCtrl->editGroupFieldDisplayField($customSection->id, $fieldName, $groupedField['fieldname'])) |
@@ -1035,23 +1035,23 @@ discard block |
||
1035 | 1035 | $sectionsBoxes[] = $sectionBox; |
1036 | 1036 | } |
1037 | 1037 | |
1038 | - if($currentColumn + $nbCol > 0){ |
|
1038 | + if ($currentColumn + $nbCol > 0) { |
|
1039 | 1039 | $sectionsSection->addItem($row); |
1040 | 1040 | } |
1041 | 1041 | |
1042 | - foreach ($sectionsBoxes as $sectionsBox){ |
|
1042 | + foreach ($sectionsBoxes as $sectionsBox) { |
|
1043 | 1043 | $sectionsBox->sortable(true, $sectionsBoxes); |
1044 | 1044 | $sectionsBox->setMetadata('samePlaceholderSize', true); |
1045 | 1045 | } |
1046 | 1046 | |
1047 | - foreach ($rows as $row){ |
|
1047 | + foreach ($rows as $row) { |
|
1048 | 1048 | $row->sortable(true, $rows); |
1049 | 1049 | $row->setMetadata('samePlaceholderSize', true); |
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | $form = $W->Form(); |
1053 | 1053 | |
1054 | - if(isset($itemId)){ |
|
1054 | + if (isset($itemId)) { |
|
1055 | 1055 | $form->setId($itemId); |
1056 | 1056 | } |
1057 | 1057 | $form->setHiddenValue('tg', $App->controllerTg); |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | $customSections = $customSectionSet->select($customSectionSet->container->is($container)); |
1079 | 1079 | |
1080 | 1080 | $sectionsValues = array(); |
1081 | - foreach ($customSections as $customSection){ |
|
1081 | + foreach ($customSections as $customSection) { |
|
1082 | 1082 | $values = $customSection->getValues(); |
1083 | 1083 | unset($values['id']); |
1084 | 1084 | unset($values['createdBy']); |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | header('Content-type: application/json'); |
1095 | - header('Content-Disposition: attachment; filename="' . $container->object . '.' . ($container->view === '' ? 'default' : $container->view) . '.' . $container->name . '.json"' . "\n"); |
|
1095 | + header('Content-Disposition: attachment; filename="'.$container->object.'.'.($container->view === '' ? 'default' : $container->view).'.'.$container->name.'.json"'."\n"); |
|
1096 | 1096 | |
1097 | 1097 | $json = bab_json_encode($sectionsValues); |
1098 | 1098 | $json = bab_convertStringFromDatabase($json, \bab_charset::UTF_8); |
@@ -1144,12 +1144,12 @@ discard block |
||
1144 | 1144 | $files->push($sectionsfile['uid']); |
1145 | 1145 | |
1146 | 1146 | $data = null; |
1147 | - foreach ($files as $f){ |
|
1147 | + foreach ($files as $f) { |
|
1148 | 1148 | $data = file_get_contents($f->toString()); |
1149 | 1149 | break; |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - if(! isset($data)){ |
|
1152 | + if (!isset($data)) { |
|
1153 | 1153 | $this->addError($App->translate('Unable to get file content')); |
1154 | 1154 | return true; |
1155 | 1155 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | |
1162 | 1162 | $customSectionSet->delete($customSectionSet->container->is($container)); |
1163 | 1163 | |
1164 | - foreach ($sectionsValues as $sectionValues){ |
|
1164 | + foreach ($sectionsValues as $sectionValues) { |
|
1165 | 1165 | $customSection = $customSectionSet->newRecord(); |
1166 | 1166 | $customSection->setValues($sectionValues); |
1167 | 1167 | $customSection->container = $container; |
@@ -1239,59 +1239,59 @@ discard block |
||
1239 | 1239 | $ranks = array(); |
1240 | 1240 | $rank = 0; |
1241 | 1241 | |
1242 | - foreach ($sections as $key => $value){ |
|
1242 | + foreach ($sections as $key => $value) { |
|
1243 | 1243 | // Sections ids start with #, while section fields start with their original section id |
1244 | - if(substr($key, 0, 1) === '#'){ |
|
1244 | + if (substr($key, 0, 1) === '#') { |
|
1245 | 1245 | $currentSectionId = substr($key, 1); |
1246 | 1246 | $rawSectionData[$currentSectionId] = array(); |
1247 | - if(! isset($oldSectionId)){ |
|
1247 | + if (!isset($oldSectionId)) { |
|
1248 | 1248 | $oldSectionId = $currentSectionId; |
1249 | 1249 | } |
1250 | - if(isset($currentSection) && $oldSectionId != $currentSectionId){ |
|
1250 | + if (isset($currentSection) && $oldSectionId != $currentSectionId) { |
|
1251 | 1251 | $oldSectionId = $currentSectionId; |
1252 | 1252 | } |
1253 | 1253 | $ranks[$currentSectionId] = $rank; |
1254 | - $rank ++; |
|
1254 | + $rank++; |
|
1255 | 1255 | $currentSection = $customSectionSet->get($customSectionSet->id->is($currentSectionId)); |
1256 | 1256 | continue; |
1257 | 1257 | } |
1258 | - if(! isset($currentSection)){ |
|
1258 | + if (!isset($currentSection)) { |
|
1259 | 1259 | continue; |
1260 | 1260 | } |
1261 | 1261 | list ($fieldSectionId, $fieldName) = explode('.', $key); |
1262 | - if($fieldSectionId == $currentSectionId){ |
|
1262 | + if ($fieldSectionId == $currentSectionId) { |
|
1263 | 1263 | $field = $currentSection->getField($fieldName); |
1264 | - if(strpos($fieldName, '_fieldsGroup') !== false){ |
|
1264 | + if (strpos($fieldName, '_fieldsGroup') !== false) { |
|
1265 | 1265 | $rawSectionData[$currentSectionId][$fieldName]['block'] = $field['block']; |
1266 | 1266 | $rawSectionData[$currentSectionId][$fieldName]['fieldname'] = '_fieldsGroup'; |
1267 | 1267 | $rawSectionData[$currentSectionId][$fieldName]['parameters'] = $field['parameters']; |
1268 | - foreach ($sections[$currentSection->id . '.fieldsGroups'][$fieldName] as $subKey => $subValue){ |
|
1268 | + foreach ($sections[$currentSection->id.'.fieldsGroups'][$fieldName] as $subKey => $subValue) { |
|
1269 | 1269 | $rawSectionData[$currentSectionId][$fieldName]['fields'][$subKey] = $field['fields'][$subKey]; |
1270 | 1270 | } |
1271 | 1271 | } |
1272 | - elseif($fieldName != 'fieldsGroups'){ |
|
1272 | + elseif ($fieldName != 'fieldsGroups') { |
|
1273 | 1273 | $rawSectionData[$currentSectionId][$fieldName] = $field; |
1274 | 1274 | } |
1275 | 1275 | } |
1276 | - else{ |
|
1276 | + else { |
|
1277 | 1277 | $field = null; |
1278 | 1278 | $tmpSection = $customSectionSet->get($customSectionSet->id->is($fieldSectionId)); |
1279 | - if($tmpSection){ |
|
1279 | + if ($tmpSection) { |
|
1280 | 1280 | $field = $tmpSection->getField($fieldName); |
1281 | 1281 | } |
1282 | - if(isset($field)){ |
|
1282 | + if (isset($field)) { |
|
1283 | 1283 | $rawSectionData[$currentSectionId][$fieldName] = $field; |
1284 | 1284 | } |
1285 | 1285 | } |
1286 | 1286 | } |
1287 | 1287 | |
1288 | - foreach ($rawSectionData as $sectionId => $fields){ |
|
1288 | + foreach ($rawSectionData as $sectionId => $fields) { |
|
1289 | 1289 | $section = $customSectionSet->get($customSectionSet->id->is($sectionId)); |
1290 | - if($section){ |
|
1290 | + if ($section) { |
|
1291 | 1291 | $section->fields = json_encode($fields); |
1292 | 1292 | $section->rank = isset($ranks[$sectionId]) ? $ranks[$sectionId] : 0; |
1293 | 1293 | $section->save(); |
1294 | - $rank ++; |
|
1294 | + $rank++; |
|
1295 | 1295 | } |
1296 | 1296 | } |
1297 | 1297 |
@@ -506,8 +506,7 @@ discard block |
||
506 | 506 | $customSectionSet = $App->CustomSectionSet(); |
507 | 507 | if(isset($id)){ |
508 | 508 | $record = $customSectionSet->request($id); |
509 | - } |
|
510 | - else{ |
|
509 | + } else{ |
|
511 | 510 | $record = $customSectionSet->newRecord(); |
512 | 511 | $record->container = $container->id; |
513 | 512 | } |
@@ -813,8 +812,7 @@ discard block |
||
813 | 812 | |
814 | 813 | if($selectedManyField instanceof ORMBoolInterface){ |
815 | 814 | $condition = $condition['bool']; |
816 | - } |
|
817 | - else{ |
|
815 | + } else{ |
|
818 | 816 | $condition = $condition['default']; |
819 | 817 | } |
820 | 818 | |
@@ -842,8 +840,7 @@ discard block |
||
842 | 840 | |
843 | 841 | if($selectedOneField instanceof ORMBoolInterface){ |
844 | 842 | $condition = $condition['bool']; |
845 | - } |
|
846 | - else{ |
|
843 | + } else{ |
|
847 | 844 | $condition = $condition['default']; |
848 | 845 | } |
849 | 846 | |
@@ -852,15 +849,13 @@ discard block |
||
852 | 849 | } |
853 | 850 | break; |
854 | 851 | } |
855 | - } |
|
856 | - else{ |
|
852 | + } else{ |
|
857 | 853 | |
858 | 854 | $field = $objectRecordSet->$field; |
859 | 855 | |
860 | 856 | if($field instanceof ORMBoolInterface){ |
861 | 857 | $condition = $condition['bool']; |
862 | - } |
|
863 | - else{ |
|
858 | + } else{ |
|
864 | 859 | $condition = $condition['default']; |
865 | 860 | } |
866 | 861 | |
@@ -1268,12 +1263,10 @@ discard block |
||
1268 | 1263 | foreach ($sections[$currentSection->id . '.fieldsGroups'][$fieldName] as $subKey => $subValue){ |
1269 | 1264 | $rawSectionData[$currentSectionId][$fieldName]['fields'][$subKey] = $field['fields'][$subKey]; |
1270 | 1265 | } |
1271 | - } |
|
1272 | - elseif($fieldName != 'fieldsGroups'){ |
|
1266 | + } elseif($fieldName != 'fieldsGroups'){ |
|
1273 | 1267 | $rawSectionData[$currentSectionId][$fieldName] = $field; |
1274 | 1268 | } |
1275 | - } |
|
1276 | - else{ |
|
1269 | + } else{ |
|
1277 | 1270 | $field = null; |
1278 | 1271 | $tmpSection = $customSectionSet->get($customSectionSet->id->is($fieldSectionId)); |
1279 | 1272 | if($tmpSection){ |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | use Capwelton\LibApp\Func_App; |
40 | 40 | use Capwelton\LibApp\AppComponent; |
41 | 41 | use Capwelton\LibOrm\Exceptions\ORMException; |
42 | -require_once $GLOBALS['babInstallPath'] . 'utilit/controller.class.php'; |
|
43 | -require_once $GLOBALS['babInstallPath'] . 'utilit/json.php'; |
|
42 | +require_once $GLOBALS['babInstallPath'].'utilit/controller.class.php'; |
|
43 | +require_once $GLOBALS['babInstallPath'].'utilit/json.php'; |
|
44 | 44 | |
45 | -require_once dirname(__FILE__) . '/../functions.php'; |
|
45 | +require_once dirname(__FILE__).'/../functions.php'; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @method self proxy() |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function addReloadSelector($reloadSelector, $withSSE = false, $for = null) |
75 | 75 | { |
76 | 76 | $this->reloadSelectors[$reloadSelector] = $reloadSelector; |
77 | - if($withSSE){ |
|
77 | + if ($withSSE) { |
|
78 | 78 | $sseRecordSet = $this->getSSERecordSet(); |
79 | 79 | $sseRecordSet->newReloadSelector($reloadSelector, $for); |
80 | 80 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | public function getSSERecordSet() |
93 | 93 | { |
94 | - if(isset($this->SSERecordSet)){ |
|
94 | + if (isset($this->SSERecordSet)) { |
|
95 | 95 | return $this->SSERecordSet; |
96 | 96 | } |
97 | 97 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | public function __call($name, $arguments = array()) |
131 | 131 | { |
132 | 132 | $component = $this->App()->getComponentByName($name); |
133 | - if($component){ |
|
133 | + if ($component) { |
|
134 | 134 | return call_user_func_array(array( |
135 | 135 | $component, |
136 | 136 | 'controller' |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function isAjaxRequest() |
175 | 175 | { |
176 | - if(! isset($this->isAjaxRequest)){ |
|
176 | + if (!isset($this->isAjaxRequest)) { |
|
177 | 177 | $this->isAjaxRequest = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); |
178 | 178 | } |
179 | 179 | return $this->isAjaxRequest; |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function requireCredential($message = null) |
187 | 187 | { |
188 | - if($this->isAjaxRequest()){ |
|
188 | + if ($this->isAjaxRequest()) { |
|
189 | 189 | $authType = 'Basic'; |
190 | 190 | } |
191 | - else{ |
|
191 | + else { |
|
192 | 192 | $authType = ''; |
193 | 193 | } |
194 | 194 | |
195 | - if(! isset($message)){ |
|
195 | + if (!isset($message)) { |
|
196 | 196 | $message = $this->App()->translate('You must be logged in to access this page.'); |
197 | 197 | } |
198 | 198 | |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | list ($prefix) = explode('_', __CLASS__); |
217 | 217 | $functionalityName = ucwords($prefix); |
218 | 218 | /** @var Func_App */ |
219 | - $App = @\bab_functionality::get('App/' . $functionalityName); |
|
219 | + $App = @\bab_functionality::get('App/'.$functionalityName); |
|
220 | 220 | |
221 | - if(!$App){ |
|
222 | - throw new AppException('Faild to autodetect functionality App/' . $functionalityName . ', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
221 | + if (!$App) { |
|
222 | + throw new AppException('Faild to autodetect functionality App/'.$functionalityName.', the getInstance method is deprecated, use $App->ControllerProxy() instead'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | $controller = $App->ControllerProxy($classname, $proxy); |
@@ -237,44 +237,44 @@ discard block |
||
237 | 237 | static function getProxyInstance(Func_App $App, $classname) |
238 | 238 | { |
239 | 239 | $class = new \ReflectionClass($classname); |
240 | - $proxyClassname = $class->getShortName() . self::PROXY_CLASS_SUFFIX; |
|
240 | + $proxyClassname = $class->getShortName().self::PROXY_CLASS_SUFFIX; |
|
241 | 241 | $finalProxyClassname = $class->getNamespaceName()."\\".$proxyClassname; |
242 | - if(! class_exists($finalProxyClassname)){ |
|
242 | + if (!class_exists($finalProxyClassname)) { |
|
243 | 243 | $classStr = ""; |
244 | - if($class->getNamespaceName() != ""){ |
|
244 | + if ($class->getNamespaceName() != "") { |
|
245 | 245 | $classStr .= " namespace ".$class->getNamespaceName()."; "; |
246 | 246 | } |
247 | - $classStr .= 'class ' . $proxyClassname . ' extends ' . $class->getShortName() . ' {' . "\n"; |
|
247 | + $classStr .= 'class '.$proxyClassname.' extends '.$class->getShortName().' {'."\n"; |
|
248 | 248 | $methods = $class->getMethods(); |
249 | 249 | |
250 | 250 | $classStr .= ' public function __construct($App) { |
251 | 251 | $this->setApp($App); |
252 | 252 | }' . "\n"; |
253 | 253 | |
254 | - foreach ($methods as $method){ |
|
255 | - if($method->name === '__construct' || ! $method->isPublic() || $method->isStatic() || $method->isFinal() || $method->name === 'setApp' || $method->name === 'App' || $method->name === 'setCrm' || $method->name === 'Crm'){ |
|
254 | + foreach ($methods as $method) { |
|
255 | + if ($method->name === '__construct' || !$method->isPublic() || $method->isStatic() || $method->isFinal() || $method->name === 'setApp' || $method->name === 'App' || $method->name === 'setCrm' || $method->name === 'Crm') { |
|
256 | 256 | continue; |
257 | 257 | } |
258 | 258 | |
259 | - $classStr .= ' public function ' . $method->name . '('; |
|
259 | + $classStr .= ' public function '.$method->name.'('; |
|
260 | 260 | $parameters = $method->getParameters(); |
261 | 261 | $parametersStr = array(); |
262 | - foreach ($parameters as $parameter){ |
|
262 | + foreach ($parameters as $parameter) { |
|
263 | 263 | |
264 | - if($parameter->isDefaultValueAvailable()){ |
|
265 | - $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true); |
|
264 | + if ($parameter->isDefaultValueAvailable()) { |
|
265 | + $parametersStr[] = '$'.$parameter->name.' = '.var_export($parameter->getDefaultValue(), true); |
|
266 | 266 | } |
267 | - else{ |
|
268 | - $parametersStr[] = '$' . $parameter->name; |
|
267 | + else { |
|
268 | + $parametersStr[] = '$'.$parameter->name; |
|
269 | 269 | } |
270 | 270 | } |
271 | 271 | $classStr .= implode(', ', $parametersStr); |
272 | - $classStr .= ') {' . "\n"; |
|
273 | - $classStr .= ' $args = func_get_args();' . "\n"; |
|
274 | - $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);' . "\n"; |
|
275 | - $classStr .= ' }' . "\n"; |
|
272 | + $classStr .= ') {'."\n"; |
|
273 | + $classStr .= ' $args = func_get_args();'."\n"; |
|
274 | + $classStr .= ' return $this->getMethodAction(__FUNCTION__, $args);'."\n"; |
|
275 | + $classStr .= ' }'."\n"; |
|
276 | 276 | } |
277 | - $classStr .= '}' . "\n"; |
|
277 | + $classStr .= '}'."\n"; |
|
278 | 278 | // We define the proxy class |
279 | 279 | eval($classStr); |
280 | 280 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | protected function getObjectName($classname) |
313 | 313 | { |
314 | 314 | list ($objectname) = explode('Controller', $classname); |
315 | - if($this->App()->getComponentByName($objectname)){ |
|
315 | + if ($this->App()->getComponentByName($objectname)) { |
|
316 | 316 | return strtolower($objectname); |
317 | 317 | } |
318 | 318 | list (, $objectname) = explode('Ctrl', $classname); |
@@ -334,18 +334,18 @@ discard block |
||
334 | 334 | |
335 | 335 | $reflector = new \ReflectionClass(get_class($this)); |
336 | 336 | $parent = $reflector->getParentClass(); |
337 | - if($parent){ |
|
337 | + if ($parent) { |
|
338 | 338 | $parentMethod = $parent->getMethod('__construct'); |
339 | 339 | $docComment = $parentMethod->getDocComment(); |
340 | - if(strpos($docComment, '@isComponentController') !== false){ |
|
340 | + if (strpos($docComment, '@isComponentController') !== false) { |
|
341 | 341 | $fullClassName = $parent->getName(); |
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
345 | 345 | $rc = new \ReflectionClass($fullClassName); |
346 | 346 | |
347 | - if(! $rc->hasMethod($methodName)){ |
|
348 | - throw new \bab_InvalidActionException($fullClassName . '::' . $methodName); |
|
347 | + if (!$rc->hasMethod($methodName)) { |
|
348 | + throw new \bab_InvalidActionException($fullClassName.'::'.$methodName); |
|
349 | 349 | } |
350 | 350 | $method = new \ReflectionMethod($fullClassName, $methodName); |
351 | 351 | |
@@ -354,32 +354,32 @@ discard block |
||
354 | 354 | $parameters = $method->getParameters(); |
355 | 355 | $actionParams = array(); |
356 | 356 | $argNumber = 0; |
357 | - foreach ($parameters as $parameter){ |
|
357 | + foreach ($parameters as $parameter) { |
|
358 | 358 | $parameterName = $parameter->getName(); |
359 | - if(isset($args[$argNumber])){ |
|
359 | + if (isset($args[$argNumber])) { |
|
360 | 360 | $actionParams[$parameterName] = $args[$argNumber]; |
361 | 361 | } |
362 | - elseif($parameter->isDefaultValueAvailable()){ |
|
362 | + elseif ($parameter->isDefaultValueAvailable()) { |
|
363 | 363 | $actionParams[$parameterName] = $parameter->getDefaultValue(); |
364 | 364 | } |
365 | - else{ |
|
365 | + else { |
|
366 | 366 | $actionParams[$parameterName] = null; |
367 | 367 | } |
368 | - $argNumber ++; |
|
368 | + $argNumber++; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $action = new WidgetAction(); |
372 | 372 | |
373 | - $action->setMethod($this->getControllerTg(), $objectName . '.' . $methodName, $actionParams); |
|
373 | + $action->setMethod($this->getControllerTg(), $objectName.'.'.$methodName, $actionParams); |
|
374 | 374 | |
375 | 375 | $docComment = $method->getDocComment(); |
376 | - if(strpos($docComment, '@ajax') !== false){ |
|
376 | + if (strpos($docComment, '@ajax') !== false) { |
|
377 | 377 | $action->setAjax(true); |
378 | 378 | } |
379 | - if(strpos($docComment, '@requireSaveMethod') !== false && method_exists($action, 'setRequireSaveMethod')){ |
|
379 | + if (strpos($docComment, '@requireSaveMethod') !== false && method_exists($action, 'setRequireSaveMethod')) { |
|
380 | 380 | $action->setRequireSaveMethod(true); |
381 | 381 | } |
382 | - if(strpos($docComment, '@requireDeleteMethod') !== false && method_exists($action, 'setRequireDeleteMethod')){ |
|
382 | + if (strpos($docComment, '@requireDeleteMethod') !== false && method_exists($action, 'setRequireDeleteMethod')) { |
|
383 | 383 | $action->setRequireDeleteMethod(true); |
384 | 384 | } |
385 | 385 | |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | |
409 | 409 | $action->setParameters($actionParams); |
410 | 410 | |
411 | - list (, , $file) = explode('/', $App->controllerTg); |
|
411 | + list (,, $file) = explode('/', $App->controllerTg); |
|
412 | 412 | |
413 | - $action->setParameter('addon', $App->getAddonName() . '.' . $file); |
|
413 | + $action->setParameter('addon', $App->getAddonName().'.'.$file); |
|
414 | 414 | $action->setParameter('idx', $idx); |
415 | 415 | |
416 | 416 | return $action; |
@@ -428,44 +428,44 @@ discard block |
||
428 | 428 | |
429 | 429 | $method = $action->getMethod(); |
430 | 430 | |
431 | - if(! isset($method) || '' === $method){ |
|
431 | + if (!isset($method) || '' === $method) { |
|
432 | 432 | return false; |
433 | 433 | } |
434 | 434 | |
435 | 435 | list ($objectName,) = explode('.', $method); |
436 | 436 | |
437 | - if(! method_exists($this, $objectName)){ |
|
437 | + if (!method_exists($this, $objectName)) { |
|
438 | 438 | /* @var $component AppComponent */ |
439 | 439 | $component = $this->app->getComponentByName($objectName); |
440 | - if($component){ |
|
440 | + if ($component) { |
|
441 | 441 | $this->app->setCurrentComponent($component); |
442 | 442 | $objectController = $component->controller(false); |
443 | 443 | } |
444 | - else{ |
|
444 | + else { |
|
445 | 445 | header('HTTP/1.0 400 Bad Request'); |
446 | 446 | throw new AppUnknownActionException($action); |
447 | 447 | } |
448 | 448 | } |
449 | 449 | |
450 | - if(! isset($component)){ |
|
450 | + if (!isset($component)) { |
|
451 | 451 | $objectController = $this->{$objectName}(false); |
452 | - if(! ($objectController instanceof AppController)){ |
|
452 | + if (!($objectController instanceof AppController)) { |
|
453 | 453 | return false; |
454 | 454 | } |
455 | 455 | } |
456 | 456 | |
457 | - try{ |
|
457 | + try { |
|
458 | 458 | $returnedValue = $objectController->execAction($action); |
459 | 459 | } |
460 | - catch (AppAccessException $e){ |
|
460 | + catch (AppAccessException $e) { |
|
461 | 461 | |
462 | - if(! bab_isUserLogged() && $e->requireCredential){ |
|
462 | + if (!bab_isUserLogged() && $e->requireCredential) { |
|
463 | 463 | bab_requireCredential($e->getMessage()); |
464 | 464 | } |
465 | - else{ |
|
466 | - if($this->isAjaxRequest()){ |
|
465 | + else { |
|
466 | + if ($this->isAjaxRequest()) { |
|
467 | 467 | |
468 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
468 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
469 | 469 | |
470 | 470 | die(bab_json_encode(array( |
471 | 471 | 'exception' => 'app_AccessException', |
@@ -476,10 +476,10 @@ discard block |
||
476 | 476 | $this->accessPage($e); |
477 | 477 | } |
478 | 478 | } |
479 | - catch (AppSaveException $e){ |
|
479 | + catch (AppSaveException $e) { |
|
480 | 480 | |
481 | - if($this->isAjaxRequest()){ |
|
482 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
481 | + if ($this->isAjaxRequest()) { |
|
482 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
483 | 483 | header('Cache-Control: no-cache, must-revalidate'); |
484 | 484 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
485 | 485 | header('Content-type: application/json'); |
@@ -491,32 +491,32 @@ discard block |
||
491 | 491 | ))); |
492 | 492 | } |
493 | 493 | } |
494 | - catch (AppDeletedRecordException $e){ |
|
494 | + catch (AppDeletedRecordException $e) { |
|
495 | 495 | $this->deletedItemPage($action, $e); |
496 | 496 | } |
497 | - catch (AppNotFoundException $e){ |
|
497 | + catch (AppNotFoundException $e) { |
|
498 | 498 | $this->notFoundPage($action, $e); |
499 | 499 | } |
500 | - catch (ORMException $e){ |
|
500 | + catch (ORMException $e) { |
|
501 | 501 | $this->errorPage($e); |
502 | 502 | } |
503 | - catch (\Exception $e){ |
|
503 | + catch (\Exception $e) { |
|
504 | 504 | $this->unexpectedErrorPage($e); |
505 | 505 | } |
506 | 506 | |
507 | 507 | $W = bab_Widgets(); |
508 | 508 | |
509 | - if($returnedValue instanceof WidgetDisplayableInterface){ |
|
509 | + if ($returnedValue instanceof WidgetDisplayableInterface) { |
|
510 | 510 | |
511 | - if($returnedValue instanceof WidgetBabPage && ! $this->isAjaxRequest()){ |
|
511 | + if ($returnedValue instanceof WidgetBabPage && !$this->isAjaxRequest()) { |
|
512 | 512 | |
513 | 513 | // If the action returned a page, we display it. |
514 | 514 | $returnedValue->displayHtml(); |
515 | 515 | } |
516 | - else{ |
|
516 | + else { |
|
517 | 517 | |
518 | 518 | $htmlCanvas = $W->HtmlCanvas(); |
519 | - if(self::$acceptJson){ |
|
519 | + if (self::$acceptJson) { |
|
520 | 520 | $itemId = $returnedValue->getId(); |
521 | 521 | $returnArray = array( |
522 | 522 | $itemId => $returnedValue->display($htmlCanvas) |
@@ -526,18 +526,18 @@ discard block |
||
526 | 526 | header('Content-type: application/json'); |
527 | 527 | die(bab_json_encode($returnArray)); |
528 | 528 | } |
529 | - else{ |
|
529 | + else { |
|
530 | 530 | header('Cache-Control: no-cache, must-revalidate'); |
531 | 531 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
532 | 532 | header('Content-type: text/html'); |
533 | - if($returnedValue instanceof WidgetPage && method_exists($returnedValue, 'getPageTitle')){ |
|
533 | + if ($returnedValue instanceof WidgetPage && method_exists($returnedValue, 'getPageTitle')) { |
|
534 | 534 | $pageTitle = $returnedValue->getPageTitle(); |
535 | 535 | |
536 | - if(method_exists($htmlCanvas, 'sendPageTitle')){ |
|
536 | + if (method_exists($htmlCanvas, 'sendPageTitle')) { |
|
537 | 537 | $htmlCanvas->sendPageTitle($pageTitle); |
538 | 538 | } |
539 | - else{ |
|
540 | - header('X-Cto-PageTitle: ' . $pageTitle); |
|
539 | + else { |
|
540 | + header('X-Cto-PageTitle: '.$pageTitle); |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 | $html = $returnedValue->display($htmlCanvas); |
@@ -545,15 +545,15 @@ discard block |
||
545 | 545 | } |
546 | 546 | } |
547 | 547 | } |
548 | - elseif(is_array($returnedValue)){ |
|
548 | + elseif (is_array($returnedValue)) { |
|
549 | 549 | |
550 | 550 | $htmlCanvas = $W->HtmlCanvas(); |
551 | 551 | $returnedArray = array(); |
552 | - foreach ($returnedValue as $key => &$item){ |
|
553 | - if($item instanceof WidgetDisplayableInterface){ |
|
552 | + foreach ($returnedValue as $key => &$item) { |
|
553 | + if ($item instanceof WidgetDisplayableInterface) { |
|
554 | 554 | $returnedArray[$item->getId()] = $item->display($htmlCanvas); |
555 | 555 | } |
556 | - else{ |
|
556 | + else { |
|
557 | 557 | $returnedArray[$key] = $item; |
558 | 558 | } |
559 | 559 | } |
@@ -562,9 +562,9 @@ discard block |
||
562 | 562 | header('Content-type: application/json'); |
563 | 563 | die(bab_convertStringFromDatabase(bab_json_encode($returnedArray), \bab_charset::UTF_8)); |
564 | 564 | } |
565 | - elseif(true === $returnedValue || is_string($returnedValue)){ |
|
565 | + elseif (true === $returnedValue || is_string($returnedValue)) { |
|
566 | 566 | |
567 | - if($this->isAjaxRequest()){ |
|
567 | + if ($this->isAjaxRequest()) { |
|
568 | 568 | $body = bab_getBody(); |
569 | 569 | $json = array(); |
570 | 570 | $json['messages'] = array(); |
@@ -572,21 +572,21 @@ discard block |
||
572 | 572 | unset($body->messages['toasts']); |
573 | 573 | $messages = $body->messages; |
574 | 574 | $errors = $body->errors; |
575 | - foreach ($messages as $message){ |
|
575 | + foreach ($messages as $message) { |
|
576 | 576 | $json['messages'][] = array( |
577 | 577 | 'level' => 'info', |
578 | 578 | 'content' => $message, |
579 | 579 | 'time' => 4000 |
580 | 580 | ); |
581 | 581 | } |
582 | - foreach ($errors as $message){ |
|
582 | + foreach ($errors as $message) { |
|
583 | 583 | $json['messages'][] = array( |
584 | 584 | 'level' => 'danger', |
585 | 585 | 'content' => $message |
586 | 586 | ); |
587 | 587 | } |
588 | 588 | $json['toasts'] = $toasts; |
589 | - if($objectController->getReloadSelectors()){ |
|
589 | + if ($objectController->getReloadSelectors()) { |
|
590 | 590 | $json['reloadSelector'] = implode(',', $objectController->getReloadSelectors()); |
591 | 591 | } |
592 | 592 | echo bab_json_encode($json); |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | |
600 | 600 | private function deletedItemPage(WidgetAction $action, AppDeletedRecordException $e) |
601 | 601 | { |
602 | - if($this->isAjaxRequest()){ |
|
603 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
602 | + if ($this->isAjaxRequest()) { |
|
603 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
604 | 604 | header('Cache-Control: no-cache, must-revalidate'); |
605 | 605 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
606 | 606 | header('Content-type: application/json'); |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | 'errorMessage' => bab_convertStringFromDatabase($e->getMessage(), 'UTF-8') |
613 | 613 | ))); |
614 | 614 | } |
615 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
615 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
616 | 616 | |
617 | 617 | $App = app_App(); |
618 | 618 | $W = bab_Widgets(); |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | ->setAlignItems(WidgetFlexLayout::FLEX_ALIGN_ITEMS_CENTER)); |
635 | 635 | $section->addItems($W->Title($App->translate('Error'), 1), $W->Title(sprintf($App->translate('This %s has been deleted'), $e->getObjectTitle()))); |
636 | 636 | |
637 | - if($e instanceof AppDeletedRecordException){ |
|
637 | + if ($e instanceof AppDeletedRecordException) { |
|
638 | 638 | $section->addItems($e->getDeletedBy(), $e->getDeletedOn()); |
639 | 639 | } |
640 | 640 | |
@@ -643,8 +643,8 @@ discard block |
||
643 | 643 | |
644 | 644 | private function notFoundPage(WidgetAction $action, AppNotFoundException $e) |
645 | 645 | { |
646 | - if($this->isAjaxRequest()){ |
|
647 | - $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle() . ' (' . $e->getId() . ')'); |
|
646 | + if ($this->isAjaxRequest()) { |
|
647 | + $message = sprintf(app_translate('This %s does not exists'), $e->getObjectTitle().' ('.$e->getId().')'); |
|
648 | 648 | $json = array( |
649 | 649 | 'messages' => array( |
650 | 650 | array( |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | echo bab_json_encode($json); |
657 | 657 | die(); |
658 | 658 | } |
659 | - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404); |
|
659 | + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); |
|
660 | 660 | header('Cache-Control: no-cache, must-revalidate'); |
661 | 661 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
662 | 662 | |
@@ -685,8 +685,8 @@ discard block |
||
685 | 685 | |
686 | 686 | private function unexpectedErrorPage(\Exception $e) |
687 | 687 | { |
688 | - if($this->isAjaxRequest()){ |
|
689 | - $message = sprintf(app_translate('An unexpected error occured') . ':' . '%s', $e->getMessage()); |
|
688 | + if ($this->isAjaxRequest()) { |
|
689 | + $message = sprintf(app_translate('An unexpected error occured').':'.'%s', $e->getMessage()); |
|
690 | 690 | $json = array( |
691 | 691 | 'messages' => array( |
692 | 692 | array( |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | echo bab_json_encode($json); |
699 | 699 | die(); |
700 | 700 | } |
701 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500); |
|
701 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500); |
|
702 | 702 | header('Cache-Control: no-cache, must-revalidate'); |
703 | 703 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
704 | 704 | |
@@ -722,25 +722,25 @@ discard block |
||
722 | 722 | ->addClass('widget-50pc alert alert-danger') |
723 | 723 | ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL)); |
724 | 724 | |
725 | - $logCode = '#' . hrtime(true); |
|
725 | + $logCode = '#'.hrtime(true); |
|
726 | 726 | $message = addcslashes($e->getMessage(), "\000..\037\177..\377\\"); |
727 | 727 | $trace = addcslashes($e->getTraceAsString(), "\000..\037\177..\377\\"); |
728 | 728 | |
729 | - error_log(sprintf('Error %s : %s', $logCode, $message) . PHP_EOL . $trace); |
|
729 | + error_log(sprintf('Error %s : %s', $logCode, $message).PHP_EOL.$trace); |
|
730 | 730 | |
731 | 731 | $section->addItems($W->Title($App->translate('Error'), 1), $W->Title($App->translate('An unexpected error occured')), $W->Label(sprintf($App->translate('It has been logged with the following error code : %s'), $logCode))); |
732 | 732 | |
733 | - if(bab_isUserAdministrator()){ |
|
733 | + if (bab_isUserAdministrator()) { |
|
734 | 734 | $contentBox->addItem($W->Section('Stack trace', $stackTraceBox = $W->FlexItems($W->Label($message) |
735 | 735 | ->addClass('widget-description')) |
736 | 736 | ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL)) |
737 | 737 | ->setFoldable(true, true)); |
738 | 738 | $traces = explode("\n", $e->getTraceAsString()); |
739 | - foreach ($traces as $trace){ |
|
739 | + foreach ($traces as $trace) { |
|
740 | 740 | $stackTraceBox->addItem($W->Label($trace)); |
741 | 741 | } |
742 | 742 | } |
743 | - else{ |
|
743 | + else { |
|
744 | 744 | $section->addItem($W->Label($App->translate('Please contact the administrator'))); |
745 | 745 | } |
746 | 746 | |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | |
750 | 750 | private function errorPage(\Exception $e) |
751 | 751 | { |
752 | - if($this->isAjaxRequest()){ |
|
753 | - $message = sprintf(app_translate('An unexpected error occured') . ':' . '%s', $e->getMessage()); |
|
752 | + if ($this->isAjaxRequest()) { |
|
753 | + $message = sprintf(app_translate('An unexpected error occured').':'.'%s', $e->getMessage()); |
|
754 | 754 | $json = array( |
755 | 755 | 'messages' => array( |
756 | 756 | array( |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | echo bab_json_encode($json); |
763 | 763 | die(); |
764 | 764 | } |
765 | - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal server error', true, 500); |
|
765 | + header($_SERVER['SERVER_PROTOCOL'].' 500 Internal server error', true, 500); |
|
766 | 766 | header('Cache-Control: no-cache, must-revalidate'); |
767 | 767 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
768 | 768 | |
@@ -786,25 +786,25 @@ discard block |
||
786 | 786 | ->addClass('widget-50pc alert alert-danger') |
787 | 787 | ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL)); |
788 | 788 | |
789 | - $logCode = '#' . hrtime(true); |
|
789 | + $logCode = '#'.hrtime(true); |
|
790 | 790 | $message = addcslashes($e->getMessage(), "\000..\037\177..\377\\"); |
791 | 791 | $trace = addcslashes($e->getTraceAsString(), "\000..\037\177..\377\\"); |
792 | 792 | |
793 | - error_log(sprintf('Error %s : %s', $logCode, $message) . PHP_EOL . $trace); |
|
793 | + error_log(sprintf('Error %s : %s', $logCode, $message).PHP_EOL.$trace); |
|
794 | 794 | |
795 | 795 | $section->addItems($W->Title($App->translate('Error'), 1), $W->Title($App->translate('An unexpected error occured')), $W->Label(sprintf($App->translate('It has been logged with the following error code : %s'), $logCode))); |
796 | 796 | |
797 | - if(bab_isUserAdministrator()){ |
|
797 | + if (bab_isUserAdministrator()) { |
|
798 | 798 | $contentBox->addItem($W->Section('Stack trace', $stackTraceBox = $W->FlexItems($W->Label($message) |
799 | 799 | ->addClass('widget-description')) |
800 | 800 | ->setDirection(WidgetFlexLayout::FLEX_DIRECTION_COL)) |
801 | 801 | ->setFoldable(true, true)); |
802 | 802 | $traces = explode("\n", $e->getTraceAsString()); |
803 | - foreach ($traces as $trace){ |
|
803 | + foreach ($traces as $trace) { |
|
804 | 804 | $stackTraceBox->addItem($W->Label($trace)); |
805 | 805 | } |
806 | 806 | } |
807 | - else{ |
|
807 | + else { |
|
808 | 808 | $section->addItem($W->Label($App->translate('Please contact the administrator'))); |
809 | 809 | } |
810 | 810 | |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | |
814 | 814 | private function accessPage(\Exception $e) |
815 | 815 | { |
816 | - if($this->isAjaxRequest()){ |
|
816 | + if ($this->isAjaxRequest()) { |
|
817 | 817 | $message = $e->getMessage(); |
818 | 818 | $json = array( |
819 | 819 | 'messages' => array( |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | echo bab_json_encode($json); |
827 | 827 | die(); |
828 | 828 | } |
829 | - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
|
829 | + header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403); |
|
830 | 830 | header('Cache-Control: no-cache, must-revalidate'); |
831 | 831 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
832 | 832 | |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | */ |
864 | 864 | public function requireSaveMethod() |
865 | 865 | { |
866 | - if('GET' === $_SERVER['REQUEST_METHOD']){ |
|
866 | + if ('GET' === $_SERVER['REQUEST_METHOD']) { |
|
867 | 867 | throw new AppException('Method not allowed'); |
868 | 868 | } |
869 | 869 | |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | */ |
879 | 879 | public function requireDeleteMethod() |
880 | 880 | { |
881 | - if('GET' === $_SERVER['REQUEST_METHOD']){ |
|
881 | + if ('GET' === $_SERVER['REQUEST_METHOD']) { |
|
882 | 882 | throw new AppException('Method not allowed'); |
883 | 883 | } |
884 | 884 | |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | 'position' => $position |
911 | 911 | ); |
912 | 912 | $babBody = bab_getBody(); |
913 | - if(! isset($babBody->messages['toasts'])){ |
|
913 | + if (!isset($babBody->messages['toasts'])) { |
|
914 | 914 | $babBody->messages['toasts'] = array(); |
915 | 915 | } |
916 | 916 | $babBody->messages['toasts'][] = $toast; |
@@ -187,8 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | if($this->isAjaxRequest()){ |
189 | 189 | $authType = 'Basic'; |
190 | - } |
|
191 | - else{ |
|
190 | + } else{ |
|
192 | 191 | $authType = ''; |
193 | 192 | } |
194 | 193 | |
@@ -263,8 +262,7 @@ discard block |
||
263 | 262 | |
264 | 263 | if($parameter->isDefaultValueAvailable()){ |
265 | 264 | $parametersStr[] = '$' . $parameter->name . ' = ' . var_export($parameter->getDefaultValue(), true); |
266 | - } |
|
267 | - else{ |
|
265 | + } else{ |
|
268 | 266 | $parametersStr[] = '$' . $parameter->name; |
269 | 267 | } |
270 | 268 | } |
@@ -358,11 +356,9 @@ discard block |
||
358 | 356 | $parameterName = $parameter->getName(); |
359 | 357 | if(isset($args[$argNumber])){ |
360 | 358 | $actionParams[$parameterName] = $args[$argNumber]; |
361 | - } |
|
362 | - elseif($parameter->isDefaultValueAvailable()){ |
|
359 | + } elseif($parameter->isDefaultValueAvailable()){ |
|
363 | 360 | $actionParams[$parameterName] = $parameter->getDefaultValue(); |
364 | - } |
|
365 | - else{ |
|
361 | + } else{ |
|
366 | 362 | $actionParams[$parameterName] = null; |
367 | 363 | } |
368 | 364 | $argNumber ++; |
@@ -440,8 +436,7 @@ discard block |
||
440 | 436 | if($component){ |
441 | 437 | $this->app->setCurrentComponent($component); |
442 | 438 | $objectController = $component->controller(false); |
443 | - } |
|
444 | - else{ |
|
439 | + } else{ |
|
445 | 440 | header('HTTP/1.0 400 Bad Request'); |
446 | 441 | throw new AppUnknownActionException($action); |
447 | 442 | } |
@@ -456,13 +451,11 @@ discard block |
||
456 | 451 | |
457 | 452 | try{ |
458 | 453 | $returnedValue = $objectController->execAction($action); |
459 | - } |
|
460 | - catch (AppAccessException $e){ |
|
454 | + } catch (AppAccessException $e){ |
|
461 | 455 | |
462 | 456 | if(! bab_isUserLogged() && $e->requireCredential){ |
463 | 457 | bab_requireCredential($e->getMessage()); |
464 | - } |
|
465 | - else{ |
|
458 | + } else{ |
|
466 | 459 | if($this->isAjaxRequest()){ |
467 | 460 | |
468 | 461 | header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
@@ -475,8 +468,7 @@ discard block |
||
475 | 468 | } |
476 | 469 | $this->accessPage($e); |
477 | 470 | } |
478 | - } |
|
479 | - catch (AppSaveException $e){ |
|
471 | + } catch (AppSaveException $e){ |
|
480 | 472 | |
481 | 473 | if($this->isAjaxRequest()){ |
482 | 474 | header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden', true, 403); |
@@ -490,17 +482,13 @@ discard block |
||
490 | 482 | 'errorMessage' => bab_convertStringFromDatabase($e->getMessage(), 'UTF-8') |
491 | 483 | ))); |
492 | 484 | } |
493 | - } |
|
494 | - catch (AppDeletedRecordException $e){ |
|
485 | + } catch (AppDeletedRecordException $e){ |
|
495 | 486 | $this->deletedItemPage($action, $e); |
496 | - } |
|
497 | - catch (AppNotFoundException $e){ |
|
487 | + } catch (AppNotFoundException $e){ |
|
498 | 488 | $this->notFoundPage($action, $e); |
499 | - } |
|
500 | - catch (ORMException $e){ |
|
489 | + } catch (ORMException $e){ |
|
501 | 490 | $this->errorPage($e); |
502 | - } |
|
503 | - catch (\Exception $e){ |
|
491 | + } catch (\Exception $e){ |
|
504 | 492 | $this->unexpectedErrorPage($e); |
505 | 493 | } |
506 | 494 | |
@@ -512,8 +500,7 @@ discard block |
||
512 | 500 | |
513 | 501 | // If the action returned a page, we display it. |
514 | 502 | $returnedValue->displayHtml(); |
515 | - } |
|
516 | - else{ |
|
503 | + } else{ |
|
517 | 504 | |
518 | 505 | $htmlCanvas = $W->HtmlCanvas(); |
519 | 506 | if(self::$acceptJson){ |
@@ -525,8 +512,7 @@ discard block |
||
525 | 512 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
526 | 513 | header('Content-type: application/json'); |
527 | 514 | die(bab_json_encode($returnArray)); |
528 | - } |
|
529 | - else{ |
|
515 | + } else{ |
|
530 | 516 | header('Cache-Control: no-cache, must-revalidate'); |
531 | 517 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
532 | 518 | header('Content-type: text/html'); |
@@ -535,8 +521,7 @@ discard block |
||
535 | 521 | |
536 | 522 | if(method_exists($htmlCanvas, 'sendPageTitle')){ |
537 | 523 | $htmlCanvas->sendPageTitle($pageTitle); |
538 | - } |
|
539 | - else{ |
|
524 | + } else{ |
|
540 | 525 | header('X-Cto-PageTitle: ' . $pageTitle); |
541 | 526 | } |
542 | 527 | } |
@@ -544,16 +529,14 @@ discard block |
||
544 | 529 | die($html); |
545 | 530 | } |
546 | 531 | } |
547 | - } |
|
548 | - elseif(is_array($returnedValue)){ |
|
532 | + } elseif(is_array($returnedValue)){ |
|
549 | 533 | |
550 | 534 | $htmlCanvas = $W->HtmlCanvas(); |
551 | 535 | $returnedArray = array(); |
552 | 536 | foreach ($returnedValue as $key => &$item){ |
553 | 537 | if($item instanceof WidgetDisplayableInterface){ |
554 | 538 | $returnedArray[$item->getId()] = $item->display($htmlCanvas); |
555 | - } |
|
556 | - else{ |
|
539 | + } else{ |
|
557 | 540 | $returnedArray[$key] = $item; |
558 | 541 | } |
559 | 542 | } |
@@ -561,8 +544,7 @@ discard block |
||
561 | 544 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
562 | 545 | header('Content-type: application/json'); |
563 | 546 | die(bab_convertStringFromDatabase(bab_json_encode($returnedArray), \bab_charset::UTF_8)); |
564 | - } |
|
565 | - elseif(true === $returnedValue || is_string($returnedValue)){ |
|
547 | + } elseif(true === $returnedValue || is_string($returnedValue)){ |
|
566 | 548 | |
567 | 549 | if($this->isAjaxRequest()){ |
568 | 550 | $body = bab_getBody(); |
@@ -739,8 +721,7 @@ discard block |
||
739 | 721 | foreach ($traces as $trace){ |
740 | 722 | $stackTraceBox->addItem($W->Label($trace)); |
741 | 723 | } |
742 | - } |
|
743 | - else{ |
|
724 | + } else{ |
|
744 | 725 | $section->addItem($W->Label($App->translate('Please contact the administrator'))); |
745 | 726 | } |
746 | 727 | |
@@ -803,8 +784,7 @@ discard block |
||
803 | 784 | foreach ($traces as $trace){ |
804 | 785 | $stackTraceBox->addItem($W->Label($trace)); |
805 | 786 | } |
806 | - } |
|
807 | - else{ |
|
787 | + } else{ |
|
808 | 788 | $section->addItem($W->Label($App->translate('Please contact the administrator'))); |
809 | 789 | } |
810 | 790 |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | use Capwelton\LibOrm\ORMRecordSet; |
39 | 39 | use Capwelton\LibOrm\MySql\ORMMySqlBackend; |
40 | 40 | |
41 | -require_once dirname(__FILE__) . '/define.php'; |
|
42 | -require_once dirname(__FILE__) . '/functions.php'; |
|
41 | +require_once dirname(__FILE__).'/define.php'; |
|
42 | +require_once dirname(__FILE__).'/functions.php'; |
|
43 | 43 | |
44 | 44 | $libappAddon = bab_getAddonInfosInstance('libapp'); |
45 | 45 | $libappPhpPath = $libappAddon->getPhpPath(); |
46 | 46 | |
47 | -require_once $libappPhpPath . '../vendor/autoload.php'; |
|
47 | +require_once $libappPhpPath.'../vendor/autoload.php'; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Provides extensible functionalities to manage an application. |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | $this->addonPrefix = 'app'; |
81 | 81 | |
82 | 82 | $this->classPrefix = 'App'; |
83 | - $this->controllerTg = 'addon/' . $this->addonName . '/main'; |
|
83 | + $this->controllerTg = 'addon/'.$this->addonName.'/main'; |
|
84 | 84 | |
85 | 85 | $addon = bab_getAddonInfosInstance($this->addonName); |
86 | 86 | $this->phpPath = $addon->getPhpPath(); |
87 | 87 | $this->recordSetPath = $this->phpPath; |
88 | 88 | $this->ctrlPath = $this->phpPath; |
89 | - $this->uiPath = $this->phpPath . 'ui/'; |
|
89 | + $this->uiPath = $this->phpPath.'ui/'; |
|
90 | 90 | |
91 | 91 | $babDB = bab_getDB(); |
92 | 92 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | if (class_exists($componentDefinitionObjectName)) { |
104 | 104 | $componentDefinition = new $componentDefinitionObjectName; |
105 | 105 | $components = $componentDefinition->getComponents($this); |
106 | - foreach ($components as $singleName => $singleComponent){ |
|
106 | + foreach ($components as $singleName => $singleComponent) { |
|
107 | 107 | $this->addComponent($singleName, $singleComponent); |
108 | 108 | } |
109 | 109 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $nbElem = count($componentName); |
133 | 133 | $componentName = $componentName[$nbElem - 1]; |
134 | 134 | $componentName = strtoupper($componentName); |
135 | - if(isset($this->components[$componentName])){ |
|
135 | + if (isset($this->components[$componentName])) { |
|
136 | 136 | return $this->components[$componentName]; |
137 | 137 | } |
138 | 138 | return null; |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | |
162 | 162 | public function __get($componentName) |
163 | 163 | { |
164 | - if(isset($this->components[$componentName])){ |
|
164 | + if (isset($this->components[$componentName])) { |
|
165 | 165 | return $this->components[$componentName]; |
166 | - }else{ |
|
166 | + } else { |
|
167 | 167 | return null; |
168 | 168 | } |
169 | 169 | } |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | |
183 | 183 | $messages = array(); |
184 | 184 | |
185 | - foreach ($components as $componentName => $component){ |
|
185 | + foreach ($components as $componentName => $component) { |
|
186 | 186 | $dependencies = $component->checkDependencies(); |
187 | - foreach($dependencies['requiredComponents'] as $requiredComponent){ |
|
187 | + foreach ($dependencies['requiredComponents'] as $requiredComponent) { |
|
188 | 188 | $messages['requiredComponents'][$componentName][] = $requiredComponent; |
189 | 189 | } |
190 | - foreach($dependencies['optionalComponents'] as $optionalComponent){ |
|
190 | + foreach ($dependencies['optionalComponents'] as $optionalComponent) { |
|
191 | 191 | $messages['optionalComponents'][$componentName][] = $optionalComponent; |
192 | 192 | } |
193 | 193 | } |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | { |
200 | 200 | $components = $this->getComponents(); |
201 | 201 | $componentDefinitions = array(); |
202 | - foreach ($components as $component){ |
|
202 | + foreach ($components as $component) { |
|
203 | 203 | $packageName = $component->getPackageName(); |
204 | - if(isset($componentDefinitions[$packageName]) && !empty($componentDefinitions[$packageName])){ |
|
204 | + if (isset($componentDefinitions[$packageName]) && !empty($componentDefinitions[$packageName])) { |
|
205 | 205 | continue; |
206 | 206 | } |
207 | 207 | $componentDefinitions[$packageName] = $component->getDefinition(); |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | public function getRecordSetPathname($class) |
245 | 245 | { |
246 | 246 | // $App->MyRecordSet() -> myrecord.class.php |
247 | - $file = strtolower(substr($class, strlen($this->classPrefix), -3)) . '.class.php'; |
|
248 | - return $this->recordSetPath . $file; |
|
247 | + $file = strtolower(substr($class, strlen($this->classPrefix), -3)).'.class.php'; |
|
248 | + return $this->recordSetPath.$file; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | public function getRecordPathname($class) |
258 | 258 | { |
259 | 259 | // $App->MyRecord() -> myrecord.class.php |
260 | - $file = strtolower(substr($class, strlen($this->classPrefix))) . '.class.php'; |
|
261 | - return $this->recordSetPath . $file; |
|
260 | + $file = strtolower(substr($class, strlen($this->classPrefix))).'.class.php'; |
|
261 | + return $this->recordSetPath.$file; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | if (substr($method, 0, 7) === 'include' && substr($method, -3) === 'Set') { |
361 | 361 | $incl = $method; |
362 | - $classNameMethod = substr($method, strlen('include')) . 'ClassName'; |
|
362 | + $classNameMethod = substr($method, strlen('include')).'ClassName'; |
|
363 | 363 | |
364 | 364 | |
365 | 365 | $classname = $this->$classNameMethod(); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | // We need to revert to multilang fields before synchronizing. |
382 | 382 | $set->useLang(false); |
383 | 383 | } |
384 | - $sql .= $mysqlbackend->setToSql($set) . "\n"; |
|
384 | + $sql .= $mysqlbackend->setToSql($set)."\n"; |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | } |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | '; |
409 | 409 | |
410 | 410 | $noPackageNames = array(); |
411 | - foreach ($this->components as $component){ |
|
411 | + foreach ($this->components as $component) { |
|
412 | 412 | /* @var $component AppComponent */ |
413 | - try{ |
|
413 | + try { |
|
414 | 414 | /* @var $set ORMRecordSet */ |
415 | 415 | $set = $component->recordSet(); |
416 | 416 | //Check if the component is not overriden by the addon |
@@ -418,26 +418,26 @@ discard block |
||
418 | 418 | //In case the set has been overriden, we simply do nothing here, as it will be instanciated by the synchronizeSql method |
419 | 419 | $cmprc = new \ReflectionClass($set); |
420 | 420 | $componentSetClass = $cmprc->getShortName(); |
421 | - if(method_exists($this, $componentSetClass)){ |
|
421 | + if (method_exists($this, $componentSetClass)) { |
|
422 | 422 | continue; |
423 | 423 | } |
424 | - if(method_exists($set, 'useLang')){ |
|
424 | + if (method_exists($set, 'useLang')) { |
|
425 | 425 | // This is necessary if the recordSet constructor uses a setLang(). |
426 | 426 | // We need to revert to multilang fields before synchronizing. |
427 | 427 | $set->useLang(false); |
428 | 428 | } |
429 | - $sql .= $mysqlbackend->setToSql($set) . "\n"; |
|
429 | + $sql .= $mysqlbackend->setToSql($set)."\n"; |
|
430 | 430 | |
431 | - if(empty($component->getPackageName())){ |
|
431 | + if (empty($component->getPackageName())) { |
|
432 | 432 | $noPackageNames[] = $component->getName(); |
433 | 433 | } |
434 | 434 | } |
435 | - catch (\Exception $e){ |
|
435 | + catch (\Exception $e) { |
|
436 | 436 | |
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | - if(!empty($noPackageNames)){ |
|
440 | + if (!empty($noPackageNames)) { |
|
441 | 441 | $errorMessage = implode(', ', $noPackageNames); |
442 | 442 | \bab_installWindow::message( |
443 | 443 | sprintf( |
@@ -461,18 +461,18 @@ discard block |
||
461 | 461 | $synchronize->fromSqlString($sql); |
462 | 462 | |
463 | 463 | $dependencies = $this->checkComponentsDependencies(); |
464 | - foreach ($dependencies['requiredComponents'] as $componentName => $requiredComponents){ |
|
465 | - foreach ($requiredComponents as $requiredComponent){ |
|
464 | + foreach ($dependencies['requiredComponents'] as $componentName => $requiredComponents) { |
|
465 | + foreach ($requiredComponents as $requiredComponent) { |
|
466 | 466 | $hasComponent = $this->getComponentByName($requiredComponent); |
467 | - if(!$hasComponent){ |
|
467 | + if (!$hasComponent) { |
|
468 | 468 | \bab_installWindow::message(sprintf($this->translate('The component %s is required for the component %s to work. You will encounter fatal errors'), $requiredComponent, $componentName)); |
469 | 469 | } |
470 | 470 | } |
471 | 471 | } |
472 | - foreach ($dependencies['optionalComponents'] as $componentName => $optionalComponents){ |
|
473 | - foreach ($optionalComponents as $optionalComponent){ |
|
472 | + foreach ($dependencies['optionalComponents'] as $componentName => $optionalComponents) { |
|
473 | + foreach ($optionalComponents as $optionalComponent) { |
|
474 | 474 | $hasComponent = $this->getComponentByName($optionalComponent); |
475 | - if(!$hasComponent){ |
|
475 | + if (!$hasComponent) { |
|
476 | 476 | \bab_installWindow::message(sprintf($this->translate('The optional component %s has not been added. The component %s may have reduced functionalities'), $optionalComponent, $componentName)); |
477 | 477 | } |
478 | 478 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | { |
486 | 486 | $components = $this->getComponents(); |
487 | 487 | |
488 | - foreach ($components as $component){ |
|
488 | + foreach ($components as $component) { |
|
489 | 489 | $component->onUpdate(); |
490 | 490 | } |
491 | 491 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | |
507 | 507 | if (substr($method, 0, strlen('include')) === 'include' && substr($method, -strlen('Set')) === 'Set') { |
508 | 508 | $incl = $method; |
509 | - $classNameMethod = substr($method, strlen('include')) . 'ClassName'; |
|
509 | + $classNameMethod = substr($method, strlen('include')).'ClassName'; |
|
510 | 510 | |
511 | 511 | $classname = $this->$classNameMethod(); |
512 | 512 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | |
521 | 521 | if (class_exists($classname) && method_exists($this, $call)) { |
522 | 522 | $set = $this->$call(); |
523 | - $sql .= $mysqlbackend->setToSql($set) . "\n"; |
|
523 | + $sql .= $mysqlbackend->setToSql($set)."\n"; |
|
524 | 524 | } |
525 | 525 | } |
526 | 526 | } |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | |
535 | 535 | public function includeBase() |
536 | 536 | { |
537 | - require_once APP_PHP_PATH . 'base.class.php'; |
|
537 | + require_once APP_PHP_PATH.'base.class.php'; |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | /** |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | public function getRecordSetByRef($recordClassname) |
581 | 581 | { |
582 | 582 | $recordClassname = str_replace($this->classPrefix, '', $recordClassname); |
583 | - $classSet = $recordClassname . 'Set'; |
|
583 | + $classSet = $recordClassname.'Set'; |
|
584 | 584 | $set = $this->$classSet(); |
585 | 585 | return $set; |
586 | 586 | } |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | list($recordClassname, $id) = $refParts; |
602 | 602 | $set = $this->getRecordSetByRef($recordClassname); |
603 | 603 | if (isset($set)) { |
604 | - if($noDefaultCriteria){ |
|
604 | + if ($noDefaultCriteria) { |
|
605 | 605 | $set->setDefaultCriteria(null); |
606 | 606 | } |
607 | 607 | return $set->get($id); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | { |
621 | 621 | $fullClassName = get_class($record); |
622 | 622 | list(, $className) = explode('_', $fullClassName); |
623 | - return $className . ':' . $record->id; |
|
623 | + return $className.':'.$record->id; |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | |
676 | 676 | //Then, check if current component has a translation |
677 | 677 | if ($translation === $str) { |
678 | - if($currentComponent = $this->getCurrentComponent()){ |
|
678 | + if ($currentComponent = $this->getCurrentComponent()) { |
|
679 | 679 | $translator->setAddonName($currentComponent->getPackageName()); |
680 | 680 | $translator->setLangPath($currentComponent->getLangPath()); |
681 | 681 | $translation = $translator->translate($str, $str_plurals, $number); |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | } |
685 | 685 | //Then, check if libapp has a translation |
686 | 686 | if ($translation === $str) { |
687 | - $translator->setLangPath(null);//Reset lang path |
|
687 | + $translator->setLangPath(null); //Reset lang path |
|
688 | 688 | $translator->setAddonName('libapp'); |
689 | 689 | $translation = $translator->translate($str, $str_plurals, $number); |
690 | 690 | } |
@@ -732,16 +732,16 @@ discard block |
||
732 | 732 | */ |
733 | 733 | public function mailTo($addr, $subject = null, $body = null) |
734 | 734 | { |
735 | - $mailTo = 'mailto:' . $addr; |
|
735 | + $mailTo = 'mailto:'.$addr; |
|
736 | 736 | $parameters = array(); |
737 | 737 | if (isset($subject)) { |
738 | - $parameters[] = 'subject=' . $subject; |
|
738 | + $parameters[] = 'subject='.$subject; |
|
739 | 739 | } |
740 | 740 | if (isset($body)) { |
741 | - $parameters[] = 'body=' . $body; |
|
741 | + $parameters[] = 'body='.$body; |
|
742 | 742 | } |
743 | 743 | if (!empty($parameters)) { |
744 | - $mailTo .= '?' . implode('&', $parameters); |
|
744 | + $mailTo .= '?'.implode('&', $parameters); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | return $mailTo; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | } |
793 | 793 | |
794 | 794 | $number = number_format($number, $decimals, ',', ' '); |
795 | - return str_replace(' ', bab_nbsp(), $number . ' ' . $prefix . $unitSymbol); |
|
795 | + return str_replace(' ', bab_nbsp(), $number.' '.$prefix.$unitSymbol); |
|
796 | 796 | } |
797 | 797 | |
798 | 798 | |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | } |
813 | 813 | |
814 | 814 | if (!isset($format)) { |
815 | - $format = \bab_registry::get('/' . $this->addonName . '/numberFormat', $PhoneNumber->getDefaultFormat()); |
|
815 | + $format = \bab_registry::get('/'.$this->addonName.'/numberFormat', $PhoneNumber->getDefaultFormat()); |
|
816 | 816 | } |
817 | 817 | $phoneNumberUtil = $PhoneNumber->PhoneNumberUtil(); |
818 | 818 | |
@@ -890,10 +890,10 @@ discard block |
||
890 | 890 | */ |
891 | 891 | public function Ui() |
892 | 892 | { |
893 | - if(get_class($this) == "Capwelton\LibApp\Func_App"){ |
|
893 | + if (get_class($this) == "Capwelton\LibApp\Func_App") { |
|
894 | 894 | return bab_getInstance("Capwelton\LibApp\Ui\AppUi")->setApp($this); |
895 | - }else{ |
|
896 | - return bab_getInstance($this->classPrefix . 'Ui')->setApp($this); |
|
895 | + } else { |
|
896 | + return bab_getInstance($this->classPrefix.'Ui')->setApp($this); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | |
@@ -922,38 +922,38 @@ discard block |
||
922 | 922 | |
923 | 923 | case substr($name, -strlen('SetClassName')) === 'SetClassName': |
924 | 924 | $className = substr($name, 0, strlen($name) - strlen('SetClassName')); |
925 | - if($component = $this->getComponentByName($className)){ |
|
925 | + if ($component = $this->getComponentByName($className)) { |
|
926 | 926 | return $component->getSetClassName(); |
927 | 927 | } |
928 | 928 | $setName = $className.'Set'; |
929 | - return $this->classPrefix . $setName; |
|
929 | + return $this->classPrefix.$setName; |
|
930 | 930 | |
931 | 931 | case substr($name, -strlen('ClassName')) === 'ClassName': |
932 | 932 | $recordName = substr($name, 0, strlen($name) - strlen('ClassName')); |
933 | - if($component = $this->getComponentByName($recordName)){ |
|
933 | + if ($component = $this->getComponentByName($recordName)) { |
|
934 | 934 | return $component->getRecordClassName(); |
935 | 935 | } |
936 | - return $this->classPrefix . $recordName; |
|
936 | + return $this->classPrefix.$recordName; |
|
937 | 937 | |
938 | 938 | case substr($name, 0, strlen('include')) === 'include' && substr($name, -strlen('Set')) === 'Set': |
939 | 939 | $fileNameBase = strtolower(substr(substr($name, 0, strlen($name) - strlen('Set')), strlen('include'))); |
940 | - if($this->getComponentByName($fileNameBase)){ |
|
940 | + if ($this->getComponentByName($fileNameBase)) { |
|
941 | 941 | return; |
942 | 942 | } |
943 | - $path = APP_SET_PATH . $fileNameBase . '.class.php'; |
|
944 | - if(is_file($path)){ |
|
943 | + $path = APP_SET_PATH.$fileNameBase.'.class.php'; |
|
944 | + if (is_file($path)) { |
|
945 | 945 | require_once $path; |
946 | 946 | } |
947 | 947 | return; |
948 | 948 | |
949 | 949 | case substr($name, -strlen('Set')) === 'Set': |
950 | - if($component = $this->getComponentByName(substr($name, 0, strlen($name) -strlen('Set')))){ |
|
950 | + if ($component = $this->getComponentByName(substr($name, 0, strlen($name) - strlen('Set')))) { |
|
951 | 951 | return $component->recordSet(); |
952 | 952 | } |
953 | 953 | |
954 | - $includeMethod = 'include' . $name; |
|
954 | + $includeMethod = 'include'.$name; |
|
955 | 955 | $this->$includeMethod(); |
956 | - $setClassNameMethod = $name . 'ClassName'; |
|
956 | + $setClassNameMethod = $name.'ClassName'; |
|
957 | 957 | $className = $this->$setClassNameMethod(); |
958 | 958 | $set = new $className($this); |
959 | 959 | return $set; |
@@ -961,8 +961,8 @@ discard block |
||
961 | 961 | case ($component = $this->getComponentByName($name)) != false: |
962 | 962 | return $component; |
963 | 963 | default: |
964 | - $setName = $name . 'Set'; |
|
965 | - $recordClassNameMethod = $name . 'ClassName'; |
|
964 | + $setName = $name.'Set'; |
|
965 | + $recordClassNameMethod = $name.'ClassName'; |
|
966 | 966 | $recordClassName = $this->$recordClassNameMethod(); |
967 | 967 | if (isset($arguments[0])) { |
968 | 968 | if ($arguments[0] instanceof $recordClassName) { |
@@ -976,38 +976,38 @@ discard block |
||
976 | 976 | } |
977 | 977 | |
978 | 978 | |
979 | - public function LinkSet(){ |
|
979 | + public function LinkSet() { |
|
980 | 980 | return $this->AppLinkSet(); |
981 | 981 | } |
982 | - public function AppLinkSet(){ |
|
982 | + public function AppLinkSet() { |
|
983 | 983 | return new AppLinkSet($this); |
984 | 984 | } |
985 | 985 | |
986 | - public function CustomFieldSet(){ |
|
986 | + public function CustomFieldSet() { |
|
987 | 987 | return $this->AppCustomFieldSet(); |
988 | 988 | } |
989 | - public function AppCustomFieldSet(){ |
|
989 | + public function AppCustomFieldSet() { |
|
990 | 990 | return new AppCustomFieldSet($this); |
991 | 991 | } |
992 | 992 | |
993 | - public function CustomContainerSet(){ |
|
993 | + public function CustomContainerSet() { |
|
994 | 994 | return $this->AppCustomContainerSet(); |
995 | 995 | } |
996 | - public function AppCustomContainerSet(){ |
|
996 | + public function AppCustomContainerSet() { |
|
997 | 997 | return new AppCustomContainerSet($this); |
998 | 998 | } |
999 | 999 | |
1000 | - public function CustomSectionSet(){ |
|
1000 | + public function CustomSectionSet() { |
|
1001 | 1001 | return $this->AppCustomSectionSet(); |
1002 | 1002 | } |
1003 | - public function AppCustomSectionSet(){ |
|
1003 | + public function AppCustomSectionSet() { |
|
1004 | 1004 | return new AppCustomSectionSet($this); |
1005 | 1005 | } |
1006 | 1006 | |
1007 | - public function LogSet(){ |
|
1007 | + public function LogSet() { |
|
1008 | 1008 | return $this->AppLogSet(); |
1009 | 1009 | } |
1010 | - public function AppLogSet(){ |
|
1010 | + public function AppLogSet() { |
|
1011 | 1011 | return new AppLogSet($this); |
1012 | 1012 | } |
1013 | 1013 |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | { |
164 | 164 | if(isset($this->components[$componentName])){ |
165 | 165 | return $this->components[$componentName]; |
166 | - }else{ |
|
166 | + } else{ |
|
167 | 167 | return null; |
168 | 168 | } |
169 | 169 | } |
@@ -431,8 +431,7 @@ discard block |
||
431 | 431 | if(empty($component->getPackageName())){ |
432 | 432 | $noPackageNames[] = $component->getName(); |
433 | 433 | } |
434 | - } |
|
435 | - catch (\Exception $e){ |
|
434 | + } catch (\Exception $e){ |
|
436 | 435 | |
437 | 436 | } |
438 | 437 | } |
@@ -892,7 +891,7 @@ discard block |
||
892 | 891 | { |
893 | 892 | if(get_class($this) == "Capwelton\LibApp\Func_App"){ |
894 | 893 | return bab_getInstance("Capwelton\LibApp\Ui\AppUi")->setApp($this); |
895 | - }else{ |
|
894 | + } else{ |
|
896 | 895 | return bab_getInstance($this->classPrefix . 'Ui')->setApp($this); |
897 | 896 | } |
898 | 897 | } |
@@ -93,7 +93,7 @@ |
||
93 | 93 | public function hasNoAccess(AppRecordSet $recordSet, $accessType, $user = null) |
94 | 94 | { |
95 | 95 | $criterion = $this->getAccessCriterion($recordSet, $accessType, $user); |
96 | - if(! $criterion instanceof ORMFalseCriterion){ |
|
96 | + if (!$criterion instanceof ORMFalseCriterion) { |
|
97 | 97 | return false; |
98 | 98 | } |
99 | 99 | return true; |