@@ -179,8 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | /*@var $customfield AppCustomField */ |
| 181 | 181 | } |
| 182 | - } |
|
| 183 | - catch (ORMBackEndSelectException $e){ |
|
| 182 | + } catch (ORMBackEndSelectException $e){ |
|
| 184 | 183 | // table does not exist, this error is thrown by the install program while creating the sets |
| 185 | 184 | } |
| 186 | 185 | } |
@@ -217,8 +216,7 @@ discard block |
||
| 217 | 216 | if($ormField instanceof ORMFkField){ |
| 218 | 217 | $this->hasOne($customField->fieldname, $ormField->getForeignSetName()) |
| 219 | 218 | ->setDescription($description); |
| 220 | - } |
|
| 221 | - else{ |
|
| 219 | + } else{ |
|
| 222 | 220 | $this->addFields($ormField); |
| 223 | 221 | } |
| 224 | 222 | } |
@@ -275,8 +273,7 @@ discard block |
||
| 275 | 273 | $linkSet = $this->App()->LinkSet(); |
| 276 | 274 | if(is_array($source) || ($source instanceof \Iterator)){ |
| 277 | 275 | return $linkSet->selectForSources($source, $this->getRecordClassName(), $linkType); |
| 278 | - } |
|
| 279 | - else{ |
|
| 276 | + } else{ |
|
| 280 | 277 | return $linkSet->selectForSource($source, $this->getRecordClassName(), $linkType); |
| 281 | 278 | } |
| 282 | 279 | } |
@@ -296,8 +293,7 @@ discard block |
||
| 296 | 293 | $linkSet = $this->App()->LinkSet(); |
| 297 | 294 | if(is_array($target) || ($target instanceof \Iterator)){ |
| 298 | 295 | return $linkSet->selectForTargets($target, $this->getRecordClassName(), $linkType); |
| 299 | - } |
|
| 300 | - else{ |
|
| 296 | + } else{ |
|
| 301 | 297 | return $linkSet->selectForTarget($target, $this->getRecordClassName(), $linkType); |
| 302 | 298 | } |
| 303 | 299 | } |
@@ -324,8 +320,7 @@ discard block |
||
| 324 | 320 | if(isset($linkType)){ |
| 325 | 321 | if(is_array($linkType)){ |
| 326 | 322 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
| 327 | - } |
|
| 328 | - else{ |
|
| 323 | + } else{ |
|
| 329 | 324 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
| 330 | 325 | } |
| 331 | 326 | } |
@@ -356,8 +351,7 @@ discard block |
||
| 356 | 351 | if(isset($linkType)){ |
| 357 | 352 | if(is_array($linkType)){ |
| 358 | 353 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
| 359 | - } |
|
| 360 | - else{ |
|
| 354 | + } else{ |
|
| 361 | 355 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
| 362 | 356 | } |
| 363 | 357 | } |
@@ -400,8 +394,7 @@ discard block |
||
| 400 | 394 | if(isset($linkType)){ |
| 401 | 395 | if(is_array($linkType)){ |
| 402 | 396 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
| 403 | - } |
|
| 404 | - else{ |
|
| 397 | + } else{ |
|
| 405 | 398 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
| 406 | 399 | } |
| 407 | 400 | } |
@@ -444,8 +437,7 @@ discard block |
||
| 444 | 437 | if(isset($linkType)){ |
| 445 | 438 | if(is_array($linkType)){ |
| 446 | 439 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
| 447 | - } |
|
| 448 | - else{ |
|
| 440 | + } else{ |
|
| 449 | 441 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
| 450 | 442 | } |
| 451 | 443 | } |
@@ -562,8 +554,7 @@ discard block |
||
| 562 | 554 | |
| 563 | 555 | if(is_array($tagLabels)){ |
| 564 | 556 | $criteria = $criteria->_AND_($linkSet->targetId->label->in($tagLabels)); |
| 565 | - } |
|
| 566 | - else{ |
|
| 557 | + } else{ |
|
| 567 | 558 | $criteria = $criteria->_AND_($linkSet->targetId->label->is($tagLabels)); |
| 568 | 559 | } |
| 569 | 560 | if(isset($linkType)){ |
@@ -57,50 +57,50 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | function app_genericSetEditor(ORMRecordSet $set) |
| 59 | 59 | { |
| 60 | - $O = \bab_functionality::get('LibOrm'); |
|
| 61 | - $O->init(); |
|
| 62 | - $W = \bab_Widgets(); |
|
| 63 | - $layout = $W->VBoxLayout(); |
|
| 64 | - $layout->setVerticalSpacing(1, 'em'); |
|
| 65 | - |
|
| 66 | - |
|
| 67 | - $fields = $set->getFields(); |
|
| 68 | - |
|
| 69 | - foreach ($fields as $field) { |
|
| 70 | - $description = $field->getDescription(); |
|
| 71 | - if (empty($description)) { |
|
| 72 | - $description = $field->getName(); |
|
| 73 | - } |
|
| 74 | - $fieldLabel = $W->Label($description . ':'); |
|
| 75 | - |
|
| 76 | - if ($field instanceof ORMDateField) { |
|
| 77 | - $widget = $W->DatePicker(); |
|
| 78 | - } else if ($field instanceof ORMTimeField) { |
|
| 79 | - $widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
| 80 | - } else if ($field instanceof ORMStringField) { |
|
| 81 | - $widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength()))); |
|
| 82 | - } else if ($field instanceof ORMEnumField) { |
|
| 83 | - $widget = $W->Select(); |
|
| 84 | - $widget->addOption('', ''); |
|
| 85 | - foreach ($field->getValues() as $key => $text) { |
|
| 86 | - $widget->addOption($key, $text); |
|
| 87 | - } |
|
| 88 | - } else if ($field instanceof ORMIntField) { |
|
| 89 | - $widget = $W->LineEdit()->setSize(9); |
|
| 90 | - } else if ($field instanceof ORMTextField) { |
|
| 91 | - $widget = $W->TextEdit()->setColumns(80)->setLines(5); |
|
| 92 | - } else if ($field instanceof ORMRecordSet) { |
|
| 93 | - $widget = app_genericSetEditor($field); |
|
| 94 | - $widget->addClass('sub-form'); |
|
| 95 | - } else { |
|
| 96 | - $widget = null; |
|
| 97 | - } |
|
| 98 | - if (isset($widget)) { |
|
| 99 | - $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget)); |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - return $layout; |
|
| 60 | + $O = \bab_functionality::get('LibOrm'); |
|
| 61 | + $O->init(); |
|
| 62 | + $W = \bab_Widgets(); |
|
| 63 | + $layout = $W->VBoxLayout(); |
|
| 64 | + $layout->setVerticalSpacing(1, 'em'); |
|
| 65 | + |
|
| 66 | + |
|
| 67 | + $fields = $set->getFields(); |
|
| 68 | + |
|
| 69 | + foreach ($fields as $field) { |
|
| 70 | + $description = $field->getDescription(); |
|
| 71 | + if (empty($description)) { |
|
| 72 | + $description = $field->getName(); |
|
| 73 | + } |
|
| 74 | + $fieldLabel = $W->Label($description . ':'); |
|
| 75 | + |
|
| 76 | + if ($field instanceof ORMDateField) { |
|
| 77 | + $widget = $W->DatePicker(); |
|
| 78 | + } else if ($field instanceof ORMTimeField) { |
|
| 79 | + $widget = $W->LineEdit()->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
| 80 | + } else if ($field instanceof ORMStringField) { |
|
| 81 | + $widget = $W->LineEdit()->setSize(min(array(80, $field->getMaxLength()))); |
|
| 82 | + } else if ($field instanceof ORMEnumField) { |
|
| 83 | + $widget = $W->Select(); |
|
| 84 | + $widget->addOption('', ''); |
|
| 85 | + foreach ($field->getValues() as $key => $text) { |
|
| 86 | + $widget->addOption($key, $text); |
|
| 87 | + } |
|
| 88 | + } else if ($field instanceof ORMIntField) { |
|
| 89 | + $widget = $W->LineEdit()->setSize(9); |
|
| 90 | + } else if ($field instanceof ORMTextField) { |
|
| 91 | + $widget = $W->TextEdit()->setColumns(80)->setLines(5); |
|
| 92 | + } else if ($field instanceof ORMRecordSet) { |
|
| 93 | + $widget = app_genericSetEditor($field); |
|
| 94 | + $widget->addClass('sub-form'); |
|
| 95 | + } else { |
|
| 96 | + $widget = null; |
|
| 97 | + } |
|
| 98 | + if (isset($widget)) { |
|
| 99 | + $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget)); |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + return $layout; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -113,50 +113,50 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | function app_genericSetFilterForm(ORMRecordSet $set) |
| 115 | 115 | { |
| 116 | - $O = \bab_functionality::get('LibOrm'); |
|
| 117 | - $O->init(); |
|
| 118 | - $W = \bab_Widgets(); |
|
| 119 | - $layout = $W->FlowLayout(); |
|
| 120 | - $layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em'); |
|
| 121 | - |
|
| 122 | - |
|
| 123 | - $fields = $set->getFields(); |
|
| 124 | - |
|
| 125 | - foreach ($fields as $field) { |
|
| 126 | - $description = $field->getDescription(); |
|
| 127 | - if (empty($description)) { |
|
| 128 | - $description = $field->getName(); |
|
| 129 | - } |
|
| 130 | - $fieldLabel = $W->Label($description . ':'); |
|
| 131 | - |
|
| 132 | - if ($field instanceof ORMDateField) { |
|
| 133 | - $widget = $W->PeriodPicker(); |
|
| 134 | - } else if ($field instanceof ORMTimeField) { |
|
| 135 | - $widget = $W->TimePicker(); |
|
| 136 | - } else if ($field instanceof ORMStringField) { |
|
| 137 | - $widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength()))); |
|
| 138 | - } else if ($field instanceof ORMEnumField) { |
|
| 139 | - $widget = $W->Select(); |
|
| 140 | - $widget->addOption('', ''); |
|
| 141 | - foreach ($field->getValues() as $key => $text) { |
|
| 142 | - $widget->addOption($key, $text); |
|
| 143 | - } |
|
| 144 | - } else if ($field instanceof ORMIntField) { |
|
| 145 | - $widget = $W->LineEdit()->setSize(9); |
|
| 146 | - } else if ($field instanceof ORMTextField) { |
|
| 147 | - $widget = $widget = $W->LineEdit()->setSize(15); |
|
| 148 | - } else if ($field instanceof ORMRecordSet) { |
|
| 149 | - $widget = app_genericSetFilterForm($field); |
|
| 150 | - $widget->addClass('sub-form'); |
|
| 151 | - } else { |
|
| 152 | - $widget = null; |
|
| 153 | - } |
|
| 154 | - if (isset($widget)) { |
|
| 155 | - $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget)); |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - return $layout; |
|
| 116 | + $O = \bab_functionality::get('LibOrm'); |
|
| 117 | + $O->init(); |
|
| 118 | + $W = \bab_Widgets(); |
|
| 119 | + $layout = $W->FlowLayout(); |
|
| 120 | + $layout->setVerticalSpacing(1, 'em')->setHorizontalSpacing(1, 'em'); |
|
| 121 | + |
|
| 122 | + |
|
| 123 | + $fields = $set->getFields(); |
|
| 124 | + |
|
| 125 | + foreach ($fields as $field) { |
|
| 126 | + $description = $field->getDescription(); |
|
| 127 | + if (empty($description)) { |
|
| 128 | + $description = $field->getName(); |
|
| 129 | + } |
|
| 130 | + $fieldLabel = $W->Label($description . ':'); |
|
| 131 | + |
|
| 132 | + if ($field instanceof ORMDateField) { |
|
| 133 | + $widget = $W->PeriodPicker(); |
|
| 134 | + } else if ($field instanceof ORMTimeField) { |
|
| 135 | + $widget = $W->TimePicker(); |
|
| 136 | + } else if ($field instanceof ORMStringField) { |
|
| 137 | + $widget = $W->LineEdit()->setSize(min(array(15, $field->getMaxLength()))); |
|
| 138 | + } else if ($field instanceof ORMEnumField) { |
|
| 139 | + $widget = $W->Select(); |
|
| 140 | + $widget->addOption('', ''); |
|
| 141 | + foreach ($field->getValues() as $key => $text) { |
|
| 142 | + $widget->addOption($key, $text); |
|
| 143 | + } |
|
| 144 | + } else if ($field instanceof ORMIntField) { |
|
| 145 | + $widget = $W->LineEdit()->setSize(9); |
|
| 146 | + } else if ($field instanceof ORMTextField) { |
|
| 147 | + $widget = $widget = $W->LineEdit()->setSize(15); |
|
| 148 | + } else if ($field instanceof ORMRecordSet) { |
|
| 149 | + $widget = app_genericSetFilterForm($field); |
|
| 150 | + $widget->addClass('sub-form'); |
|
| 151 | + } else { |
|
| 152 | + $widget = null; |
|
| 153 | + } |
|
| 154 | + if (isset($widget)) { |
|
| 155 | + $layout->addItem($W->VBoxLayout()->addItem($fieldLabel)->addItem($widget)); |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + return $layout; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
@@ -169,47 +169,47 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | function app_LabelledWidget($labelText, WidgetDisplayableInterface $widget) |
| 171 | 171 | { |
| 172 | - $W = \bab_Widgets(); |
|
| 173 | - |
|
| 174 | - $label = $W->Label($labelText); |
|
| 175 | - if ($widget instanceof WidgetInputWidget) { |
|
| 176 | - $label->setAssociatedWidget($widget); |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - if ($widget instanceof WidgetCheckBox) { |
|
| 180 | - $layout = $W->HBoxItems( |
|
| 181 | - $widget->setSizePolicy(WidgetSizePolicy::MINIMUM), |
|
| 182 | - $label |
|
| 183 | - )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em'); |
|
| 184 | - } else { |
|
| 185 | - $layout = $W->VBoxItems( |
|
| 186 | - $label, |
|
| 187 | - $widget |
|
| 188 | - )->setVerticalSpacing(0.5, 'em'); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - return $layout; |
|
| 172 | + $W = \bab_Widgets(); |
|
| 173 | + |
|
| 174 | + $label = $W->Label($labelText); |
|
| 175 | + if ($widget instanceof WidgetInputWidget) { |
|
| 176 | + $label->setAssociatedWidget($widget); |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + if ($widget instanceof WidgetCheckBox) { |
|
| 180 | + $layout = $W->HBoxItems( |
|
| 181 | + $widget->setSizePolicy(WidgetSizePolicy::MINIMUM), |
|
| 182 | + $label |
|
| 183 | + )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em'); |
|
| 184 | + } else { |
|
| 185 | + $layout = $W->VBoxItems( |
|
| 186 | + $label, |
|
| 187 | + $widget |
|
| 188 | + )->setVerticalSpacing(0.5, 'em'); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + return $layout; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | |
| 196 | 196 | function app_LabelledCheckbox($labelText, $checkboxName, $options = null) |
| 197 | 197 | { |
| 198 | - $W = \bab_Widgets(); |
|
| 198 | + $W = \bab_Widgets(); |
|
| 199 | 199 | |
| 200 | - $label = $W->Label($labelText)->colon(false); |
|
| 201 | - $checkbox = $W->Checkbox()->setName($checkboxName); |
|
| 202 | - $label->setAssociatedWidget($checkbox); |
|
| 203 | - if (isset($options)) { |
|
| 204 | - $label->setSizePolicy(WidgetSizePolicy::FIXED)->setCanvasOptions($options); |
|
| 205 | - } |
|
| 200 | + $label = $W->Label($labelText)->colon(false); |
|
| 201 | + $checkbox = $W->Checkbox()->setName($checkboxName); |
|
| 202 | + $label->setAssociatedWidget($checkbox); |
|
| 203 | + if (isset($options)) { |
|
| 204 | + $label->setSizePolicy(WidgetSizePolicy::FIXED)->setCanvasOptions($options); |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - $layout = $W->HBoxItems( |
|
| 208 | - $checkbox->setSizePolicy(WidgetSizePolicy::MINIMUM), |
|
| 209 | - $label |
|
| 210 | - )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em'); |
|
| 207 | + $layout = $W->HBoxItems( |
|
| 208 | + $checkbox->setSizePolicy(WidgetSizePolicy::MINIMUM), |
|
| 209 | + $label |
|
| 210 | + )->setVerticalAlign('middle')->setHorizontalSpacing(0.5, 'em'); |
|
| 211 | 211 | |
| 212 | - return $layout; |
|
| 212 | + return $layout; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
@@ -217,42 +217,42 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | function app_LabelledOrmSelect(ORMMySqlIterator $iterator, $fieldName, $selectName, $label, $hidden = false, $groupFieldName = null) |
| 219 | 219 | { |
| 220 | - $W = \bab_Widgets(); |
|
| 221 | - |
|
| 222 | - if (isset($groupFieldName)) { |
|
| 223 | - $groupPathElements = explode('/', $groupFieldName); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - $select = $W->Select()->setName($selectName); |
|
| 227 | - |
|
| 228 | - $select->addOption('', ''); |
|
| 229 | - |
|
| 230 | - $nbOptions = 0; |
|
| 231 | - foreach ($iterator as $record) { |
|
| 232 | - if (isset($record->code)) { |
|
| 233 | - $optionText = $record->code . ' - ' . $record->$fieldName; |
|
| 234 | - } else { |
|
| 235 | - $optionText = $record->$fieldName; |
|
| 236 | - } |
|
| 237 | - if (isset($groupFieldName)) { |
|
| 238 | - $group = $record; |
|
| 239 | - foreach ($groupPathElements as $groupPathElement) { |
|
| 240 | - $group = $group->$groupPathElement; |
|
| 241 | - } |
|
| 242 | - $select->addOption($record->id, $optionText, $group); |
|
| 243 | - } else { |
|
| 244 | - $select->addOption($record->id, $optionText); |
|
| 245 | - } |
|
| 246 | - $nbOptions++; |
|
| 247 | - $lastId = $record->id; |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - if ($nbOptions == 1) { |
|
| 251 | - $select->setValue($lastId); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - |
|
| 255 | - return app_LabelledWidget($label, $select); |
|
| 220 | + $W = \bab_Widgets(); |
|
| 221 | + |
|
| 222 | + if (isset($groupFieldName)) { |
|
| 223 | + $groupPathElements = explode('/', $groupFieldName); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + $select = $W->Select()->setName($selectName); |
|
| 227 | + |
|
| 228 | + $select->addOption('', ''); |
|
| 229 | + |
|
| 230 | + $nbOptions = 0; |
|
| 231 | + foreach ($iterator as $record) { |
|
| 232 | + if (isset($record->code)) { |
|
| 233 | + $optionText = $record->code . ' - ' . $record->$fieldName; |
|
| 234 | + } else { |
|
| 235 | + $optionText = $record->$fieldName; |
|
| 236 | + } |
|
| 237 | + if (isset($groupFieldName)) { |
|
| 238 | + $group = $record; |
|
| 239 | + foreach ($groupPathElements as $groupPathElement) { |
|
| 240 | + $group = $group->$groupPathElement; |
|
| 241 | + } |
|
| 242 | + $select->addOption($record->id, $optionText, $group); |
|
| 243 | + } else { |
|
| 244 | + $select->addOption($record->id, $optionText); |
|
| 245 | + } |
|
| 246 | + $nbOptions++; |
|
| 247 | + $lastId = $record->id; |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + if ($nbOptions == 1) { |
|
| 251 | + $select->setValue($lastId); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + |
|
| 255 | + return app_LabelledWidget($label, $select); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -260,108 +260,108 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | function app_OrmWidget(ORMField $field) |
| 262 | 262 | { |
| 263 | - $W = \bab_Widgets(); |
|
| 263 | + $W = \bab_Widgets(); |
|
| 264 | 264 | |
| 265 | 265 | |
| 266 | - if ($field instanceof ORMDateField) { |
|
| 267 | - $widget = $W->DatePicker(); |
|
| 268 | - } else if ($field instanceof ORMTimeField) { |
|
| 269 | - $widget = $W->TimeEdit(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
| 270 | - } else if ($field instanceof ORMDatetimeField) { |
|
| 271 | - $widget = $W->DateTimePicker(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
| 272 | - } else if ($field instanceof ORMEnumField) { |
|
| 273 | - $widget = $W->Select(); |
|
| 266 | + if ($field instanceof ORMDateField) { |
|
| 267 | + $widget = $W->DatePicker(); |
|
| 268 | + } else if ($field instanceof ORMTimeField) { |
|
| 269 | + $widget = $W->TimeEdit(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
| 270 | + } else if ($field instanceof ORMDatetimeField) { |
|
| 271 | + $widget = $W->DateTimePicker(); //->setMaxSize(5)->setSize(5)->addClass('widget-timepicker'); |
|
| 272 | + } else if ($field instanceof ORMEnumField) { |
|
| 273 | + $widget = $W->Select(); |
|
| 274 | 274 | //// $widget = $W->MultiSelect()->setSingleSelect(); |
| 275 | - $widget->addOption('', ''); |
|
| 276 | - $values = $field->getValues(); |
|
| 277 | - foreach ($values as $key => $value) { |
|
| 278 | - $widget->addOption($key, $value); |
|
| 279 | - } |
|
| 280 | - } else if ($field instanceof ORMSetField) { |
|
| 281 | - $widget = $W->MultiSelect()->setSelectedList(2); |
|
| 282 | - $values = $field->getValues(); |
|
| 283 | - foreach ($values as $key => $value) { |
|
| 284 | - $widget->addOption($key, $value); |
|
| 285 | - } |
|
| 286 | - } else if ($field instanceof ORMUserField) { |
|
| 287 | - $widget = $W->SuggestUser() |
|
| 288 | - ->setMinChars(0) |
|
| 289 | - ->setSizePolicy(\Func_Icons::ICON_LEFT_16); |
|
| 290 | - } else if ($field instanceof ORMCurrencyField) { |
|
| 291 | - $widget = $W->LineEdit()->setSize(6)->addClass('widget-input-currency'); |
|
| 292 | - } else if ($field instanceof ORMBoolField) { |
|
| 293 | - $widget = $W->CheckBox()->setCheckedValue('1'); |
|
| 294 | - } else if ($field instanceof ORMIntField) { |
|
| 295 | - $widget = $W->LineEdit() |
|
| 296 | - ->setSize(6)->addClass('widget-input-numeric'); |
|
| 297 | - } else if ($field instanceof ORMEmailField) { |
|
| 298 | - $widget = $W->EmailLineEdit() |
|
| 299 | - ->setMaxSize($field->getMaxLength()); |
|
| 300 | - } else if ($field instanceof ORMFileField) { |
|
| 301 | - $widget = $W->FilePicker(); |
|
| 302 | - } else if ($field instanceof ORMStringField) { |
|
| 303 | - $widget = $W->LineEdit() |
|
| 304 | - ->setMaxSize($field->getMaxLength()); |
|
| 305 | - } else if ($field instanceof ORMTextField) { |
|
| 306 | - $widget = $W->TextEdit() |
|
| 307 | - ->addClass('widget-autoresize'); |
|
| 308 | - } else if ($field instanceof ORMPkField) { |
|
| 309 | - $widget = $W->Hidden(); |
|
| 310 | - } else if ($field instanceof ORMFkField) { |
|
| 311 | - $widget = $W->Select(); |
|
| 312 | - $fieldName = $field->getName(); |
|
| 313 | - $parentSet = clone $field->getParentSet(); |
|
| 314 | - $parentSet->join($fieldName); |
|
| 315 | - $set = $parentSet->$fieldName; |
|
| 316 | - $records = $set->select(); |
|
| 317 | - $records->orderAsc($set->name); |
|
| 318 | - $pkName = $set->getPrimaryKey(); |
|
| 319 | - $widget->addOption('', ''); |
|
| 320 | - foreach ($records as $record) { |
|
| 321 | - $widget->addOption($record->$pkName, $record->name); |
|
| 322 | - } |
|
| 323 | - } else if ($field instanceof ORMRecordSet) { |
|
| 324 | - $widget = $W->Select(); |
|
| 275 | + $widget->addOption('', ''); |
|
| 276 | + $values = $field->getValues(); |
|
| 277 | + foreach ($values as $key => $value) { |
|
| 278 | + $widget->addOption($key, $value); |
|
| 279 | + } |
|
| 280 | + } else if ($field instanceof ORMSetField) { |
|
| 281 | + $widget = $W->MultiSelect()->setSelectedList(2); |
|
| 282 | + $values = $field->getValues(); |
|
| 283 | + foreach ($values as $key => $value) { |
|
| 284 | + $widget->addOption($key, $value); |
|
| 285 | + } |
|
| 286 | + } else if ($field instanceof ORMUserField) { |
|
| 287 | + $widget = $W->SuggestUser() |
|
| 288 | + ->setMinChars(0) |
|
| 289 | + ->setSizePolicy(\Func_Icons::ICON_LEFT_16); |
|
| 290 | + } else if ($field instanceof ORMCurrencyField) { |
|
| 291 | + $widget = $W->LineEdit()->setSize(6)->addClass('widget-input-currency'); |
|
| 292 | + } else if ($field instanceof ORMBoolField) { |
|
| 293 | + $widget = $W->CheckBox()->setCheckedValue('1'); |
|
| 294 | + } else if ($field instanceof ORMIntField) { |
|
| 295 | + $widget = $W->LineEdit() |
|
| 296 | + ->setSize(6)->addClass('widget-input-numeric'); |
|
| 297 | + } else if ($field instanceof ORMEmailField) { |
|
| 298 | + $widget = $W->EmailLineEdit() |
|
| 299 | + ->setMaxSize($field->getMaxLength()); |
|
| 300 | + } else if ($field instanceof ORMFileField) { |
|
| 301 | + $widget = $W->FilePicker(); |
|
| 302 | + } else if ($field instanceof ORMStringField) { |
|
| 303 | + $widget = $W->LineEdit() |
|
| 304 | + ->setMaxSize($field->getMaxLength()); |
|
| 305 | + } else if ($field instanceof ORMTextField) { |
|
| 306 | + $widget = $W->TextEdit() |
|
| 307 | + ->addClass('widget-autoresize'); |
|
| 308 | + } else if ($field instanceof ORMPkField) { |
|
| 309 | + $widget = $W->Hidden(); |
|
| 310 | + } else if ($field instanceof ORMFkField) { |
|
| 311 | + $widget = $W->Select(); |
|
| 312 | + $fieldName = $field->getName(); |
|
| 313 | + $parentSet = clone $field->getParentSet(); |
|
| 314 | + $parentSet->join($fieldName); |
|
| 315 | + $set = $parentSet->$fieldName; |
|
| 316 | + $records = $set->select(); |
|
| 317 | + $records->orderAsc($set->name); |
|
| 318 | + $pkName = $set->getPrimaryKey(); |
|
| 319 | + $widget->addOption('', ''); |
|
| 320 | + foreach ($records as $record) { |
|
| 321 | + $widget->addOption($record->$pkName, $record->name); |
|
| 322 | + } |
|
| 323 | + } else if ($field instanceof ORMRecordSet) { |
|
| 324 | + $widget = $W->Select(); |
|
| 325 | 325 | //// $widget = $W->MultiSelect()->setSingleSelect(); |
| 326 | 326 | // $fieldName = $field->getName(); |
| 327 | 327 | // $parentSet = $field->getParentSet(); |
| 328 | 328 | // $parentSet->join($fieldName); |
| 329 | 329 | // $set = $parentSet->$fieldName; |
| 330 | - $records = $field->select(); |
|
| 331 | - $records->orderAsc($field->name); |
|
| 332 | - $pkName = $field->getPrimaryKey(); |
|
| 333 | - $widget->addOption('', ''); |
|
| 334 | - foreach ($records as $record) { |
|
| 335 | - $widget->addOption($record->$pkName, $record->name); |
|
| 336 | - } |
|
| 337 | - } else { |
|
| 338 | - $widget = $W->LineEdit(); |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - $widget->setName($field->getName()); |
|
| 342 | - |
|
| 343 | - return $widget; |
|
| 330 | + $records = $field->select(); |
|
| 331 | + $records->orderAsc($field->name); |
|
| 332 | + $pkName = $field->getPrimaryKey(); |
|
| 333 | + $widget->addOption('', ''); |
|
| 334 | + foreach ($records as $record) { |
|
| 335 | + $widget->addOption($record->$pkName, $record->name); |
|
| 336 | + } |
|
| 337 | + } else { |
|
| 338 | + $widget = $W->LineEdit(); |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + $widget->setName($field->getName()); |
|
| 342 | + |
|
| 343 | + return $widget; |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | |
| 347 | 347 | |
| 348 | 348 | function app_LabelledOrmWidget(ORMField $field, $label = null, $hidden = false) |
| 349 | 349 | { |
| 350 | - $W = \bab_Widgets(); |
|
| 350 | + $W = \bab_Widgets(); |
|
| 351 | 351 | |
| 352 | - if ($hidden) { |
|
| 353 | - $widget = $W->Hidden(); |
|
| 354 | - $widget->setName($field->getName()); |
|
| 355 | - return $widget; |
|
| 356 | - } |
|
| 352 | + if ($hidden) { |
|
| 353 | + $widget = $W->Hidden(); |
|
| 354 | + $widget->setName($field->getName()); |
|
| 355 | + return $widget; |
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | - if (is_null($label)) { |
|
| 359 | - $label = $field->getDescription(); |
|
| 360 | - } |
|
| 358 | + if (is_null($label)) { |
|
| 359 | + $label = $field->getDescription(); |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | - $widget = app_OrmWidget($field); |
|
| 362 | + $widget = app_OrmWidget($field); |
|
| 363 | 363 | |
| 364 | - return app_LabelledWidget($label, $widget); |
|
| 364 | + return app_LabelledWidget($label, $widget); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
@@ -377,16 +377,16 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | function app_dateTime(ORMField $field, $value) { |
| 379 | 379 | |
| 380 | - $W = \bab_functionality::get('Widgets'); |
|
| 381 | - $name = $field->getName(); |
|
| 382 | - $label = $W->Label($field->getDescription()); |
|
| 380 | + $W = \bab_functionality::get('Widgets'); |
|
| 381 | + $name = $field->getName(); |
|
| 382 | + $label = $W->Label($field->getDescription()); |
|
| 383 | 383 | |
| 384 | - $frame = app_dateTimeField($name, $label, $value); |
|
| 384 | + $frame = app_dateTimeField($name, $label, $value); |
|
| 385 | 385 | |
| 386 | - return $W->VBoxItems( |
|
| 387 | - $label, |
|
| 388 | - $frame |
|
| 389 | - ); |
|
| 386 | + return $W->VBoxItems( |
|
| 387 | + $label, |
|
| 388 | + $frame |
|
| 389 | + ); |
|
| 390 | 390 | |
| 391 | 391 | } |
| 392 | 392 | |
@@ -400,24 +400,24 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | function app_dateTimeField($fieldName, WidgetLabel $label, $value = null) |
| 402 | 402 | { |
| 403 | - $W = \bab_functionality::get('Widgets'); |
|
| 403 | + $W = \bab_functionality::get('Widgets'); |
|
| 404 | 404 | |
| 405 | - $datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date'); |
|
| 406 | - $timepart = $W->TimePicker()->setName('time'); |
|
| 405 | + $datepart = $W->DatePicker()->setAssociatedLabel($label)->setName('date'); |
|
| 406 | + $timepart = $W->TimePicker()->setName('time'); |
|
| 407 | 407 | |
| 408 | - if (isset($value)) { |
|
| 408 | + if (isset($value)) { |
|
| 409 | 409 | |
| 410 | - $value = explode(' ', $value); |
|
| 410 | + $value = explode(' ', $value); |
|
| 411 | 411 | |
| 412 | - $datepart->setValue($value[0]); |
|
| 413 | - $timepart->setValue($value[1]); |
|
| 414 | - } |
|
| 412 | + $datepart->setValue($value[0]); |
|
| 413 | + $timepart->setValue($value[1]); |
|
| 414 | + } |
|
| 415 | 415 | |
| 416 | - $datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName) |
|
| 417 | - ->addItem($datepart) |
|
| 418 | - ->addItem($timepart); |
|
| 416 | + $datetime = $W->Frame(null, $W->HBoxLayout())->setName($fieldName) |
|
| 417 | + ->addItem($datepart) |
|
| 418 | + ->addItem($timepart); |
|
| 419 | 419 | |
| 420 | - return $datetime; |
|
| 420 | + return $datetime; |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | |
@@ -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 | } |
@@ -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 | |
@@ -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){ |
@@ -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 | |
@@ -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 | } |