Revize 93413904
Přidáno uživatelem Jan Šedivý před téměř 6 roky(ů)
app/AdminModule/component/Surface/SurfaceGrid.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\AdminModule\Components; |
|
4 |
|
|
5 |
|
|
6 |
use App\Model\Repository\SurfaceTypeRepository; |
|
7 |
use App\Utils\DataGrid\DataGrid; |
|
8 |
use Ublaboo\DataGrid\Exception\DataGridException; |
|
9 |
|
|
10 |
class SurfaceTypeGrid extends DataGrid |
|
11 |
{ |
|
12 |
/** @var SurfaceTypeRepository */ |
|
13 |
private $surfaceTypeRepository; |
|
14 |
|
|
15 |
/** |
|
16 |
* SurfaceTypeGrid constructor. |
|
17 |
* @param SurfaceTypeRepository $surfaceTypeRepository |
|
18 |
*/ |
|
19 |
public function __construct(SurfaceTypeRepository $surfaceTypeRepository) |
|
20 |
{ |
|
21 |
$this->surfaceTypeRepository = $surfaceTypeRepository; |
|
22 |
|
|
23 |
parent::__construct(); |
|
24 |
|
|
25 |
} |
|
26 |
|
|
27 |
|
|
28 |
public function init() |
|
29 |
{ |
|
30 |
$this->setPrimaryKey(SurfaceTypeRepository::COLUMN_ID); |
|
31 |
$this->setDataSource($this->surfaceTypeRepository->findAll()->order(SurfaceTypeRepository::COLUMN_SORTER)); |
|
32 |
} |
|
33 |
|
|
34 |
/** |
|
35 |
* Definice sloupečků, akcí, vyhledávácích filtrů gridu |
|
36 |
* |
|
37 |
* @throws DataGridException |
|
38 |
*/ |
|
39 |
public function define() |
|
40 |
{ |
|
41 |
$this->addColumnNumber(SurfaceTypeRepository::COLUMN_ID, 'ID')->setDefaultHide(TRUE); |
|
42 |
$this->addColumnText(SurfaceTypeRepository::COLUMN_SURFACE_TYPE, 'Surface Type'); |
|
43 |
$this->addColumnText(SurfaceTypeRepository::COLUMN_SORTER, 'Sort Position'); |
|
44 |
|
|
45 |
$this->addAction('edit', 'upravit', 'Surface:editType', ['id' => SurfaceTypeRepository::COLUMN_ID]) |
|
46 |
->setTitle('Edit'); |
|
47 |
|
|
48 |
$this->setDefaultPerPage(20); |
|
49 |
} |
|
50 |
} |
|
51 |
|
|
52 |
interface ISurfaceTypeGridFactory |
|
53 |
{ |
|
54 |
/** |
|
55 |
* @return SurfaceTypeGrid |
|
56 |
*/ |
|
57 |
public function create(); |
|
58 |
} |
app/AdminModule/presenters/SurfacePresenter.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\AdminModule\Presenters; |
|
4 |
|
|
5 |
|
|
6 |
use App\AdminModule\Components\ISurfaceTypeGridFactory; |
|
7 |
|
|
8 |
class SurfacePresenter extends BaseAdminPresenter |
|
9 |
{ |
|
10 |
/** @var ISurfaceTypeGridFactory */ |
|
11 |
private $surfaceTypeGridFactory; |
|
12 |
|
|
13 |
private $typeId; |
|
14 |
|
|
15 |
/** |
|
16 |
* SurfacePresenter constructor. |
|
17 |
* @param ISurfaceTypeGridFactory $surfaceTypeGridFactory |
|
18 |
*/ |
|
19 |
public function __construct(ISurfaceTypeGridFactory $surfaceTypeGridFactory) |
|
20 |
{ |
|
21 |
parent::__construct(); |
|
22 |
|
|
23 |
$this->surfaceTypeGridFactory = $surfaceTypeGridFactory; |
|
24 |
} |
|
25 |
|
|
26 |
public function actionAddType() |
|
27 |
{ |
|
28 |
|
|
29 |
} |
|
30 |
|
|
31 |
public function actionEditType($id) |
|
32 |
{ |
|
33 |
|
|
34 |
} |
|
35 |
|
|
36 |
public function actionDeleteType($id) |
|
37 |
{ |
|
38 |
|
|
39 |
} |
|
40 |
|
|
41 |
public function createComponentSurfaceTypeGrid() |
|
42 |
{ |
|
43 |
return $this->surfaceTypeGridFactory->create(); |
|
44 |
} |
|
45 |
} |
app/AdminModule/templates/@layout.latte | ||
---|---|---|
111 | 111 |
Book type </a></li> |
112 | 112 |
<li class="nav-item"><a href="#" class="nav-link" title="Object type"> |
113 | 113 |
Object type </a></li> |
114 |
<li class="nav-item"><a href="#" class="nav-link" title="Surface type">
|
|
114 |
<li class="nav-item"><a n:href="Surface:" n:class="nav-link, $presenter->isLinkCurrent('Surface:*') ? active" title="Surface type">
|
|
115 | 115 |
Surface type </a></li> |
116 | 116 |
|
117 | 117 |
<li class="nav-item"><a n:href="Museum:default" n:class="nav-link, $presenter->isLinkCurrent('Museum:*') ? active" title="Museum"> |
app/AdminModule/templates/Surface/default.latte | ||
---|---|---|
1 |
{block content} |
|
2 |
{control surfaceTypeGrid} |
|
3 |
{/block} |
app/config/components.neon | ||
---|---|---|
3 | 3 |
- App\FrontModule\Components\IExampleGirdFactory |
4 | 4 |
- App\AdminModule\Components\IUserGridFactory |
5 | 5 |
- App\AdminModule\Components\IMuseumGridFactory |
6 |
- App\AdminModule\Components\ISurfaceTypeGridFactory |
|
6 | 7 |
|
7 | 8 |
# Formuláře |
8 | 9 |
- App\FrontModule\Components\ILoginFormFactory |
Také k dispozici: Unified diff
Re #7336 Grid pro typy povrchů