|
@@ 425-429 (lines=5) @@
|
| 422 |
|
if (!empty($modelName::$cols[$colName]['relation'])) { |
| 423 |
|
$type = !empty($relations[$modelName::$cols[$colName]['relation']]['type']) ? $relations[$modelName::$cols[$colName]['relation']]['type'] : 'to'; |
| 424 |
|
switch ($type) { |
| 425 |
|
case 'relModel': |
| 426 |
|
$managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
| 427 |
|
$count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
| 428 |
|
$count = $count ? $count : 'Нет'; |
| 429 |
|
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>"; |
| 430 |
|
case 'many': |
| 431 |
|
$managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
| 432 |
|
$count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
|
@@ 430-434 (lines=5) @@
|
| 427 |
|
$count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
| 428 |
|
$count = $count ? $count : 'Нет'; |
| 429 |
|
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>"; |
| 430 |
|
case 'many': |
| 431 |
|
$managerParams = ['relation' => $modelName::$cols[$colName]['relation']]; |
| 432 |
|
$count = $item->{$modelName::$cols[$colName]['relation']}(array_merge($params, ['count' => 1])); |
| 433 |
|
$count = $count ? $count : 'Нет'; |
| 434 |
|
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>"; |
| 435 |
|
default : |
| 436 |
|
if ($item->{$modelName::$cols[$colName]['relation']}) { |
| 437 |
|
if (\App::$cur->name == 'admin') { |