@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return function ($step = NULL, $params = []) { |
|
| 3 | +return function($step = NULL, $params = []) { |
|
| 4 | 4 | |
| 5 | 5 | $groups = [ |
| 6 | 6 | [ |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | /** |
| 358 | 358 | * Information extractor for col relations path |
| 359 | 359 | * |
| 360 | - * @param string|array $info |
|
| 360 | + * @param string $info |
|
| 361 | 361 | * @return array |
| 362 | 362 | */ |
| 363 | 363 | public static function parseColRecursion($info) |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | * Generate params string for col by name |
| 434 | 434 | * |
| 435 | 435 | * @param string $colName |
| 436 | - * @return boolean|string |
|
| 436 | + * @return false|string |
|
| 437 | 437 | */ |
| 438 | 438 | public static function genColParams($colName) |
| 439 | 439 | { |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | /** |
| 574 | 574 | * return relations list |
| 575 | 575 | * |
| 576 | - * @return array |
|
| 576 | + * @return string |
|
| 577 | 577 | */ |
| 578 | 578 | public static function relations() |
| 579 | 579 | { |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | * |
| 1066 | 1066 | * @param array $params |
| 1067 | 1067 | * @param array $where |
| 1068 | - * @return boolean |
|
| 1068 | + * @return false|null |
|
| 1069 | 1069 | */ |
| 1070 | 1070 | public static function update($params, $where = []) |
| 1071 | 1071 | { |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $relModel = $relations[$colInfo['colParams']['relation']]['model']; |
| 212 | 212 | $relModel = strpos($relModel, '\\') === 0 ? substr($relModel, 1) : $relModel; |
| 213 | 213 | if ($manageHref) { |
| 214 | - $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relModel) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано'; |
|
| 214 | + $value = $relValue ? "<a href='/admin/".str_replace('\\', '/view/', $relModel)."/".$relValue->pk()."'>".$relValue->name()."</a>" : 'Не задано'; |
|
| 215 | 215 | } else { |
| 216 | 216 | $value = $relValue ? $relValue->name() : 'Не задано'; |
| 217 | 217 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | case 'image': |
| 222 | 222 | $file = Files\File::get($item->$colName); |
| 223 | 223 | if ($file) { |
| 224 | - $value = '<img src="' . $file->path . '?resize=60x120" />'; |
|
| 224 | + $value = '<img src="'.$file->path.'?resize=60x120" />'; |
|
| 225 | 225 | } else { |
| 226 | 226 | $value = '<img src="/static/system/images/no-image.png?resize=60x120" />'; |
| 227 | 227 | } |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | return; |
| 260 | 260 | } |
| 261 | 261 | if (!is_array($array)) { |
| 262 | - if (!isset($cols[static::colPrefix() . $array]) && isset(static::$cols[$array])) { |
|
| 262 | + if (!isset($cols[static::colPrefix().$array]) && isset(static::$cols[$array])) { |
|
| 263 | 263 | static::createCol($array); |
| 264 | 264 | $cols = static::cols(true); |
| 265 | 265 | } |
| 266 | - if (!isset($cols[$array]) && isset($cols[static::colPrefix() . $array])) { |
|
| 267 | - $array = static::colPrefix() . $array; |
|
| 266 | + if (!isset($cols[$array]) && isset($cols[static::colPrefix().$array])) { |
|
| 267 | + $array = static::colPrefix().$array; |
|
| 268 | 268 | } else { |
| 269 | 269 | static::checkForJoin($array, $rootModel); |
| 270 | 270 | } |
@@ -273,14 +273,14 @@ discard block |
||
| 273 | 273 | switch ($searchtype) { |
| 274 | 274 | case 'key': |
| 275 | 275 | foreach ($array as $key => $item) { |
| 276 | - if (!isset($cols[static::colPrefix() . $key]) && isset(static::$cols[$key])) { |
|
| 276 | + if (!isset($cols[static::colPrefix().$key]) && isset(static::$cols[$key])) { |
|
| 277 | 277 | static::createCol($key); |
| 278 | 278 | $cols = static::cols(true); |
| 279 | 279 | } |
| 280 | - if (!isset($cols[$key]) && isset($cols[static::colPrefix() . $key])) { |
|
| 281 | - $array[static::colPrefix() . $key] = $item; |
|
| 280 | + if (!isset($cols[$key]) && isset($cols[static::colPrefix().$key])) { |
|
| 281 | + $array[static::colPrefix().$key] = $item; |
|
| 282 | 282 | unset($array[$key]); |
| 283 | - $key = static::colPrefix() . $key; |
|
| 283 | + $key = static::colPrefix().$key; |
|
| 284 | 284 | } |
| 285 | 285 | if (is_array($array[$key])) { |
| 286 | 286 | static::fixPrefix($array[$key], 'key', $rootModel); |
@@ -291,12 +291,12 @@ discard block |
||
| 291 | 291 | break; |
| 292 | 292 | case 'first': |
| 293 | 293 | if (isset($array[0]) && is_string($array[0])) { |
| 294 | - if (!isset($cols[static::colPrefix() . $array[0]]) && isset(static::$cols[$array[0]])) { |
|
| 294 | + if (!isset($cols[static::colPrefix().$array[0]]) && isset(static::$cols[$array[0]])) { |
|
| 295 | 295 | static::createCol($array[0]); |
| 296 | 296 | $cols = static::cols(true); |
| 297 | 297 | } |
| 298 | - if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix() . $array[0]])) { |
|
| 299 | - $array[0] = static::colPrefix() . $array[0]; |
|
| 298 | + if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix().$array[0]])) { |
|
| 299 | + $array[0] = static::colPrefix().$array[0]; |
|
| 300 | 300 | } else { |
| 301 | 301 | static::checkForJoin($array[0], $rootModel); |
| 302 | 302 | } |
@@ -329,13 +329,13 @@ discard block |
||
| 329 | 329 | case 'to': |
| 330 | 330 | $relCol = $relations[$rel]['col']; |
| 331 | 331 | static::fixPrefix($relCol); |
| 332 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
| 332 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
| 333 | 333 | break; |
| 334 | 334 | case 'one': |
| 335 | 335 | case 'many': |
| 336 | 336 | $relCol = $relations[$rel]['col']; |
| 337 | 337 | $relations[$rel]['model']::fixPrefix($relCol); |
| 338 | - $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
| 338 | + $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
| 339 | 339 | break; |
| 340 | 340 | } |
| 341 | 341 | $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel); |
@@ -376,13 +376,13 @@ discard block |
||
| 376 | 376 | $relCol = $relations[$rel]['col']; |
| 377 | 377 | static::fixPrefix($relCol); |
| 378 | 378 | //$info['modelName'] = $relations[$rel]['model']; |
| 379 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol]; |
|
| 379 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol]; |
|
| 380 | 380 | break; |
| 381 | 381 | case 'one': |
| 382 | 382 | $relCol = $relations[$rel]['col']; |
| 383 | 383 | $relations[$rel]['model']::fixPrefix($relCol); |
| 384 | 384 | //$info['modelName'] = $relations[$rel]['model']; |
| 385 | - $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol]; |
|
| 385 | + $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol]; |
|
| 386 | 386 | break; |
| 387 | 387 | } |
| 388 | 388 | $info = $relations[$rel]['model']::parseColRecursion($info); |
@@ -400,8 +400,8 @@ discard block |
||
| 400 | 400 | } else { |
| 401 | 401 | $info['colParams'] = []; |
| 402 | 402 | } |
| 403 | - if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix() . $info['col']])) { |
|
| 404 | - $info['col'] = static::colPrefix() . $info['col']; |
|
| 403 | + if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix().$info['col']])) { |
|
| 404 | + $info['col'] = static::colPrefix().$info['col']; |
|
| 405 | 405 | } |
| 406 | 406 | $info['modelName'] = get_called_class(); |
| 407 | 407 | } |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | if ($params === false) { |
| 508 | 508 | return false; |
| 509 | 509 | } |
| 510 | - return App::$cur->db->addCol(static::table(), static::colPrefix() . $colName, $params); |
|
| 510 | + return App::$cur->db->addCol(static::table(), static::colPrefix().$colName, $params); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | public static function createTable() |
@@ -537,28 +537,28 @@ discard block |
||
| 537 | 537 | return true; |
| 538 | 538 | } |
| 539 | 539 | $cols = [ |
| 540 | - $colPrefix . 'id' => 'pk' |
|
| 540 | + $colPrefix.'id' => 'pk' |
|
| 541 | 541 | ]; |
| 542 | 542 | $className = get_called_class(); |
| 543 | 543 | if (!empty($className::$cols)) { |
| 544 | 544 | foreach ($className::$cols as $colName => $colParams) { |
| 545 | 545 | if ($colName == 'date_create') { |
| 546 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
| 546 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
| 547 | 547 | continue; |
| 548 | 548 | } |
| 549 | 549 | $params = $className::genColParams($colName); |
| 550 | 550 | if ($params) { |
| 551 | - $cols[$colPrefix . $colName] = $params; |
|
| 551 | + $cols[$colPrefix.$colName] = $params; |
|
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | - if (empty($cols[$colPrefix . 'date_create'])) { |
|
| 556 | - $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
| 555 | + if (empty($cols[$colPrefix.'date_create'])) { |
|
| 556 | + $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP'; |
|
| 557 | 557 | } |
| 558 | 558 | $tableIndexes = []; |
| 559 | 559 | if ($indexes) { |
| 560 | 560 | foreach ($indexes as $indexName => $index) { |
| 561 | - $tableIndexes[] = $index['type'] . ' ' . App::$cur->db->table_prefix . $indexName . ' (' . implode(',', $index['cols']) . ')'; |
|
| 561 | + $tableIndexes[] = $index['type'].' '.App::$cur->db->table_prefix.$indexName.' ('.implode(',', $index['cols']).')'; |
|
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | public static function index() |
| 585 | 585 | { |
| 586 | 586 | |
| 587 | - return static::colPrefix() . 'id'; |
|
| 587 | + return static::colPrefix().'id'; |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | /** |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | { |
| 597 | 597 | $classPath = explode('\\', get_called_class()); |
| 598 | 598 | $classPath = array_slice($classPath, 1); |
| 599 | - return strtolower(implode('_', $classPath)) . '_'; |
|
| 599 | + return strtolower(implode('_', $classPath)).'_'; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /** |
@@ -661,12 +661,12 @@ discard block |
||
| 661 | 661 | case 'to': |
| 662 | 662 | $relCol = $relations[$rel]['col']; |
| 663 | 663 | static::fixPrefix($relCol); |
| 664 | - App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
| 664 | + App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
| 665 | 665 | break; |
| 666 | 666 | case 'one': |
| 667 | 667 | $col = $relations[$rel]['col']; |
| 668 | 668 | $relations[$rel]['model']::fixPrefix($col); |
| 669 | - App::$cur->db->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
| 669 | + App::$cur->db->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
| 670 | 670 | break; |
| 671 | 671 | } |
| 672 | 672 | } |
@@ -681,8 +681,8 @@ discard block |
||
| 681 | 681 | } |
| 682 | 682 | if ($param !== null) { |
| 683 | 683 | $cols = static::cols(); |
| 684 | - if (!isset($cols[$col]) && isset($cols[static::colPrefix() . $col])) { |
|
| 685 | - $col = static::colPrefix() . $col; |
|
| 684 | + if (!isset($cols[$col]) && isset($cols[static::colPrefix().$col])) { |
|
| 685 | + $col = static::colPrefix().$col; |
|
| 686 | 686 | } |
| 687 | 687 | App::$cur->db->where($col, $param); |
| 688 | 688 | } else { |
@@ -742,12 +742,12 @@ discard block |
||
| 742 | 742 | case 'to': |
| 743 | 743 | $relCol = $relations[$rel]['col']; |
| 744 | 744 | static::fixPrefix($relCol); |
| 745 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
| 745 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
| 746 | 746 | break; |
| 747 | 747 | case 'one': |
| 748 | 748 | $col = $relations[$rel]['col']; |
| 749 | 749 | $relations[$rel]['model']::fixPrefix($col); |
| 750 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
| 750 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
| 751 | 751 | break; |
| 752 | 752 | } |
| 753 | 753 | } |
@@ -1063,12 +1063,12 @@ discard block |
||
| 1063 | 1063 | case 'to': |
| 1064 | 1064 | $relCol = $relations[$rel]['col']; |
| 1065 | 1065 | static::fixPrefix($relCol); |
| 1066 | - $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol); |
|
| 1066 | + $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol); |
|
| 1067 | 1067 | break; |
| 1068 | 1068 | case 'one': |
| 1069 | 1069 | $col = $relations[$rel]['col']; |
| 1070 | 1070 | $relations[$rel]['model']::fixPrefix($col); |
| 1071 | - $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col); |
|
| 1071 | + $query->join($relations[$rel]['model']::table(), static::index().' = '.$col); |
|
| 1072 | 1072 | break; |
| 1073 | 1073 | } |
| 1074 | 1074 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | } else { |
| 1086 | 1086 | $cols .= '*'; |
| 1087 | 1087 | } |
| 1088 | - $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : ''); |
|
| 1088 | + $cols .= ') as `count`'.(!empty($options['cols']) ? ','.$options['cols'] : ''); |
|
| 1089 | 1089 | $query->cols = $cols; |
| 1090 | 1090 | if (!empty($options['group'])) { |
| 1091 | 1091 | $query->group($options['group']); |
@@ -1223,25 +1223,25 @@ discard block |
||
| 1223 | 1223 | $itemModel = $class::$treeCategory; |
| 1224 | 1224 | $oldPath = $this->tree_path; |
| 1225 | 1225 | $this->tree_path = $this->getCatalogTree($this); |
| 1226 | - $itemsTable = \App::$cur->db->table_prefix . $itemModel::table(); |
|
| 1227 | - $itemTreeCol = $itemModel::colPrefix() . 'tree_path'; |
|
| 1226 | + $itemsTable = \App::$cur->db->table_prefix.$itemModel::table(); |
|
| 1227 | + $itemTreeCol = $itemModel::colPrefix().'tree_path'; |
|
| 1228 | 1228 | |
| 1229 | - $categoryTreeCol = $this->colPrefix() . 'tree_path'; |
|
| 1230 | - $categoryTable = \App::$cur->db->table_prefix . $this->table(); |
|
| 1229 | + $categoryTreeCol = $this->colPrefix().'tree_path'; |
|
| 1230 | + $categoryTable = \App::$cur->db->table_prefix.$this->table(); |
|
| 1231 | 1231 | if ($oldPath) { |
| 1232 | 1232 | \App::$cur->db->query('UPDATE |
| 1233 | - ' . $categoryTable . ' |
|
| 1233 | + ' . $categoryTable.' |
|
| 1234 | 1234 | SET |
| 1235 | - ' . $categoryTreeCol . ' = REPLACE(' . $categoryTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
| 1236 | - WHERE ' . $categoryTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
| 1235 | + ' . $categoryTreeCol.' = REPLACE('.$categoryTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
| 1236 | + WHERE ' . $categoryTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
| 1237 | 1237 | |
| 1238 | 1238 | \App::$cur->db->query('UPDATE |
| 1239 | - ' . $itemsTable . ' |
|
| 1239 | + ' . $itemsTable.' |
|
| 1240 | 1240 | SET |
| 1241 | - ' . $itemTreeCol . ' = REPLACE(' . $itemTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") |
|
| 1242 | - WHERE ' . $itemTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"'); |
|
| 1241 | + ' . $itemTreeCol.' = REPLACE('.$itemTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") |
|
| 1242 | + WHERE ' . $itemTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"'); |
|
| 1243 | 1243 | } |
| 1244 | - $itemModel::update([$itemTreeCol => $this->tree_path . $this->id . '/'], [$itemModel::colPrefix() . $this->index(), $this->id]); |
|
| 1244 | + $itemModel::update([$itemTreeCol => $this->tree_path.$this->id.'/'], [$itemModel::colPrefix().$this->index(), $this->id]); |
|
| 1245 | 1245 | } |
| 1246 | 1246 | |
| 1247 | 1247 | /** |
@@ -1256,9 +1256,9 @@ discard block |
||
| 1256 | 1256 | $catalogParent = $catalogClass::get($catalog->parent_id); |
| 1257 | 1257 | if ($catalog && $catalogParent) { |
| 1258 | 1258 | if ($catalogParent->tree_path) { |
| 1259 | - return $catalogParent->tree_path . $catalogParent->id . '/'; |
|
| 1259 | + return $catalogParent->tree_path.$catalogParent->id.'/'; |
|
| 1260 | 1260 | } else { |
| 1261 | - return $this->getCatalogTree($catalogParent) . $catalogParent->id . '/'; |
|
| 1261 | + return $this->getCatalogTree($catalogParent).$catalogParent->id.'/'; |
|
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | 1264 | return '/'; |
@@ -1273,7 +1273,7 @@ discard block |
||
| 1273 | 1273 | $categoryModel = $class::$categoryModel; |
| 1274 | 1274 | $category = $categoryModel::get($this->{$categoryModel::index()}); |
| 1275 | 1275 | if ($category) { |
| 1276 | - $this->tree_path = $category->tree_path . $category->pk() . '/'; |
|
| 1276 | + $this->tree_path = $category->tree_path.$category->pk().'/'; |
|
| 1277 | 1277 | } else { |
| 1278 | 1278 | $this->tree_path = '/'; |
| 1279 | 1279 | } |
@@ -1299,7 +1299,7 @@ discard block |
||
| 1299 | 1299 | $this->changeCategoryTree(); |
| 1300 | 1300 | } |
| 1301 | 1301 | if (!empty($this->_changedParams) && $this->pk()) { |
| 1302 | - Inji::$inst->event('modelItemParamsChanged-' . get_called_class(), $this); |
|
| 1302 | + Inji::$inst->event('modelItemParamsChanged-'.get_called_class(), $this); |
|
| 1303 | 1303 | } |
| 1304 | 1304 | $this->beforeSave(); |
| 1305 | 1305 | |
@@ -1337,7 +1337,7 @@ discard block |
||
| 1337 | 1337 | } |
| 1338 | 1338 | $this->_params = $result->fetch(); |
| 1339 | 1339 | if ($new) { |
| 1340 | - Inji::$inst->event('modelCreatedItem-' . get_called_class(), $this); |
|
| 1340 | + Inji::$inst->event('modelCreatedItem-'.get_called_class(), $this); |
|
| 1341 | 1341 | } |
| 1342 | 1342 | $this->afterSave(); |
| 1343 | 1343 | return $this->{$this->index()}; |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | static::fixPrefix($params); |
| 1484 | 1484 | $className = get_called_class(); |
| 1485 | 1485 | foreach ($params as $paramName => $value) { |
| 1486 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $paramName); |
|
| 1486 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $paramName); |
|
| 1487 | 1487 | if (!empty($className::$cols[$shortName])) { |
| 1488 | 1488 | switch ($className::$cols[$shortName]['type']) { |
| 1489 | 1489 | case 'decimal': |
@@ -1763,7 +1763,7 @@ discard block |
||
| 1763 | 1763 | { |
| 1764 | 1764 | static::fixPrefix($name); |
| 1765 | 1765 | $className = get_called_class(); |
| 1766 | - $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $name); |
|
| 1766 | + $shortName = preg_replace('!'.$this->colPrefix().'!', '', $name); |
|
| 1767 | 1767 | if (!empty($className::$cols[$shortName])) { |
| 1768 | 1768 | switch ($className::$cols[$shortName]['type']) { |
| 1769 | 1769 | case 'decimal': |
@@ -260,8 +260,7 @@ discard block |
||
| 260 | 260 | } else { |
| 261 | 261 | $value = $item->$colName; |
| 262 | 262 | } |
| 263 | - } |
|
| 264 | - else { |
|
| 263 | + } else { |
|
| 265 | 264 | $value = $item->$colName; |
| 266 | 265 | } |
| 267 | 266 | break; |
@@ -751,17 +750,21 @@ discard block |
||
| 751 | 750 | if (!$query) { |
| 752 | 751 | return []; |
| 753 | 752 | } |
| 754 | - if (!empty($options['where'])) |
|
| 755 | - $query->where($options['where']); |
|
| 753 | + if (!empty($options['where'])) { |
|
| 754 | + $query->where($options['where']); |
|
| 755 | + } |
|
| 756 | 756 | if (!empty($options['group'])) { |
| 757 | 757 | $query->group($options['group']); |
| 758 | 758 | } |
| 759 | - if (!empty($options['order'])) |
|
| 760 | - $query->order($options['order']); |
|
| 761 | - if (!empty($options['join'])) |
|
| 762 | - $query->join($options['join']); |
|
| 763 | - if (!empty($options['distinct'])) |
|
| 764 | - $query->distinct = $options['distinct']; |
|
| 759 | + if (!empty($options['order'])) { |
|
| 760 | + $query->order($options['order']); |
|
| 761 | + } |
|
| 762 | + if (!empty($options['join'])) { |
|
| 763 | + $query->join($options['join']); |
|
| 764 | + } |
|
| 765 | + if (!empty($options['distinct'])) { |
|
| 766 | + $query->distinct = $options['distinct']; |
|
| 767 | + } |
|
| 765 | 768 | |
| 766 | 769 | foreach (static::$relJoins as $join) { |
| 767 | 770 | $query->join($join[0], $join[1]); |
@@ -787,14 +790,14 @@ discard block |
||
| 787 | 790 | } |
| 788 | 791 | static::$needJoin = []; |
| 789 | 792 | |
| 790 | - if (!empty($options['limit'])) |
|
| 791 | - $limit = (int) $options['limit']; |
|
| 792 | - else { |
|
| 793 | + if (!empty($options['limit'])) { |
|
| 794 | + $limit = (int) $options['limit']; |
|
| 795 | + } else { |
|
| 793 | 796 | $limit = 0; |
| 794 | 797 | } |
| 795 | - if (!empty($options['start'])) |
|
| 796 | - $start = (int) $options['start']; |
|
| 797 | - else { |
|
| 798 | + if (!empty($options['start'])) { |
|
| 799 | + $start = (int) $options['start']; |
|
| 800 | + } else { |
|
| 798 | 801 | $start = 0; |
| 799 | 802 | } |
| 800 | 803 | if ($limit || $start) { |
@@ -1061,21 +1064,23 @@ discard block |
||
| 1061 | 1064 | if (!empty($options['where'])) { |
| 1062 | 1065 | static::fixPrefix($options['where'], 'first'); |
| 1063 | 1066 | } |
| 1064 | - if (!empty($options['where'])) |
|
| 1065 | - $query->where($options['where']); |
|
| 1066 | - if (!empty($options['join'])) |
|
| 1067 | - $query->join($options['join']); |
|
| 1067 | + if (!empty($options['where'])) { |
|
| 1068 | + $query->where($options['where']); |
|
| 1069 | + } |
|
| 1070 | + if (!empty($options['join'])) { |
|
| 1071 | + $query->join($options['join']); |
|
| 1072 | + } |
|
| 1068 | 1073 | if (!empty($options['order'])) { |
| 1069 | 1074 | $query->order($options['order']); |
| 1070 | 1075 | } |
| 1071 | - if (!empty($options['limit'])) |
|
| 1072 | - $limit = (int) $options['limit']; |
|
| 1073 | - else { |
|
| 1076 | + if (!empty($options['limit'])) { |
|
| 1077 | + $limit = (int) $options['limit']; |
|
| 1078 | + } else { |
|
| 1074 | 1079 | $limit = 0; |
| 1075 | 1080 | } |
| 1076 | - if (!empty($options['start'])) |
|
| 1077 | - $start = (int) $options['start']; |
|
| 1078 | - else { |
|
| 1081 | + if (!empty($options['start'])) { |
|
| 1082 | + $start = (int) $options['start']; |
|
| 1083 | + } else { |
|
| 1079 | 1084 | $start = 0; |
| 1080 | 1085 | } |
| 1081 | 1086 | if ($limit || $start) { |
@@ -1153,8 +1158,9 @@ discard block |
||
| 1153 | 1158 | |
| 1154 | 1159 | $values = []; |
| 1155 | 1160 | foreach ($cols as $col => $param) { |
| 1156 | - if (isset($params[$col])) |
|
| 1157 | - $values[$col] = $params[$col]; |
|
| 1161 | + if (isset($params[$col])) { |
|
| 1162 | + $values[$col] = $params[$col]; |
|
| 1163 | + } |
|
| 1158 | 1164 | } |
| 1159 | 1165 | if (empty($values)) { |
| 1160 | 1166 | return false; |
@@ -1337,8 +1343,9 @@ discard block |
||
| 1337 | 1343 | $values = []; |
| 1338 | 1344 | |
| 1339 | 1345 | foreach ($this->cols() as $col => $param) { |
| 1340 | - if (isset($this->_params[$col])) |
|
| 1341 | - $values[$col] = $this->_params[$col]; |
|
| 1346 | + if (isset($this->_params[$col])) { |
|
| 1347 | + $values[$col] = $this->_params[$col]; |
|
| 1348 | + } |
|
| 1342 | 1349 | } |
| 1343 | 1350 | if (empty($values) && empty($options['empty'])) { |
| 1344 | 1351 | return false; |
@@ -1498,8 +1505,9 @@ discard block |
||
| 1498 | 1505 | { |
| 1499 | 1506 | |
| 1500 | 1507 | foreach (static::relations() as $relName => $rel) { |
| 1501 | - if ($rel['col'] == $col) |
|
| 1502 | - return $relName; |
|
| 1508 | + if ($rel['col'] == $col) { |
|
| 1509 | + return $relName; |
|
| 1510 | + } |
|
| 1503 | 1511 | } |
| 1504 | 1512 | return NULL; |
| 1505 | 1513 | } |
@@ -329,6 +329,9 @@ |
||
| 329 | 329 | return $rows; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | + /** |
|
| 333 | + * @param DataManager $dataManager |
|
| 334 | + */ |
|
| 332 | 335 | public static function drawCol($item, $colName, $params = [], $dataManager = null, $originalCol = '', $originalItem = null) |
| 333 | 336 | { |
| 334 | 337 | $modelName = get_class($item); |
@@ -168,12 +168,12 @@ |
||
| 168 | 168 | <li><a href ='' onclick='inji.Ui.dataManagers.get(this).rowSelection("inverse");return false;'>Инвертировать</a></li> |
| 169 | 169 | <li role="separator" class="divider"></li> |
| 170 | 170 | <?php |
| 171 | - foreach ($actions as $action => $actionParams) { |
|
| 172 | - if (class_exists($actionParams['className']) && $actionParams['className']::$groupAction) { |
|
| 173 | - echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
| 174 | - } |
|
| 175 | - } |
|
| 176 | - ?> |
|
| 171 | + foreach ($actions as $action => $actionParams) { |
|
| 172 | + if (class_exists($actionParams['className']) && $actionParams['className']::$groupAction) { |
|
| 173 | + echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | + ?> |
|
| 177 | 177 | </ul> |
| 178 | 178 | </div> |
| 179 | 179 | <?php |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->name = $this->managerOptions['name']; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $this->managerId = str_replace('\\', '_', 'dataManager_' . $this->modelName . '_' . $this->managerName . '_' . \Tools::randomString()); |
|
| 61 | + $this->managerId = str_replace('\\', '_', 'dataManager_'.$this->modelName.'_'.$this->managerName.'_'.\Tools::randomString()); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | if (!empty($this->managerOptions['filters'])) { |
| 103 | 103 | $buttons[] = [ |
| 104 | 104 | 'text' => 'Фильтры', |
| 105 | - 'onclick' => ' var modal = $("#' . $this->managerId . '_filters"); |
|
| 105 | + 'onclick' => ' var modal = $("#'.$this->managerId.'_filters"); |
|
| 106 | 106 | modal.modal("show");', |
| 107 | 107 | ]; |
| 108 | 108 | } |
| 109 | 109 | $buttons[] = [ |
| 110 | 110 | 'text' => 'Добавить элемент', |
| 111 | - 'onclick' => 'inji.Ui.dataManagers.get(this).newItem("' . str_replace('\\', '\\\\', $modelName) . '",' . json_encode($formParams) . ');', |
|
| 111 | + 'onclick' => 'inji.Ui.dataManagers.get(this).newItem("'.str_replace('\\', '\\\\', $modelName).'",'.json_encode($formParams).');', |
|
| 112 | 112 | ]; |
| 113 | 113 | |
| 114 | 114 | return $buttons; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | 'className' => $action |
| 139 | 139 | ]; |
| 140 | 140 | } |
| 141 | - $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']; |
|
| 141 | + $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']; |
|
| 142 | 142 | if (!class_exists($return[$key]['className']) || ($onlyGroupActions && !$return[$key]['className']::$groupAction)) { |
| 143 | 143 | unset($return[$key]); |
| 144 | 144 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | <?php |
| 171 | 171 | foreach ($actions as $action => $actionParams) { |
| 172 | 172 | if (class_exists($actionParams['className']) && $actionParams['className']::$groupAction) { |
| 173 | - echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
| 173 | + echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"".str_replace('\\', '\\\\', $action)."\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | ?> |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | return []; |
| 222 | 222 | } |
| 223 | 223 | if (!$this->checkAccess()) { |
| 224 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
| 224 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
| 225 | 225 | return []; |
| 226 | 226 | } |
| 227 | 227 | $modelName = $this->modelName; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $queryParams['start'] = $this->page * $this->limit - $this->limit; |
| 238 | 238 | } |
| 239 | 239 | if (!empty($params['categoryPath']) && $modelName::$categoryModel) { |
| 240 | - $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE']; |
|
| 240 | + $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE']; |
|
| 241 | 241 | } |
| 242 | 242 | if (!empty($params['appType'])) { |
| 243 | 243 | $queryParams['appType'] = $params['appType']; |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | if (!empty($params['filters'][$col]['max'])) { |
| 297 | 297 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
| 298 | 298 | |
| 299 | - $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
|
| 299 | + $date = $params['filters'][$col]['max'].' 23:59:59'; |
|
| 300 | 300 | } else { |
| 301 | 301 | $date = $params['filters'][$col]['max']; |
| 302 | 302 | } |
@@ -323,16 +323,16 @@ discard block |
||
| 323 | 323 | } |
| 324 | 324 | switch ($params['filters'][$col]['compareType']) { |
| 325 | 325 | case 'contains': |
| 326 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
| 326 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE']; |
|
| 327 | 327 | break; |
| 328 | 328 | case 'equals': |
| 329 | 329 | $queryParams['where'][] = [$col, $params['filters'][$col]['value']]; |
| 330 | 330 | break; |
| 331 | 331 | case 'starts_with': |
| 332 | - $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
| 332 | + $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE']; |
|
| 333 | 333 | break; |
| 334 | 334 | case 'ends_with': |
| 335 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE']; |
|
| 335 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE']; |
|
| 336 | 336 | break; |
| 337 | 337 | } |
| 338 | 338 | break; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $item = $relation['relModel']::get([[$item->index(), $item->id], [$model->index(), $model->id]]); |
| 372 | 372 | } |
| 373 | 373 | $row = []; |
| 374 | - $row[] = '<input type ="checkbox" name = "pk[]" value =' . $item->pk() . '>'; |
|
| 374 | + $row[] = '<input type ="checkbox" name = "pk[]" value ='.$item->pk().'>'; |
|
| 375 | 375 | $row[] = $item->pk(); |
| 376 | 376 | foreach ($this->managerOptions['cols'] as $key => $colName) { |
| 377 | 377 | if (!empty($params['download'])) { |
@@ -417,16 +417,16 @@ discard block |
||
| 417 | 417 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
| 418 | 418 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
| 419 | 419 | $count = $count ? $count : 'Нет'; |
| 420 | - 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>"; |
|
| 420 | + 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>"; |
|
| 421 | 421 | case 'many': |
| 422 | 422 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
| 423 | 423 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
| 424 | 424 | $count = $count ? $count : 'Нет'; |
| 425 | - 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>"; |
|
| 425 | + 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>"; |
|
| 426 | 426 | default : |
| 427 | 427 | if ($item->{$modelName::$cols[$colName]['relation']}) { |
| 428 | 428 | if (\App::$cur->name == 'admin') { |
| 429 | - $href = "<a href ='/admin/" . str_replace('\\', '/view/', $relations[$modelName::$cols[$colName]['relation']]['model']) . "/" . $item->{$modelName::$cols[$colName]['relation']}->pk() . "'>"; |
|
| 429 | + $href = "<a href ='/admin/".str_replace('\\', '/view/', $relations[$modelName::$cols[$colName]['relation']]['model'])."/".$item->{$modelName::$cols[$colName]['relation']}->pk()."'>"; |
|
| 430 | 430 | if (!empty($modelName::$cols[$colName]['showCol'])) { |
| 431 | 431 | $href .= $item->{$modelName::$cols[$colName]['relation']}->{$modelName::$cols[$colName]['showCol']}; |
| 432 | 432 | } else { |
@@ -456,18 +456,18 @@ discard block |
||
| 456 | 456 | case 'many': |
| 457 | 457 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
| 458 | 458 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
| 459 | - 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>"; |
|
| 459 | + 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>"; |
|
| 460 | 460 | default: |
| 461 | 461 | return $item->$colName; |
| 462 | 462 | } |
| 463 | 463 | } elseif (!empty($modelName::$cols[$colName]['type'])) { |
| 464 | - if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
| 464 | + if (\App::$cur->name == 'admin' && $originalCol == 'name' || ($dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
| 465 | 465 | $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager'; |
| 466 | - $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
|
| 467 | - return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($originalItem)) . "/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
| 466 | + $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem)); |
|
| 467 | + return "<a href ='/admin/".str_replace('\\', '/view/', get_class($originalItem))."/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
| 468 | 468 | } elseif (\App::$cur->name == 'admin' && $colName == 'name') { |
| 469 | - $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
|
| 470 | - return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($item)) . "/{$item->id}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
| 469 | + $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem)); |
|
| 470 | + return "<a href ='/admin/".str_replace('\\', '/view/', get_class($item))."/{$item->id}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
| 471 | 471 | } else { |
| 472 | 472 | return \Model::resloveTypeValue($item, $colName); |
| 473 | 473 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | return []; |
| 503 | 503 | } |
| 504 | 504 | if (!$this->checkAccess()) { |
| 505 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
| 505 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
| 506 | 506 | return []; |
| 507 | 507 | } |
| 508 | 508 | if (!empty($params['limit'])) { |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | ]; |
| 517 | 517 | $modelName = $this->modelName; |
| 518 | 518 | if (!empty($params['categoryPath']) && $modelName::$categoryModel) { |
| 519 | - $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE']; |
|
| 519 | + $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE']; |
|
| 520 | 520 | } |
| 521 | 521 | if (!empty($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'])) { |
| 522 | 522 | foreach ($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'] as $colName => $colOptions) { |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | if (!empty($params['filters'][$col]['max'])) { |
| 571 | 571 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
| 572 | 572 | |
| 573 | - $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
|
| 573 | + $date = $params['filters'][$col]['max'].' 23:59:59'; |
|
| 574 | 574 | } else { |
| 575 | 575 | $date = $params['filters'][$col]['max']; |
| 576 | 576 | } |
@@ -597,16 +597,16 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | switch ($params['filters'][$col]['compareType']) { |
| 599 | 599 | case 'contains': |
| 600 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
| 600 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE']; |
|
| 601 | 601 | break; |
| 602 | 602 | case 'equals': |
| 603 | 603 | $queryParams['where'][] = [$col, $params['filters'][$col]['value']]; |
| 604 | 604 | break; |
| 605 | 605 | case 'starts_with': |
| 606 | - $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
| 606 | + $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE']; |
|
| 607 | 607 | break; |
| 608 | 608 | case 'ends_with': |
| 609 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE']; |
|
| 609 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE']; |
|
| 610 | 610 | break; |
| 611 | 611 | } |
| 612 | 612 | break; |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | $tableCols[] = !empty($colOptions['label']) ? $colOptions['label'] : $colName; |
| 641 | 641 | } |
| 642 | 642 | $tableCols[] = ''; |
| 643 | - $this->table->class .=' datamanagertable'; |
|
| 643 | + $this->table->class .= ' datamanagertable'; |
|
| 644 | 644 | $this->table->setCols($tableCols); |
| 645 | 645 | } |
| 646 | 646 | |
@@ -663,12 +663,12 @@ discard block |
||
| 663 | 663 | return false; |
| 664 | 664 | } |
| 665 | 665 | if (!$this->checkAccess()) { |
| 666 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
| 666 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
| 667 | 667 | return []; |
| 668 | 668 | } |
| 669 | 669 | $tree = new Tree(); |
| 670 | 670 | $tree->ul($this->managerOptions['categorys']['model'], 0, function($category) { |
| 671 | - $path = $category->tree_path . ($category->pk() ? $category->pk() . "/" : ''); |
|
| 671 | + $path = $category->tree_path.($category->pk() ? $category->pk()."/" : ''); |
|
| 672 | 672 | $cleanClassName = str_replace('\\', '\\\\', get_class($category)); |
| 673 | 673 | 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> |
| 674 | 674 | |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | ]]); |
| 59 | 59 | ?>)</h3> |
| 60 | 60 | <?php |
| 61 | - foreach (\Dashboard\Comment::getList([ 'where' => [ |
|
| 62 | - ['item_id', $item->id], |
|
| 63 | - ['model', $modelName], |
|
| 64 | - ], 'order' => ['date_create', 'desc']]) as $comment) { |
|
| 65 | - ?> |
|
| 61 | + foreach (\Dashboard\Comment::getList([ 'where' => [ |
|
| 62 | + ['item_id', $item->id], |
|
| 63 | + ['model', $modelName], |
|
| 64 | + ], 'order' => ['date_create', 'desc']]) as $comment) { |
|
| 65 | + ?> |
|
| 66 | 66 | <div class="row"> |
| 67 | 67 | <div class="col-sm-3" style="max-width: 300px;"> |
| 68 | 68 | <a href='/admin/Users/view/User/<?= $comment->user->pk(); ?>'><?= $comment->user->name(); ?></a><br /> |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | </div> |
| 74 | 74 | </div> |
| 75 | 75 | <?php |
| 76 | - } |
|
| 77 | - ?> |
|
| 76 | + } |
|
| 77 | + ?> |
|
| 78 | 78 | </div> |
| 79 | 79 | <div> |
| 80 | 80 | <?php |
| 81 | - $form = new \Ui\Form(); |
|
| 82 | - $form->begin(); |
|
| 83 | - $form->input('textarea', 'comment', 'Комментарий'); |
|
| 84 | - $form->end(); |
|
| 85 | - ?> |
|
| 81 | + $form = new \Ui\Form(); |
|
| 82 | + $form->begin(); |
|
| 83 | + $form->input('textarea', 'comment', 'Комментарий'); |
|
| 84 | + $form->end(); |
|
| 85 | + ?> |
|
| 86 | 86 | </div> |
@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | case 'relation': |
| 25 | 25 | $relations = $colInfo['modelName']::relations(); |
| 26 | 26 | $relValue = $relations[$colInfo['colParams']['relation']]['model']::get($item->$colName); |
| 27 | - $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relations[$colInfo['colParams']['relation']]['model']) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано'; |
|
| 27 | + $value = $relValue ? "<a href='/admin/".str_replace('\\', '/view/', $relations[$colInfo['colParams']['relation']]['model'])."/".$relValue->pk()."'>".$relValue->name()."</a>" : 'Не задано'; |
|
| 28 | 28 | break; |
| 29 | 29 | } |
| 30 | 30 | break; |
| 31 | 31 | case 'image': |
| 32 | 32 | $file = Files\File::get($item->$colName); |
| 33 | 33 | if ($file) { |
| 34 | - $value = '<img src="' . $file->path . '?resize=60x120" />'; |
|
| 34 | + $value = '<img src="'.$file->path.'?resize=60x120" />'; |
|
| 35 | 35 | } else { |
| 36 | 36 | $value = '<img src="/static/system/images/no-image.png?resize=60x120" />'; |
| 37 | 37 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | ]]); |
| 59 | 59 | ?>)</h3> |
| 60 | 60 | <?php |
| 61 | - foreach (\Dashboard\Comment::getList([ 'where' => [ |
|
| 61 | + foreach (\Dashboard\Comment::getList(['where' => [ |
|
| 62 | 62 | ['item_id', $item->id], |
| 63 | 63 | ['model', $modelName], |
| 64 | 64 | ], 'order' => ['date_create', 'desc']]) as $comment) { |