Completed
Push — master ( 0e57e6...32019c )
by Alexey
04:45
created
system/modules/Ui/objects/ActiveForm/Input/File.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
           'size' => $_FILES[$this->activeForm->requestFormName]['size'][$this->modelName][$this->colName],
23 23
           'error' => $_FILES[$this->activeForm->requestFormName]['error'][$this->modelName][$this->colName],
24 24
               ], [
25
-          'upload_code' => 'activeForm:' . $this->activeForm->modelName . ':' . $this->activeForm->model->pk()
25
+          'upload_code' => 'activeForm:'.$this->activeForm->modelName.':'.$this->activeForm->model->pk()
26 26
       ]);
27 27
 
28 28
       if ($file_id) {
Please login to merge, or discard this patch.
system/modules/Ui/objects/ActiveForm.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $this->formName = $form;
48 48
         $this->form = \App::$cur->ui->getModelForm($this->modelName, $form);
49 49
         if (empty($this->form)) {
50
-          throw new \Exception('empty form ' . $form);
50
+          throw new \Exception('empty form '.$form);
51 51
         }
52 52
         $this->inputs = $this->getInputs();
53 53
       }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
               $this->model->_params[$modelName::index()] = 0;
83 83
             }
84 84
             $relOptions['model']::fixPrefix($relOptions['col']);
85
-            $inputs[$col] = new ActiveForm(new $relOptions['model']([ $relOptions['col'] => &$this->model->_params[$modelName::index()]]), $colPath[2]);
85
+            $inputs[$col] = new ActiveForm(new $relOptions['model']([$relOptions['col'] => &$this->model->_params[$modelName::index()]]), $colPath[2]);
86 86
           }
87 87
           $inputs[$col]->parent = $this;
88 88
         } elseif (!empty($modelName::$cols[$col])) {
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 
96 96
   public function checkRequest($params = [], $ajax = false) {
97 97
     if (!$this->checkAccess()) {
98
-      $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->formName . '"');
98
+      $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->formName.'"');
99 99
       return [];
100 100
     }
101 101
     $successId = 0;
102 102
     if (!empty($_POST[$this->requestFormName][$this->modelName]) || !empty($_FILES[$this->requestFormName]['tmp_name'][$this->modelName])) {
103
-      $request = !empty($_POST[$this->requestFormName][$this->modelName])?$_POST[$this->requestFormName][$this->modelName]:[];
103
+      $request = !empty($_POST[$this->requestFormName][$this->modelName]) ? $_POST[$this->requestFormName][$this->modelName] : [];
104 104
       if ($this->model) {
105 105
         if (!empty($this->form['handler'])) {
106 106
           $modelName = $this->model;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
             if (!empty($this->form['userGroupReadonly'][\Users\User::$cur->group_id]) && in_array($col, $this->form['userGroupReadonly'][\Users\User::$cur->group_id])) {
127 127
               continue;
128 128
             }
129
-            $inputClassName = '\Ui\ActiveForm\Input\\' . ucfirst($param['type']);
129
+            $inputClassName = '\Ui\ActiveForm\Input\\'.ucfirst($param['type']);
130 130
             $input = new $inputClassName();
131 131
             $input->activeForm = $this;
132 132
             $input->activeFormParams = $params;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             if ($ajax) {
172 172
               \Msg::show();
173 173
             } elseif (!empty($_GET['redirectUrl'])) {
174
-              \Tools::redirect($_GET['redirectUrl'] . (!empty($_GET['dataManagerHash']) ? '#' . $_GET['dataManagerHash'] : ''));
174
+              \Tools::redirect($_GET['redirectUrl'].(!empty($_GET['dataManagerHash']) ? '#'.$_GET['dataManagerHash'] : ''));
175 175
             }
176 176
             $successId = $this->model->pk();
177 177
           }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
   public function draw($params = [], $ajax = false) {
188 188
     if (!$this->checkAccess()) {
189
-      $this->drawError('you not have access to "' . $this->modelName . '" form with name: "' . $this->formName . '"');
189
+      $this->drawError('you not have access to "'.$this->modelName.'" form with name: "'.$this->formName.'"');
190 190
       return [];
191 191
     }
192 192
     $form = new Form(!empty($this->form['formOptions']) ? $this->form['formOptions'] : []);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     if (is_object($options)) {
198 198
       $options->draw();
199 199
     } else {
200
-      $inputClassName = '\Ui\ActiveForm\Input\\' . ucfirst($options['type']);
200
+      $inputClassName = '\Ui\ActiveForm\Input\\'.ucfirst($options['type']);
201 201
       $input = new $inputClassName();
202 202
       $input->form = $form;
203 203
       $input->activeForm = $this;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     }
277 277
     foreach ($values as $key => $value) {
278 278
       if (is_array($value) && !empty($value['input']) && empty($value['input']['noprefix'])) {
279
-        $values[$key]['input']['name'] = $aditionalInputNamePrefix . "[{$value['input']['name']}]";
279
+        $values[$key]['input']['name'] = $aditionalInputNamePrefix."[{$value['input']['name']}]";
280 280
       }
281 281
     }
282 282
     return $values;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
    */
299 299
   public function checkAccess() {
300 300
     if (empty($this->form)) {
301
-      $this->drawError('"' . $this->modelName . '" form with name: "' . $this->formName . '" not found');
301
+      $this->drawError('"'.$this->modelName.'" form with name: "'.$this->formName.'" not found');
302 302
       return false;
303 303
     }
304 304
     if (\App::$cur->Access && !\App::$cur->Access->checkAccess($this)) {
Please login to merge, or discard this patch.
system/modules/Ui/objects/DataManager.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
       $this->name = $this->managerOptions['name'];
58 58
     }
59 59
 
60
-    $this->managerId = str_replace('\\', '_', 'dataManager_' . $this->modelName . '_' . $this->managerName . '_' . \Tools::randomString());
60
+    $this->managerId = str_replace('\\', '_', 'dataManager_'.$this->modelName.'_'.$this->managerName.'_'.\Tools::randomString());
61 61
   }
62 62
 
63 63
   /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     if (!empty($this->managerOptions['filters'])) {
104 104
       $buttons[] = [
105 105
           'text' => 'Фильтры',
106
-          'onclick' => '  var modal = $("#' . $this->managerId . '_filters");
106
+          'onclick' => '  var modal = $("#'.$this->managerId.'_filters");
107 107
                 modal.modal("show");',
108 108
       ];
109 109
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
       $formParams['formName'] = 'simpleItem';
112 112
       $buttons[] = [
113 113
           'text' => '<i class = "glyphicon glyphicon-send"></i> Быстрое создание',
114
-          'onclick' => 'inji.Ui.dataManagers.get(this).newItem("' . str_replace('\\', '\\\\', $modelName) . '",' . json_encode($formParams) . ');',
114
+          'onclick' => 'inji.Ui.dataManagers.get(this).newItem("'.str_replace('\\', '\\\\', $modelName).'",'.json_encode($formParams).');',
115 115
       ];
116 116
     }
117 117
     $formParams['formName'] = !empty($this->managerOptions['editForm']) ? $this->managerOptions['editForm'] : 'manager';
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
       $aform = new ActiveForm(new $modelName, $formParams['formName']);
124 124
       if ($aform->checkAccess()) {
125 125
         $buttons[] = [
126
-            'text' => 'Создать ' . $name,
127
-            'onclick' => 'inji.Ui.dataManagers.get(this).newItem("' . str_replace('\\', '\\\\', $modelName) . '",' . json_encode($formParams) . ');',
126
+            'text' => 'Создать '.$name,
127
+            'onclick' => 'inji.Ui.dataManagers.get(this).newItem("'.str_replace('\\', '\\\\', $modelName).'",'.json_encode($formParams).');',
128 128
         ];
129 129
       }
130 130
     }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             'className' => $action
159 159
         ];
160 160
       }
161
-      $return[$key]['className'] = strpos($return[$key]['className'], '\\') === false && class_exists('Ui\DataManager\Action\\' . $return[$key]['className']) ? 'Ui\DataManager\Action\\' . $return[$key]['className'] : $return[$key]['className'];
161
+      $return[$key]['className'] = strpos($return[$key]['className'], '\\') === false && class_exists('Ui\DataManager\Action\\'.$return[$key]['className']) ? 'Ui\DataManager\Action\\'.$return[$key]['className'] : $return[$key]['className'];
162 162
       if (!class_exists($return[$key]['className']) || ($onlyGroupActions && !$return[$key]['className']::$groupAction)) {
163 163
         unset($return[$key]);
164 164
       }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
           <?php
190 190
           foreach ($actions as $action => $actionParams) {
191 191
             if (class_exists($actionParams['className']) && $actionParams['className']::$groupAction) {
192
-              echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>";
192
+              echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"".str_replace('\\', '\\\\', $action)."\");return false;'>{$actionParams['className']::$name}</a></li>";
193 193
             }
194 194
           }
195 195
           ?>
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
       return [];
240 240
     }
241 241
     if (!$this->checkAccess()) {
242
-      $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"');
242
+      $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"');
243 243
       return [];
244 244
     }
245 245
     $modelName = $this->modelName;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
       $queryParams['start'] = $this->page * $this->limit - $this->limit;
256 256
     }
257 257
     if (!empty($params['categoryPath']) && $modelName::$categoryModel) {
258
-      $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE'];
258
+      $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE'];
259 259
     }
260 260
     if (!empty($params['appType'])) {
261 261
       $queryParams['appType'] = $params['appType'];
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             if (!empty($params['filters'][$col]['max'])) {
318 318
               if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) {
319 319
 
320
-                $date = $params['filters'][$col]['max'] . ' 23:59:59';
320
+                $date = $params['filters'][$col]['max'].' 23:59:59';
321 321
               } else {
322 322
                 $date = $params['filters'][$col]['max'];
323 323
               }
@@ -344,16 +344,16 @@  discard block
 block discarded – undo
344 344
             }
345 345
             switch ($params['filters'][$col]['compareType']) {
346 346
               case 'contains':
347
-                $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE'];
347
+                $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE'];
348 348
                 break;
349 349
               case 'equals':
350 350
                 $queryParams['where'][] = [$col, $params['filters'][$col]['value']];
351 351
                 break;
352 352
               case 'starts_with':
353
-                $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE'];
353
+                $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE'];
354 354
                 break;
355 355
               case 'ends_with':
356
-                $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE'];
356
+                $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE'];
357 357
                 break;
358 358
             }
359 359
             break;
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
         $item = $relation['relModel']::get([[$item->index(), $item->id], [$model->index(), $model->id]]);
384 384
       }
385 385
       $row = [];
386
-      $row[] = '<input type ="checkbox" name = "pk[]" value =' . $item->pk() . '>';
387
-      $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '%5C', get_class($originalItem));
388
-      $row[] = "<a href ='/admin/" . $item->genViewLink() . "?redirectUrl={$redirectUrl}'>{$item->pk()}</a>";
386
+      $row[] = '<input type ="checkbox" name = "pk[]" value ='.$item->pk().'>';
387
+      $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '%5C', get_class($originalItem));
388
+      $row[] = "<a href ='/admin/".$item->genViewLink()."?redirectUrl={$redirectUrl}'>{$item->pk()}</a>";
389 389
       foreach ($this->managerOptions['cols'] as $key => $colName) {
390 390
         if (!empty($params['download'])) {
391 391
           $row[] = \Model::getColValue($item, is_array($colName) ? $key : $colName, true, false);
@@ -429,16 +429,16 @@  discard block
 block discarded – undo
429 429
           $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
430 430
           $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
431 431
           $count = $count ? $count : 'Нет';
432
-          return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count}</a>";
432
+          return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"".str_replace('\\', '\\\\', $modelName).":".$item->pk()."\",".json_encode(array_merge($params, $managerParams)).")'>{$count}</a>";
433 433
         case 'many':
434 434
           $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
435 435
           $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
436 436
           $count = $count ? $count : 'Нет';
437
-          return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count}</a>";
437
+          return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"".str_replace('\\', '\\\\', $modelName).":".$item->pk()."\",".json_encode(array_merge($params, $managerParams)).")'>{$count}</a>";
438 438
         default :
439 439
           if ($item->{$modelName::$cols[$colName]['relation']}) {
440 440
             if (\App::$cur->name == 'admin') {
441
-              $href = "<a href ='/admin/" . $item->{$modelName::$cols[$colName]['relation']}->genViewLink() . "'>";
441
+              $href = "<a href ='/admin/".$item->{$modelName::$cols[$colName]['relation']}->genViewLink()."'>";
442 442
               if (!empty($modelName::$cols[$colName]['showCol'])) {
443 443
                 $href .= $item->{$modelName::$cols[$colName]['relation']}->{$modelName::$cols[$colName]['showCol']};
444 444
               } else {
@@ -468,17 +468,17 @@  discard block
 block discarded – undo
468 468
           case 'many':
469 469
             $managerParams = ['relation' => $modelName::$cols[$colName]['relation']];
470 470
             $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1]));
471
-            return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"" . str_replace('\\', '\\\\', $modelName) . ":" . $item->pk() . "\"," . json_encode(array_merge($params, $managerParams)) . ")'>{$count} " . \Tools::getNumEnding($count, ['Элемент', 'Элемента', 'Элементов']) . "</a>";
471
+            return "<a class = 'btn btn-xs btn-primary' onclick = 'inji.Ui.dataManagers.popUp(\"".str_replace('\\', '\\\\', $modelName).":".$item->pk()."\",".json_encode(array_merge($params, $managerParams)).")'>{$count} ".\Tools::getNumEnding($count, ['Элемент', 'Элемента', 'Элементов'])."</a>";
472 472
           default:
473 473
             return $item->$colName;
474 474
         }
475 475
       } elseif (!empty($modelName::$cols[$colName]['type'])) {
476
-        if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) {
476
+        if (\App::$cur->name == 'admin' && $originalCol == 'name' || ($dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) {
477 477
           $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager';
478
-          $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem));
478
+          $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem));
479 479
           return "<a href ='/admin/{$originalItem->genViewLink()}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>";
480 480
         } elseif (\App::$cur->name == 'admin' && $colName == 'name') {
481
-          $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem));
481
+          $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem));
482 482
           return "<a href ='/admin/{$item->genViewLink()}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>";
483 483
         } elseif ($modelName::$cols[$colName]['type'] == 'html') {
484 484
           $uid = \Tools::randomString();
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
               el{$uid}.after('<a href=\"#\" onclick=\"el{$uid}Toggle();return false;\">Развернуть</a>');
509 509
             }
510 510
             })</script>";
511
-          return "<div id = '{$uid}' style='max-height:44px;overflow:hidden;'>{$item->$colName}</div>" . $script;
511
+          return "<div id = '{$uid}' style='max-height:44px;overflow:hidden;'>{$item->$colName}</div>".$script;
512 512
         } else {
513 513
           return \Model::resloveTypeValue($item, $colName);
514 514
         }
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
       return [];
542 542
     }
543 543
     if (!$this->checkAccess()) {
544
-      $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"');
544
+      $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"');
545 545
       return [];
546 546
     }
547 547
     if (!empty($params['limit'])) {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
     ];
556 556
     $modelName = $this->modelName;
557 557
     if (!empty($params['categoryPath']) && $modelName::$categoryModel) {
558
-      $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE'];
558
+      $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE'];
559 559
     }
560 560
     if (!empty($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'])) {
561 561
       foreach ($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'] as $colName => $colOptions) {
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
             if (!empty($params['filters'][$col]['max'])) {
613 613
               if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) {
614 614
 
615
-                $date = $params['filters'][$col]['max'] . ' 23:59:59';
615
+                $date = $params['filters'][$col]['max'].' 23:59:59';
616 616
               } else {
617 617
                 $date = $params['filters'][$col]['max'];
618 618
               }
@@ -639,16 +639,16 @@  discard block
 block discarded – undo
639 639
             }
640 640
             switch ($params['filters'][$col]['compareType']) {
641 641
               case 'contains':
642
-                $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE'];
642
+                $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE'];
643 643
                 break;
644 644
               case 'equals':
645 645
                 $queryParams['where'][] = [$col, $params['filters'][$col]['value']];
646 646
                 break;
647 647
               case 'starts_with':
648
-                $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE'];
648
+                $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE'];
649 649
                 break;
650 650
               case 'ends_with':
651
-                $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE'];
651
+                $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE'];
652 652
                 break;
653 653
             }
654 654
             break;
@@ -679,12 +679,12 @@  discard block
 block discarded – undo
679 679
     $tableCols = [];
680 680
     foreach ($cols as $colName => $colOptions) {
681 681
       $tableCols[] = [
682
-          'attributes' => ['class' => $this->managerId . '_colname_' . $colName, 'data-colname' => $colName],
682
+          'attributes' => ['class' => $this->managerId.'_colname_'.$colName, 'data-colname' => $colName],
683 683
           'text' => !empty($colOptions['label']) ? $colOptions['label'] : $colName
684 684
       ];
685 685
     }
686 686
     $tableCols[] = '';
687
-    $this->table->class .=' datamanagertable';
687
+    $this->table->class .= ' datamanagertable';
688 688
     $this->table->setCols($tableCols);
689 689
   }
690 690
 
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
       return false;
706 706
     }
707 707
     if (!$this->checkAccess()) {
708
-      $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"');
708
+      $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"');
709 709
       return [];
710 710
     }
711 711
     $tree = new Tree();
712 712
     $tree->ul($this->managerOptions['categorys']['model'], 0, function($category) {
713
-      $path = $category->tree_path . ($category->pk() ? $category->pk() . "/" : '');
713
+      $path = $category->tree_path.($category->pk() ? $category->pk()."/" : '');
714 714
       $cleanClassName = str_replace('\\', '\\\\', get_class($category));
715 715
       return "<a href='#' onclick='inji.Ui.dataManagers.get(this).switchCategory(this);return false;' data-index='{$category->index()}' data-path ='{$path}' data-id='{$category->pk()}' data-model='{$this->managerOptions['categorys']['model']}'> {$category->name}</a> 
716 716
                 
Please login to merge, or discard this patch.
system/modules/Ui/widgets/Form/textarea.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 echo $label !== false ? "<label>{$label}</label>" : '';
5 5
 $attributes = [
6 6
     'name' => $name,
7
-    'class' => "form-control " . (!empty($options['class']) ? $options['class'] : '')
7
+    'class' => "form-control ".(!empty($options['class']) ? $options['class'] : '')
8 8
 ];
9 9
 if (!empty($options['required'])) {
10 10
   $attributes['required'] = 'required';
Please login to merge, or discard this patch.
system/Inji/Model.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             $relModel = $relations[$colInfo['colParams']['relation']]['model'];
208 208
             $relModel = strpos($relModel, '\\') === 0 ? substr($relModel, 1) : $relModel;
209 209
             if ($manageHref) {
210
-              $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relModel) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано';
210
+              $value = $relValue ? "<a href='/admin/".str_replace('\\', '/view/', $relModel)."/".$relValue->pk()."'>".$relValue->name()."</a>" : 'Не задано';
211 211
             } else {
212 212
               $value = $relValue ? $relValue->name() : 'Не задано';
213 213
             }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
       case 'image':
218 218
         $file = Files\File::get($item->$colName);
219 219
         if ($file) {
220
-          $value = '<img src="' . $file->path . '?resize=60x120" />';
220
+          $value = '<img src="'.$file->path.'?resize=60x120" />';
221 221
         } else {
222 222
           $value = '<img src="/static/system/images/no-image.png?resize=60x120" />';
223 223
         }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
       case 'file':
226 226
         $file = Files\File::get($item->$colName);
227 227
         if ($file) {
228
-          $value = '<a href="' . $file->path . '">' . $file->name . '.' . $file->type->ext . '</a>';
228
+          $value = '<a href="'.$file->path.'">'.$file->name.'.'.$file->type->ext.'</a>';
229 229
         } else {
230 230
           $value = 'Файл не загружен';
231 231
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                 case 'map':
270 270
                   if ($item->$colName && json_decode($item->$colName, true)) {
271 271
                     $addres = json_decode($item->$colName, true);
272
-                    $name = $addres['address'] ? $addres['address'] : 'lat:' . $addres['lat'] . ': lng:' . $addres['lng'];
272
+                    $name = $addres['address'] ? $addres['address'] : 'lat:'.$addres['lat'].': lng:'.$addres['lng'];
273 273
                     \App::$cur->libs->loadLib('yandexMap');
274 274
                     ob_start();
275 275
                     $uid = Tools::randomString();
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                     <?php
302 302
                     $content = ob_get_contents();
303 303
                     ob_end_clean();
304
-                    $onclick = 'inji.Ui.modals.show("' . addcslashes($addres['address'], '"') . '", $("#map' . $uid . '_container script").html().replace(/^\/\*/g, "").replace(/\*\/$/g, "")+"</script>","mapmodal' . $uid . '","modal-lg");';
304
+                    $onclick = 'inji.Ui.modals.show("'.addcslashes($addres['address'], '"').'", $("#map'.$uid.'_container script").html().replace(/^\/\*/g, "").replace(/\*\/$/g, "")+"</script>","mapmodal'.$uid.'","modal-lg");';
305 305
                     $onclick .= 'return false;';
306 306
                     $value = "<a href ='#' onclick='{$onclick}' >{$name}</a>";
307 307
                     $value .= $content;
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
       return;
342 342
     }
343 343
     if (!is_array($array)) {
344
-      if (!isset($cols[static::colPrefix() . $array]) && isset(static::$cols[$array])) {
344
+      if (!isset($cols[static::colPrefix().$array]) && isset(static::$cols[$array])) {
345 345
         static::createCol($array);
346 346
         $cols = static::cols(true);
347 347
       }
348
-      if (!isset($cols[$array]) && isset($cols[static::colPrefix() . $array])) {
349
-        $array = static::colPrefix() . $array;
348
+      if (!isset($cols[$array]) && isset($cols[static::colPrefix().$array])) {
349
+        $array = static::colPrefix().$array;
350 350
       } else {
351 351
         static::checkForJoin($array, $rootModel);
352 352
       }
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
     switch ($searchtype) {
356 356
       case 'key':
357 357
         foreach ($array as $key => $item) {
358
-          if (!isset($cols[static::colPrefix() . $key]) && isset(static::$cols[$key])) {
358
+          if (!isset($cols[static::colPrefix().$key]) && isset(static::$cols[$key])) {
359 359
             static::createCol($key);
360 360
             $cols = static::cols(true);
361 361
           }
362
-          if (!isset($cols[$key]) && isset($cols[static::colPrefix() . $key])) {
363
-            $array[static::colPrefix() . $key] = $item;
362
+          if (!isset($cols[$key]) && isset($cols[static::colPrefix().$key])) {
363
+            $array[static::colPrefix().$key] = $item;
364 364
             unset($array[$key]);
365
-            $key = static::colPrefix() . $key;
365
+            $key = static::colPrefix().$key;
366 366
           }
367 367
           if (is_array($array[$key])) {
368 368
             static::fixPrefix($array[$key], 'key', $rootModel);
@@ -373,12 +373,12 @@  discard block
 block discarded – undo
373 373
         break;
374 374
       case 'first':
375 375
         if (isset($array[0]) && is_string($array[0])) {
376
-          if (!isset($cols[static::colPrefix() . $array[0]]) && isset(static::$cols[$array[0]])) {
376
+          if (!isset($cols[static::colPrefix().$array[0]]) && isset(static::$cols[$array[0]])) {
377 377
             static::createCol($array[0]);
378 378
             $cols = static::cols(true);
379 379
           }
380
-          if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix() . $array[0]])) {
381
-            $array[0] = static::colPrefix() . $array[0];
380
+          if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix().$array[0]])) {
381
+            $array[0] = static::colPrefix().$array[0];
382 382
           } else {
383 383
             static::checkForJoin($array[0], $rootModel);
384 384
           }
@@ -410,13 +410,13 @@  discard block
 block discarded – undo
410 410
           case 'to':
411 411
             $relCol = $relations[$rel]['col'];
412 412
             static::fixPrefix($relCol);
413
-            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
413
+            $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol];
414 414
             break;
415 415
           case 'one':
416 416
           case 'many':
417 417
             $relCol = $relations[$rel]['col'];
418 418
             $relations[$rel]['model']::fixPrefix($relCol);
419
-            $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
419
+            $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol];
420 420
             break;
421 421
         }
422 422
         $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
@@ -455,13 +455,13 @@  discard block
 block discarded – undo
455 455
             $relCol = $relations[$rel]['col'];
456 456
             static::fixPrefix($relCol);
457 457
             //$info['modelName'] = $relations[$rel]['model'];
458
-            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
458
+            $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol];
459 459
             break;
460 460
           case 'one':
461 461
             $relCol = $relations[$rel]['col'];
462 462
             $relations[$rel]['model']::fixPrefix($relCol);
463 463
             //$info['modelName'] = $relations[$rel]['model'];
464
-            $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
464
+            $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol];
465 465
             break;
466 466
         }
467 467
         $info = $relations[$rel]['model']::parseColRecursion($info);
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
       } else {
480 480
         $info['colParams'] = [];
481 481
       }
482
-      if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix() . $info['col']])) {
483
-        $info['col'] = static::colPrefix() . $info['col'];
482
+      if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix().$info['col']])) {
483
+        $info['col'] = static::colPrefix().$info['col'];
484 484
       }
485 485
       $info['modelName'] = get_called_class();
486 486
     }
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
     if ($params === false) {
587 587
       return false;
588 588
     }
589
-    return App::$cur->db->addCol(static::table(), static::colPrefix() . $colName, $params);
589
+    return App::$cur->db->addCol(static::table(), static::colPrefix().$colName, $params);
590 590
   }
591 591
 
592 592
   public static function createTable() {
@@ -615,28 +615,28 @@  discard block
 block discarded – undo
615 615
       return true;
616 616
     }
617 617
     $cols = [
618
-        $colPrefix . 'id' => 'pk'
618
+        $colPrefix.'id' => 'pk'
619 619
     ];
620 620
     $className = get_called_class();
621 621
     if (!empty($className::$cols)) {
622 622
       foreach ($className::$cols as $colName => $colParams) {
623 623
         if ($colName == 'date_create') {
624
-          $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
624
+          $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
625 625
           continue;
626 626
         }
627 627
         $params = $className::genColParams($colName);
628 628
         if ($params) {
629
-          $cols[$colPrefix . $colName] = $params;
629
+          $cols[$colPrefix.$colName] = $params;
630 630
         }
631 631
       }
632 632
     }
633
-    if (empty($cols[$colPrefix . 'date_create'])) {
634
-      $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
633
+    if (empty($cols[$colPrefix.'date_create'])) {
634
+      $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
635 635
     }
636 636
     $tableIndexes = [];
637 637
     if ($indexes) {
638 638
       foreach ($indexes as $indexName => $index) {
639
-        $tableIndexes[] = $index['type'] . ' ' . App::$cur->db->table_prefix . $indexName . ' (' . implode(',', $index['cols']) . ')';
639
+        $tableIndexes[] = $index['type'].' '.App::$cur->db->table_prefix.$indexName.' ('.implode(',', $index['cols']).')';
640 640
       }
641 641
     }
642 642
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
    */
661 661
   public static function index() {
662 662
 
663
-    return static::colPrefix() . 'id';
663
+    return static::colPrefix().'id';
664 664
   }
665 665
 
666 666
   /**
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
   public static function colPrefix() {
672 672
     $classPath = explode('\\', get_called_class());
673 673
     $classPath = array_slice($classPath, 1);
674
-    return strtolower(implode('_', $classPath)) . '_';
674
+    return strtolower(implode('_', $classPath)).'_';
675 675
   }
676 676
 
677 677
   /**
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
    * @return string
706 706
    */
707 707
   public function name() {
708
-    return $this->{$this->nameCol()} ? $this->{$this->nameCol()} : '№' . $this->pk();
708
+    return $this->{$this->nameCol()} ? $this->{$this->nameCol()} : '№'.$this->pk();
709 709
   }
710 710
 
711 711
   /**
@@ -739,12 +739,12 @@  discard block
 block discarded – undo
739 739
           case 'to':
740 740
             $relCol = $relations[$rel]['col'];
741 741
             static::fixPrefix($relCol);
742
-            App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol);
742
+            App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol);
743 743
             break;
744 744
           case 'one':
745 745
             $col = $relations[$rel]['col'];
746 746
             $relations[$rel]['model']::fixPrefix($col);
747
-            App::$cur->db->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col);
747
+            App::$cur->db->join($relations[$rel]['model']::table(), static::index().' = '.$col);
748 748
             break;
749 749
         }
750 750
       }
@@ -759,8 +759,8 @@  discard block
 block discarded – undo
759 759
       }
760 760
       if ($param !== null) {
761 761
         $cols = static::cols();
762
-        if (!isset($cols[$col]) && isset($cols[static::colPrefix() . $col])) {
763
-          $col = static::colPrefix() . $col;
762
+        if (!isset($cols[$col]) && isset($cols[static::colPrefix().$col])) {
763
+          $col = static::colPrefix().$col;
764 764
         }
765 765
         App::$cur->db->where($col, $param);
766 766
       } else {
@@ -824,12 +824,12 @@  discard block
 block discarded – undo
824 824
           case 'to':
825 825
             $relCol = $relations[$rel]['col'];
826 826
             static::fixPrefix($relCol);
827
-            $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol);
827
+            $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol);
828 828
             break;
829 829
           case 'one':
830 830
             $col = $relations[$rel]['col'];
831 831
             $relations[$rel]['model']::fixPrefix($col);
832
-            $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col);
832
+            $query->join($relations[$rel]['model']::table(), static::index().' = '.$col);
833 833
             break;
834 834
         }
835 835
       }
@@ -1151,12 +1151,12 @@  discard block
 block discarded – undo
1151 1151
           case 'to':
1152 1152
             $relCol = $relations[$rel]['col'];
1153 1153
             static::fixPrefix($relCol);
1154
-            $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol);
1154
+            $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol);
1155 1155
             break;
1156 1156
           case 'one':
1157 1157
             $col = $relations[$rel]['col'];
1158 1158
             $relations[$rel]['model']::fixPrefix($col);
1159
-            $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col);
1159
+            $query->join($relations[$rel]['model']::table(), static::index().' = '.$col);
1160 1160
             break;
1161 1161
         }
1162 1162
       }
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
     } else {
1174 1174
       $cols .= '*';
1175 1175
     }
1176
-    $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : '');
1176
+    $cols .= ') as `count`'.(!empty($options['cols']) ? ','.$options['cols'] : '');
1177 1177
     $query->cols = $cols;
1178 1178
     if (!empty($options['group'])) {
1179 1179
       $query->group($options['group']);
@@ -1306,25 +1306,25 @@  discard block
 block discarded – undo
1306 1306
     $itemModel = $class::$treeCategory;
1307 1307
     $oldPath = $this->tree_path;
1308 1308
     $this->tree_path = $this->getCatalogTree($this);
1309
-    $itemsTable = \App::$cur->db->table_prefix . $itemModel::table();
1310
-    $itemTreeCol = $itemModel::colPrefix() . 'tree_path';
1309
+    $itemsTable = \App::$cur->db->table_prefix.$itemModel::table();
1310
+    $itemTreeCol = $itemModel::colPrefix().'tree_path';
1311 1311
 
1312
-    $categoryTreeCol = $this->colPrefix() . 'tree_path';
1313
-    $categoryTable = \App::$cur->db->table_prefix . $this->table();
1312
+    $categoryTreeCol = $this->colPrefix().'tree_path';
1313
+    $categoryTable = \App::$cur->db->table_prefix.$this->table();
1314 1314
     if ($oldPath) {
1315 1315
       \App::$cur->db->query('UPDATE
1316
-                ' . $categoryTable . ' 
1316
+                ' . $categoryTable.' 
1317 1317
                     SET 
1318
-                        ' . $categoryTreeCol . ' = REPLACE(' . $categoryTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") 
1319
-                    WHERE ' . $categoryTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"');
1318
+                        ' . $categoryTreeCol.' = REPLACE('.$categoryTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") 
1319
+                    WHERE ' . $categoryTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"');
1320 1320
 
1321 1321
       \App::$cur->db->query('UPDATE
1322
-                ' . $itemsTable . '
1322
+                ' . $itemsTable.'
1323 1323
                     SET 
1324
-                        ' . $itemTreeCol . ' = REPLACE(' . $itemTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") 
1325
-                    WHERE ' . $itemTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"');
1324
+                        ' . $itemTreeCol.' = REPLACE('.$itemTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") 
1325
+                    WHERE ' . $itemTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"');
1326 1326
     }
1327
-    $itemModel::update([$itemTreeCol => $this->tree_path . $this->id . '/'], [$itemModel::colPrefix() . $this->index(), $this->id]);
1327
+    $itemModel::update([$itemTreeCol => $this->tree_path.$this->id.'/'], [$itemModel::colPrefix().$this->index(), $this->id]);
1328 1328
   }
1329 1329
 
1330 1330
   /**
@@ -1338,9 +1338,9 @@  discard block
 block discarded – undo
1338 1338
     $catalogParent = $catalogClass::get($catalog->parent_id);
1339 1339
     if ($catalog && $catalogParent) {
1340 1340
       if ($catalogParent->tree_path) {
1341
-        return $catalogParent->tree_path . $catalogParent->id . '/';
1341
+        return $catalogParent->tree_path.$catalogParent->id.'/';
1342 1342
       } else {
1343
-        return $this->getCatalogTree($catalogParent) . $catalogParent->id . '/';
1343
+        return $this->getCatalogTree($catalogParent).$catalogParent->id.'/';
1344 1344
       }
1345 1345
     }
1346 1346
     return '/';
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
     $categoryModel = $class::$categoryModel;
1355 1355
     $category = $categoryModel::get($this->{$categoryModel::index()});
1356 1356
     if ($category) {
1357
-      $this->tree_path = $category->tree_path . $category->pk() . '/';
1357
+      $this->tree_path = $category->tree_path.$category->pk().'/';
1358 1358
     } else {
1359 1359
       $this->tree_path = '/';
1360 1360
     }
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
       $this->changeCategoryTree();
1380 1380
     }
1381 1381
     if (!empty($this->_changedParams) && $this->pk()) {
1382
-      Inji::$inst->event('modelItemParamsChanged-' . get_called_class(), $this);
1382
+      Inji::$inst->event('modelItemParamsChanged-'.get_called_class(), $this);
1383 1383
     }
1384 1384
     $this->beforeSave();
1385 1385
 
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
     }
1425 1425
     $this->_params = $result->fetch();
1426 1426
     if ($new) {
1427
-      Inji::$inst->event('modelCreatedItem-' . get_called_class(), $this);
1427
+      Inji::$inst->event('modelCreatedItem-'.get_called_class(), $this);
1428 1428
     }
1429 1429
     $this->afterSave();
1430 1430
     return $this->{$this->index()};
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
     static::fixPrefix($params);
1563 1563
     $className = get_called_class();
1564 1564
     foreach ($params as $paramName => $value) {
1565
-      $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $paramName);
1565
+      $shortName = preg_replace('!'.$this->colPrefix().'!', '', $paramName);
1566 1566
       if (!empty($className::$cols[$shortName])) {
1567 1567
         switch ($className::$cols[$shortName]['type']) {
1568 1568
           case 'decimal':
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
   public function __set($name, $value) {
1840 1840
     static::fixPrefix($name);
1841 1841
     $className = get_called_class();
1842
-    $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $name);
1842
+    $shortName = preg_replace('!'.$this->colPrefix().'!', '', $name);
1843 1843
     if (!empty($className::$cols[$shortName])) {
1844 1844
       switch ($className::$cols[$shortName]['type']) {
1845 1845
         case 'decimal':
Please login to merge, or discard this patch.