@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function uriParse($uri) { |
38 | 38 | $answerPos = strpos($uri, '?'); |
39 | - $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri) )), 1); |
|
39 | + $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri))), 1); |
|
40 | 40 | |
41 | 41 | foreach ($params as $key => $param) { |
42 | 42 | if ($param != '') { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $path = explode('/', $path); |
62 | 62 | $cur = ''; |
63 | 63 | foreach ($path as $item) { |
64 | - $cur .= $item . '/'; |
|
64 | + $cur .= $item.'/'; |
|
65 | 65 | if (!file_exists($cur)) { |
66 | 66 | mkdir($cur); |
67 | 67 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public static function resizeImage($img_path, $max_width = 1000, $max_height = 1000, $crop = false, $pos = 'center') { |
83 | 83 | ini_set("gd.jpeg_ignore_warning", 1); |
84 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($img_path); |
|
84 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($img_path); |
|
85 | 85 | switch ($img_type) { |
86 | 86 | case 1: |
87 | 87 | $img_type = 'gif'; |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | |
108 | 108 | if ($crop === true || $crop == 'q') { |
109 | 109 | if ($img_width > $img_height) { |
110 | - $imgX = floor(( $img_width - $img_height ) / 2); |
|
110 | + $imgX = floor(($img_width - $img_height) / 2); |
|
111 | 111 | $imgY = 0; |
112 | 112 | $img_width = $img_height; |
113 | 113 | $new_width = $max_width; |
114 | 114 | $new_height = $max_height; |
115 | 115 | } else { |
116 | 116 | $imgX = 0; |
117 | - $imgY = floor(( $img_height - $img_width ) / 2); |
|
117 | + $imgY = floor(($img_height - $img_width) / 2); |
|
118 | 118 | $img_height = $img_width; |
119 | 119 | $new_width = $max_width; |
120 | 120 | $new_height = $max_height; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $new_width = $max_width; |
136 | 136 | $new_height = $max_height; |
137 | 137 | //Находим начальные координаты (центрируем новое изображение) |
138 | - $imgX = (int) (($ow / 2) - ($img_width / 2) ); |
|
138 | + $imgX = (int) (($ow / 2) - ($img_width / 2)); |
|
139 | 139 | if ($pos == 'center') { |
140 | 140 | $imgY = (int) (($oh / 2) - ($img_height / 2)); |
141 | 141 | } else { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if (!headers_sent()) { |
209 | 209 | header("Location: {$href}"); |
210 | 210 | } else { |
211 | - echo '\'"><script>window.location="' . $href . '";</script>'; |
|
211 | + echo '\'"><script>window.location="'.$href.'";</script>'; |
|
212 | 212 | } |
213 | 213 | exit("Перенаправление на: <a href = '{$href}'>{$href}</a>"); |
214 | 214 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $pathArray = $cleanPathArray; |
267 | 267 | $cleanPathArray = []; |
268 | 268 | } while ($changes); |
269 | - return (strpos($path, '/') === 0 ? '/' : '') . implode('/', $pathArray); |
|
269 | + return (strpos($path, '/') === 0 ? '/' : '').implode('/', $pathArray); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | if (empty($month[$mm - 1])) { |
287 | 287 | return 'Не указано'; |
288 | 288 | } |
289 | - return ($dd > 0 ? $dd . " " : '') . $month[$mm - 1] . " " . $yy . " " . $hours; |
|
289 | + return ($dd > 0 ? $dd." " : '').$month[$mm - 1]." ".$yy." ".$hours; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | if (in_array($file, ['.', '..'])) { |
365 | 365 | continue; |
366 | 366 | } |
367 | - if (is_dir($from . '/' . $file)) { |
|
368 | - self::copyFiles($from . '/' . $file, $to . '/' . $file); |
|
367 | + if (is_dir($from.'/'.$file)) { |
|
368 | + self::copyFiles($from.'/'.$file, $to.'/'.$file); |
|
369 | 369 | } else { |
370 | - copy($from . '/' . $file, $to . '/' . $file); |
|
370 | + copy($from.'/'.$file, $to.'/'.$file); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | } |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | } |
47 | 47 | } |
48 | 48 | $fileObject->name = $fileinfo['filename']; |
49 | - $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
|
50 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
51 | - unlink($sitePath . $fileObject->path); |
|
49 | + $fileObject->path = $type->type_dir.date('Y-m-d').'/'.microtime(true).'.'.$fileinfo['extension']; |
|
50 | + if ($fileObject->id && file_exists($sitePath.$fileObject->path)) |
|
51 | + unlink($sitePath.$fileObject->path); |
|
52 | 52 | |
53 | - Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
|
53 | + Tools::createDir($sitePath.$type->type_dir.date('Y-m-d').'/'); |
|
54 | 54 | |
55 | - if (!move_uploaded_file($file['tmp_name'], $sitePath . $fileObject->path)) { |
|
55 | + if (!move_uploaded_file($file['tmp_name'], $sitePath.$fileObject->path)) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | |
59 | 59 | if ($type->allow_resize && $type->options && json_decode($type->options, true)) { |
60 | 60 | $typeOptions = json_decode($type->options, true); |
61 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($sitePath . $fileObject->path); |
|
61 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($sitePath.$fileObject->path); |
|
62 | 62 | if ($img_height > $typeOptions['max_height'] || $img_width > $typeOptions['max_width']) { |
63 | - Tools::resizeImage($sitePath . $fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
|
63 | + Tools::resizeImage($sitePath.$fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -104,25 +104,25 @@ discard block |
||
104 | 104 | } |
105 | 105 | } |
106 | 106 | $fileObject->name = $fileinfo['filename']; |
107 | - $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
|
108 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
109 | - unlink($sitePath . $fileObject->path); |
|
107 | + $fileObject->path = $type->type_dir.date('Y-m-d').'/'.microtime(true).'.'.$fileinfo['extension']; |
|
108 | + if ($fileObject->id && file_exists($sitePath.$fileObject->path)) |
|
109 | + unlink($sitePath.$fileObject->path); |
|
110 | 110 | |
111 | - Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
|
111 | + Tools::createDir($sitePath.$type->type_dir.date('Y-m-d').'/'); |
|
112 | 112 | |
113 | 113 | $file = @file_get_contents($url); |
114 | 114 | if ($file === false) { |
115 | 115 | return 0; |
116 | 116 | } |
117 | - if (!file_put_contents($sitePath . $fileObject->path, $file)) { |
|
117 | + if (!file_put_contents($sitePath.$fileObject->path, $file)) { |
|
118 | 118 | return 0; |
119 | 119 | } |
120 | 120 | |
121 | 121 | if ($type->allow_resize && $type->options && json_decode($type->options, true)) { |
122 | 122 | $typeOptions = json_decode($type->options, true); |
123 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($sitePath . $fileObject->path); |
|
123 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($sitePath.$fileObject->path); |
|
124 | 124 | if ($img_height > $typeOptions['max_height'] || $img_width > $typeOptions['max_width']) { |
125 | - Tools::resizeImage($sitePath . $fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
|
125 | + Tools::resizeImage($sitePath.$fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (!$dataManager->checkAccess()) { |
3 | - echo 'you not have access to "' . $dataManager->modelName . '" manager with name: "' . $dataManager->managerName . '"'; |
|
3 | + echo 'you not have access to "'.$dataManager->modelName.'" manager with name: "'.$dataManager->managerName.'"'; |
|
4 | 4 | return false; |
5 | 5 | } |
6 | 6 | ?> |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | continue; |
47 | 47 | } |
48 | - if(++$i && !($i%2)){ |
|
48 | + if (++$i && !($i % 2)) { |
|
49 | 49 | echo '</div><div class="row">'; |
50 | 50 | } |
51 | 51 | echo '<div class="col-md-6">'; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $options = [ |
74 | 74 | 'where' => !empty($filters['getRows']['where']) ? $filters['getRows']['where'] : '' |
75 | 75 | ]; |
76 | - if (isset($cols[$relations[$colInfo['colParams']['relation']]['model']::colPrefix() . 'name'])) { |
|
76 | + if (isset($cols[$relations[$colInfo['colParams']['relation']]['model']::colPrefix().'name'])) { |
|
77 | 77 | $options['order'] = 'name'; |
78 | 78 | } |
79 | 79 | $items = $relations[$colInfo['colParams']['relation']]['model']::getList($options); |
@@ -57,7 +57,7 @@ discard block |
||
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 |
||
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 |
||
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'; |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | } |
122 | 122 | if (!empty($modelName::$forms[$formParams['formName']])) { |
123 | 123 | $buttons[] = [ |
124 | - 'text' => 'Создать ' . $name, |
|
125 | - 'onclick' => 'inji.Ui.dataManagers.get(this).newItem("' . str_replace('\\', '\\\\', $modelName) . '",' . json_encode($formParams) . ');', |
|
124 | + 'text' => 'Создать '.$name, |
|
125 | + 'onclick' => 'inji.Ui.dataManagers.get(this).newItem("'.str_replace('\\', '\\\\', $modelName).'",'.json_encode($formParams).');', |
|
126 | 126 | ]; |
127 | 127 | } |
128 | 128 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | 'className' => $action |
153 | 153 | ]; |
154 | 154 | } |
155 | - $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']; |
|
155 | + $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']; |
|
156 | 156 | if (!class_exists($return[$key]['className']) || ($onlyGroupActions && !$return[$key]['className']::$groupAction)) { |
157 | 157 | unset($return[$key]); |
158 | 158 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | <?php |
184 | 184 | foreach ($actions as $action => $actionParams) { |
185 | 185 | if (class_exists($actionParams['className']) && $actionParams['className']::$groupAction) { |
186 | - echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
186 | + echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"".str_replace('\\', '\\\\', $action)."\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | ?> |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | return []; |
234 | 234 | } |
235 | 235 | if (!$this->checkAccess()) { |
236 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
236 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
237 | 237 | return []; |
238 | 238 | } |
239 | 239 | $modelName = $this->modelName; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $queryParams['start'] = $this->page * $this->limit - $this->limit; |
250 | 250 | } |
251 | 251 | if (!empty($params['categoryPath']) && $modelName::$categoryModel) { |
252 | - $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE']; |
|
252 | + $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE']; |
|
253 | 253 | } |
254 | 254 | if (!empty($params['appType'])) { |
255 | 255 | $queryParams['appType'] = $params['appType']; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | if (!empty($params['filters'][$col]['max'])) { |
309 | 309 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
310 | 310 | |
311 | - $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
|
311 | + $date = $params['filters'][$col]['max'].' 23:59:59'; |
|
312 | 312 | } else { |
313 | 313 | $date = $params['filters'][$col]['max']; |
314 | 314 | } |
@@ -335,16 +335,16 @@ discard block |
||
335 | 335 | } |
336 | 336 | switch ($params['filters'][$col]['compareType']) { |
337 | 337 | case 'contains': |
338 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
338 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE']; |
|
339 | 339 | break; |
340 | 340 | case 'equals': |
341 | 341 | $queryParams['where'][] = [$col, $params['filters'][$col]['value']]; |
342 | 342 | break; |
343 | 343 | case 'starts_with': |
344 | - $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
344 | + $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE']; |
|
345 | 345 | break; |
346 | 346 | case 'ends_with': |
347 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE']; |
|
347 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE']; |
|
348 | 348 | break; |
349 | 349 | } |
350 | 350 | break; |
@@ -383,7 +383,7 @@ discard block |
||
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() . '>'; |
|
386 | + $row[] = '<input type ="checkbox" name = "pk[]" value ='.$item->pk().'>'; |
|
387 | 387 | $row[] = $item->pk(); |
388 | 388 | foreach ($this->managerOptions['cols'] as $key => $colName) { |
389 | 389 | if (!empty($params['download'])) { |
@@ -428,16 +428,16 @@ discard block |
||
428 | 428 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
429 | 429 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
430 | 430 | $count = $count ? $count : 'Нет'; |
431 | - 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>"; |
|
431 | + 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 | 432 | case 'many': |
433 | 433 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
434 | 434 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
435 | 435 | $count = $count ? $count : 'Нет'; |
436 | - 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>"; |
|
436 | + 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 | 437 | default : |
438 | 438 | if ($item->{$modelName::$cols[$colName]['relation']}) { |
439 | 439 | if (\App::$cur->name == 'admin') { |
440 | - $href = "<a href ='/admin/" . str_replace('\\', '/view/', $relations[$modelName::$cols[$colName]['relation']]['model']) . "/" . $item->{$modelName::$cols[$colName]['relation']}->pk() . "'>"; |
|
440 | + $href = "<a href ='/admin/".str_replace('\\', '/view/', $relations[$modelName::$cols[$colName]['relation']]['model'])."/".$item->{$modelName::$cols[$colName]['relation']}->pk()."'>"; |
|
441 | 441 | if (!empty($modelName::$cols[$colName]['showCol'])) { |
442 | 442 | $href .= $item->{$modelName::$cols[$colName]['relation']}->{$modelName::$cols[$colName]['showCol']}; |
443 | 443 | } else { |
@@ -467,18 +467,18 @@ discard block |
||
467 | 467 | case 'many': |
468 | 468 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
469 | 469 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
470 | - 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>"; |
|
470 | + 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 | 471 | default: |
472 | 472 | return $item->$colName; |
473 | 473 | } |
474 | 474 | } elseif (!empty($modelName::$cols[$colName]['type'])) { |
475 | - if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
475 | + if (\App::$cur->name == 'admin' && $originalCol == 'name' || ($dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
476 | 476 | $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager'; |
477 | - $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
|
478 | - return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($originalItem)) . "/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
477 | + $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem)); |
|
478 | + return "<a href ='/admin/".str_replace('\\', '/view/', get_class($originalItem))."/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
479 | 479 | } elseif (\App::$cur->name == 'admin' && $colName == 'name') { |
480 | - $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
|
481 | - return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($item)) . "/{$item->id}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
480 | + $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem)); |
|
481 | + return "<a href ='/admin/".str_replace('\\', '/view/', get_class($item))."/{$item->id}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
482 | 482 | } else { |
483 | 483 | return \Model::resloveTypeValue($item, $colName); |
484 | 484 | } |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | return []; |
512 | 512 | } |
513 | 513 | if (!$this->checkAccess()) { |
514 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
514 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
515 | 515 | return []; |
516 | 516 | } |
517 | 517 | if (!empty($params['limit'])) { |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | ]; |
526 | 526 | $modelName = $this->modelName; |
527 | 527 | if (!empty($params['categoryPath']) && $modelName::$categoryModel) { |
528 | - $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE']; |
|
528 | + $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE']; |
|
529 | 529 | } |
530 | 530 | if (!empty($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'])) { |
531 | 531 | foreach ($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'] as $colName => $colOptions) { |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | if (!empty($params['filters'][$col]['max'])) { |
580 | 580 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
581 | 581 | |
582 | - $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
|
582 | + $date = $params['filters'][$col]['max'].' 23:59:59'; |
|
583 | 583 | } else { |
584 | 584 | $date = $params['filters'][$col]['max']; |
585 | 585 | } |
@@ -606,16 +606,16 @@ discard block |
||
606 | 606 | } |
607 | 607 | switch ($params['filters'][$col]['compareType']) { |
608 | 608 | case 'contains': |
609 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
609 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE']; |
|
610 | 610 | break; |
611 | 611 | case 'equals': |
612 | 612 | $queryParams['where'][] = [$col, $params['filters'][$col]['value']]; |
613 | 613 | break; |
614 | 614 | case 'starts_with': |
615 | - $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
615 | + $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE']; |
|
616 | 616 | break; |
617 | 617 | case 'ends_with': |
618 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE']; |
|
618 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE']; |
|
619 | 619 | break; |
620 | 620 | } |
621 | 621 | break; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | $tableCols[] = !empty($colOptions['label']) ? $colOptions['label'] : $colName; |
649 | 649 | } |
650 | 650 | $tableCols[] = ''; |
651 | - $this->table->class .=' datamanagertable'; |
|
651 | + $this->table->class .= ' datamanagertable'; |
|
652 | 652 | $this->table->setCols($tableCols); |
653 | 653 | } |
654 | 654 | |
@@ -669,12 +669,12 @@ discard block |
||
669 | 669 | return false; |
670 | 670 | } |
671 | 671 | if (!$this->checkAccess()) { |
672 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
672 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
673 | 673 | return []; |
674 | 674 | } |
675 | 675 | $tree = new Tree(); |
676 | 676 | $tree->ul($this->managerOptions['categorys']['model'], 0, function($category) { |
677 | - $path = $category->tree_path . ($category->pk() ? $category->pk() . "/" : ''); |
|
677 | + $path = $category->tree_path.($category->pk() ? $category->pk()."/" : ''); |
|
678 | 678 | $cleanClassName = str_replace('\\', '\\\\', get_class($category)); |
679 | 679 | 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> |
680 | 680 |
@@ -134,14 +134,14 @@ |
||
134 | 134 | $categorys = Category::getList(['where' => ['id', implode(',', $treePath), 'IN']]); |
135 | 135 | foreach ($categorys as $category) { |
136 | 136 | if ($category->alias) { |
137 | - $href .="/{$category->alias}"; |
|
137 | + $href .= "/{$category->alias}"; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |
141 | 141 | if ((!$href || $href == '/materials') && !$this->alias) { |
142 | - return ($href ? $href : '/materials') . '/view/' . $this->pk(); |
|
142 | + return ($href ? $href : '/materials').'/view/'.$this->pk(); |
|
143 | 143 | } |
144 | - return $href . "/" . ($this->alias ? $this->alias : $this->pk()); |
|
144 | + return $href."/".($this->alias ? $this->alias : $this->pk()); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | public function resolveTemplate() { |
@@ -207,7 +207,7 @@ discard block |
||
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 |
||
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 | } |
@@ -286,12 +286,12 @@ discard block |
||
286 | 286 | return; |
287 | 287 | } |
288 | 288 | if (!is_array($array)) { |
289 | - if (!isset($cols[static::colPrefix() . $array]) && isset(static::$cols[$array])) { |
|
289 | + if (!isset($cols[static::colPrefix().$array]) && isset(static::$cols[$array])) { |
|
290 | 290 | static::createCol($array); |
291 | 291 | $cols = static::cols(true); |
292 | 292 | } |
293 | - if (!isset($cols[$array]) && isset($cols[static::colPrefix() . $array])) { |
|
294 | - $array = static::colPrefix() . $array; |
|
293 | + if (!isset($cols[$array]) && isset($cols[static::colPrefix().$array])) { |
|
294 | + $array = static::colPrefix().$array; |
|
295 | 295 | } else { |
296 | 296 | static::checkForJoin($array, $rootModel); |
297 | 297 | } |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | switch ($searchtype) { |
301 | 301 | case 'key': |
302 | 302 | foreach ($array as $key => $item) { |
303 | - if (!isset($cols[static::colPrefix() . $key]) && isset(static::$cols[$key])) { |
|
303 | + if (!isset($cols[static::colPrefix().$key]) && isset(static::$cols[$key])) { |
|
304 | 304 | static::createCol($key); |
305 | 305 | $cols = static::cols(true); |
306 | 306 | } |
307 | - if (!isset($cols[$key]) && isset($cols[static::colPrefix() . $key])) { |
|
308 | - $array[static::colPrefix() . $key] = $item; |
|
307 | + if (!isset($cols[$key]) && isset($cols[static::colPrefix().$key])) { |
|
308 | + $array[static::colPrefix().$key] = $item; |
|
309 | 309 | unset($array[$key]); |
310 | - $key = static::colPrefix() . $key; |
|
310 | + $key = static::colPrefix().$key; |
|
311 | 311 | } |
312 | 312 | if (is_array($array[$key])) { |
313 | 313 | static::fixPrefix($array[$key], 'key', $rootModel); |
@@ -318,12 +318,12 @@ discard block |
||
318 | 318 | break; |
319 | 319 | case 'first': |
320 | 320 | if (isset($array[0]) && is_string($array[0])) { |
321 | - if (!isset($cols[static::colPrefix() . $array[0]]) && isset(static::$cols[$array[0]])) { |
|
321 | + if (!isset($cols[static::colPrefix().$array[0]]) && isset(static::$cols[$array[0]])) { |
|
322 | 322 | static::createCol($array[0]); |
323 | 323 | $cols = static::cols(true); |
324 | 324 | } |
325 | - if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix() . $array[0]])) { |
|
326 | - $array[0] = static::colPrefix() . $array[0]; |
|
325 | + if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix().$array[0]])) { |
|
326 | + $array[0] = static::colPrefix().$array[0]; |
|
327 | 327 | } else { |
328 | 328 | static::checkForJoin($array[0], $rootModel); |
329 | 329 | } |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | case 'to': |
356 | 356 | $relCol = $relations[$rel]['col']; |
357 | 357 | static::fixPrefix($relCol); |
358 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
358 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
359 | 359 | break; |
360 | 360 | case 'one': |
361 | 361 | case 'many': |
362 | 362 | $relCol = $relations[$rel]['col']; |
363 | 363 | $relations[$rel]['model']::fixPrefix($relCol); |
364 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
364 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
365 | 365 | break; |
366 | 366 | } |
367 | 367 | $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel); |
@@ -400,13 +400,13 @@ discard block |
||
400 | 400 | $relCol = $relations[$rel]['col']; |
401 | 401 | static::fixPrefix($relCol); |
402 | 402 | //$info['modelName'] = $relations[$rel]['model']; |
403 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
403 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
404 | 404 | break; |
405 | 405 | case 'one': |
406 | 406 | $relCol = $relations[$rel]['col']; |
407 | 407 | $relations[$rel]['model']::fixPrefix($relCol); |
408 | 408 | //$info['modelName'] = $relations[$rel]['model']; |
409 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
409 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
410 | 410 | break; |
411 | 411 | } |
412 | 412 | $info = $relations[$rel]['model']::parseColRecursion($info); |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | } else { |
425 | 425 | $info['colParams'] = []; |
426 | 426 | } |
427 | - if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix() . $info['col']])) { |
|
428 | - $info['col'] = static::colPrefix() . $info['col']; |
|
427 | + if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix().$info['col']])) { |
|
428 | + $info['col'] = static::colPrefix().$info['col']; |
|
429 | 429 | } |
430 | 430 | $info['modelName'] = get_called_class(); |
431 | 431 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | if ($params === false) { |
529 | 529 | return false; |
530 | 530 | } |
531 | - return App::$cur->db->addCol(static::table(), static::colPrefix() . $colName, $params); |
|
531 | + return App::$cur->db->addCol(static::table(), static::colPrefix().$colName, $params); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | public static function createTable() { |
@@ -557,28 +557,28 @@ discard block |
||
557 | 557 | return true; |
558 | 558 | } |
559 | 559 | $cols = [ |
560 | - $colPrefix . 'id' => 'pk' |
|
560 | + $colPrefix.'id' => 'pk' |
|
561 | 561 | ]; |
562 | 562 | $className = get_called_class(); |
563 | 563 | if (!empty($className::$cols)) { |
564 | 564 | foreach ($className::$cols as $colName => $colParams) { |
565 | 565 | if ($colName == 'date_create') { |
566 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
566 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
567 | 567 | continue; |
568 | 568 | } |
569 | 569 | $params = $className::genColParams($colName); |
570 | 570 | if ($params) { |
571 | - $cols[$colPrefix . $colName] = $params; |
|
571 | + $cols[$colPrefix.$colName] = $params; |
|
572 | 572 | } |
573 | 573 | } |
574 | 574 | } |
575 | - if (empty($cols[$colPrefix . 'date_create'])) { |
|
576 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
575 | + if (empty($cols[$colPrefix.'date_create'])) { |
|
576 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
577 | 577 | } |
578 | 578 | $tableIndexes = []; |
579 | 579 | if ($indexes) { |
580 | 580 | foreach ($indexes as $indexName => $index) { |
581 | - $tableIndexes[] = $index['type'] . ' ' . App::$cur->db->table_prefix . $indexName . ' (' . implode(',', $index['cols']) . ')'; |
|
581 | + $tableIndexes[] = $index['type'].' '.App::$cur->db->table_prefix.$indexName.' ('.implode(',', $index['cols']).')'; |
|
582 | 582 | } |
583 | 583 | } |
584 | 584 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | */ |
603 | 603 | public static function index() { |
604 | 604 | |
605 | - return static::colPrefix() . 'id'; |
|
605 | + return static::colPrefix().'id'; |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | /** |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public static function colPrefix() { |
614 | 614 | $classPath = explode('\\', get_called_class()); |
615 | 615 | $classPath = array_slice($classPath, 1); |
616 | - return strtolower(implode('_', $classPath)) . '_'; |
|
616 | + return strtolower(implode('_', $classPath)).'_'; |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | /** |
@@ -674,12 +674,12 @@ discard block |
||
674 | 674 | case 'to': |
675 | 675 | $relCol = $relations[$rel]['col']; |
676 | 676 | static::fixPrefix($relCol); |
677 | - App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
677 | + App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
678 | 678 | break; |
679 | 679 | case 'one': |
680 | 680 | $col = $relations[$rel]['col']; |
681 | 681 | $relations[$rel]['model']::fixPrefix($col); |
682 | - App::$cur->db->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
682 | + App::$cur->db->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
683 | 683 | break; |
684 | 684 | } |
685 | 685 | } |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | } |
695 | 695 | if ($param !== null) { |
696 | 696 | $cols = static::cols(); |
697 | - if (!isset($cols[$col]) && isset($cols[static::colPrefix() . $col])) { |
|
698 | - $col = static::colPrefix() . $col; |
|
697 | + if (!isset($cols[$col]) && isset($cols[static::colPrefix().$col])) { |
|
698 | + $col = static::colPrefix().$col; |
|
699 | 699 | } |
700 | 700 | App::$cur->db->where($col, $param); |
701 | 701 | } else { |
@@ -759,12 +759,12 @@ discard block |
||
759 | 759 | case 'to': |
760 | 760 | $relCol = $relations[$rel]['col']; |
761 | 761 | static::fixPrefix($relCol); |
762 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
762 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
763 | 763 | break; |
764 | 764 | case 'one': |
765 | 765 | $col = $relations[$rel]['col']; |
766 | 766 | $relations[$rel]['model']::fixPrefix($col); |
767 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
767 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
768 | 768 | break; |
769 | 769 | } |
770 | 770 | } |
@@ -1078,12 +1078,12 @@ discard block |
||
1078 | 1078 | case 'to': |
1079 | 1079 | $relCol = $relations[$rel]['col']; |
1080 | 1080 | static::fixPrefix($relCol); |
1081 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
1081 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
1082 | 1082 | break; |
1083 | 1083 | case 'one': |
1084 | 1084 | $col = $relations[$rel]['col']; |
1085 | 1085 | $relations[$rel]['model']::fixPrefix($col); |
1086 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
1086 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
1087 | 1087 | break; |
1088 | 1088 | } |
1089 | 1089 | } |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | } else { |
1101 | 1101 | $cols .= '*'; |
1102 | 1102 | } |
1103 | - $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : ''); |
|
1103 | + $cols .= ') as `count`'.(!empty($options['cols']) ? ','.$options['cols'] : ''); |
|
1104 | 1104 | $query->cols = $cols; |
1105 | 1105 | if (!empty($options['group'])) { |
1106 | 1106 | $query->group($options['group']); |
@@ -1233,25 +1233,25 @@ discard block |
||
1233 | 1233 | $itemModel = $class::$treeCategory; |
1234 | 1234 | $oldPath = $this->tree_path; |
1235 | 1235 | $this->tree_path = $this->getCatalogTree($this); |
1236 | - $itemsTable = \App::$cur->db->table_prefix . $itemModel::table(); |
|
1237 | - $itemTreeCol = $itemModel::colPrefix() . 'tree_path'; |
|
1236 | + $itemsTable = \App::$cur->db->table_prefix.$itemModel::table(); |
|
1237 | + $itemTreeCol = $itemModel::colPrefix().'tree_path'; |
|
1238 | 1238 | |
1239 | - $categoryTreeCol = $this->colPrefix() . 'tree_path'; |
|
1240 | - $categoryTable = \App::$cur->db->table_prefix . $this->table(); |
|
1239 | + $categoryTreeCol = $this->colPrefix().'tree_path'; |
|
1240 | + $categoryTable = \App::$cur->db->table_prefix.$this->table(); |
|
1241 | 1241 | if ($oldPath) { |
1242 | 1242 | \App::$cur->db->query('UPDATE |
1243 | - ' . $categoryTable . ' |
|
1243 | + ' . $categoryTable.' |
|
1244 | 1244 | SET |
1245 | - ' . $categoryTreeCol . ' = REPLACE(' . $categoryTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
1246 | - WHERE ' . $categoryTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
1245 | + ' . $categoryTreeCol.' = REPLACE('.$categoryTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
1246 | + WHERE ' . $categoryTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
1247 | 1247 | |
1248 | 1248 | \App::$cur->db->query('UPDATE |
1249 | - ' . $itemsTable . ' |
|
1249 | + ' . $itemsTable.' |
|
1250 | 1250 | SET |
1251 | - ' . $itemTreeCol . ' = REPLACE(' . $itemTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
1252 | - WHERE ' . $itemTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
1251 | + ' . $itemTreeCol.' = REPLACE('.$itemTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
1252 | + WHERE ' . $itemTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
1253 | 1253 | } |
1254 | - $itemModel::update([$itemTreeCol => $this->tree_path . $this->id . '/'], [$itemModel::colPrefix() . $this->index(), $this->id]); |
|
1254 | + $itemModel::update([$itemTreeCol => $this->tree_path.$this->id.'/'], [$itemModel::colPrefix().$this->index(), $this->id]); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | /** |
@@ -1265,9 +1265,9 @@ discard block |
||
1265 | 1265 | $catalogParent = $catalogClass::get($catalog->parent_id); |
1266 | 1266 | if ($catalog && $catalogParent) { |
1267 | 1267 | if ($catalogParent->tree_path) { |
1268 | - return $catalogParent->tree_path . $catalogParent->id . '/'; |
|
1268 | + return $catalogParent->tree_path.$catalogParent->id.'/'; |
|
1269 | 1269 | } else { |
1270 | - return $this->getCatalogTree($catalogParent) . $catalogParent->id . '/'; |
|
1270 | + return $this->getCatalogTree($catalogParent).$catalogParent->id.'/'; |
|
1271 | 1271 | } |
1272 | 1272 | } |
1273 | 1273 | return '/'; |
@@ -1281,7 +1281,7 @@ discard block |
||
1281 | 1281 | $categoryModel = $class::$categoryModel; |
1282 | 1282 | $category = $categoryModel::get($this->{$categoryModel::index()}); |
1283 | 1283 | if ($category) { |
1284 | - $this->tree_path = $category->tree_path . $category->pk() . '/'; |
|
1284 | + $this->tree_path = $category->tree_path.$category->pk().'/'; |
|
1285 | 1285 | } else { |
1286 | 1286 | $this->tree_path = '/'; |
1287 | 1287 | } |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | $this->changeCategoryTree(); |
1307 | 1307 | } |
1308 | 1308 | if (!empty($this->_changedParams) && $this->pk()) { |
1309 | - Inji::$inst->event('modelItemParamsChanged-' . get_called_class(), $this); |
|
1309 | + Inji::$inst->event('modelItemParamsChanged-'.get_called_class(), $this); |
|
1310 | 1310 | } |
1311 | 1311 | $this->beforeSave(); |
1312 | 1312 | |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | } |
1352 | 1352 | $this->_params = $result->fetch(); |
1353 | 1353 | if ($new) { |
1354 | - Inji::$inst->event('modelCreatedItem-' . get_called_class(), $this); |
|
1354 | + Inji::$inst->event('modelCreatedItem-'.get_called_class(), $this); |
|
1355 | 1355 | } |
1356 | 1356 | $this->afterSave(); |
1357 | 1357 | return $this->{$this->index()}; |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | static::fixPrefix($params); |
1490 | 1490 | $className = get_called_class(); |
1491 | 1491 | foreach ($params as $paramName => $value) { |
1492 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $paramName); |
|
1492 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $paramName); |
|
1493 | 1493 | if (!empty($className::$cols[$shortName])) { |
1494 | 1494 | switch ($className::$cols[$shortName]['type']) { |
1495 | 1495 | case 'decimal': |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | public function __set($name, $value) { |
1758 | 1758 | static::fixPrefix($name); |
1759 | 1759 | $className = get_called_class(); |
1760 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $name); |
|
1760 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $name); |
|
1761 | 1761 | if (!empty($className::$cols[$shortName])) { |
1762 | 1762 | switch ($className::$cols[$shortName]['type']) { |
1763 | 1763 | case 'decimal': |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | $newValue = ''; |
187 | 187 | foreach ($value as $item) { |
188 | 188 | if ($newValue) { |
189 | - $newValue.=','; |
|
189 | + $newValue .= ','; |
|
190 | 190 | } |
191 | 191 | if (is_string($item)) { |
192 | - $newValue .='"' . $item . '"'; |
|
192 | + $newValue .= '"'.$item.'"'; |
|
193 | 193 | } else { |
194 | - $newValue .=$item; |
|
194 | + $newValue .= $item; |
|
195 | 195 | } |
196 | 196 | } |
197 | - $value = '(' . $newValue . ')'; |
|
197 | + $value = '('.$newValue.')'; |
|
198 | 198 | } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) { |
199 | 199 | $value = "({$value})"; |
200 | 200 | } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) { |
@@ -270,15 +270,15 @@ discard block |
||
270 | 270 | $newValue = ''; |
271 | 271 | foreach ($value as $item) { |
272 | 272 | if ($newValue) { |
273 | - $newValue.=','; |
|
273 | + $newValue .= ','; |
|
274 | 274 | } |
275 | 275 | if (is_string($item)) { |
276 | - $newValue .='"' . $item . '"'; |
|
276 | + $newValue .= '"'.$item.'"'; |
|
277 | 277 | } else { |
278 | - $newValue .=$item; |
|
278 | + $newValue .= $item; |
|
279 | 279 | } |
280 | 280 | } |
281 | - $value = '(' . $newValue . ')'; |
|
281 | + $value = '('.$newValue.')'; |
|
282 | 282 | } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) { |
283 | 283 | $value = "({$value})"; |
284 | 284 | } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) { |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | |
335 | 335 | switch ($this->operation) { |
336 | 336 | case 'SELECT': |
337 | - $query .= ' ' . ($this->distinct ? 'DISTINCT' : ''); |
|
338 | - $query .= ' ' . (!$this->cols ? '*' : ((is_array($this->cols) ? implode(',', $this->cols) : $this->cols))); |
|
337 | + $query .= ' '.($this->distinct ? 'DISTINCT' : ''); |
|
338 | + $query .= ' '.(!$this->cols ? '*' : ((is_array($this->cols) ? implode(',', $this->cols) : $this->cols))); |
|
339 | 339 | case 'DELETE': |
340 | 340 | $query .= ' FROM'; |
341 | 341 | break; |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | $this->params = array_merge($this->params, array_values($this->cols)); |
353 | 353 | $colsStr = ''; |
354 | 354 | if ($this->cols) { |
355 | - $colsStr = '`' . implode('`,`', array_keys($this->cols)) . '`'; |
|
355 | + $colsStr = '`'.implode('`,`', array_keys($this->cols)).'`'; |
|
356 | 356 | } |
357 | - $query .= ' (' . $colsStr . ') VALUES (' . rtrim(str_repeat('?,', count($this->cols)), ',') . ')'; |
|
357 | + $query .= ' ('.$colsStr.') VALUES ('.rtrim(str_repeat('?,', count($this->cols)), ',').')'; |
|
358 | 358 | break; |
359 | 359 | case 'CREATE TABLE': |
360 | 360 | $query .= " ("; |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | $query = rtrim($query, ','); |
368 | 368 | if ($this->indexes) { |
369 | - $query .= ', ' . implode(',', $this->indexes); |
|
369 | + $query .= ', '.implode(',', $this->indexes); |
|
370 | 370 | } |
371 | 371 | $query .= ") ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci"; |
372 | 372 | break; |
@@ -381,27 +381,27 @@ discard block |
||
381 | 381 | } |
382 | 382 | } |
383 | 383 | $update = implode(',', $updates); |
384 | - $query .=" SET {$update}"; |
|
384 | + $query .= " SET {$update}"; |
|
385 | 385 | case 'SELECT': |
386 | 386 | case 'DELETE': |
387 | 387 | $this->buildWhere($this->where); |
388 | 388 | if ($this->whereString) { |
389 | - $query .= ' ' . $this->whereString; |
|
389 | + $query .= ' '.$this->whereString; |
|
390 | 390 | } |
391 | 391 | break; |
392 | 392 | } |
393 | 393 | if ($this->group) { |
394 | - $query .= ' GROUP BY ' . implode(',', $this->group); |
|
394 | + $query .= ' GROUP BY '.implode(',', $this->group); |
|
395 | 395 | } |
396 | 396 | $this->buildHaving($this->having); |
397 | 397 | if ($this->havingString) { |
398 | - $query .= ' ' . $this->havingString; |
|
398 | + $query .= ' '.$this->havingString; |
|
399 | 399 | } |
400 | 400 | if ($this->order) { |
401 | - $query .= ' ORDER BY ' . implode(',', $this->order); |
|
401 | + $query .= ' ORDER BY '.implode(',', $this->order); |
|
402 | 402 | } |
403 | 403 | if ($this->limit) { |
404 | - $query .= ' ' . $this->limit; |
|
404 | + $query .= ' '.$this->limit; |
|
405 | 405 | } |
406 | 406 | return ['query' => $query, 'params' => $this->params]; |
407 | 407 | } |
@@ -4,7 +4,7 @@ |
||
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'; |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | echo $col['col']['label']; |
25 | 25 | if (!empty($col['col']['model'])) { |
26 | 26 | $modelName = $col['col']['model']; |
27 | - $onclick = 'inji.Ui.forms.popUp(\'' . addslashes($modelName) . '\',{},function(elem){' |
|
27 | + $onclick = 'inji.Ui.forms.popUp(\''.addslashes($modelName).'\',{},function(elem){' |
|
28 | 28 | . 'return function(data,modal){inji.Ui.forms.submitAjax($(elem).closest(\'form\')[0], {notSave: true});}}(this));return false;'; |
29 | - echo ' (<a href="" onclick="' . $onclick . ';this.disabled=true;return false;">Создать</a>)'; |
|
29 | + echo ' (<a href="" onclick="'.$onclick.';this.disabled=true;return false;">Создать</a>)'; |
|
30 | 30 | } |
31 | 31 | echo "</th>"; |
32 | 32 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $input->options['noContainer'] = true; |
49 | 49 | $input->colParams['label'] = false; |
50 | 50 | $input->colParams['value'] = $row[$colName]; |
51 | - $input->colName .= '[' . $colName . '][' . ($i) . ']'; |
|
51 | + $input->colName .= '['.$colName.']['.($i).']'; |
|
52 | 52 | $input->draw(); |
53 | 53 | if (empty($col['hidden'])) { |
54 | 54 | echo '</td>'; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | $col['input']->options['noContainer'] = true; |
89 | 89 | $col['input']->colParams['label'] = false; |
90 | - $col['input']->colName.="[{$colName}][]"; |
|
90 | + $col['input']->colName .= "[{$colName}][]"; |
|
91 | 91 | $col['input']->draw(); |
92 | 92 | if (empty($col['hidden'])) { |
93 | 93 | echo '</td>'; |