@@ -717,17 +717,21 @@ discard block |
||
717 | 717 | if (!$query) { |
718 | 718 | return false; |
719 | 719 | } |
720 | - if (!empty($options['where'])) |
|
721 | - $query->where($options['where']); |
|
720 | + if (!empty($options['where'])) { |
|
721 | + $query->where($options['where']); |
|
722 | + } |
|
722 | 723 | if (!empty($options['group'])) { |
723 | 724 | $query->group($options['group']); |
724 | 725 | } |
725 | - if (!empty($options['order'])) |
|
726 | - $query->order($options['order']); |
|
727 | - if (!empty($options['join'])) |
|
728 | - $query->join($options['join']); |
|
729 | - if (!empty($options['distinct'])) |
|
730 | - $query->distinct = $options['distinct']; |
|
726 | + if (!empty($options['order'])) { |
|
727 | + $query->order($options['order']); |
|
728 | + } |
|
729 | + if (!empty($options['join'])) { |
|
730 | + $query->join($options['join']); |
|
731 | + } |
|
732 | + if (!empty($options['distinct'])) { |
|
733 | + $query->distinct = $options['distinct']; |
|
734 | + } |
|
731 | 735 | |
732 | 736 | foreach (static::$relJoins as $join) { |
733 | 737 | $query->join($join[0], $join[1]); |
@@ -753,14 +757,14 @@ discard block |
||
753 | 757 | } |
754 | 758 | static::$needJoin = []; |
755 | 759 | |
756 | - if (!empty($options['limit'])) |
|
757 | - $limit = (int) $options['limit']; |
|
758 | - else { |
|
760 | + if (!empty($options['limit'])) { |
|
761 | + $limit = (int) $options['limit']; |
|
762 | + } else { |
|
759 | 763 | $limit = 0; |
760 | 764 | } |
761 | - if (!empty($options['start'])) |
|
762 | - $start = (int) $options['start']; |
|
763 | - else { |
|
765 | + if (!empty($options['start'])) { |
|
766 | + $start = (int) $options['start']; |
|
767 | + } else { |
|
764 | 768 | $start = 0; |
765 | 769 | } |
766 | 770 | if ($limit || $start) { |
@@ -1019,21 +1023,23 @@ discard block |
||
1019 | 1023 | if (!empty($options['where'])) { |
1020 | 1024 | static::fixPrefix($options['where'], 'first'); |
1021 | 1025 | } |
1022 | - if (!empty($options['where'])) |
|
1023 | - $query->where($options['where']); |
|
1024 | - if (!empty($options['join'])) |
|
1025 | - $query->join($options['join']); |
|
1026 | + if (!empty($options['where'])) { |
|
1027 | + $query->where($options['where']); |
|
1028 | + } |
|
1029 | + if (!empty($options['join'])) { |
|
1030 | + $query->join($options['join']); |
|
1031 | + } |
|
1026 | 1032 | if (!empty($options['order'])) { |
1027 | 1033 | $query->order($options['order']); |
1028 | 1034 | } |
1029 | - if (!empty($options['limit'])) |
|
1030 | - $limit = (int) $options['limit']; |
|
1031 | - else { |
|
1035 | + if (!empty($options['limit'])) { |
|
1036 | + $limit = (int) $options['limit']; |
|
1037 | + } else { |
|
1032 | 1038 | $limit = 0; |
1033 | 1039 | } |
1034 | - if (!empty($options['start'])) |
|
1035 | - $start = (int) $options['start']; |
|
1036 | - else { |
|
1040 | + if (!empty($options['start'])) { |
|
1041 | + $start = (int) $options['start']; |
|
1042 | + } else { |
|
1037 | 1043 | $start = 0; |
1038 | 1044 | } |
1039 | 1045 | if ($limit || $start) { |
@@ -1112,8 +1118,9 @@ discard block |
||
1112 | 1118 | |
1113 | 1119 | $values = []; |
1114 | 1120 | foreach ($cols as $col => $param) { |
1115 | - if (isset($params[$col])) |
|
1116 | - $values[$col] = $params[$col]; |
|
1121 | + if (isset($params[$col])) { |
|
1122 | + $values[$col] = $params[$col]; |
|
1123 | + } |
|
1117 | 1124 | } |
1118 | 1125 | if (empty($values)) { |
1119 | 1126 | return false; |
@@ -1296,8 +1303,9 @@ discard block |
||
1296 | 1303 | $values = []; |
1297 | 1304 | |
1298 | 1305 | foreach ($this->cols() as $col => $param) { |
1299 | - if (isset($this->_params[$col])) |
|
1300 | - $values[$col] = $this->_params[$col]; |
|
1306 | + if (isset($this->_params[$col])) { |
|
1307 | + $values[$col] = $this->_params[$col]; |
|
1308 | + } |
|
1301 | 1309 | } |
1302 | 1310 | if (empty($values) && empty($options['empty'])) { |
1303 | 1311 | return false; |
@@ -1457,8 +1465,9 @@ discard block |
||
1457 | 1465 | { |
1458 | 1466 | |
1459 | 1467 | foreach (static::relations() as $relName => $rel) { |
1460 | - if ($rel['col'] == $col) |
|
1461 | - return $relName; |
|
1468 | + if ($rel['col'] == $col) { |
|
1469 | + return $relName; |
|
1470 | + } |
|
1462 | 1471 | } |
1463 | 1472 | return NULL; |
1464 | 1473 | } |
@@ -1614,8 +1623,9 @@ discard block |
||
1614 | 1623 | App::$cur->db->where($relation['relTablePrefix'] . $this->index(), $this->pk()); |
1615 | 1624 | App::$cur->db->where($relation['relTablePrefix'] . $relation['model']::index(), $objectId); |
1616 | 1625 | $isset = App::$cur->db->select($relation['relTable'])->fetch_assoc(); |
1617 | - if ($isset) |
|
1618 | - return true; |
|
1626 | + if ($isset) { |
|
1627 | + return true; |
|
1628 | + } |
|
1619 | 1629 | |
1620 | 1630 | App::$cur->db->insert($relation['relTable'], [ |
1621 | 1631 | $relation['relTablePrefix'] . $this->index() => $this->{$this->index()}, |
@@ -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 |
@@ -23,17 +23,17 @@ |
||
23 | 23 | ?> |
24 | 24 | <ul class="treeview" data-col='tree_path'> |
25 | 25 | <?php |
26 | - if (is_string($objectRoot)) { |
|
27 | - $items = $objectRoot::getList(['where' => ['parent_id', 0]]); |
|
28 | - } else { |
|
29 | - $class = get_class($objectRoot); |
|
30 | - $items = $class::getList(['where' => ['parent_id', $objectRoot->pk()]]); |
|
31 | - } |
|
32 | - $count += count($items); |
|
33 | - foreach ($items as $objectChild) { |
|
34 | - $count+=static::showLi($objectChild, 1, $maxDeep, $hrefFunc); |
|
35 | - } |
|
36 | - ?> |
|
26 | + if (is_string($objectRoot)) { |
|
27 | + $items = $objectRoot::getList(['where' => ['parent_id', 0]]); |
|
28 | + } else { |
|
29 | + $class = get_class($objectRoot); |
|
30 | + $items = $class::getList(['where' => ['parent_id', $objectRoot->pk()]]); |
|
31 | + } |
|
32 | + $count += count($items); |
|
33 | + foreach ($items as $objectChild) { |
|
34 | + $count+=static::showLi($objectChild, 1, $maxDeep, $hrefFunc); |
|
35 | + } |
|
36 | + ?> |
|
37 | 37 | </ul> |
38 | 38 | <?php |
39 | 39 | return $count; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | $count += count($items); |
33 | 33 | foreach ($items as $objectChild) { |
34 | - $count+=static::showLi($objectChild, 1, $maxDeep, $hrefFunc); |
|
34 | + $count += static::showLi($objectChild, 1, $maxDeep, $hrefFunc); |
|
35 | 35 | } |
36 | 36 | ?> |
37 | 37 | </ul> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | <ul> |
57 | 57 | <?php |
58 | 58 | } |
59 | - $count+=static::showLi($objectChild, $deep + 1, $maxDeep, $hrefFunc); |
|
59 | + $count += static::showLi($objectChild, $deep + 1, $maxDeep, $hrefFunc); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | if ($isset) { |