Completed
Branch master (ebb499)
by Alexey
04:15
created
system/modules/Ui/objects/Tree.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@  discard block
 block discarded – undo
24 24
             <?php
25 25
             if (is_string($objectRoot)) {
26 26
                 $items = $objectRoot::getList(['where' => ['parent_id', 0]]);
27
-            } else {
27
+            }
28
+            else {
28 29
                 $class = get_class($objectRoot);
29 30
                 $items = $class::getList(['where' => ['parent_id', $objectRoot->pk()], 'order' => $order]);
30 31
             }
@@ -66,7 +67,8 @@  discard block
 block discarded – undo
66 67
         }
67 68
         if ($isset) {
68 69
             echo '</ul></li>';
69
-        } else {
70
+        }
71
+        else {
70 72
             echo \Html::el('li', $attributes, $item);
71 73
         }
72 74
         return $count;
Please login to merge, or discard this patch.
system/modules/Ui/objects/Pages.php 1 patch
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,15 +30,18 @@
 block discarded – undo
30 30
             $this->params['page'] = 0;
31 31
             $this->params['pages'] = 0;
32 32
             $this->params['start'] = 0;
33
-        } else {
33
+        }
34
+        else {
34 35
             $this->params['pages'] = ceil($this->options['count'] / $this->params['limit']);
35 36
             $this->params['page'] = 1;
36 37
             if (!empty($this->data['page'])) {
37 38
                 $this->params['page'] = (int) $this->data['page'];
38
-                if ($this->params['page'] <= 0)
39
-                    $this->params['page'] = 1;
40
-                elseif ($this->params['page'] > ceil($this->options['count'] / $this->params['limit']))
41
-                    $this->params['page'] = ceil($this->options['count'] / $this->params['limit']);
39
+                if ($this->params['page'] <= 0) {
40
+                                    $this->params['page'] = 1;
41
+                }
42
+                elseif ($this->params['page'] > ceil($this->options['count'] / $this->params['limit'])) {
43
+                                    $this->params['page'] = ceil($this->options['count'] / $this->params['limit']);
44
+                }
42 45
             }
43 46
 
44 47
             $this->params['start'] = $this->params['page'] * $this->params['limit'] - $this->params['limit'];
Please login to merge, or discard this patch.
system/modules/Ui/objects/DataManager.php 1 patch
Braces   +46 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,10 +42,12 @@  discard block
 block discarded – undo
42 42
             $this->managerOptions = !empty($modelNameOrOptions::$dataManagers[$managerName]) ? $modelNameOrOptions::$dataManagers[$managerName] : [];
43 43
             if (isset($modelNameOrOptions::$objectName)) {
44 44
                 $this->name = $modelNameOrOptions::$objectName;
45
-            } else {
45
+            }
46
+            else {
46 47
                 $this->name = $modelNameOrOptions;
47 48
             }
48
-        } else {
49
+        }
50
+        else {
49 51
             $this->managerOptions = $modelNameOrOptions;
50 52
         }
51 53
 
@@ -152,7 +154,8 @@  discard block
 block discarded – undo
152 154
                     $action['className'] = $key;
153 155
                 }
154 156
                 $return[$key] = $action;
155
-            } else {
157
+            }
158
+            else {
156 159
                 $key = $action;
157 160
                 $return[$key] = [
158 161
                     'className' => $action
@@ -208,7 +211,8 @@  discard block
 block discarded – undo
208 211
             if (is_array($col)) {
209 212
                 $colName = $key;
210 213
                 $colOptions = $col;
211
-            } else {
214
+            }
215
+            else {
212 216
                 $colName = $col;
213 217
                 $colOptions = [];
214 218
             }
@@ -218,7 +222,8 @@  discard block
 block discarded – undo
218 222
             }
219 223
             if (empty($colOptions['label']) && !empty($colInfo['label'])) {
220 224
                 $colOptions['label'] = $colInfo['label'];
221
-            } elseif (empty($colOptions['label'])) {
225
+            }
226
+            elseif (empty($colOptions['label'])) {
222 227
                 $colOptions['label'] = $colName;
223 228
             }
224 229
             $cols[$colName] = $colOptions;
@@ -267,7 +272,8 @@  discard block
 block discarded – undo
267 272
             foreach ($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'] as $colName => $colOptions) {
268 273
                 if (!empty($colOptions['userCol'])) {
269 274
                     $queryParams['where'][] = [$colName, \Model::getColValue(\Users\User::$cur, $colOptions['userCol'])];
270
-                } elseif (isset($colOptions['value'])) {
275
+                }
276
+                elseif (isset($colOptions['value'])) {
271 277
                     if (is_array($colOptions['value'])) {
272 278
                         foreach ($colOptions['value'] as $key => $value) {
273 279
                             if ($key === 'userCol') {
@@ -318,7 +324,8 @@  discard block
 block discarded – undo
318 324
                             if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) {
319 325
 
320 326
                                 $date = $params['filters'][$col]['max'] . ' 23:59:59';
321
-                            } else {
327
+                            }
328
+                            else {
322 329
                                 $date = $params['filters'][$col]['max'];
323 330
                             }
324 331
                             $queryParams['where'][] = [$col, $date, '<='];
@@ -362,7 +369,8 @@  discard block
 block discarded – undo
362 369
         }
363 370
         if (!empty($params['mode']) && $params['mode'] == 'sort') {
364 371
             $queryParams['order'] = ['weight', 'asc'];
365
-        } elseif (!empty($params['sortered']) && !empty($this->managerOptions['sortable'])) {
372
+        }
373
+        elseif (!empty($params['sortered']) && !empty($this->managerOptions['sortable'])) {
366 374
             foreach ($params['sortered'] as $colName => $sortType) {
367 375
                 if ($colName && in_array($colName, $this->managerOptions['sortable'])) {
368 376
                     $sortType = in_array($sortType, ['desc', 'asc']) ? $sortType : 'desc';
@@ -373,7 +381,8 @@  discard block
 block discarded – undo
373 381
         if ($model && !empty($params['relation'])) {
374 382
             $relation = $model::getRelation($params['relation']);
375 383
             $items = $model->$params['relation']($queryParams);
376
-        } else {
384
+        }
385
+        else {
377 386
             $relation = false;
378 387
             $items = $modelName::getList($queryParams);
379 388
         }
@@ -389,7 +398,8 @@  discard block
 block discarded – undo
389 398
             foreach ($this->managerOptions['cols'] as $key => $colName) {
390 399
                 if (!empty($params['download'])) {
391 400
                     $row[] = \Model::getColValue($item, is_array($colName) ? $key : $colName, true, false);
392
-                } else {
401
+                }
402
+                else {
393 403
                     $row[] = DataManager::drawCol($item, is_array($colName) ? $key : $colName, $params, $this);
394 404
                 }
395 405
             }
@@ -418,7 +428,8 @@  discard block
 block discarded – undo
418 428
             $col = substr($colName, strpos($colName, ':') + 1);
419 429
             if ($item->$rel) {
420 430
                 return DataManager::drawCol($item->$rel, $col, $params, $dataManager, $originalCol, $originalItem);
421
-            } else {
431
+            }
432
+            else {
422 433
                 return 'Не указано';
423 434
             }
424 435
         }
@@ -441,20 +452,24 @@  discard block
 block discarded – undo
441 452
                             $href = "<a href ='/admin/" . $item->{$modelName::$cols[$colName]['relation']}->genViewLink() . "'>";
442 453
                             if (!empty($modelName::$cols[$colName]['showCol'])) {
443 454
                                 $href .= $item->{$modelName::$cols[$colName]['relation']}->{$modelName::$cols[$colName]['showCol']};
444
-                            } else {
455
+                            }
456
+                            else {
445 457
 
446 458
                                 $href .= $item->{$modelName::$cols[$colName]['relation']}->name();
447 459
                             }
448 460
                             $href .= '</a>';
449 461
                             return $href;
450
-                        } else {
462
+                        }
463
+                        else {
451 464
                             return $item->{$modelName::$cols[$colName]['relation']}->name();
452 465
                         }
453
-                    } else {
466
+                    }
467
+                    else {
454 468
                         return $item->$colName;
455 469
                     }
456 470
             }
457
-        } else {
471
+        }
472
+        else {
458 473
             if (!empty($modelName::$cols[$colName]['view']['type'])) {
459 474
                 switch ($modelName::$cols[$colName]['view']['type']) {
460 475
                     case 'widget':
@@ -472,15 +487,18 @@  discard block
 block discarded – undo
472 487
                     default:
473 488
                         return $item->$colName;
474 489
                 }
475
-            } elseif (!empty($modelName::$cols[$colName]['type'])) {
490
+            }
491
+            elseif (!empty($modelName::$cols[$colName]['type'])) {
476 492
                 if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) {
477 493
                     $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager';
478 494
                     $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem));
479 495
                     return "<a href ='/admin/{$originalItem->genViewLink()}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>";
480
-                } elseif (\App::$cur->name == 'admin' && $colName == 'name') {
496
+                }
497
+                elseif (\App::$cur->name == 'admin' && $colName == 'name') {
481 498
                     $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem));
482 499
                     return "<a href ='/admin/{$item->genViewLink()}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>";
483
-                } elseif ($modelName::$cols[$colName]['type'] == 'html') {
500
+                }
501
+                elseif ($modelName::$cols[$colName]['type'] == 'html') {
484 502
                     $uid = \Tools::randomString();
485 503
                     $script = "<script>inji.onLoad(function(){
486 504
             var el{$uid}=$('#{$uid}');
@@ -509,10 +527,12 @@  discard block
 block discarded – undo
509 527
             }
510 528
             })</script>";
511 529
                     return "<div id = '{$uid}' style='max-height:44px;overflow:hidden;'>{$item->$colName}</div>" . $script;
512
-                } else {
530
+                }
531
+                else {
513 532
                     return \Model::resloveTypeValue($item, $colName);
514 533
                 }
515
-            } else {
534
+            }
535
+            else {
516 536
                 return $item->$colName;
517 537
             }
518 538
         }
@@ -561,7 +581,8 @@  discard block
 block discarded – undo
561 581
             foreach ($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'] as $colName => $colOptions) {
562 582
                 if (!empty($colOptions['userCol'])) {
563 583
                     $queryParams['where'][] = [$colName, \Model::getColValue(\Users\User::$cur, $colOptions['userCol'])];
564
-                } elseif (isset($colOptions['value'])) {
584
+                }
585
+                elseif (isset($colOptions['value'])) {
565 586
                     if (is_array($colOptions['value'])) {
566 587
                         foreach ($colOptions['value'] as $key => $value) {
567 588
                             if ($key === 'userCol') {
@@ -613,7 +634,8 @@  discard block
 block discarded – undo
613 634
                             if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) {
614 635
 
615 636
                                 $date = $params['filters'][$col]['max'] . ' 23:59:59';
616
-                            } else {
637
+                            }
638
+                            else {
617 639
                                 $date = $params['filters'][$col]['max'];
618 640
                             }
619 641
                             $queryParams['where'][] = [$col, $date, '<='];
@@ -657,7 +679,8 @@  discard block
 block discarded – undo
657 679
         }
658 680
         if ($model && !empty($params['relation'])) {
659 681
             $count = $model->$params['relation']($queryParams);
660
-        } else {
682
+        }
683
+        else {
661 684
             $count = $modelName::getCount($queryParams);
662 685
         }
663 686
         $pages = new Pages([
Please login to merge, or discard this patch.
system/modules/Ui/Controllers/DataManagerController.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@  discard block
 block discarded – undo
23 23
             $raw = explode(':', $item);
24 24
             $return['modelName'] = $raw[0];
25 25
             $return['model'] = $return['modelName']::get($raw[1], $return['modelName']::index(), $return['params']);
26
-        } else {
26
+        }
27
+        else {
27 28
             $return['modelName'] = $item;
28 29
             $return['model'] = null;
29 30
         }
@@ -32,7 +33,8 @@  discard block
 block discarded – undo
32 33
             $relation = $return['modelName']::getRelation($return['params']['relation']);
33 34
             if (!empty($relation['type']) && $relation['type'] == 'relModel') {
34 35
                 $return['modelName'] = $relation['relModel'];
35
-            } else {
36
+            }
37
+            else {
36 38
                 $return['modelName'] = $relation['model'];
37 39
             }
38 40
         }
@@ -131,7 +133,8 @@  discard block
 block discarded – undo
131 133
                 }
132 134
                 echo "\n";
133 135
                 $endRow = true;
134
-            } else {
136
+            }
137
+            else {
135 138
                 Ui\Table::drawRow($row);
136 139
             }
137 140
         }
@@ -220,7 +223,8 @@  discard block
 block discarded – undo
220 223
                     $actionParams = $actions[$request['action']];
221 224
                     if (!empty($actionParams['access']['groups']) && !in_array(\Users\User::$cur->group_id, $actionParams['access']['groups'])) {
222 225
                         $result->content = 'У вас нет прав доступа к операции ' . (!isset($actionParams['name']) ? $actionParams['className']::$name : $actionParams['name']);
223
-                    } else {
226
+                    }
227
+                    else {
224 228
                         try {
225 229
                             $result->successMsg = $actionParams['className']::groupAction($dataManager, $ids, $actionParams, !empty($_GET['adInfo']) ? $_GET['adInfo'] : []);
226 230
                             $result->success = true;
@@ -230,7 +234,8 @@  discard block
 block discarded – undo
230 234
                     }
231 235
                 }
232 236
             }
233
-        } else {
237
+        }
238
+        else {
234 239
             $result->content = 'У вас нет прав доступа к менеджеру ' . $request['managerName'] . ' модели ' . $request['modelName'];
235 240
         }
236 241
         $result->send();
Please login to merge, or discard this patch.
system/modules/Ui/widgets/Form/select.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@  discard block
 block discarded – undo
24 24
             $aditionValue = !empty($options['aditionalValue']) ? $options['aditionalValue'] : '';
25 25
         }
26 26
         $optionsHtml .= "<option data-aditionalInput='" . ( count($aditionalInputs) - 1) . "' value ='{$key}'{$selected}>{$value['text']}</option>";
27
-    } else {
27
+    }
28
+    else {
28 29
         $optionsHtml .= "<option value ='{$key}'{$selected}>{$value}</option>";
29 30
     }
30 31
 }
@@ -47,7 +48,8 @@  discard block
 block discarded – undo
47 48
     if ($key !== $showedInput) {
48 49
         $input['options']['disabled'] = true;
49 50
         $input['options']['class'] = !empty($input['options']['class']) ? $input['options']['class'] . ' hidden' : 'hidden';
50
-    } else {
51
+    }
52
+    else {
51 53
         $input['options']['value'] = empty($input['options']['value']) ? $aditionValue : $input['options']['value'];
52 54
     }
53 55
     if ($input['type'] == 'select') {
Please login to merge, or discard this patch.
system/modules/Ui/widgets/Table/foot.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,8 @@
 block discarded – undo
4 4
       foreach ($table->cols as $col) {
5 5
           if (is_string($col)) {
6 6
               echo "<th>{$col}</th>";
7
-          } else {
7
+          }
8
+          else {
8 9
               echo Html::el('th', !empty($col['attributes']) ? $col['attributes'] : [], $col['text']);
9 10
           }
10 11
       }
Please login to merge, or discard this patch.
system/modules/Ui/widgets/DataManager/filters.php 1 patch
Braces   +24 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@  discard block
 block discarded – undo
15 15
           if ($dataManager->modelName) {
16 16
               $modelName = $dataManager->modelName;
17 17
               $colInfo = $modelName::getColInfo($col);
18
-          } else {
18
+          }
19
+          else {
19 20
               $colInfo = $dataManager->managerOptions['cols'][$col];
20 21
           }
21 22
           $values = [];
@@ -28,10 +29,12 @@  discard block
 block discarded – undo
28 29
                       $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1);
29 30
 
30 31
                       $inputOptions['value'] = \Users\User::$cur->$rel->$param;
31
-                  } else {
32
+                  }
33
+                  else {
32 34
                       $this->model->$col = \Users\User::$cur->{$preset['userCol']};
33 35
                   }
34
-              } elseif (!empty($colOptions['value'])) {
36
+              }
37
+              elseif (!empty($colOptions['value'])) {
35 38
                   $inputOptions['value'] = $colOptions['value'];
36 39
               }
37 40
               if (is_array($inputOptions['value'])) {
@@ -40,7 +43,8 @@  discard block
 block discarded – undo
40 43
                       $inputOptions['value'] = $value;
41 44
                       $form->input('hidden', "datamanagerFilters[{$col}][value][{$key}]", '', $inputOptions);
42 45
                   }
43
-              } else {
46
+              }
47
+              else {
44 48
                   $form->input('hidden', "datamanagerFilters[{$col}][value]", '', $inputOptions);
45 49
               }
46 50
               continue;
@@ -59,7 +63,8 @@  discard block
 block discarded – undo
59 63
                           case 'method':
60 64
                               if (!empty($colInfo['colParams']['params'])) {
61 65
                                   $values = call_user_func_array([App::$cur->$colInfo['colParams']['module'], $colInfo['colParams']['method']], $colInfo['colParams']['params']);
62
-                              } else {
66
+                              }
67
+                              else {
63 68
                                   $values = ['' => 'Не важно'] + App::$cur->$colInfo['colParams']['module']->$colInfo['colParams']['method']();
64 69
                               }
65 70
                               break;
@@ -81,7 +86,8 @@  discard block
 block discarded – undo
81 86
                               foreach ($items as $key => $item) {
82 87
                                   if (!empty($inputParams['showCol'])) {
83 88
                                       $values[$key] = $item->$inputParams['showCol'];
84
-                                  } else {
89
+                                  }
90
+                                  else {
85 91
                                       $values[$key] = $item->name();
86 92
                                   }
87 93
                               }
@@ -100,10 +106,12 @@  discard block
 block discarded – undo
100 106
                                   $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1);
101 107
 
102 108
                                   $inputOptions['value'] = \Users\User::$cur->$rel->$param;
103
-                              } else {
109
+                              }
110
+                              else {
104 111
                                   $this->model->$col = \Users\User::$cur->{$preset['userCol']};
105 112
                               }
106
-                          } elseif (!empty($colOptions['value'])) {
113
+                          }
114
+                          elseif (!empty($colOptions['value'])) {
107 115
 
108 116
                               $inputOptions['value'] = $colOptions['value'];
109 117
                           }
@@ -141,9 +149,11 @@  discard block
 block discarded – undo
141 149
                           <?php
142 150
                           if (!empty($_GET['datamanagerFilters'][$col]['value'])) {
143 151
                               $value = 1;
144
-                          } elseif (isset($_GET['datamanagerFilters'][$col]['value'])) {
152
+                          }
153
+                          elseif (isset($_GET['datamanagerFilters'][$col]['value'])) {
145 154
                               $value = 0;
146
-                          } else {
155
+                          }
156
+                          else {
147 157
                               $value = '';
148 158
                           }
149 159
                           $inputOptions = ['value' => $value, 'values' => [
@@ -162,10 +172,12 @@  discard block
 block discarded – undo
162 172
                                       $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1);
163 173
 
164 174
                                       $inputOptions['value'] = \Users\User::$cur->$rel->$param;
165
-                                  } else {
175
+                                  }
176
+                                  else {
166 177
                                       $this->model->$col = \Users\User::$cur->{$preset['userCol']};
167 178
                                   }
168
-                              } elseif (!empty($colOptions['value'])) {
179
+                              }
180
+                              elseif (!empty($colOptions['value'])) {
169 181
 
170 182
                                   $inputOptions['value'] = $colOptions['value'];
171 183
                               }
Please login to merge, or discard this patch.
system/modules/Materials/models/Material.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -147,9 +147,11 @@  discard block
 block discarded – undo
147 147
     public function resolveTemplate() {
148 148
         if ($this->template !== 'inherit') {
149 149
             return $this->template;
150
-        } elseif ($this->template == 'inherit' && $this->category) {
150
+        }
151
+        elseif ($this->template == 'inherit' && $this->category) {
151 152
             return $this->category->resolveTemplate(true);
152
-        } else {
153
+        }
154
+        else {
153 155
             return 'current';
154 156
         }
155 157
     }
@@ -157,9 +159,11 @@  discard block
 block discarded – undo
157 159
     public function resolveViewer() {
158 160
         if ($this->viewer !== 'inherit') {
159 161
             return $this->viewer;
160
-        } elseif ($this->viewer == 'inherit' && $this->category) {
162
+        }
163
+        elseif ($this->viewer == 'inherit' && $this->category) {
161 164
             return $this->category->resolveViewer(true);
162
-        } else {
165
+        }
166
+        else {
163 167
             return 'default';
164 168
         }
165 169
     }
Please login to merge, or discard this patch.
system/modules/Materials/models/Category.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,9 +136,11 @@  discard block
 block discarded – undo
136 136
         $param = $material ? 'material_template' : 'template';
137 137
         if ($this->$param !== 'inherit') {
138 138
             return $this->$param;
139
-        } elseif ($this->$param == 'inherit' && $this->parent) {
139
+        }
140
+        elseif ($this->$param == 'inherit' && $this->parent) {
140 141
             return $this->parent->resolveTemplate($material);
141
-        } else {
142
+        }
143
+        else {
142 144
             return 'current';
143 145
         }
144 146
     }
@@ -147,9 +149,11 @@  discard block
 block discarded – undo
147 149
         $param = $material ? 'material_viewer' : 'viewer';
148 150
         if ($this->$param !== 'inherit') {
149 151
             return $this->$param;
150
-        } elseif ($this->$param == 'inherit' && $this->parent) {
152
+        }
153
+        elseif ($this->$param == 'inherit' && $this->parent) {
151 154
             return $this->parent->resolveViewer($material);
152
-        } else {
155
+        }
156
+        else {
153 157
             return $material ? 'default' : 'category';
154 158
         }
155 159
     }
Please login to merge, or discard this patch.