@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $type = substr($path, 0, strpos($path, '/')); |
| 53 | 53 | switch ($type) { |
| 54 | 54 | case 'libs': |
| 55 | - return App::$cur->Libs->getPath(array_slice(explode('/', $path),2)); |
|
| 55 | + return App::$cur->Libs->getPath(array_slice(explode('/', $path), 2)); |
|
| 56 | 56 | break; |
| 57 | 57 | case 'templates': |
| 58 | 58 | $path = substr($path, strpos($path, '/') + 1); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $fileName = $fileinfo['filename'] . '.' . $fileinfo['extension']; |
| 190 | 190 | if (App::$cur->db->connect) { |
| 191 | - $fileObj = Files\File::get([ 'path', '%/' . $fileinfo['filename'] . '.' . $fileinfo['extension'], 'LIKE']); |
|
| 191 | + $fileObj = Files\File::get(['path', '%/' . $fileinfo['filename'] . '.' . $fileinfo['extension'], 'LIKE']); |
|
| 192 | 192 | if ($fileObj) { |
| 193 | 193 | $fileName = $fileObj->original_name; |
| 194 | 194 | } |
@@ -112,10 +112,11 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | $sizes = explode('x', $_GET['resize']); |
| 114 | 114 | $sizes[0] = intval($sizes[0]); |
| 115 | - if (isset($sizes[1])) |
|
| 116 | - $sizes[1] = intval($sizes[1]); |
|
| 117 | - else |
|
| 118 | - $sizes[1] = 0; |
|
| 115 | + if (isset($sizes[1])) { |
|
| 116 | + $sizes[1] = intval($sizes[1]); |
|
| 117 | + } else { |
|
| 118 | + $sizes[1] = 0; |
|
| 119 | + } |
|
| 119 | 120 | |
| 120 | 121 | if (!$sizes[0] || !$sizes[1]) { |
| 121 | 122 | header('HTTP/1.1 404 Not Found'); |
@@ -127,15 +128,16 @@ discard block |
||
| 127 | 128 | $dir = App::$primary->path; |
| 128 | 129 | |
| 129 | 130 | if (!empty($_GET['resize_crop'])) { |
| 130 | - if (in_array($_GET['resize_crop'], array('q', 'c'))) |
|
| 131 | - $crop = $_GET['resize_crop']; |
|
| 132 | - else |
|
| 133 | - $crop = 'c'; |
|
| 131 | + if (in_array($_GET['resize_crop'], array('q', 'c'))) { |
|
| 132 | + $crop = $_GET['resize_crop']; |
|
| 133 | + } else { |
|
| 134 | + $crop = 'c'; |
|
| 135 | + } |
|
| 136 | + } elseif (!empty($_GET['resize_quadro'])) { |
|
| 137 | + $crop = 'q'; |
|
| 138 | + } else { |
|
| 139 | + $crop = ''; |
|
| 134 | 140 | } |
| 135 | - elseif (!empty($_GET['resize_quadro'])) |
|
| 136 | - $crop = 'q'; |
|
| 137 | - else |
|
| 138 | - $crop = ''; |
|
| 139 | 141 | $pos = 'center'; |
| 140 | 142 | if (!empty($_GET['resize_pos']) && in_array($_GET['resize_pos'], array('top', 'center'))) { |
| 141 | 143 | $pos = $_GET['resize_pos']; |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Text blocks module |
|
| 4 | - * |
|
| 5 | - * @author Alexey Krupskiy <[email protected]> |
|
| 6 | - * @link http://inji.ru/ |
|
| 7 | - * @copyright 2015 Alexey Krupskiy |
|
| 8 | - * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE |
|
| 9 | - */ |
|
| 3 | + * Text blocks module |
|
| 4 | + * |
|
| 5 | + * @author Alexey Krupskiy <[email protected]> |
|
| 6 | + * @link http://inji.ru/ |
|
| 7 | + * @copyright 2015 Alexey Krupskiy |
|
| 8 | + * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE |
|
| 9 | + */ |
|
| 10 | 10 | class TextBlocks extends Module |
| 11 | 11 | { |
| 12 | 12 | function init() |
@@ -58,7 +58,7 @@ |
||
| 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', 'desc']]) as $comment) { |
@@ -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> |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | $this->model->_params[$modelName::index()] = 0; |
| 74 | 74 | } |
| 75 | 75 | $relOptions['model']::fixPrefix($relOptions['col']); |
| 76 | - $inputs[$col] = new ActiveForm(new $relOptions['model']([ $relOptions['col'] => &$this->model->_params[$modelName::index()]]), $colPath[2]); |
|
| 76 | + $inputs[$col] = new ActiveForm(new $relOptions['model']([$relOptions['col'] => &$this->model->_params[$modelName::index()]]), $colPath[2]); |
|
| 77 | 77 | } |
| 78 | 78 | $inputs[$col]->parent = $this; |
| 79 | 79 | } elseif (!empty($modelName::$cols[$col])) { |
@@ -397,7 +397,7 @@ |
||
| 397 | 397 | return $item->$colName; |
| 398 | 398 | } |
| 399 | 399 | } elseif (!empty($modelName::$cols[$colName]['type'])) { |
| 400 | - if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
| 400 | + if (\App::$cur->name == 'admin' && $originalCol == 'name' || ($dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
| 401 | 401 | $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager'; |
| 402 | 402 | $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
| 403 | 403 | return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($originalItem)) . "/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * Construct new data manager |
| 29 | 29 | * |
| 30 | 30 | * @param string $modelName |
| 31 | - * @param string|array $dataManager |
|
| 31 | + * @param string $dataManager |
|
| 32 | 32 | * @throws Exception |
| 33 | 33 | */ |
| 34 | 34 | public function __construct($modelName, $dataManager = 'manager') |
@@ -330,6 +330,9 @@ discard block |
||
| 330 | 330 | return $rows; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | + /** |
|
| 334 | + * @param DataManager $dataManager |
|
| 335 | + */ |
|
| 333 | 336 | public static function drawCol($item, $colName, $params = [], $dataManager = null, $originalCol = '', $originalItem = null) |
| 334 | 337 | { |
| 335 | 338 | $modelName = get_class($item); |
@@ -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 |
@@ -34,10 +34,11 @@ |
||
| 34 | 34 | $this->params['page'] = 1; |
| 35 | 35 | if (!empty($this->data['page'])) { |
| 36 | 36 | $this->params['page'] = (int) $this->data['page']; |
| 37 | - if ($this->params['page'] <= 0) |
|
| 38 | - $this->params['page'] = 1; |
|
| 39 | - elseif ($this->params['page'] > ceil($this->options['count'] / $this->params['limit'])) |
|
| 40 | - $this->params['page'] = ceil($this->options['count'] / $this->params['limit']); |
|
| 37 | + if ($this->params['page'] <= 0) { |
|
| 38 | + $this->params['page'] = 1; |
|
| 39 | + } elseif ($this->params['page'] > ceil($this->options['count'] / $this->params['limit'])) { |
|
| 40 | + $this->params['page'] = ceil($this->options['count'] / $this->params['limit']); |
|
| 41 | + } |
|
| 41 | 42 | } |
| 42 | 43 | |
| 43 | 44 | $this->params['start'] = $this->params['page'] * $this->params['limit'] - $this->params['limit']; |
@@ -3,38 +3,38 @@ |
||
| 3 | 3 | ?> |
| 4 | 4 | <div id ='<?= $id; ?>' class="uiActiveForm" data-modelname="<?= $activeForm->modelName; ?>" data-formname="<?= $activeForm->formName; ?>" data-inputs='<?= json_encode($activeForm->inputs); ?>'> |
| 5 | 5 | <?php |
| 6 | - if ($activeForm->parent === null) { |
|
| 7 | - $form->action = $activeForm->action; |
|
| 8 | - $form->begin($activeForm->header, ['onsubmit' => $ajax ? 'inji.Ui.forms.submitAjax(this);return false;' : '']); |
|
| 9 | - } elseif ($activeForm->header) { |
|
| 10 | - echo "<h3>{$activeForm->header}</h3>"; |
|
| 11 | - } |
|
| 12 | - if (empty($activeForm->form['noMapCell'])) { |
|
| 13 | - foreach ($activeForm->form['map'] as $row) { |
|
| 14 | - $colSize = 12 / count($row); |
|
| 15 | - echo "<div class ='row'>"; |
|
| 16 | - foreach ($row as $col) { |
|
| 17 | - echo "<div class = 'col-sm-{$colSize}'>"; |
|
| 18 | - if ($col) { |
|
| 19 | - $activeForm->drawCol($col, $activeForm->inputs[$col], $form, $params); |
|
| 20 | - } |
|
| 21 | - echo '</div>'; |
|
| 22 | - } |
|
| 23 | - echo '</div>'; |
|
| 24 | - } |
|
| 25 | - } else { |
|
| 26 | - foreach ($activeForm->form['map'] as $row) { |
|
| 27 | - foreach ($row as $col) { |
|
| 28 | - if ($col) { |
|
| 29 | - $activeForm->drawCol($col, $activeForm->inputs[$col], $form, $params); |
|
| 30 | - } |
|
| 31 | - } |
|
| 32 | - } |
|
| 33 | - } |
|
| 34 | - if ($activeForm->parent === null) { |
|
| 35 | - $form->end($activeForm->model ? ($activeForm->model->pk() ? 'Сохранить' : 'Создать') : 'Отправить'); |
|
| 36 | - } |
|
| 37 | - ?> |
|
| 6 | + if ($activeForm->parent === null) { |
|
| 7 | + $form->action = $activeForm->action; |
|
| 8 | + $form->begin($activeForm->header, ['onsubmit' => $ajax ? 'inji.Ui.forms.submitAjax(this);return false;' : '']); |
|
| 9 | + } elseif ($activeForm->header) { |
|
| 10 | + echo "<h3>{$activeForm->header}</h3>"; |
|
| 11 | + } |
|
| 12 | + if (empty($activeForm->form['noMapCell'])) { |
|
| 13 | + foreach ($activeForm->form['map'] as $row) { |
|
| 14 | + $colSize = 12 / count($row); |
|
| 15 | + echo "<div class ='row'>"; |
|
| 16 | + foreach ($row as $col) { |
|
| 17 | + echo "<div class = 'col-sm-{$colSize}'>"; |
|
| 18 | + if ($col) { |
|
| 19 | + $activeForm->drawCol($col, $activeForm->inputs[$col], $form, $params); |
|
| 20 | + } |
|
| 21 | + echo '</div>'; |
|
| 22 | + } |
|
| 23 | + echo '</div>'; |
|
| 24 | + } |
|
| 25 | + } else { |
|
| 26 | + foreach ($activeForm->form['map'] as $row) { |
|
| 27 | + foreach ($row as $col) { |
|
| 28 | + if ($col) { |
|
| 29 | + $activeForm->drawCol($col, $activeForm->inputs[$col], $form, $params); |
|
| 30 | + } |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | + } |
|
| 34 | + if ($activeForm->parent === null) { |
|
| 35 | + $form->end($activeForm->model ? ($activeForm->model->pk() ? 'Сохранить' : 'Создать') : 'Отправить'); |
|
| 36 | + } |
|
| 37 | + ?> |
|
| 38 | 38 | </div> |
| 39 | 39 | <script> |
| 40 | 40 | inji.onLoad(function () { |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | 'style' => '' |
| 23 | 23 | ]; |
| 24 | 24 | if (!empty($dataManager->managerOptions['categorys'])) { |
| 25 | - $mainCol['style'].='margin-left:260px;'; |
|
| 25 | + $mainCol['style'] .= 'margin-left:260px;'; |
|
| 26 | 26 | echo '<div class ="pull-left dataManager-categorys" style = "width:250px;">'; |
| 27 | 27 | $this->widget('Ui\DataManager/categorys', compact('dataManager')); |
| 28 | 28 | echo '</div>'; |
@@ -127,40 +127,40 @@ |
||
| 127 | 127 | ?> |
| 128 | 128 | <div class="filter_form_field filter_select"> |
| 129 | 129 | <?php |
| 130 | - if (!empty($_GET['datamanagerFilters'][$col]['value'])) { |
|
| 131 | - $value = 1; |
|
| 132 | - } elseif (isset($_GET['datamanagerFilters'][$col]['value'])) { |
|
| 133 | - $value = 0; |
|
| 134 | - } else { |
|
| 135 | - $value = ''; |
|
| 136 | - } |
|
| 137 | - $inputOptions = ['value' => $value, 'values' => [ |
|
| 138 | - '' => 'Не важно', |
|
| 139 | - '1' => $colInfo['label'], |
|
| 140 | - '0' => 'Нет' |
|
| 141 | - ] |
|
| 142 | - ]; |
|
| 143 | - if (!empty($dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col])) { |
|
| 130 | + if (!empty($_GET['datamanagerFilters'][$col]['value'])) { |
|
| 131 | + $value = 1; |
|
| 132 | + } elseif (isset($_GET['datamanagerFilters'][$col]['value'])) { |
|
| 133 | + $value = 0; |
|
| 134 | + } else { |
|
| 135 | + $value = ''; |
|
| 136 | + } |
|
| 137 | + $inputOptions = ['value' => $value, 'values' => [ |
|
| 138 | + '' => 'Не важно', |
|
| 139 | + '1' => $colInfo['label'], |
|
| 140 | + '0' => 'Нет' |
|
| 141 | + ] |
|
| 142 | + ]; |
|
| 143 | + if (!empty($dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col])) { |
|
| 144 | 144 | |
| 145 | - $inputOptions['disabled'] = true; |
|
| 146 | - $colOptions = $dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col]; |
|
| 147 | - if (!empty($colOptions['userCol'])) { |
|
| 148 | - if (strpos($colOptions['userCol'], ':')) { |
|
| 149 | - $rel = substr($colOptions['userCol'], 0, strpos($colOptions['userCol'], ':')); |
|
| 150 | - $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
|
| 145 | + $inputOptions['disabled'] = true; |
|
| 146 | + $colOptions = $dataManager->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'][$col]; |
|
| 147 | + if (!empty($colOptions['userCol'])) { |
|
| 148 | + if (strpos($colOptions['userCol'], ':')) { |
|
| 149 | + $rel = substr($colOptions['userCol'], 0, strpos($colOptions['userCol'], ':')); |
|
| 150 | + $param = substr($colOptions['userCol'], strpos($colOptions['userCol'], ':') + 1); |
|
| 151 | 151 | |
| 152 | - $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
|
| 153 | - } else { |
|
| 154 | - $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
|
| 155 | - } |
|
| 156 | - } elseif (!empty($colOptions['value'])) { |
|
| 152 | + $inputOptions['value'] = \Users\User::$cur->$rel->$param; |
|
| 153 | + } else { |
|
| 154 | + $this->model->$col = \Users\User::$cur->{$preset['userCol']}; |
|
| 155 | + } |
|
| 156 | + } elseif (!empty($colOptions['value'])) { |
|
| 157 | 157 | |
| 158 | - $inputOptions['value'] = $colOptions['value']; |
|
| 159 | - } |
|
| 160 | - } |
|
| 161 | - $inputOptions['class'] = 'input-sm'; |
|
| 162 | - $form->input('select', "datamanagerFilters[{$col}][value]", $colInfo['label'], $inputOptions); |
|
| 163 | - ?> |
|
| 158 | + $inputOptions['value'] = $colOptions['value']; |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + $inputOptions['class'] = 'input-sm'; |
|
| 162 | + $form->input('select', "datamanagerFilters[{$col}][value]", $colInfo['label'], $inputOptions); |
|
| 163 | + ?> |
|
| 164 | 164 | </div> |
| 165 | 165 | |
| 166 | 166 | <?php |