@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public static function uriParse($uri) { |
| 38 | 38 | $answerPos = strpos($uri, '?'); |
| 39 | - $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri) )), 1); |
|
| 39 | + $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri))), 1); |
|
| 40 | 40 | |
| 41 | 41 | foreach ($params as $key => $param) { |
| 42 | 42 | if ($param != '') { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $path = explode('/', $path); |
| 62 | 62 | $cur = ''; |
| 63 | 63 | foreach ($path as $item) { |
| 64 | - $cur .= $item . '/'; |
|
| 64 | + $cur .= $item.'/'; |
|
| 65 | 65 | if (!file_exists($cur)) { |
| 66 | 66 | mkdir($cur); |
| 67 | 67 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public static function resizeImage($img_path, $max_width = 1000, $max_height = 1000, $crop = false, $pos = 'center') { |
| 83 | 83 | ini_set("gd.jpeg_ignore_warning", 1); |
| 84 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($img_path); |
|
| 84 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($img_path); |
|
| 85 | 85 | switch ($img_type) { |
| 86 | 86 | case 1: |
| 87 | 87 | $img_type = 'gif'; |
@@ -107,14 +107,14 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | if ($crop === true || $crop == 'q') { |
| 109 | 109 | if ($img_width > $img_height) { |
| 110 | - $imgX = floor(( $img_width - $img_height ) / 2); |
|
| 110 | + $imgX = floor(($img_width - $img_height) / 2); |
|
| 111 | 111 | $imgY = 0; |
| 112 | 112 | $img_width = $img_height; |
| 113 | 113 | $new_width = $max_width; |
| 114 | 114 | $new_height = $max_height; |
| 115 | 115 | } else { |
| 116 | 116 | $imgX = 0; |
| 117 | - $imgY = floor(( $img_height - $img_width ) / 2); |
|
| 117 | + $imgY = floor(($img_height - $img_width) / 2); |
|
| 118 | 118 | $img_height = $img_width; |
| 119 | 119 | $new_width = $max_width; |
| 120 | 120 | $new_height = $max_height; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $new_width = $max_width; |
| 136 | 136 | $new_height = $max_height; |
| 137 | 137 | //Находим начальные координаты (центрируем новое изображение) |
| 138 | - $imgX = (int) (($ow / 2) - ($img_width / 2) ); |
|
| 138 | + $imgX = (int) (($ow / 2) - ($img_width / 2)); |
|
| 139 | 139 | if ($pos == 'center') { |
| 140 | 140 | $imgY = (int) (($oh / 2) - ($img_height / 2)); |
| 141 | 141 | } else { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | if (!headers_sent()) { |
| 209 | 209 | header("Location: {$href}"); |
| 210 | 210 | } else { |
| 211 | - echo '\'"><script>window.location="' . $href . '";</script>'; |
|
| 211 | + echo '\'"><script>window.location="'.$href.'";</script>'; |
|
| 212 | 212 | } |
| 213 | 213 | exit("Перенаправление на: <a href = '{$href}'>{$href}</a>"); |
| 214 | 214 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $pathArray = $cleanPathArray; |
| 267 | 267 | $cleanPathArray = []; |
| 268 | 268 | } while ($changes); |
| 269 | - return (strpos($path, '/') === 0 ? '/' : '') . implode('/', $pathArray); |
|
| 269 | + return (strpos($path, '/') === 0 ? '/' : '').implode('/', $pathArray); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | if (empty($month[$mm - 1])) { |
| 287 | 287 | return 'Не указано'; |
| 288 | 288 | } |
| 289 | - return ($dd > 0 ? $dd . " " : '') . $month[$mm - 1] . " " . $yy . " " . $hours; |
|
| 289 | + return ($dd > 0 ? $dd." " : '').$month[$mm - 1]." ".$yy." ".$hours; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | /** |
@@ -364,10 +364,10 @@ discard block |
||
| 364 | 364 | if (in_array($file, ['.', '..'])) { |
| 365 | 365 | continue; |
| 366 | 366 | } |
| 367 | - if (is_dir($from . '/' . $file)) { |
|
| 368 | - self::copyFiles($from . '/' . $file, $to . '/' . $file); |
|
| 367 | + if (is_dir($from.'/'.$file)) { |
|
| 368 | + self::copyFiles($from.'/'.$file, $to.'/'.$file); |
|
| 369 | 369 | } else { |
| 370 | - copy($from . '/' . $file, $to . '/' . $file); |
|
| 370 | + copy($from.'/'.$file, $to.'/'.$file); |
|
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | } |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | $fileObject->name = $fileinfo['filename']; |
| 49 | - $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
|
| 50 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
| 51 | - unlink($sitePath . $fileObject->path); |
|
| 49 | + $fileObject->path = $type->type_dir.date('Y-m-d').'/'.microtime(true).'.'.$fileinfo['extension']; |
|
| 50 | + if ($fileObject->id && file_exists($sitePath.$fileObject->path)) |
|
| 51 | + unlink($sitePath.$fileObject->path); |
|
| 52 | 52 | |
| 53 | - Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
|
| 53 | + Tools::createDir($sitePath.$type->type_dir.date('Y-m-d').'/'); |
|
| 54 | 54 | |
| 55 | - if (!move_uploaded_file($file['tmp_name'], $sitePath . $fileObject->path)) { |
|
| 55 | + if (!move_uploaded_file($file['tmp_name'], $sitePath.$fileObject->path)) { |
|
| 56 | 56 | return false; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | if ($type->allow_resize && $type->options && json_decode($type->options, true)) { |
| 60 | 60 | $typeOptions = json_decode($type->options, true); |
| 61 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($sitePath . $fileObject->path); |
|
| 61 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($sitePath.$fileObject->path); |
|
| 62 | 62 | if ($img_height > $typeOptions['max_height'] || $img_width > $typeOptions['max_width']) { |
| 63 | - Tools::resizeImage($sitePath . $fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
|
| 63 | + Tools::resizeImage($sitePath.$fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -104,25 +104,25 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | $fileObject->name = $fileinfo['filename']; |
| 107 | - $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension']; |
|
| 108 | - if ($fileObject->id && file_exists($sitePath . $fileObject->path)) |
|
| 109 | - unlink($sitePath . $fileObject->path); |
|
| 107 | + $fileObject->path = $type->type_dir.date('Y-m-d').'/'.microtime(true).'.'.$fileinfo['extension']; |
|
| 108 | + if ($fileObject->id && file_exists($sitePath.$fileObject->path)) |
|
| 109 | + unlink($sitePath.$fileObject->path); |
|
| 110 | 110 | |
| 111 | - Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/'); |
|
| 111 | + Tools::createDir($sitePath.$type->type_dir.date('Y-m-d').'/'); |
|
| 112 | 112 | |
| 113 | 113 | $file = @file_get_contents($url); |
| 114 | 114 | if ($file === false) { |
| 115 | 115 | return 0; |
| 116 | 116 | } |
| 117 | - if (!file_put_contents($sitePath . $fileObject->path, $file)) { |
|
| 117 | + if (!file_put_contents($sitePath.$fileObject->path, $file)) { |
|
| 118 | 118 | return 0; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | if ($type->allow_resize && $type->options && json_decode($type->options, true)) { |
| 122 | 122 | $typeOptions = json_decode($type->options, true); |
| 123 | - list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($sitePath . $fileObject->path); |
|
| 123 | + list($img_width, $img_height, $img_type, $img_tag) = getimagesize($sitePath.$fileObject->path); |
|
| 124 | 124 | if ($img_height > $typeOptions['max_height'] || $img_width > $typeOptions['max_width']) { |
| 125 | - Tools::resizeImage($sitePath . $fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
|
| 125 | + Tools::resizeImage($sitePath.$fileObject->path, $typeOptions['max_width'], $typeOptions['max_height']); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if (!$dataManager->checkAccess()) { |
| 3 | - echo 'you not have access to "' . $dataManager->modelName . '" manager with name: "' . $dataManager->managerName . '"'; |
|
| 3 | + echo 'you not have access to "'.$dataManager->modelName.'" manager with name: "'.$dataManager->managerName.'"'; |
|
| 4 | 4 | return false; |
| 5 | 5 | } |
| 6 | 6 | ?> |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | continue; |
| 47 | 47 | } |
| 48 | - if(++$i && !($i%2)){ |
|
| 48 | + if (++$i && !($i % 2)) { |
|
| 49 | 49 | echo '</div><div class="row">'; |
| 50 | 50 | } |
| 51 | 51 | echo '<div class="col-md-6">'; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $options = [ |
| 74 | 74 | 'where' => !empty($filters['getRows']['where']) ? $filters['getRows']['where'] : '' |
| 75 | 75 | ]; |
| 76 | - if (isset($cols[$relations[$colInfo['colParams']['relation']]['model']::colPrefix() . 'name'])) { |
|
| 76 | + if (isset($cols[$relations[$colInfo['colParams']['relation']]['model']::colPrefix().'name'])) { |
|
| 77 | 77 | $options['order'] = 'name'; |
| 78 | 78 | } |
| 79 | 79 | $items = $relations[$colInfo['colParams']['relation']]['model']::getList($options); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->name = $this->managerOptions['name']; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $this->managerId = str_replace('\\', '_', 'dataManager_' . $this->modelName . '_' . $this->managerName . '_' . \Tools::randomString()); |
|
| 60 | + $this->managerId = str_replace('\\', '_', 'dataManager_'.$this->modelName.'_'.$this->managerName.'_'.\Tools::randomString()); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if (!empty($this->managerOptions['filters'])) { |
| 104 | 104 | $buttons[] = [ |
| 105 | 105 | 'text' => 'Фильтры', |
| 106 | - 'onclick' => ' var modal = $("#' . $this->managerId . '_filters"); |
|
| 106 | + 'onclick' => ' var modal = $("#'.$this->managerId.'_filters"); |
|
| 107 | 107 | modal.modal("show");', |
| 108 | 108 | ]; |
| 109 | 109 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $formParams['formName'] = 'simpleItem'; |
| 112 | 112 | $buttons[] = [ |
| 113 | 113 | 'text' => '<i class = "glyphicon glyphicon-send"></i> Быстрое создание', |
| 114 | - 'onclick' => 'inji.Ui.dataManagers.get(this).newItem("' . str_replace('\\', '\\\\', $modelName) . '",' . json_encode($formParams) . ');', |
|
| 114 | + 'onclick' => 'inji.Ui.dataManagers.get(this).newItem("'.str_replace('\\', '\\\\', $modelName).'",'.json_encode($formParams).');', |
|
| 115 | 115 | ]; |
| 116 | 116 | } |
| 117 | 117 | $formParams['formName'] = !empty($this->managerOptions['editForm']) ? $this->managerOptions['editForm'] : 'manager'; |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | if (!empty($modelName::$forms[$formParams['formName']])) { |
| 123 | 123 | $buttons[] = [ |
| 124 | - 'text' => 'Создать ' . $name, |
|
| 125 | - 'onclick' => 'inji.Ui.dataManagers.get(this).newItem("' . str_replace('\\', '\\\\', $modelName) . '",' . json_encode($formParams) . ');', |
|
| 124 | + 'text' => 'Создать '.$name, |
|
| 125 | + 'onclick' => 'inji.Ui.dataManagers.get(this).newItem("'.str_replace('\\', '\\\\', $modelName).'",'.json_encode($formParams).');', |
|
| 126 | 126 | ]; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | 'className' => $action |
| 153 | 153 | ]; |
| 154 | 154 | } |
| 155 | - $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']; |
|
| 155 | + $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']; |
|
| 156 | 156 | if (!class_exists($return[$key]['className']) || ($onlyGroupActions && !$return[$key]['className']::$groupAction)) { |
| 157 | 157 | unset($return[$key]); |
| 158 | 158 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | <?php |
| 184 | 184 | foreach ($actions as $action => $actionParams) { |
| 185 | 185 | if (class_exists($actionParams['className']) && $actionParams['className']::$groupAction) { |
| 186 | - echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"" . str_replace('\\', '\\\\', $action) . "\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
| 186 | + echo "<li><a role='button' href ='#' onclick='inji.Ui.dataManagers.get(this).groupAction(\"".str_replace('\\', '\\\\', $action)."\");return false;'>{$actionParams['className']::$name}</a></li>"; |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | ?> |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | return []; |
| 234 | 234 | } |
| 235 | 235 | if (!$this->checkAccess()) { |
| 236 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
| 236 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
| 237 | 237 | return []; |
| 238 | 238 | } |
| 239 | 239 | $modelName = $this->modelName; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $queryParams['start'] = $this->page * $this->limit - $this->limit; |
| 250 | 250 | } |
| 251 | 251 | if (!empty($params['categoryPath']) && $modelName::$categoryModel) { |
| 252 | - $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE']; |
|
| 252 | + $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE']; |
|
| 253 | 253 | } |
| 254 | 254 | if (!empty($params['appType'])) { |
| 255 | 255 | $queryParams['appType'] = $params['appType']; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | if (!empty($params['filters'][$col]['max'])) { |
| 309 | 309 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
| 310 | 310 | |
| 311 | - $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
|
| 311 | + $date = $params['filters'][$col]['max'].' 23:59:59'; |
|
| 312 | 312 | } else { |
| 313 | 313 | $date = $params['filters'][$col]['max']; |
| 314 | 314 | } |
@@ -335,16 +335,16 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | switch ($params['filters'][$col]['compareType']) { |
| 337 | 337 | case 'contains': |
| 338 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
| 338 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE']; |
|
| 339 | 339 | break; |
| 340 | 340 | case 'equals': |
| 341 | 341 | $queryParams['where'][] = [$col, $params['filters'][$col]['value']]; |
| 342 | 342 | break; |
| 343 | 343 | case 'starts_with': |
| 344 | - $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
| 344 | + $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE']; |
|
| 345 | 345 | break; |
| 346 | 346 | case 'ends_with': |
| 347 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE']; |
|
| 347 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE']; |
|
| 348 | 348 | break; |
| 349 | 349 | } |
| 350 | 350 | break; |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $item = $relation['relModel']::get([[$item->index(), $item->id], [$model->index(), $model->id]]); |
| 384 | 384 | } |
| 385 | 385 | $row = []; |
| 386 | - $row[] = '<input type ="checkbox" name = "pk[]" value =' . $item->pk() . '>'; |
|
| 386 | + $row[] = '<input type ="checkbox" name = "pk[]" value ='.$item->pk().'>'; |
|
| 387 | 387 | $row[] = $item->pk(); |
| 388 | 388 | foreach ($this->managerOptions['cols'] as $key => $colName) { |
| 389 | 389 | if (!empty($params['download'])) { |
@@ -428,16 +428,16 @@ discard block |
||
| 428 | 428 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
| 429 | 429 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
| 430 | 430 | $count = $count ? $count : 'Нет'; |
| 431 | - 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>"; |
|
| 431 | + 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>"; |
|
| 432 | 432 | case 'many': |
| 433 | 433 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
| 434 | 434 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
| 435 | 435 | $count = $count ? $count : 'Нет'; |
| 436 | - 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>"; |
|
| 436 | + 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>"; |
|
| 437 | 437 | default : |
| 438 | 438 | if ($item->{$modelName::$cols[$colName]['relation']}) { |
| 439 | 439 | if (\App::$cur->name == 'admin') { |
| 440 | - $href = "<a href ='/admin/" . str_replace('\\', '/view/', $relations[$modelName::$cols[$colName]['relation']]['model']) . "/" . $item->{$modelName::$cols[$colName]['relation']}->pk() . "'>"; |
|
| 440 | + $href = "<a href ='/admin/".str_replace('\\', '/view/', $relations[$modelName::$cols[$colName]['relation']]['model'])."/".$item->{$modelName::$cols[$colName]['relation']}->pk()."'>"; |
|
| 441 | 441 | if (!empty($modelName::$cols[$colName]['showCol'])) { |
| 442 | 442 | $href .= $item->{$modelName::$cols[$colName]['relation']}->{$modelName::$cols[$colName]['showCol']}; |
| 443 | 443 | } else { |
@@ -467,18 +467,18 @@ discard block |
||
| 467 | 467 | case 'many': |
| 468 | 468 | $managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
| 469 | 469 | $count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
| 470 | - 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>"; |
|
| 470 | + 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>"; |
|
| 471 | 471 | default: |
| 472 | 472 | return $item->$colName; |
| 473 | 473 | } |
| 474 | 474 | } elseif (!empty($modelName::$cols[$colName]['type'])) { |
| 475 | - if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
| 475 | + if (\App::$cur->name == 'admin' && $originalCol == 'name' || ($dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) { |
|
| 476 | 476 | $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager'; |
| 477 | - $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
|
| 478 | - return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($originalItem)) . "/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
| 477 | + $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem)); |
|
| 478 | + return "<a href ='/admin/".str_replace('\\', '/view/', get_class($originalItem))."/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
| 479 | 479 | } elseif (\App::$cur->name == 'admin' && $colName == 'name') { |
| 480 | - $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem)); |
|
| 481 | - return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($item)) . "/{$item->id}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
| 480 | + $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/'.str_replace('\\', '/', get_class($originalItem)); |
|
| 481 | + return "<a href ='/admin/".str_replace('\\', '/view/', get_class($item))."/{$item->id}?redirectUrl={$redirectUrl}'>{$item->$colName}</a>"; |
|
| 482 | 482 | } else { |
| 483 | 483 | return \Model::resloveTypeValue($item, $colName); |
| 484 | 484 | } |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | return []; |
| 512 | 512 | } |
| 513 | 513 | if (!$this->checkAccess()) { |
| 514 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
| 514 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
| 515 | 515 | return []; |
| 516 | 516 | } |
| 517 | 517 | if (!empty($params['limit'])) { |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | ]; |
| 526 | 526 | $modelName = $this->modelName; |
| 527 | 527 | if (!empty($params['categoryPath']) && $modelName::$categoryModel) { |
| 528 | - $queryParams['where'][] = ['tree_path', $params['categoryPath'] . '%', 'LIKE']; |
|
| 528 | + $queryParams['where'][] = ['tree_path', $params['categoryPath'].'%', 'LIKE']; |
|
| 529 | 529 | } |
| 530 | 530 | if (!empty($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'])) { |
| 531 | 531 | foreach ($this->managerOptions['userGroupFilter'][\Users\User::$cur->group_id]['getRows'] as $colName => $colOptions) { |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | if (!empty($params['filters'][$col]['max'])) { |
| 580 | 580 | if ($colInfo['colParams']['type'] == 'dateTime' && !strpos($params['filters'][$col]['max'], ' ')) { |
| 581 | 581 | |
| 582 | - $date = $params['filters'][$col]['max'] . ' 23:59:59'; |
|
| 582 | + $date = $params['filters'][$col]['max'].' 23:59:59'; |
|
| 583 | 583 | } else { |
| 584 | 584 | $date = $params['filters'][$col]['max']; |
| 585 | 585 | } |
@@ -606,16 +606,16 @@ discard block |
||
| 606 | 606 | } |
| 607 | 607 | switch ($params['filters'][$col]['compareType']) { |
| 608 | 608 | case 'contains': |
| 609 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
| 609 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'].'%', 'LIKE']; |
|
| 610 | 610 | break; |
| 611 | 611 | case 'equals': |
| 612 | 612 | $queryParams['where'][] = [$col, $params['filters'][$col]['value']]; |
| 613 | 613 | break; |
| 614 | 614 | case 'starts_with': |
| 615 | - $queryParams['where'][] = [$col, $params['filters'][$col]['value'] . '%', 'LIKE']; |
|
| 615 | + $queryParams['where'][] = [$col, $params['filters'][$col]['value'].'%', 'LIKE']; |
|
| 616 | 616 | break; |
| 617 | 617 | case 'ends_with': |
| 618 | - $queryParams['where'][] = [$col, '%' . $params['filters'][$col]['value'], 'LIKE']; |
|
| 618 | + $queryParams['where'][] = [$col, '%'.$params['filters'][$col]['value'], 'LIKE']; |
|
| 619 | 619 | break; |
| 620 | 620 | } |
| 621 | 621 | break; |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | $tableCols[] = !empty($colOptions['label']) ? $colOptions['label'] : $colName; |
| 649 | 649 | } |
| 650 | 650 | $tableCols[] = ''; |
| 651 | - $this->table->class .=' datamanagertable'; |
|
| 651 | + $this->table->class .= ' datamanagertable'; |
|
| 652 | 652 | $this->table->setCols($tableCols); |
| 653 | 653 | } |
| 654 | 654 | |
@@ -669,12 +669,12 @@ discard block |
||
| 669 | 669 | return false; |
| 670 | 670 | } |
| 671 | 671 | if (!$this->checkAccess()) { |
| 672 | - $this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->managerName . '"'); |
|
| 672 | + $this->drawError('you not have access to "'.$this->modelName.'" manager with name: "'.$this->managerName.'"'); |
|
| 673 | 673 | return []; |
| 674 | 674 | } |
| 675 | 675 | $tree = new Tree(); |
| 676 | 676 | $tree->ul($this->managerOptions['categorys']['model'], 0, function($category) { |
| 677 | - $path = $category->tree_path . ($category->pk() ? $category->pk() . "/" : ''); |
|
| 677 | + $path = $category->tree_path.($category->pk() ? $category->pk()."/" : ''); |
|
| 678 | 678 | $cleanClassName = str_replace('\\', '\\\\', get_class($category)); |
| 679 | 679 | return "<a href='#' onclick='inji.Ui.dataManagers.get(this).switchCategory(this);return false;' data-index='{$category->index()}' data-path ='{$path}' data-id='{$category->pk()}' data-model='{$this->managerOptions['categorys']['model']}'> {$category->name}</a> |
| 680 | 680 | |
@@ -134,14 +134,14 @@ |
||
| 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 | } |
| 141 | 141 | if ((!$href || $href == '/materials') && !$this->alias) { |
| 142 | - return ($href ? $href : '/materials') . '/view/' . $this->pk(); |
|
| 142 | + return ($href ? $href : '/materials').'/view/'.$this->pk(); |
|
| 143 | 143 | } |
| 144 | - return $href . "/" . ($this->alias ? $this->alias : $this->pk()); |
|
| 144 | + return $href."/".($this->alias ? $this->alias : $this->pk()); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | public function resolveTemplate() { |