@@ -1,13 +1,13 @@ |
||
1 | 1 | <tfoot> |
2 | 2 | <tr> |
3 | 3 | <?php |
4 | - foreach ($table->cols as $col) { |
|
5 | - if (is_string($col)) { |
|
6 | - echo "<th>{$col}</th>"; |
|
7 | - } else { |
|
8 | - echo Html::el('th', !empty($col['attributes']) ? $col['attributes'] : [], $col['text']); |
|
9 | - } |
|
10 | - } |
|
11 | - ?> |
|
4 | + foreach ($table->cols as $col) { |
|
5 | + if (is_string($col)) { |
|
6 | + echo "<th>{$col}</th>"; |
|
7 | + } else { |
|
8 | + echo Html::el('th', !empty($col['attributes']) ? $col['attributes'] : [], $col['text']); |
|
9 | + } |
|
10 | + } |
|
11 | + ?> |
|
12 | 12 | </tr> |
13 | 13 | </tfoot> |
14 | 14 | \ No newline at end of file |
@@ -4,7 +4,8 @@ |
||
4 | 4 | foreach ($table->cols as $col) { |
5 | 5 | if (is_string($col)) { |
6 | 6 | echo "<th>{$col}</th>"; |
7 | - } else { |
|
7 | + } |
|
8 | + else { |
|
8 | 9 | echo Html::el('th', !empty($col['attributes']) ? $col['attributes'] : [], $col['text']); |
9 | 10 | } |
10 | 11 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <tr> |
2 | 2 | <?php |
3 | - foreach ($row as $html) { |
|
4 | - if (is_array($html)) { |
|
5 | - extract($html); |
|
6 | - } |
|
7 | - echo "<td " . (!empty($class) ? "class='{$class}'" : '') . ">{$html}</td>"; |
|
8 | - } |
|
9 | - ?> |
|
3 | + foreach ($row as $html) { |
|
4 | + if (is_array($html)) { |
|
5 | + extract($html); |
|
6 | + } |
|
7 | + echo "<td " . (!empty($class) ? "class='{$class}'" : '') . ">{$html}</td>"; |
|
8 | + } |
|
9 | + ?> |
|
10 | 10 | </tr> |
11 | 11 | \ No newline at end of file |
@@ -4,7 +4,8 @@ |
||
4 | 4 | foreach ($buttons as $button) { |
5 | 5 | if (!empty($button['class'])) { |
6 | 6 | $button['class'] = 'btn btn-primary btn-sm ' . $button['class']; |
7 | - } else { |
|
7 | + } |
|
8 | + else { |
|
8 | 9 | $button['class'] = 'btn btn-primary btn-sm'; |
9 | 10 | } |
10 | 11 | $html .= Html::el('a', $button, $button['text']); |
@@ -8,110 +8,110 @@ discard block |
||
8 | 8 | return false;"> |
9 | 9 | <div class="row"> |
10 | 10 | <?php |
11 | - $i = -1; |
|
12 | - $form = new Ui\Form(); |
|
13 | - foreach ($dataManager->managerOptions['filters'] as $col) { |
|
11 | + $i = -1; |
|
12 | + $form = new Ui\Form(); |
|
13 | + foreach ($dataManager->managerOptions['filters'] as $col) { |
|
14 | 14 | |
15 | - if ($dataManager->modelName) { |
|
16 | - $modelName = $dataManager->modelName; |
|
17 | - $colInfo = $modelName::getColInfo($col); |
|
18 | - } else { |
|
19 | - $colInfo = $dataManager->managerOptions['cols'][$col]; |
|
20 | - } |
|
21 | - $values = []; |
|
22 | - $inputOptions = []; |
|
23 | - if (!empty($dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col])) { |
|
24 | - $colOptions = $dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col]; |
|
25 | - if (!empty($colOptions['userCol'])) { |
|
26 | - if (strpos($colOptions['userCol'], ':')) { |
|
27 | - $rel = substr($colOptions['userCol'], 0, strpos($colOptions['userCol'], ':')); |
|
28 | - $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
|
15 | + if ($dataManager->modelName) { |
|
16 | + $modelName = $dataManager->modelName; |
|
17 | + $colInfo = $modelName::getColInfo($col); |
|
18 | + } else { |
|
19 | + $colInfo = $dataManager->managerOptions['cols'][$col]; |
|
20 | + } |
|
21 | + $values = []; |
|
22 | + $inputOptions = []; |
|
23 | + if (!empty($dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col])) { |
|
24 | + $colOptions = $dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col]; |
|
25 | + if (!empty($colOptions['userCol'])) { |
|
26 | + if (strpos($colOptions['userCol'], ':')) { |
|
27 | + $rel = substr($colOptions['userCol'], 0, strpos($colOptions['userCol'], ':')); |
|
28 | + $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
|
29 | 29 | |
30 | - $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
|
31 | - } else { |
|
32 | - $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
|
33 | - } |
|
34 | - } elseif (!empty($colOptions['value'])) { |
|
35 | - $inputOptions['value'] = $colOptions['value']; |
|
36 | - } |
|
37 | - if (is_array($inputOptions['value'])) { |
|
38 | - $values = $inputOptions['value']; |
|
39 | - foreach ($values as $key => $value) { |
|
40 | - $inputOptions['value'] = $value; |
|
41 | - $form->input('hidden', "datamanagerFilters[{$col}][value][{$key}]", '', $inputOptions); |
|
42 | - } |
|
43 | - } else { |
|
44 | - $form->input('hidden', "datamanagerFilters[{$col}][value]", '', $inputOptions); |
|
45 | - } |
|
46 | - continue; |
|
47 | - } |
|
48 | - if (++$i && !($i % 2)) { |
|
49 | - echo '</div><div class="row">'; |
|
50 | - } |
|
51 | - echo '<div class="col-md-6">'; |
|
52 | - if (!empty($colInfo['colParams']['type'])) { |
|
53 | - switch ($colInfo['colParams']['type']) { |
|
54 | - case'select': |
|
30 | + $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
|
31 | + } else { |
|
32 | + $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
|
33 | + } |
|
34 | + } elseif (!empty($colOptions['value'])) { |
|
35 | + $inputOptions['value'] = $colOptions['value']; |
|
36 | + } |
|
37 | + if (is_array($inputOptions['value'])) { |
|
38 | + $values = $inputOptions['value']; |
|
39 | + foreach ($values as $key => $value) { |
|
40 | + $inputOptions['value'] = $value; |
|
41 | + $form->input('hidden', "datamanagerFilters[{$col}][value][{$key}]", '', $inputOptions); |
|
42 | + } |
|
43 | + } else { |
|
44 | + $form->input('hidden', "datamanagerFilters[{$col}][value]", '', $inputOptions); |
|
45 | + } |
|
46 | + continue; |
|
47 | + } |
|
48 | + if (++$i && !($i % 2)) { |
|
49 | + echo '</div><div class="row">'; |
|
50 | + } |
|
51 | + echo '<div class="col-md-6">'; |
|
52 | + if (!empty($colInfo['colParams']['type'])) { |
|
53 | + switch ($colInfo['colParams']['type']) { |
|
54 | + case'select': |
|
55 | 55 | switch ($colInfo['colParams']['source']) { |
56 | - case 'array': |
|
56 | + case 'array': |
|
57 | 57 | $values = ['' => 'Не важно'] + $colInfo['colParams']['sourceArray']; |
58 | - break; |
|
59 | - case 'method': |
|
58 | + break; |
|
59 | + case 'method': |
|
60 | 60 | if (!empty($colInfo['colParams']['params'])) { |
61 | - $values = call_user_func_array([App::$cur->$colInfo['colParams']['module'], $colInfo['colParams']['method']], $colInfo['colParams']['params']); |
|
62 | - } else { |
|
63 | - $values = ['' => 'Не важно'] + App::$cur->$colInfo['colParams']['module']->$colInfo['colParams']['method'](); |
|
64 | - } |
|
65 | - break; |
|
66 | - case 'model': |
|
61 | + $values = call_user_func_array([App::$cur->$colInfo['colParams']['module'], $colInfo['colParams']['method']], $colInfo['colParams']['params']); |
|
62 | + } else { |
|
63 | + $values = ['' => 'Не важно'] + App::$cur->$colInfo['colParams']['module']->$colInfo['colParams']['method'](); |
|
64 | + } |
|
65 | + break; |
|
66 | + case 'model': |
|
67 | 67 | $values = ['' => 'Не важно'] + $colInfo['colParams']['model']::getList(['forSelect' => true]); |
68 | - break; |
|
69 | - case 'relation': |
|
68 | + break; |
|
69 | + case 'relation': |
|
70 | 70 | $relations = $colInfo['modelName']::relations(); |
71 | - $filters = $relations[$colInfo['colParams']['relation']]['model']::managerFilters(); |
|
72 | - $cols = $relations[$colInfo['colParams']['relation']]['model']::cols(); |
|
73 | - $options = [ |
|
74 | - 'where' => !empty($filters['getRows']['where']) ? $filters['getRows']['where'] : '' |
|
75 | - ]; |
|
76 | - if (isset($cols[$relations[$colInfo['colParams']['relation']]['model']::colPrefix() . 'name'])) { |
|
77 | - $options['order'] = 'name'; |
|
78 | - } |
|
79 | - $items = $relations[$colInfo['colParams']['relation']]['model']::getList($options); |
|
80 | - $values = ['' => 'Не задано']; |
|
81 | - foreach ($items as $key => $item) { |
|
82 | - if (!empty($inputParams['showCol'])) { |
|
83 | - $values[$key] = $item->$inputParams['showCol']; |
|
84 | - } else { |
|
85 | - $values[$key] = $item->name(); |
|
86 | - } |
|
87 | - } |
|
88 | - $values; |
|
89 | - break; |
|
90 | - } |
|
91 | - $value = !empty($_GET['datamanagerFilters'][$col]['value']) ? $_GET['datamanagerFilters'][$col]['value'] : (!empty($params['filters'][$col]['value']) ? $params['filters'][$col]['value'] : ''); |
|
92 | - $inputOptions = ['value' => $value, 'values' => $values, 'multiple' => true]; |
|
93 | - if (!empty($dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col])) { |
|
71 | + $filters = $relations[$colInfo['colParams']['relation']]['model']::managerFilters(); |
|
72 | + $cols = $relations[$colInfo['colParams']['relation']]['model']::cols(); |
|
73 | + $options = [ |
|
74 | + 'where' => !empty($filters['getRows']['where']) ? $filters['getRows']['where'] : '' |
|
75 | + ]; |
|
76 | + if (isset($cols[$relations[$colInfo['colParams']['relation']]['model']::colPrefix() . 'name'])) { |
|
77 | + $options['order'] = 'name'; |
|
78 | + } |
|
79 | + $items = $relations[$colInfo['colParams']['relation']]['model']::getList($options); |
|
80 | + $values = ['' => 'Не задано']; |
|
81 | + foreach ($items as $key => $item) { |
|
82 | + if (!empty($inputParams['showCol'])) { |
|
83 | + $values[$key] = $item->$inputParams['showCol']; |
|
84 | + } else { |
|
85 | + $values[$key] = $item->name(); |
|
86 | + } |
|
87 | + } |
|
88 | + $values; |
|
89 | + break; |
|
90 | + } |
|
91 | + $value = !empty($_GET['datamanagerFilters'][$col]['value']) ? $_GET['datamanagerFilters'][$col]['value'] : (!empty($params['filters'][$col]['value']) ? $params['filters'][$col]['value'] : ''); |
|
92 | + $inputOptions = ['value' => $value, 'values' => $values, 'multiple' => true]; |
|
93 | + if (!empty($dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col])) { |
|
94 | 94 | |
95 | - $inputOptions['disabled'] = true; |
|
96 | - $colOptions = $dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col]; |
|
97 | - if (!empty($colOptions['userCol'])) { |
|
98 | - if (strpos($colOptions['userCol'], ':')) { |
|
99 | - $rel = substr($colOptions['userCol'], 0, strpos($colOptions['userCol'], ':')); |
|
100 | - $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
|
95 | + $inputOptions['disabled'] = true; |
|
96 | + $colOptions = $dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col]; |
|
97 | + if (!empty($colOptions['userCol'])) { |
|
98 | + if (strpos($colOptions['userCol'], ':')) { |
|
99 | + $rel = substr($colOptions['userCol'], 0, strpos($colOptions['userCol'], ':')); |
|
100 | + $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
|
101 | 101 | |
102 | - $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
|
103 | - } else { |
|
104 | - $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
|
105 | - } |
|
106 | - } elseif (!empty($colOptions['value'])) { |
|
102 | + $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
|
103 | + } else { |
|
104 | + $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
|
105 | + } |
|
106 | + } elseif (!empty($colOptions['value'])) { |
|
107 | 107 | |
108 | - $inputOptions['value'] = $colOptions['value']; |
|
109 | - } |
|
110 | - } |
|
111 | - $inputOptions['class'] = 'input-sm'; |
|
112 | - $form->input('select', "datamanagerFilters[{$col}][value]", $colInfo['label'], $inputOptions); |
|
113 | - break; |
|
114 | - case 'email': |
|
108 | + $inputOptions['value'] = $colOptions['value']; |
|
109 | + } |
|
110 | + } |
|
111 | + $inputOptions['class'] = 'input-sm'; |
|
112 | + $form->input('select', "datamanagerFilters[{$col}][value]", $colInfo['label'], $inputOptions); |
|
113 | + break; |
|
114 | + case 'email': |
|
115 | 115 | case 'text': |
116 | 116 | case 'textarea': |
117 | 117 | case 'html': |
@@ -139,40 +139,40 @@ discard block |
||
139 | 139 | ?> |
140 | 140 | <div class="filter_form_field filter_select"> |
141 | 141 | <?php |
142 | - if (!empty($_GET['datamanagerFilters'][$col]['value'])) { |
|
143 | - $value = 1; |
|
144 | - } elseif (isset($_GET['datamanagerFilters'][$col]['value'])) { |
|
145 | - $value = 0; |
|
146 | - } else { |
|
147 | - $value = ''; |
|
148 | - } |
|
149 | - $inputOptions = ['value' => $value, 'values' => [ |
|
150 | - '' => 'Не важно', |
|
151 | - '1' => $colInfo['label'], |
|
152 | - '0' => 'Нет' |
|
153 | - ] |
|
154 | - ]; |
|
155 | - if (!empty($dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col])) { |
|
142 | + if (!empty($_GET['datamanagerFilters'][$col]['value'])) { |
|
143 | + $value = 1; |
|
144 | + } elseif (isset($_GET['datamanagerFilters'][$col]['value'])) { |
|
145 | + $value = 0; |
|
146 | + } else { |
|
147 | + $value = ''; |
|
148 | + } |
|
149 | + $inputOptions = ['value' => $value, 'values' => [ |
|
150 | + '' => 'Не важно', |
|
151 | + '1' => $colInfo['label'], |
|
152 | + '0' => 'Нет' |
|
153 | + ] |
|
154 | + ]; |
|
155 | + if (!empty($dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col])) { |
|
156 | 156 | |
157 | - $inputOptions['disabled'] = true; |
|
158 | - $colOptions = $dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col]; |
|
159 | - if (!empty($colOptions['userCol'])) { |
|
160 | - if (strpos($colOptions['userCol'], ':')) { |
|
161 | - $rel = substr($colOptions['userCol'], 0, strpos($colOptions['userCol'], ':')); |
|
162 | - $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
|
157 | + $inputOptions['disabled'] = true; |
|
158 | + $colOptions = $dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col]; |
|
159 | + if (!empty($colOptions['userCol'])) { |
|
160 | + if (strpos($colOptions['userCol'], ':')) { |
|
161 | + $rel = substr($colOptions['userCol'], 0, strpos($colOptions['userCol'], ':')); |
|
162 | + $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
|
163 | 163 | |
164 | - $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
|
165 | - } else { |
|
166 | - $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
|
167 | - } |
|
168 | - } elseif (!empty($colOptions['value'])) { |
|
164 | + $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
|
165 | + } else { |
|
166 | + $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
|
167 | + } |
|
168 | + } elseif (!empty($colOptions['value'])) { |
|
169 | 169 | |
170 | - $inputOptions['value'] = $colOptions['value']; |
|
171 | - } |
|
172 | - } |
|
173 | - $inputOptions['class'] = 'input-sm'; |
|
174 | - $form->input('select', "datamanagerFilters[{$col}][value]", $colInfo['label'], $inputOptions); |
|
175 | - ?> |
|
170 | + $inputOptions['value'] = $colOptions['value']; |
|
171 | + } |
|
172 | + } |
|
173 | + $inputOptions['class'] = 'input-sm'; |
|
174 | + $form->input('select', "datamanagerFilters[{$col}][value]", $colInfo['label'], $inputOptions); |
|
175 | + ?> |
|
176 | 176 | </div> |
177 | 177 | |
178 | 178 | <?php |
@@ -15,7 +15,8 @@ discard block |
||
15 | 15 | if ($dataManager->modelName) { |
16 | 16 | $modelName = $dataManager->modelName; |
17 | 17 | $colInfo = $modelName::getColInfo($col); |
18 | - } else { |
|
18 | + } |
|
19 | + else { |
|
19 | 20 | $colInfo = $dataManager->managerOptions['cols'][$col]; |
20 | 21 | } |
21 | 22 | $values = []; |
@@ -28,10 +29,12 @@ discard block |
||
28 | 29 | $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
29 | 30 | |
30 | 31 | $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
31 | - } else { |
|
32 | + } |
|
33 | + else { |
|
32 | 34 | $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
33 | 35 | } |
34 | - } elseif (!empty($colOptions['value'])) { |
|
36 | + } |
|
37 | + elseif (!empty($colOptions['value'])) { |
|
35 | 38 | $inputOptions['value'] = $colOptions['value']; |
36 | 39 | } |
37 | 40 | if (is_array($inputOptions['value'])) { |
@@ -40,7 +43,8 @@ discard block |
||
40 | 43 | $inputOptions['value'] = $value; |
41 | 44 | $form->input('hidden', "datamanagerFilters[{$col}][value][{$key}]", '', $inputOptions); |
42 | 45 | } |
43 | - } else { |
|
46 | + } |
|
47 | + else { |
|
44 | 48 | $form->input('hidden', "datamanagerFilters[{$col}][value]", '', $inputOptions); |
45 | 49 | } |
46 | 50 | continue; |
@@ -59,7 +63,8 @@ discard block |
||
59 | 63 | case 'method': |
60 | 64 | if (!empty($colInfo['colParams']['params'])) { |
61 | 65 | $values = call_user_func_array([App::$cur->$colInfo['colParams']['module'], $colInfo['colParams']['method']], $colInfo['colParams']['params']); |
62 | - } else { |
|
66 | + } |
|
67 | + else { |
|
63 | 68 | $values = ['' => 'Не важно'] + App::$cur->$colInfo['colParams']['module']->$colInfo['colParams']['method'](); |
64 | 69 | } |
65 | 70 | break; |
@@ -81,7 +86,8 @@ discard block |
||
81 | 86 | foreach ($items as $key => $item) { |
82 | 87 | if (!empty($inputParams['showCol'])) { |
83 | 88 | $values[$key] = $item->$inputParams['showCol']; |
84 | - } else { |
|
89 | + } |
|
90 | + else { |
|
85 | 91 | $values[$key] = $item->name(); |
86 | 92 | } |
87 | 93 | } |
@@ -100,10 +106,12 @@ discard block |
||
100 | 106 | $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
101 | 107 | |
102 | 108 | $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
103 | - } else { |
|
109 | + } |
|
110 | + else { |
|
104 | 111 | $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
105 | 112 | } |
106 | - } elseif (!empty($colOptions['value'])) { |
|
113 | + } |
|
114 | + elseif (!empty($colOptions['value'])) { |
|
107 | 115 | |
108 | 116 | $inputOptions['value'] = $colOptions['value']; |
109 | 117 | } |
@@ -141,9 +149,11 @@ discard block |
||
141 | 149 | <?php |
142 | 150 | if (!empty($_GET['datamanagerFilters'][$col]['value'])) { |
143 | 151 | $value = 1; |
144 | - } elseif (isset($_GET['datamanagerFilters'][$col]['value'])) { |
|
152 | + } |
|
153 | + elseif (isset($_GET['datamanagerFilters'][$col]['value'])) { |
|
145 | 154 | $value = 0; |
146 | - } else { |
|
155 | + } |
|
156 | + else { |
|
147 | 157 | $value = ''; |
148 | 158 | } |
149 | 159 | $inputOptions = ['value' => $value, 'values' => [ |
@@ -162,10 +172,12 @@ discard block |
||
162 | 172 | $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
163 | 173 | |
164 | 174 | $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
165 | - } else { |
|
175 | + } |
|
176 | + else { |
|
166 | 177 | $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
167 | 178 | } |
168 | - } elseif (!empty($colOptions['value'])) { |
|
179 | + } |
|
180 | + elseif (!empty($colOptions['value'])) { |
|
169 | 181 | |
170 | 182 | $inputOptions['value'] = $colOptions['value']; |
171 | 183 | } |
@@ -134,7 +134,7 @@ |
||
134 | 134 | $categorys = Category::getList(['where' => ['id', implode(',', $treePath), 'IN']]); |
135 | 135 | foreach ($categorys as $category) { |
136 | 136 | if ($category->alias) { |
137 | - $href .="/{$category->alias}"; |
|
137 | + $href .= "/{$category->alias}"; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |
@@ -147,9 +147,11 @@ discard block |
||
147 | 147 | public function resolveTemplate() { |
148 | 148 | if ($this->template !== 'inherit') { |
149 | 149 | return $this->template; |
150 | - } elseif ($this->template == 'inherit' && $this->category) { |
|
150 | + } |
|
151 | + elseif ($this->template == 'inherit' && $this->category) { |
|
151 | 152 | return $this->category->resolveTemplate(true); |
152 | - } else { |
|
153 | + } |
|
154 | + else { |
|
153 | 155 | return 'current'; |
154 | 156 | } |
155 | 157 | } |
@@ -157,9 +159,11 @@ discard block |
||
157 | 159 | public function resolveViewer() { |
158 | 160 | if ($this->viewer !== 'inherit') { |
159 | 161 | return $this->viewer; |
160 | - } elseif ($this->viewer == 'inherit' && $this->category) { |
|
162 | + } |
|
163 | + elseif ($this->viewer == 'inherit' && $this->category) { |
|
161 | 164 | return $this->category->resolveViewer(true); |
162 | - } else { |
|
165 | + } |
|
166 | + else { |
|
163 | 167 | return 'default'; |
164 | 168 | } |
165 | 169 | } |
@@ -33,7 +33,8 @@ discard block |
||
33 | 33 | ['category_id', $category->id], |
34 | 34 | ['alias', $args[count($args) - 1]], |
35 | 35 | ]; |
36 | - } else { |
|
36 | + } |
|
37 | + else { |
|
37 | 38 | $where = [['alias', $path]]; |
38 | 39 | } |
39 | 40 | $material = Materials\Material::get($where); |
@@ -43,7 +44,8 @@ discard block |
||
43 | 44 | ['category_id', $category->id], |
44 | 45 | ['id', (int) $args[count($args) - 1]], |
45 | 46 | ]; |
46 | - } else { |
|
47 | + } |
|
48 | + else { |
|
47 | 49 | $where = [['alias', $path]]; |
48 | 50 | } |
49 | 51 | $material = Materials\Material::get($where); |
@@ -54,12 +56,14 @@ discard block |
||
54 | 56 | $this->categoryAction($category->id); |
55 | 57 | } |
56 | 58 | } |
57 | - } else { |
|
59 | + } |
|
60 | + else { |
|
58 | 61 | $material = Materials\Material::get(1, 'default'); |
59 | 62 | } |
60 | 63 | if ($material) { |
61 | 64 | $this->viewAction($material->id); |
62 | - } elseif (!$category && !$material) { |
|
65 | + } |
|
66 | + elseif (!$category && !$material) { |
|
63 | 67 | Tools::header('404'); |
64 | 68 | $this->view->page([ |
65 | 69 | 'content' => '404', |
@@ -92,7 +96,8 @@ discard block |
||
92 | 96 | 'content' => '404', |
93 | 97 | 'data' => ['text' => 'Такой страницы не найдено'] |
94 | 98 | ]); |
95 | - } else { |
|
99 | + } |
|
100 | + else { |
|
96 | 101 | $this->view->setTitle($category->name); |
97 | 102 | |
98 | 103 | $pages = new Ui\Pages($_GET, ['count' => Materials\Material::getCount(['where' => ['tree_path', $category->tree_path . $category->id . '/%', 'LIKE']]), 'limit' => 10]); |
@@ -135,7 +140,8 @@ discard block |
||
135 | 140 | } |
136 | 141 | if ($material->image) { |
137 | 142 | $this->view->addMetaTag(['property' => 'og:image', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . $material->image->path]); |
138 | - } elseif ($logo = Files\File::get('site_logo', 'code')) { |
|
143 | + } |
|
144 | + elseif ($logo = Files\File::get('site_logo', 'code')) { |
|
139 | 145 | $this->view->addMetaTag(['property' => 'og:image', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . $logo->path]); |
140 | 146 | } |
141 | 147 | $this->view->setTitle($material->name); |
@@ -2,10 +2,10 @@ discard block |
||
2 | 2 | <div class="row"> |
3 | 3 | <div class="col-md-3"> |
4 | 4 | <?php |
5 | - \Ui\Tree::ul($category->getRoot(), 0, function($category) { |
|
6 | - echo "<a href='{$category->getHref()}'> {$category->name()}</a>"; |
|
7 | - }); |
|
8 | - ?> |
|
5 | + \Ui\Tree::ul($category->getRoot(), 0, function($category) { |
|
6 | + echo "<a href='{$category->getHref()}'> {$category->name()}</a>"; |
|
7 | + }); |
|
8 | + ?> |
|
9 | 9 | </div> |
10 | 10 | <div class="col-md-9"> |
11 | 11 | <div class="content"> |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | <div class ="category-materials"> |
17 | 17 | <div class ="row"> |
18 | 18 | <?php |
19 | - $i = 0; |
|
20 | - foreach ($materials as $material) { |
|
21 | - ?> |
|
19 | + $i = 0; |
|
20 | + foreach ($materials as $material) { |
|
21 | + ?> |
|
22 | 22 | <div class = "col-sm-6 category-material"> |
23 | 23 | <a class="category-material-name" href ="<?= $material->getHref(); ?>"><h3><?= $material->name; ?></h3></a> |
24 | 24 | <div class="category-material-preview"><?= $material->preview; ?></div> |
@@ -2,11 +2,11 @@ |
||
2 | 2 | <div class="row"> |
3 | 3 | <div class="col-md-3"> |
4 | 4 | <?php |
5 | - $category = $material->category; |
|
6 | - \Ui\Tree::ul($category->getRoot(), 0, function($category) { |
|
7 | - echo "<a href='{$category->getHref()}'> {$category->name()}</a>"; |
|
8 | - }); |
|
9 | - ?> |
|
5 | + $category = $material->category; |
|
6 | + \Ui\Tree::ul($category->getRoot(), 0, function($category) { |
|
7 | + echo "<a href='{$category->getHref()}'> {$category->name()}</a>"; |
|
8 | + }); |
|
9 | + ?> |
|
10 | 10 | </div> |
11 | 11 | <div class="col-md-9"> |
12 | 12 | <div class="content"> |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | <!-- Indicators --> |
15 | 15 | <ol class="carousel-indicators"> |
16 | 16 | <?php |
17 | - $i = 0; |
|
18 | - for ($i = 0; $i < count($slides); $i++) { |
|
19 | - ?> |
|
17 | + $i = 0; |
|
18 | + for ($i = 0; $i < count($slides); $i++) { |
|
19 | + ?> |
|
20 | 20 | <li data-target="#sliderWidget-<?= $slider->id; ?>" data-slide-to="<?= $i; ?>" <?= !$i ? 'class="active"' : ''; ?>></li> |
21 | 21 | <?php |
22 | 22 | } |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | <!-- Wrapper for slides --> |
28 | 28 | <div class="carousel-inner" role="listbox"> |
29 | 29 | <?php |
30 | - $i = 0; |
|
31 | - foreach ($slides as $item) { |
|
32 | - ?> |
|
30 | + $i = 0; |
|
31 | + foreach ($slides as $item) { |
|
32 | + ?> |
|
33 | 33 | <div class="item <?= !$i ? 'active' : ''; ?>"> |
34 | 34 | <?php |
35 | - if ($item->link) { |
|
36 | - echo "<a href = '{$item->link}' style = 'display:inline-block;'>"; |
|
37 | - } |
|
38 | - ?> |
|
35 | + if ($item->link) { |
|
36 | + echo "<a href = '{$item->link}' style = 'display:inline-block;'>"; |
|
37 | + } |
|
38 | + ?> |
|
39 | 39 | <img src="<?= Statics::file($item->image->path); ?>" alt="<?= $item->name; ?>"> |
40 | 40 | <div class="carousel-caption"> |
41 | 41 | <?= $item->description; ?> |