@@ -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 | { |
@@ -718,17 +718,21 @@ discard block |
||
718 | 718 | if (!$query) { |
719 | 719 | return []; |
720 | 720 | } |
721 | - if (!empty($options['where'])) |
|
722 | - $query->where($options['where']); |
|
721 | + if (!empty($options['where'])) { |
|
722 | + $query->where($options['where']); |
|
723 | + } |
|
723 | 724 | if (!empty($options['group'])) { |
724 | 725 | $query->group($options['group']); |
725 | 726 | } |
726 | - if (!empty($options['order'])) |
|
727 | - $query->order($options['order']); |
|
728 | - if (!empty($options['join'])) |
|
729 | - $query->join($options['join']); |
|
730 | - if (!empty($options['distinct'])) |
|
731 | - $query->distinct = $options['distinct']; |
|
727 | + if (!empty($options['order'])) { |
|
728 | + $query->order($options['order']); |
|
729 | + } |
|
730 | + if (!empty($options['join'])) { |
|
731 | + $query->join($options['join']); |
|
732 | + } |
|
733 | + if (!empty($options['distinct'])) { |
|
734 | + $query->distinct = $options['distinct']; |
|
735 | + } |
|
732 | 736 | |
733 | 737 | foreach (static::$relJoins as $join) { |
734 | 738 | $query->join($join[0], $join[1]); |
@@ -754,14 +758,14 @@ discard block |
||
754 | 758 | } |
755 | 759 | static::$needJoin = []; |
756 | 760 | |
757 | - if (!empty($options['limit'])) |
|
758 | - $limit = (int) $options['limit']; |
|
759 | - else { |
|
761 | + if (!empty($options['limit'])) { |
|
762 | + $limit = (int) $options['limit']; |
|
763 | + } else { |
|
760 | 764 | $limit = 0; |
761 | 765 | } |
762 | - if (!empty($options['start'])) |
|
763 | - $start = (int) $options['start']; |
|
764 | - else { |
|
766 | + if (!empty($options['start'])) { |
|
767 | + $start = (int) $options['start']; |
|
768 | + } else { |
|
765 | 769 | $start = 0; |
766 | 770 | } |
767 | 771 | if ($limit || $start) { |
@@ -781,8 +785,7 @@ discard block |
||
781 | 785 | if ($exc->getCode() == '42S02') { |
782 | 786 | static::createTable(); |
783 | 787 | $result = $query->query($queryArr); |
784 | - } |
|
785 | - else { |
|
788 | + } else { |
|
786 | 789 | throw $exc; |
787 | 790 | } |
788 | 791 | |
@@ -1027,21 +1030,23 @@ discard block |
||
1027 | 1030 | if (!empty($options['where'])) { |
1028 | 1031 | static::fixPrefix($options['where'], 'first'); |
1029 | 1032 | } |
1030 | - if (!empty($options['where'])) |
|
1031 | - $query->where($options['where']); |
|
1032 | - if (!empty($options['join'])) |
|
1033 | - $query->join($options['join']); |
|
1033 | + if (!empty($options['where'])) { |
|
1034 | + $query->where($options['where']); |
|
1035 | + } |
|
1036 | + if (!empty($options['join'])) { |
|
1037 | + $query->join($options['join']); |
|
1038 | + } |
|
1034 | 1039 | if (!empty($options['order'])) { |
1035 | 1040 | $query->order($options['order']); |
1036 | 1041 | } |
1037 | - if (!empty($options['limit'])) |
|
1038 | - $limit = (int) $options['limit']; |
|
1039 | - else { |
|
1042 | + if (!empty($options['limit'])) { |
|
1043 | + $limit = (int) $options['limit']; |
|
1044 | + } else { |
|
1040 | 1045 | $limit = 0; |
1041 | 1046 | } |
1042 | - if (!empty($options['start'])) |
|
1043 | - $start = (int) $options['start']; |
|
1044 | - else { |
|
1047 | + if (!empty($options['start'])) { |
|
1048 | + $start = (int) $options['start']; |
|
1049 | + } else { |
|
1045 | 1050 | $start = 0; |
1046 | 1051 | } |
1047 | 1052 | if ($limit || $start) { |
@@ -1119,8 +1124,9 @@ discard block |
||
1119 | 1124 | |
1120 | 1125 | $values = []; |
1121 | 1126 | foreach ($cols as $col => $param) { |
1122 | - if (isset($params[$col])) |
|
1123 | - $values[$col] = $params[$col]; |
|
1127 | + if (isset($params[$col])) { |
|
1128 | + $values[$col] = $params[$col]; |
|
1129 | + } |
|
1124 | 1130 | } |
1125 | 1131 | if (empty($values)) { |
1126 | 1132 | return false; |
@@ -1303,8 +1309,9 @@ discard block |
||
1303 | 1309 | $values = []; |
1304 | 1310 | |
1305 | 1311 | foreach ($this->cols() as $col => $param) { |
1306 | - if (isset($this->_params[$col])) |
|
1307 | - $values[$col] = $this->_params[$col]; |
|
1312 | + if (isset($this->_params[$col])) { |
|
1313 | + $values[$col] = $this->_params[$col]; |
|
1314 | + } |
|
1308 | 1315 | } |
1309 | 1316 | if (empty($values) && empty($options['empty'])) { |
1310 | 1317 | return false; |
@@ -1464,8 +1471,9 @@ discard block |
||
1464 | 1471 | { |
1465 | 1472 | |
1466 | 1473 | foreach (static::relations() as $relName => $rel) { |
1467 | - if ($rel['col'] == $col) |
|
1468 | - return $relName; |
|
1474 | + if ($rel['col'] == $col) { |
|
1475 | + return $relName; |
|
1476 | + } |
|
1469 | 1477 | } |
1470 | 1478 | return NULL; |
1471 | 1479 | } |
@@ -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': |
@@ -270,10 +270,11 @@ |
||
270 | 270 | $item->sales ++; |
271 | 271 | $item->save(); |
272 | 272 | |
273 | - if (empty($_GET['count'])) |
|
274 | - $count = 1; |
|
275 | - else |
|
276 | - $count = (float) $_GET['count']; |
|
273 | + if (empty($_GET['count'])) { |
|
274 | + $count = 1; |
|
275 | + } else { |
|
276 | + $count = (float) $_GET['count']; |
|
277 | + } |
|
277 | 278 | |
278 | 279 | $cart = $this->ecommerce->getCurCart(); |
279 | 280 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $warecount = $cartitem->price->offer->warehouseCount($cart->id); |
63 | 63 | if ($cartitem->count > $warecount) { |
64 | 64 | $error = true; |
65 | - Msg::add('Вы заказали <b>' . $cartitem->item->name . '</b> больше чем есть на складе. на складе: <b>' . $warecount . '</b>', 'danger'); |
|
65 | + Msg::add('Вы заказали <b>'.$cartitem->item->name.'</b> больше чем есть на складе. на складе: <b>'.$warecount.'</b>', 'danger'); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | foreach ($deliverys[$cart->delivery_id]->fields as $field) { |
75 | 75 | if (empty($_POST['deliveryFields'][$field->id]) && $field->required) { |
76 | 76 | $error = 1; |
77 | - Msg::add('Вы не указали: ' . $field->name); |
|
77 | + Msg::add('Вы не указали: '.$field->name); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | foreach (\Ecommerce\UserAdds\Field::getList() as $field) { |
91 | 91 | if (empty($_POST['userAdds']['fields'][$field->id]) && $field->required) { |
92 | 92 | $error = 1; |
93 | - Msg::add('Вы не указали: ' . $field->name); |
|
93 | + Msg::add('Вы не указали: '.$field->name); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | if (!empty($_POST['discounts']['card_item_id'])) { |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | } |
128 | 128 | $cart = \Ecommerce\Cart::get($cart->id); |
129 | 129 | if (!empty(\App::$cur->ecommerce->config['notify_mail'])) { |
130 | - $text = 'Перейдите в админ панель чтобы просмотреть новый заказ <a href = "http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/admin/ecommerce/Cart">Админ панель</a>'; |
|
131 | - $title = 'Новый заказ в интернет магазине на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME); |
|
132 | - \Tools::sendMail('noreply@' . INJI_DOMAIN_NAME, \App::$cur->ecommerce->config['notify_mail'], $title, $text); |
|
130 | + $text = 'Перейдите в админ панель чтобы просмотреть новый заказ <a href = "http://'.idn_to_utf8(INJI_DOMAIN_NAME).'/admin/ecommerce/Cart">Админ панель</a>'; |
|
131 | + $title = 'Новый заказ в интернет магазине на сайте '.idn_to_utf8(INJI_DOMAIN_NAME); |
|
132 | + \Tools::sendMail('noreply@'.INJI_DOMAIN_NAME, \App::$cur->ecommerce->config['notify_mail'], $title, $text); |
|
133 | 133 | } |
134 | 134 | if ($this->notifications) { |
135 | 135 | $notification = new Notifications\Notification(); |
136 | - $notification->name = 'Новый заказ в интернет магазине на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME); |
|
136 | + $notification->name = 'Новый заказ в интернет магазине на сайте '.idn_to_utf8(INJI_DOMAIN_NAME); |
|
137 | 137 | $notification->text = 'Перейдите в админ панель чтобы просмотреть новый заказ'; |
138 | 138 | $notification->chanel_id = $this->notifications->getChanel('Ecommerce-orders')->id; |
139 | 139 | $notification->save(); |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | 'href' => '/ecommerce/cart' |
180 | 180 | ]; |
181 | 181 | $bread[] = [ |
182 | - 'text' => 'Заказ: №' . $cart->id, |
|
183 | - 'href' => '/ecommerce/cart/orderDetail/' . $cart->id |
|
182 | + 'text' => 'Заказ: №'.$cart->id, |
|
183 | + 'href' => '/ecommerce/cart/orderDetail/'.$cart->id |
|
184 | 184 | ]; |
185 | - $this->view->setTitle('Заказ №' . $cart->id); |
|
185 | + $this->view->setTitle('Заказ №'.$cart->id); |
|
186 | 186 | $this->view->page(['data' => compact('cart', 'bread')]); |
187 | 187 | } |
188 | 188 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $result->send(); |
276 | 276 | } |
277 | 277 | |
278 | - $item->sales ++; |
|
278 | + $item->sales++; |
|
279 | 279 | $item->save(); |
280 | 280 | |
281 | 281 | if (empty($_GET['count'])) |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | if (empty($this->module->config['sell_over_warehouse']) && $price->offer->warehouseCount() < $count) { |
290 | 290 | $result->success = false; |
291 | - $result->content = 'На складе недостаточно товара! Доступно: ' . $price->offer->warehouseCount(); |
|
291 | + $result->content = 'На складе недостаточно товара! Доступно: '.$price->offer->warehouseCount(); |
|
292 | 292 | $result->send(); |
293 | 293 | } |
294 | 294 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $cart->addItem($price->id, $count); |
306 | 306 | } |
307 | 307 | $cart->calc(); |
308 | - $result->successMsg = '<a href="/ecommerce/view/' . $item->id . '">' . $item->name() . ($price->offer->name() ? ' (' . $price->offer->name() . ')' : '') . '</a> добавлен <a href="/ecommerce/cart">в корзину покупок</a>!'; |
|
308 | + $result->successMsg = '<a href="/ecommerce/view/'.$item->id.'">'.$item->name().($price->offer->name() ? ' ('.$price->offer->name().')' : '').'</a> добавлен <a href="/ecommerce/cart">в корзину покупок</a>!'; |
|
309 | 309 | $result->send(); |
310 | 310 | } |
311 | 311 |
@@ -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) { |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $buttons = []; |
12 | 12 | foreach ($actions as $action => $actionParams) { |
13 | 13 | if (class_exists($actionParams['className']) && $actionParams['className']::$rowAction) { |
14 | - $buttons[]= $actionParams['className']::rowButton($dataManager, $item, $params, $actionParams); |
|
14 | + $buttons[] = $actionParams['className']::rowButton($dataManager, $item, $params, $actionParams); |
|
15 | 15 | } |
16 | 16 | } |
17 | 17 | echo implode(' ', $buttons); |
@@ -92,6 +92,9 @@ discard block |
||
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | + /** |
|
96 | + * @param string $user_mail |
|
97 | + */ |
|
95 | 98 | public function passre($user_mail) |
96 | 99 | { |
97 | 100 | $user = $this->get($user_mail, 'mail'); |
@@ -322,6 +325,9 @@ discard block |
||
322 | 325 | return $user->id; |
323 | 326 | } |
324 | 327 | |
328 | + /** |
|
329 | + * @param string $pass |
|
330 | + */ |
|
325 | 331 | public function hashpass($pass) |
326 | 332 | { |
327 | 333 | return password_hash($pass, PASSWORD_DEFAULT); |
@@ -359,6 +365,9 @@ discard block |
||
359 | 365 | return $return; |
360 | 366 | } |
361 | 367 | |
368 | + /** |
|
369 | + * @param integer $cat_id |
|
370 | + */ |
|
362 | 371 | public function addUserActivity($user_id, $cat_id , $text = '') |
363 | 372 | { |
364 | 373 | $ua = new Users\Activity([ |
@@ -196,17 +196,20 @@ |
||
196 | 196 | */ |
197 | 197 | public function get($idn, $ltype = 'id') |
198 | 198 | { |
199 | - if (!$idn) |
|
200 | - return false; |
|
199 | + if (!$idn) { |
|
200 | + return false; |
|
201 | + } |
|
201 | 202 | |
202 | - if (is_numeric($idn) && $ltype != 'login') |
|
203 | - $user = Users\User::get($idn, 'id'); |
|
204 | - elseif ($ltype == 'login') |
|
205 | - $user = Users\User::get($idn, 'login'); |
|
206 | - else |
|
207 | - $user = Users\User::get($idn, 'mail'); |
|
208 | - if (!$user) |
|
209 | - return []; |
|
203 | + if (is_numeric($idn) && $ltype != 'login') { |
|
204 | + $user = Users\User::get($idn, 'id'); |
|
205 | + } elseif ($ltype == 'login') { |
|
206 | + $user = Users\User::get($idn, 'login'); |
|
207 | + } else { |
|
208 | + $user = Users\User::get($idn, 'mail'); |
|
209 | + } |
|
210 | + if (!$user) { |
|
211 | + return []; |
|
212 | + } |
|
210 | 213 | |
211 | 214 | return $user; |
212 | 215 | } |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | if (isset($_GET['logout'])) { |
25 | 25 | return $this->logOut(); |
26 | 26 | } |
27 | - if (filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_session_hash') && filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_id')) { |
|
28 | - return $this->cuntinueSession(filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_session_hash'), filter_input(INPUT_COOKIE, $this->cookiePrefix . '_user_id')); |
|
27 | + if (filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_session_hash') && filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_id')) { |
|
28 | + return $this->cuntinueSession(filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_session_hash'), filter_input(INPUT_COOKIE, $this->cookiePrefix.'_user_id')); |
|
29 | 29 | } |
30 | 30 | if (isset($_POST['autorization']) && trim(filter_input(INPUT_POST, 'user_login')) && trim(filter_input(INPUT_POST, 'user_pass'))) { |
31 | 31 | unset($_POST['autorization']); |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | |
42 | 42 | public function logOut($redirect = true) |
43 | 43 | { |
44 | - if (!empty($_COOKIE[$this->cookiePrefix . "_user_session_hash"]) && !empty($_COOKIE[$this->cookiePrefix . "_user_id"])) { |
|
44 | + if (!empty($_COOKIE[$this->cookiePrefix."_user_session_hash"]) && !empty($_COOKIE[$this->cookiePrefix."_user_id"])) { |
|
45 | 45 | $session = Users\Session::get([ |
46 | - ['user_id', $_COOKIE[$this->cookiePrefix . "_user_id"]], |
|
47 | - ['hash', $_COOKIE[$this->cookiePrefix . "_user_session_hash"]] |
|
46 | + ['user_id', $_COOKIE[$this->cookiePrefix."_user_id"]], |
|
47 | + ['hash', $_COOKIE[$this->cookiePrefix."_user_session_hash"]] |
|
48 | 48 | ]); |
49 | 49 | if ($session) { |
50 | 50 | $session->delete(); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | if (!headers_sent()) { |
54 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
55 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
54 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
55 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
56 | 56 | } |
57 | 57 | if ($redirect) { |
58 | 58 | if (!empty($this->config['logoutUrl'][$this->app->type])) { |
@@ -70,25 +70,25 @@ discard block |
||
70 | 70 | ]); |
71 | 71 | if ($session && $session->user && $session->user->blocked) { |
72 | 72 | if (!headers_sent()) { |
73 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
74 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
73 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
74 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
75 | 75 | } |
76 | 76 | Msg::add('Ваш аккаунт заблокирован', 'info'); |
77 | 77 | return; |
78 | 78 | } |
79 | 79 | if ($session && $session->user && !$session->user->blocked) { |
80 | 80 | if (!headers_sent()) { |
81 | - setcookie($this->cookiePrefix . "_user_session_hash", $session->hash, time() + 360000, "/"); |
|
82 | - setcookie($this->cookiePrefix . "_user_id", $session->user_id, time() + 360000, "/"); |
|
81 | + setcookie($this->cookiePrefix."_user_session_hash", $session->hash, time() + 360000, "/"); |
|
82 | + setcookie($this->cookiePrefix."_user_id", $session->user_id, time() + 360000, "/"); |
|
83 | 83 | } |
84 | 84 | if (!empty($this->config['needActivation']) && $session->user->activation) { |
85 | 85 | if (!headers_sent()) { |
86 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
87 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
86 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
87 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
88 | 88 | } |
89 | - Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $session->user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
89 | + Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$session->user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
90 | 90 | } elseif ($session->user->activation) { |
91 | - Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $session->user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
91 | + Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$session->user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
92 | 92 | } |
93 | 93 | if (!$session->user->mail && !empty($this->config['noMailNotify'])) { |
94 | 94 | Msg::add($this->config['noMailNotify']); |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | Users\User::$cur->save(); |
99 | 99 | } else { |
100 | 100 | if (!headers_sent()) { |
101 | - setcookie($this->cookiePrefix . "_user_session_hash", '', 0, "/"); |
|
102 | - setcookie($this->cookiePrefix . "_user_id", '', 0, "/"); |
|
101 | + setcookie($this->cookiePrefix."_user_session_hash", '', 0, "/"); |
|
102 | + setcookie($this->cookiePrefix."_user_id", '', 0, "/"); |
|
103 | 103 | } |
104 | 104 | Msg::add('Ваша сессия устарела или более недействительна, вам необходимо пройти <a href = "/users/login">авторизацию</a> заново', 'info'); |
105 | 105 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $user = $this->get($user_mail, 'mail'); |
111 | 111 | if (!$user) { |
112 | - Msg::add('Пользователь ' . $user_mail . ' не найден, проверьте првильность ввода e-mail или зарегистрируйтесь', 'danger'); |
|
112 | + Msg::add('Пользователь '.$user_mail.' не найден, проверьте првильность ввода e-mail или зарегистрируйтесь', 'danger'); |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | $passre = Users\Passre::get([['user_id', $user->id], ['status', 1]]); |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | $passre->status = 2; |
118 | 118 | $passre->save(); |
119 | 119 | } |
120 | - $hash = $user->id . '_' . Tools::randomString(50); |
|
120 | + $hash = $user->id.'_'.Tools::randomString(50); |
|
121 | 121 | $passre = new Users\Passre(['user_id' => $user->id, 'status' => 1, 'hash' => $hash]); |
122 | 122 | $passre->save(); |
123 | - Tools::sendMail('noreply@' . INJI_DOMAIN_NAME, $user_mail, 'Восстановление пароля на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для продолжения восстановления пароля перейдите по ссылке: <a href = "http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/?passrecont=1&hash=' . $hash . '">' . idn_to_utf8(INJI_DOMAIN_NAME) . '/?passrecont=1&hash=' . $hash . '</a>'); |
|
123 | + Tools::sendMail('noreply@'.INJI_DOMAIN_NAME, $user_mail, 'Восстановление пароля на сайте '.idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />для продолжения восстановления пароля перейдите по ссылке: <a href = "http://'.idn_to_utf8(INJI_DOMAIN_NAME).'/?passrecont=1&hash='.$hash.'">'.idn_to_utf8(INJI_DOMAIN_NAME).'/?passrecont=1&hash='.$hash.'</a>'); |
|
124 | 124 | Tools::redirect('/', 'На указанный почтовый ящик была выслана инструкция по восстановлению пароля', 'success'); |
125 | 125 | } |
126 | 126 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $user->pass = $this->hashpass($pass); |
139 | 139 | $user->save(); |
140 | 140 | $this->autorization($user->mail, $user->pass, 'mail'); |
141 | - Tools::sendMail('noreply@' . INJI_DOMAIN_NAME, $user->mail, 'Новый пароль на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />Ваш новый пароль: ' . $pass); |
|
141 | + Tools::sendMail('noreply@'.INJI_DOMAIN_NAME, $user->mail, 'Новый пароль на сайте '.idn_to_utf8(INJI_DOMAIN_NAME), 'Было запрошено восстановление пароля на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />Ваш новый пароль: '.$pass); |
|
142 | 142 | Tools::redirect('/', 'На указанный почтовый ящик был выслан новый пароль', 'success'); |
143 | 143 | } |
144 | 144 | } |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | $user = $this->get($login, $ltype); |
152 | 152 | if ($user && $this->verifypass($pass, $user->pass) && !$user->blocked) { |
153 | 153 | if (!empty($this->config['needActivation']) && $session->user->activation) { |
154 | - Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $session->user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
154 | + Tools::redirect('/', 'Этот аккаунт ещё не активирован. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$session->user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
155 | 155 | } elseif ($user->activation) { |
156 | - Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/' . $user->id . '"><b>повторно выслать ссылку активации</b></a>'); |
|
156 | + Msg::add('Этот аккаунт ещё не активирован, не все функции могут быть доступны. <br />Если вы не получали письмо с ссылкой для активации, нажмите на - <a href = "/users/resendActivation/'.$user->id.'"><b>повторно выслать ссылку активации</b></a>'); |
|
157 | 157 | } |
158 | 158 | if (!$user->mail && !empty($this->config['noMailNotify'])) { |
159 | 159 | Msg::add($this->config['noMailNotify']); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if ($user && $user->blocked) { |
173 | 173 | Msg::add('Вы заблокированы', 'danger'); |
174 | 174 | } elseif ($user) { |
175 | - Msg::add('Вы ошиблись при наборе пароля или логина, попробуйте ещё раз или воспользуйтесь <a href = "?passre=1&user_mail=' . $user->mail . '">Восстановлением пароля</a>', 'danger'); |
|
175 | + Msg::add('Вы ошиблись при наборе пароля или логина, попробуйте ещё раз или воспользуйтесь <a href = "?passre=1&user_mail='.$user->mail.'">Восстановлением пароля</a>', 'danger'); |
|
176 | 176 | } else { |
177 | 177 | Msg::add('Данный почтовый ящик не зарегистрирован в системе', 'danger'); |
178 | 178 | } |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | $session->save(); |
196 | 196 | |
197 | 197 | if (!headers_sent()) { |
198 | - setcookie($this->cookiePrefix . "_user_session_hash", $session->hash, time() + 360000, "/"); |
|
199 | - setcookie($this->cookiePrefix . "_user_id", $session->user_id, time() + 360000, "/"); |
|
198 | + setcookie($this->cookiePrefix."_user_session_hash", $session->hash, time() + 360000, "/"); |
|
199 | + setcookie($this->cookiePrefix."_user_id", $session->user_id, time() + 360000, "/"); |
|
200 | 200 | } else { |
201 | 201 | Msg::add('Не удалось провести авторизацию. Попробуйте позже', 'info'); |
202 | 202 | } |
@@ -318,20 +318,20 @@ discard block |
||
318 | 318 | $this->autorization($user_mail, $pass, 'mail'); |
319 | 319 | } |
320 | 320 | if (!empty($this->config['needActivation'])) { |
321 | - $from = 'noreply@' . INJI_DOMAIN_NAME; |
|
321 | + $from = 'noreply@'.INJI_DOMAIN_NAME; |
|
322 | 322 | $to = $user_mail; |
323 | - $subject = 'Регистрация на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME); |
|
324 | - $text = 'Вы были зарегистрированы на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: ' . $pass; |
|
325 | - $text .='<br />'; |
|
323 | + $subject = 'Регистрация на сайте '.idn_to_utf8(INJI_DOMAIN_NAME); |
|
324 | + $text = 'Вы были зарегистрированы на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: '.$pass; |
|
326 | 325 | $text .= '<br />'; |
327 | - $text .= 'Для активации вашего аккаунта перейдите по ссылке <a href = "http://' . INJI_DOMAIN_NAME . '/users/activation/' . $user->id . '/' . $user->activation . '">http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/users/activation/' . $user->id . '/' . $user->activation . '</a>'; |
|
326 | + $text .= '<br />'; |
|
327 | + $text .= 'Для активации вашего аккаунта перейдите по ссылке <a href = "http://'.INJI_DOMAIN_NAME.'/users/activation/'.$user->id.'/'.$user->activation.'">http://'.idn_to_utf8(INJI_DOMAIN_NAME).'/users/activation/'.$user->id.'/'.$user->activation.'</a>'; |
|
328 | 328 | Tools::sendMail($from, $to, $subject, $text); |
329 | 329 | Msg::add('Вы были зарегистрированы. На указанный почтовый ящик был выслан ваш пароль и ссылка для активации', 'success'); |
330 | 330 | } else { |
331 | - $from = 'noreply@' . INJI_DOMAIN_NAME; |
|
331 | + $from = 'noreply@'.INJI_DOMAIN_NAME; |
|
332 | 332 | $to = $user_mail; |
333 | - $subject = 'Регистрация на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME); |
|
334 | - $text = 'Вы были зарегистрированы на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: ' . $pass; |
|
333 | + $subject = 'Регистрация на сайте '.idn_to_utf8(INJI_DOMAIN_NAME); |
|
334 | + $text = 'Вы были зарегистрированы на сайте '.idn_to_utf8(INJI_DOMAIN_NAME).'<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: '.$pass; |
|
335 | 335 | Tools::sendMail($from, $to, $subject, $text); |
336 | 336 | Msg::add('Вы были зарегистрированы. На указанный почтовый ящик был выслан ваш пароль', 'success'); |
337 | 337 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | 'map' => [ |
45 | 45 | ['name', 'type'], |
46 | 46 | ['required', 'save'], |
47 | - [ 'userfield'] |
|
47 | + ['userfield'] |
|
48 | 48 | ] |
49 | 49 | ] |
50 | 50 | ]; |
@@ -164,12 +164,12 @@ |
||
164 | 164 | <li><a href ='' onclick='inji.Ui.dataManagers.get(this).rowSelection("inverse");return false;'>Инвертировать</a></li> |
165 | 165 | <li role="separator" class="divider"></li> |
166 | 166 | <?php |
167 | - foreach ($actions as $action => $actionParams) { |
|
168 | - if (class_exists($actionParams['className']) && $actionParams['className']::$groupAction) { |
|
169 | - echo "<li><a href ='' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
170 | - } |
|
171 | - } |
|
172 | - ?> |
|
167 | + foreach ($actions as $action => $actionParams) { |
|
168 | + if (class_exists($actionParams['className']) && $actionParams['className']::$groupAction) { |
|
169 | + echo "<li><a href ='' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
170 | + } |
|
171 | + } |
|
172 | + ?> |
|
173 | 173 | </ul> |
174 | 174 | </div> |
175 | 175 | <?php |
@@ -28,7 +28,6 @@ discard block |
||
28 | 28 | * Construct new data manager |
29 | 29 | * |
30 | 30 | * @param string|array $modelNameOrOptions |
31 | - * @param string $dataManager |
|
32 | 31 | * @throws Exception |
33 | 32 | */ |
34 | 33 | public function __construct($modelNameOrOptions, $managerName = 'manager') |
@@ -386,6 +385,9 @@ discard block |
||
386 | 385 | return $rows; |
387 | 386 | } |
388 | 387 | |
388 | + /** |
|
389 | + * @param DataManager $dataManager |
|
390 | + */ |
|
389 | 391 | public static function drawCol($item, $colName, $params = [], $dataManager = null, $originalCol = '', $originalItem = null) |
390 | 392 | { |
391 | 393 | $modelName = get_class($item); |
@@ -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.forms.popUp("' . str_replace('\\', '\\\\', $modelName) . '",' . json_encode($formParams) . ')', |
|
111 | + 'onclick' => 'inji.Ui.forms.popUp("'.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 href ='' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
173 | + echo "<li><a 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,13 +663,13 @@ 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 | - return "<a href='#' onclick='inji.Ui.dataManagers.get(this).switchCategory(this);return false;' data-path ='" . $category->tree_path . ($category->pk() ? $category->pk() . "/" : '') . "'> " . $category->name . "</a> |
|
672 | - <a href = '#' onclick = 'inji.Ui.forms.popUp(\"" . str_replace('\\', '\\\\', get_class($category)) . ':' . $category->pk() . "\")' class ='glyphicon glyphicon-edit'></a> |
|
671 | + return "<a href='#' onclick='inji.Ui.dataManagers.get(this).switchCategory(this);return false;' data-path ='".$category->tree_path.($category->pk() ? $category->pk()."/" : '')."'> ".$category->name."</a> |
|
672 | + <a href = '#' onclick = 'inji.Ui.forms.popUp(\"" . str_replace('\\', '\\\\', get_class($category)).':'.$category->pk()."\")' class ='glyphicon glyphicon-edit'></a> |
|
673 | 673 | <a onclick='inji.Ui.dataManagers.get(this).delCategory({$category->pk()});return false;' class ='glyphicon glyphicon-remove'></a>"; |
674 | 674 | }); |
675 | 675 | ?> |
@@ -44,7 +44,7 @@ |
||
44 | 44 | 'map' => [ |
45 | 45 | ['name', 'type'], |
46 | 46 | ['required', 'save'], |
47 | - [ 'userfield'] |
|
47 | + ['userfield'] |
|
48 | 48 | ] |
49 | 49 | ] |
50 | 50 | ]; |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <fieldset> |
2 | 2 | <?php |
3 | - if (\Users\User::$cur->id) { |
|
4 | - $userAdds = Ecommerce\UserAdds::getList(['where' => ['user_id', \Users\User::$cur->id]]); |
|
5 | - $values = []; |
|
6 | - foreach ($userAdds as $userAdd) { |
|
7 | - $values[$userAdd->id] = $userAdd->values(['array' => true]); |
|
8 | - } |
|
9 | - if ($userAdds) { |
|
10 | - $form->input('select', 'userAddsId', 'Ваши контакты', ['values' => ['' => 'Выберите'] + Ecommerce\UserAdds::getList(['where' => ['user_id', \Users\User::$cur->id], 'forSelect' => true])]); |
|
11 | - echo '<hr />'; |
|
12 | - } |
|
13 | - ?> |
|
3 | + if (\Users\User::$cur->id) { |
|
4 | + $userAdds = Ecommerce\UserAdds::getList(['where' => ['user_id', \Users\User::$cur->id]]); |
|
5 | + $values = []; |
|
6 | + foreach ($userAdds as $userAdd) { |
|
7 | + $values[$userAdd->id] = $userAdd->values(['array' => true]); |
|
8 | + } |
|
9 | + if ($userAdds) { |
|
10 | + $form->input('select', 'userAddsId', 'Ваши контакты', ['values' => ['' => 'Выберите'] + Ecommerce\UserAdds::getList(['where' => ['user_id', \Users\User::$cur->id], 'forSelect' => true])]); |
|
11 | + echo '<hr />'; |
|
12 | + } |
|
13 | + ?> |
|
14 | 14 | <script> |
15 | 15 | var userAddsValues = <?= json_encode($values); ?>; |
16 | 16 | inji.onLoad(function () { |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | }) |
25 | 25 | </script> |
26 | 26 | <?php |
27 | - } |
|
28 | - foreach (Ecommerce\UserAdds\Field::getList(['order' => ['weight', 'asc']]) as $field) { |
|
29 | - $form->input($field->type, "userAdds[fields][{$field->id}]", $field->name, ['required' => $field->required]); |
|
30 | - } |
|
31 | - ?> |
|
27 | + } |
|
28 | + foreach (Ecommerce\UserAdds\Field::getList(['order' => ['weight', 'asc']]) as $field) { |
|
29 | + $form->input($field->type, "userAdds[fields][{$field->id}]", $field->name, ['required' => $field->required]); |
|
30 | + } |
|
31 | + ?> |
|
32 | 32 | </fieldset> |
33 | 33 | \ No newline at end of file |