@@ -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 | ?> |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $model->save(); |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | - return 'Измненено <b>' . $count . '</b> ' . \Tools::getNumEnding($count, ['запись', 'записи', 'записей']); |
|
| 32 | + return 'Измненено <b>'.$count.'</b> '.\Tools::getNumEnding($count, ['запись', 'записи', 'записей']); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | ob_end_clean(); |
| 97 | 97 | header('Content-Encoding: UTF-8'); |
| 98 | 98 | header("Content-Type: text/csv"); |
| 99 | - header("Content-Disposition: attachment; filename=" . $request['modelName']::$objectName . '.csv'); |
|
| 99 | + header("Content-Disposition: attachment; filename=".$request['modelName']::$objectName.'.csv'); |
|
| 100 | 100 | echo "\xEF\xBB\xBF"; // UTF-8 BOM |
| 101 | 101 | |
| 102 | 102 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | echo ";"; |
| 109 | 109 | } |
| 110 | 110 | $endRow = false; |
| 111 | - echo '"' . $options['label'] . '"'; |
|
| 111 | + echo '"'.$options['label'].'"'; |
|
| 112 | 112 | } |
| 113 | 113 | echo "\n"; |
| 114 | 114 | $endRow = true; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | echo ";"; |
| 123 | 123 | } |
| 124 | 124 | $endRow = false; |
| 125 | - echo '"' . str_replace(["\n", '"'], ['“'], $col) . '"'; |
|
| 125 | + echo '"'.str_replace(["\n", '"'], ['“'], $col).'"'; |
|
| 126 | 126 | } |
| 127 | 127 | echo "\n"; |
| 128 | 128 | $endRow = true; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $pages = $dataManager->getPages($request['params'], $request['model']); |
| 144 | 144 | if ($pages) { |
| 145 | 145 | $pages->draw(); |
| 146 | - echo '<div style="background:#fff;">записей: <b>' . $pages->options['count'] . '</b>. страница <b>' . $pages->params['page'] . '</b> из <b>' . $pages->params['pages'] . '</b></div>'; |
|
| 146 | + echo '<div style="background:#fff;">записей: <b>'.$pages->options['count'].'</b>. страница <b>'.$pages->params['page'].'</b> из <b>'.$pages->params['pages'].'</b></div>'; |
|
| 147 | 147 | } |
| 148 | 148 | $result->content['pages'] = ob_get_contents(); |
| 149 | 149 | ob_end_clean(); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if (!empty($actions[$request['action']])) { |
| 220 | 220 | $actionParams = $actions[$request['action']]; |
| 221 | 221 | if (!empty($actionParams['access']['groups']) && !in_array(\Users\User::$cur->group_id, $actionParams['access']['groups'])) { |
| 222 | - $result->content = 'У вас нет прав доступа к операции ' . (!isset($actionParams['name']) ? $actionParams['className']::$name : $actionParams['name']); |
|
| 222 | + $result->content = 'У вас нет прав доступа к операции '.(!isset($actionParams['name']) ? $actionParams['className']::$name : $actionParams['name']); |
|
| 223 | 223 | } else { |
| 224 | 224 | try { |
| 225 | 225 | $result->successMsg = $actionParams['className']::groupAction($dataManager, $ids, $actionParams, !empty($_GET['adInfo']) ? $_GET['adInfo'] : []); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | } else { |
| 234 | - $result->content = 'У вас нет прав доступа к менеджеру ' . $request['managerName'] . ' модели ' . $request['modelName']; |
|
| 234 | + $result->content = 'У вас нет прав доступа к менеджеру '.$request['managerName'].' модели '.$request['modelName']; |
|
| 235 | 235 | } |
| 236 | 236 | $result->send(); |
| 237 | 237 | } |
@@ -9,33 +9,33 @@ |
||
| 9 | 9 | ?> |
| 10 | 10 | <div id ='<?= $id; ?>' class="uiActiveForm" data-modelname="<?= $activeForm->modelName; ?>" data-formname="<?= $activeForm->formName; ?>" data-inputs='<?= json_encode($formInputs); ?>'> |
| 11 | 11 | <?php |
| 12 | - $form->action = $activeForm->action; |
|
| 13 | - $form->begin($activeForm->header, ['onsubmit' => $ajax ? 'inji.Ui.forms.submitAjax(this);return false;' : ''], ['activeForm' => $activeForm]); |
|
| 12 | + $form->action = $activeForm->action; |
|
| 13 | + $form->begin($activeForm->header, ['onsubmit' => $ajax ? 'inji.Ui.forms.submitAjax(this);return false;' : ''], ['activeForm' => $activeForm]); |
|
| 14 | 14 | |
| 15 | - if (empty($activeForm->form['noMapCell'])) { |
|
| 16 | - foreach ($activeForm->form['map'] as $row) { |
|
| 17 | - $colSize = 12 / count($row); |
|
| 18 | - echo "<div class ='row'>"; |
|
| 19 | - foreach ($row as $col) { |
|
| 20 | - echo "<div class = 'col-sm-{$colSize}'>"; |
|
| 21 | - if ($col) { |
|
| 22 | - $activeForm->drawCol($col, $activeForm->inputs[$col], $form, $params); |
|
| 23 | - } |
|
| 24 | - echo '</div>'; |
|
| 25 | - } |
|
| 26 | - echo '</div>'; |
|
| 27 | - } |
|
| 28 | - } else { |
|
| 29 | - foreach ($activeForm->form['map'] as $row) { |
|
| 30 | - foreach ($row as $col) { |
|
| 31 | - if ($col) { |
|
| 32 | - $activeForm->drawCol($col, $activeForm->inputs[$col], $form, $params); |
|
| 33 | - } |
|
| 34 | - } |
|
| 35 | - } |
|
| 36 | - } |
|
| 37 | - $form->end($activeForm->model ? ($activeForm->model->pk() ? 'Сохранить' : 'Создать') : 'Отправить', [], ['activeForm' => $activeForm]); |
|
| 38 | - ?> |
|
| 15 | + if (empty($activeForm->form['noMapCell'])) { |
|
| 16 | + foreach ($activeForm->form['map'] as $row) { |
|
| 17 | + $colSize = 12 / count($row); |
|
| 18 | + echo "<div class ='row'>"; |
|
| 19 | + foreach ($row as $col) { |
|
| 20 | + echo "<div class = 'col-sm-{$colSize}'>"; |
|
| 21 | + if ($col) { |
|
| 22 | + $activeForm->drawCol($col, $activeForm->inputs[$col], $form, $params); |
|
| 23 | + } |
|
| 24 | + echo '</div>'; |
|
| 25 | + } |
|
| 26 | + echo '</div>'; |
|
| 27 | + } |
|
| 28 | + } else { |
|
| 29 | + foreach ($activeForm->form['map'] as $row) { |
|
| 30 | + foreach ($row as $col) { |
|
| 31 | + if ($col) { |
|
| 32 | + $activeForm->drawCol($col, $activeForm->inputs[$col], $form, $params); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | + $form->end($activeForm->model ? ($activeForm->model->pk() ? 'Сохранить' : 'Создать') : 'Отправить', [], ['activeForm' => $activeForm]); |
|
| 38 | + ?> |
|
| 39 | 39 | </div> |
| 40 | 40 | <script> |
| 41 | 41 | inji.onLoad(function () { |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | } |
| 9 | 9 | ?>> |
| 10 | 10 | <?php |
| 11 | - } |
|
| 12 | - ?> |
|
| 11 | + } |
|
| 12 | + ?> |
|
| 13 | 13 | <?= !empty($header) ? "<h1>{$header}</h1>" : ''; ?> |
| 14 | 14 | |
| 15 | 15 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if (empty($params['activeForm']) || $params['activeForm']->parent === null) { |
| 3 | 3 | ?> |
| 4 | - <form <?= $form->id ? 'id="' . $form->id . '"' : ''; ?> action ="<?= $form->action; ?>" method ="<?= $form->method; ?>" enctype="multipart/form-data" |
|
| 4 | + <form <?= $form->id ? 'id="'.$form->id.'"' : ''; ?> action ="<?= $form->action; ?>" method ="<?= $form->method; ?>" enctype="multipart/form-data" |
|
| 5 | 5 | <?php |
| 6 | 6 | foreach ($options as $attribute => $value) { |
| 7 | 7 | echo " {$attribute} = '{$value}' "; |
@@ -5,10 +5,10 @@ |
||
| 5 | 5 | <div class="form-group"> |
| 6 | 6 | <button class ='btn btn-primary' |
| 7 | 7 | <?php |
| 8 | - foreach ($attributs as $attribute => $value) { |
|
| 9 | - echo " {$attribute} = '{$value}' "; |
|
| 10 | - } |
|
| 11 | - ?> |
|
| 8 | + foreach ($attributs as $attribute => $value) { |
|
| 9 | + echo " {$attribute} = '{$value}' "; |
|
| 10 | + } |
|
| 11 | + ?> |
|
| 12 | 12 | ><?= $btnText; ?></button> |
| 13 | 13 | </div> |
| 14 | 14 | <?php |