@@ -45,7 +45,8 @@ discard block |
||
45 | 45 | $colName = empty($this->colParams['col']) ? $this->colName : $this->colParams['col']; |
46 | 46 | if (isset($request[$this->colName])) { |
47 | 47 | $this->activeForm->model->{$colName} = $request[$this->colName]; |
48 | - } else { |
|
48 | + } |
|
49 | + else { |
|
49 | 50 | $this->activeForm->model->{$colName} = 0; |
50 | 51 | $this->activeForm->model->{$colName} = ''; |
51 | 52 | } |
@@ -70,7 +71,8 @@ discard block |
||
70 | 71 | $value = ''; |
71 | 72 | if (!empty($preset['value'])) { |
72 | 73 | $value = $preset['value']; |
73 | - } elseif (!empty($preset['userCol'])) { |
|
74 | + } |
|
75 | + elseif (!empty($preset['userCol'])) { |
|
74 | 76 | if (strpos($preset['userCol'], ':')) { |
75 | 77 | $rel = substr($preset['userCol'], 0, strpos($preset['userCol'], ':')); |
76 | 78 | $param = substr($preset['userCol'], strpos($preset['userCol'], ':') + 1); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | $count += count($items); |
32 | 32 | foreach ($items as $objectChild) { |
33 | - $count+=static::showLi($objectChild, 1, $maxDeep, $hrefFunc, $order); |
|
33 | + $count += static::showLi($objectChild, 1, $maxDeep, $hrefFunc, $order); |
|
34 | 34 | } |
35 | 35 | ?> |
36 | 36 | </ul> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | echo \Html::el('li', $attributes, $item, true); |
62 | 62 | echo '<ul>'; |
63 | 63 | } |
64 | - $count+=static::showLi($objectChild, $deep + 1, $maxDeep, $hrefFunc, $order); |
|
64 | + $count += static::showLi($objectChild, $deep + 1, $maxDeep, $hrefFunc, $order); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | if ($isset) { |
@@ -24,7 +24,8 @@ discard block |
||
24 | 24 | <?php |
25 | 25 | if (is_string($objectRoot)) { |
26 | 26 | $items = $objectRoot::getList(['where' => ['parent_id', 0]]); |
27 | - } else { |
|
27 | + } |
|
28 | + else { |
|
28 | 29 | $class = get_class($objectRoot); |
29 | 30 | $items = $class::getList(['where' => ['parent_id', $objectRoot->pk()], 'order' => $order]); |
30 | 31 | } |
@@ -66,7 +67,8 @@ discard block |
||
66 | 67 | } |
67 | 68 | if ($isset) { |
68 | 69 | echo '</ul></li>'; |
69 | - } else { |
|
70 | + } |
|
71 | + else { |
|
70 | 72 | echo \Html::el('li', $attributes, $item); |
71 | 73 | } |
72 | 74 | return $count; |
@@ -30,15 +30,18 @@ |
||
30 | 30 | $this->params['page'] = 0; |
31 | 31 | $this->params['pages'] = 0; |
32 | 32 | $this->params['start'] = 0; |
33 | - } else { |
|
33 | + } |
|
34 | + else { |
|
34 | 35 | $this->params['pages'] = ceil($this->options['count'] / $this->params['limit']); |
35 | 36 | $this->params['page'] = 1; |
36 | 37 | if (!empty($this->data['page'])) { |
37 | 38 | $this->params['page'] = (int) $this->data['page']; |
38 | - if ($this->params['page'] <= 0) |
|
39 | - $this->params['page'] = 1; |
|
40 | - elseif ($this->params['page'] > ceil($this->options['count'] / $this->params['limit'])) |
|
41 | - $this->params['page'] = ceil($this->options['count'] / $this->params['limit']); |
|
39 | + if ($this->params['page'] <= 0) { |
|
40 | + $this->params['page'] = 1; |
|
41 | + } |
|
42 | + elseif ($this->params['page'] > ceil($this->options['count'] / $this->params['limit'])) { |
|
43 | + $this->params['page'] = ceil($this->options['count'] / $this->params['limit']); |
|
44 | + } |
|
42 | 45 | } |
43 | 46 | |
44 | 47 | $this->params['start'] = $this->params['page'] * $this->params['limit'] - $this->params['limit']; |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | $raw = explode(':', $item); |
24 | 24 | $return['modelName'] = $raw[0]; |
25 | 25 | $return['model'] = $return['modelName']::get($raw[1], $return['modelName']::index(), $return['params']); |
26 | - } else { |
|
26 | + } |
|
27 | + else { |
|
27 | 28 | $return['modelName'] = $item; |
28 | 29 | $return['model'] = null; |
29 | 30 | } |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | $relation = $return['modelName']::getRelation($return['params']['relation']); |
33 | 34 | if (!empty($relation['type']) && $relation['type'] == 'relModel') { |
34 | 35 | $return['modelName'] = $relation['relModel']; |
35 | - } else { |
|
36 | + } |
|
37 | + else { |
|
36 | 38 | $return['modelName'] = $relation['model']; |
37 | 39 | } |
38 | 40 | } |
@@ -131,7 +133,8 @@ discard block |
||
131 | 133 | } |
132 | 134 | echo "\n"; |
133 | 135 | $endRow = true; |
134 | - } else { |
|
136 | + } |
|
137 | + else { |
|
135 | 138 | Ui\Table::drawRow($row); |
136 | 139 | } |
137 | 140 | } |
@@ -220,7 +223,8 @@ discard block |
||
220 | 223 | $actionParams = $actions[$request['action']]; |
221 | 224 | if (!empty($actionParams['access']['groups']) && !in_array(\Users\User::$cur->group_id, $actionParams['access']['groups'])) { |
222 | 225 | $result->content = 'У вас нет прав доступа к операции ' . (!isset($actionParams['name']) ? $actionParams['className']::$name : $actionParams['name']); |
223 | - } else { |
|
226 | + } |
|
227 | + else { |
|
224 | 228 | try { |
225 | 229 | $result->successMsg = $actionParams['className']::groupAction($dataManager, $ids, $actionParams, !empty($_GET['adInfo']) ? $_GET['adInfo'] : []); |
226 | 230 | $result->success = true; |
@@ -230,7 +234,8 @@ discard block |
||
230 | 234 | } |
231 | 235 | } |
232 | 236 | } |
233 | - } else { |
|
237 | + } |
|
238 | + else { |
|
234 | 239 | $result->content = 'У вас нет прав доступа к менеджеру ' . $request['managerName'] . ' модели ' . $request['modelName']; |
235 | 240 | } |
236 | 241 | $result->send(); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $showedInput = count($aditionalInputs) - 1; |
24 | 24 | $aditionValue = !empty($options['aditionalValue']) ? $options['aditionalValue'] : ''; |
25 | 25 | } |
26 | - $optionsHtml .= "<option data-aditionalInput='" . ( count($aditionalInputs) - 1) . "' value ='{$key}'{$selected}>{$value['text']}</option>"; |
|
26 | + $optionsHtml .= "<option data-aditionalInput='" . (count($aditionalInputs) - 1) . "' value ='{$key}'{$selected}>{$value['text']}</option>"; |
|
27 | 27 | } else { |
28 | 28 | $optionsHtml .= "<option value ='{$key}'{$selected}>{$value}</option>"; |
29 | 29 | } |
@@ -24,7 +24,8 @@ discard block |
||
24 | 24 | $aditionValue = !empty($options['aditionalValue']) ? $options['aditionalValue'] : ''; |
25 | 25 | } |
26 | 26 | $optionsHtml .= "<option data-aditionalInput='" . ( count($aditionalInputs) - 1) . "' value ='{$key}'{$selected}>{$value['text']}</option>"; |
27 | - } else { |
|
27 | + } |
|
28 | + else { |
|
28 | 29 | $optionsHtml .= "<option value ='{$key}'{$selected}>{$value}</option>"; |
29 | 30 | } |
30 | 31 | } |
@@ -47,7 +48,8 @@ discard block |
||
47 | 48 | if ($key !== $showedInput) { |
48 | 49 | $input['options']['disabled'] = true; |
49 | 50 | $input['options']['class'] = !empty($input['options']['class']) ? $input['options']['class'] . ' hidden' : 'hidden'; |
50 | - } else { |
|
51 | + } |
|
52 | + else { |
|
51 | 53 | $input['options']['value'] = empty($input['options']['value']) ? $aditionValue : $input['options']['value']; |
52 | 54 | } |
53 | 55 | if ($input['type'] == 'select') { |
@@ -16,61 +16,61 @@ |
||
16 | 16 | <thead> |
17 | 17 | <tr> |
18 | 18 | <?php |
19 | - foreach ($options['cols'] as $colName => $col) { |
|
20 | - if (!empty($col['hidden'])) { |
|
21 | - continue; |
|
22 | - } |
|
23 | - echo "<th>"; |
|
24 | - echo $col['col']['label']; |
|
25 | - if (!empty($col['col']['model'])) { |
|
26 | - $modelName = $col['col']['model']; |
|
27 | - $onclick = 'inji.Ui.forms.popUp(\'' . addslashes($modelName) . '\',{},function(elem){' |
|
28 | - . 'return function(data,modal){inji.Ui.forms.submitAjax($(elem).closest(\'form\')[0], {notSave: true});}}(this));return false;'; |
|
29 | - echo ' (<a href="" onclick="' . $onclick . ';this.disabled=true;return false;">Создать</a>)'; |
|
30 | - } |
|
31 | - echo "</th>"; |
|
32 | - } |
|
33 | - ?> |
|
19 | + foreach ($options['cols'] as $colName => $col) { |
|
20 | + if (!empty($col['hidden'])) { |
|
21 | + continue; |
|
22 | + } |
|
23 | + echo "<th>"; |
|
24 | + echo $col['col']['label']; |
|
25 | + if (!empty($col['col']['model'])) { |
|
26 | + $modelName = $col['col']['model']; |
|
27 | + $onclick = 'inji.Ui.forms.popUp(\'' . addslashes($modelName) . '\',{},function(elem){' |
|
28 | + . 'return function(data,modal){inji.Ui.forms.submitAjax($(elem).closest(\'form\')[0], {notSave: true});}}(this));return false;'; |
|
29 | + echo ' (<a href="" onclick="' . $onclick . ';this.disabled=true;return false;">Создать</a>)'; |
|
30 | + } |
|
31 | + echo "</th>"; |
|
32 | + } |
|
33 | + ?> |
|
34 | 34 | <td> </td> |
35 | 35 | </tr> |
36 | 36 | </thead> |
37 | 37 | <tbody class="listBody"> |
38 | 38 | <?php |
39 | - $i = 0; |
|
40 | - if (!empty($options['values'])) { |
|
41 | - foreach ($options['values'] as $row) { |
|
42 | - echo '<tr>'; |
|
43 | - foreach ($options['cols'] as $colName => $col) { |
|
44 | - $input = clone $col['input']; |
|
45 | - if (empty($col['hidden'])) { |
|
46 | - echo '<td>'; |
|
47 | - } |
|
48 | - $input->options['noContainer'] = true; |
|
49 | - $input->colParams['label'] = false; |
|
50 | - $input->colParams['value'] = $row[$colName]; |
|
51 | - $input->colName .= '[' . $colName . '][' . ($i) . ']'; |
|
52 | - $input->draw(); |
|
53 | - if (empty($col['hidden'])) { |
|
54 | - echo '</td>'; |
|
55 | - } |
|
56 | - } |
|
57 | - $i++; |
|
58 | - echo '<td class="actionTd"><a class="btn btn-danger btn-xs" onclick="inji.Ui.forms.delRowFromList(this);"><i class="glyphicon glyphicon-remove"></i></a></td>'; |
|
59 | - echo '</tr>'; |
|
60 | - } |
|
61 | - } |
|
62 | - ?> |
|
39 | + $i = 0; |
|
40 | + if (!empty($options['values'])) { |
|
41 | + foreach ($options['values'] as $row) { |
|
42 | + echo '<tr>'; |
|
43 | + foreach ($options['cols'] as $colName => $col) { |
|
44 | + $input = clone $col['input']; |
|
45 | + if (empty($col['hidden'])) { |
|
46 | + echo '<td>'; |
|
47 | + } |
|
48 | + $input->options['noContainer'] = true; |
|
49 | + $input->colParams['label'] = false; |
|
50 | + $input->colParams['value'] = $row[$colName]; |
|
51 | + $input->colName .= '[' . $colName . '][' . ($i) . ']'; |
|
52 | + $input->draw(); |
|
53 | + if (empty($col['hidden'])) { |
|
54 | + echo '</td>'; |
|
55 | + } |
|
56 | + } |
|
57 | + $i++; |
|
58 | + echo '<td class="actionTd"><a class="btn btn-danger btn-xs" onclick="inji.Ui.forms.delRowFromList(this);"><i class="glyphicon glyphicon-remove"></i></a></td>'; |
|
59 | + echo '</tr>'; |
|
60 | + } |
|
61 | + } |
|
62 | + ?> |
|
63 | 63 | </tbody> |
64 | 64 | <tfoot> |
65 | 65 | <tr> |
66 | 66 | <?php |
67 | - foreach ($options['cols'] as $colName => $col) { |
|
68 | - if (!empty($col['hidden'])) { |
|
69 | - continue; |
|
70 | - } |
|
71 | - echo "<th>{$col['col']['label']}</th>"; |
|
72 | - } |
|
73 | - ?> |
|
67 | + foreach ($options['cols'] as $colName => $col) { |
|
68 | + if (!empty($col['hidden'])) { |
|
69 | + continue; |
|
70 | + } |
|
71 | + echo "<th>{$col['col']['label']}</th>"; |
|
72 | + } |
|
73 | + ?> |
|
74 | 74 | <td> </td> |
75 | 75 | </tr> |
76 | 76 | </tfoot> |
@@ -87,7 +87,7 @@ |
||
87 | 87 | } |
88 | 88 | $col['input']->options['noContainer'] = true; |
89 | 89 | $col['input']->colParams['label'] = false; |
90 | - $col['input']->colName.="[{$colName}][]"; |
|
90 | + $col['input']->colName .= "[{$colName}][]"; |
|
91 | 91 | $col['input']->draw(); |
92 | 92 | if (empty($col['hidden'])) { |
93 | 93 | echo '</td>'; |
@@ -43,7 +43,8 @@ |
||
43 | 43 | function INJI_SYSTEM_ERROR($msg, $fatal = false) { |
44 | 44 | if ($fatal) { |
45 | 45 | exit("<div style = 'text-align:center;font-size:20px;margin-top:25%;'>{$msg}</div>"); |
46 | - } else { |
|
46 | + } |
|
47 | + else { |
|
47 | 48 | echo "<div style = 'text-align:center;font-size:20px;margin-top:25%;'>{$msg}</div>"; |
48 | 49 | } |
49 | 50 | } |
@@ -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 |
@@ -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 | } |