78 lines
4.2 KiB
PHP
78 lines
4.2 KiB
PHP
<?php
|
|
global $gdb;
|
|
|
|
$grid = new \grid( 'pp_banners' );
|
|
$grid -> gdb_opt = $gdb;
|
|
$grid -> order = [ 'column' => 'name', 'type' => 'ASC' ];
|
|
$grid -> search = [
|
|
[ 'name' => 'Nazwa', 'db' => 'name', 'type' => 'text' ],
|
|
[ 'name' => 'Aktywny', 'db' => 'status', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
|
|
];
|
|
$grid -> columns_view = [
|
|
[
|
|
'name' => 'Lp.',
|
|
'th' => [ 'class' => 'g-lp' ],
|
|
'td' => [ 'class' => 'g-center' ],
|
|
'autoincrement' => true
|
|
],
|
|
[
|
|
'name' => 'Nazwa',
|
|
'db' => 'name',
|
|
'sort' => true,
|
|
'php' => 'echo "<a href=\"/admin/banners/banner_edit/id=[id]\">[name]</a>";'
|
|
],
|
|
[
|
|
'name' => 'Aktywny',
|
|
'db' => 'status',
|
|
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
|
|
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
|
'td' => [ 'class' => 'g-center' ]
|
|
],
|
|
[
|
|
'name' => 'Strona główna',
|
|
'db' => 'home_page',
|
|
'replace' => [ 'array' => [ 0 => 'nie', 1 => '<span class="text-system">tak</span>' ] ],
|
|
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
|
'td' => [ 'class' => 'g-center' ]
|
|
],
|
|
[
|
|
'name' => 'Slajder',
|
|
'db' => 'home_page',
|
|
'replace' => [ 'array' => [ 1 => 'nie', 0 => '<span class="text-system">tak</span>' ] ],
|
|
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
|
|
'td' => [ 'class' => 'g-center' ]
|
|
],
|
|
[
|
|
'name' => 'Data rozpoczęcia',
|
|
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
|
|
'td' => [ 'class' => 'g-center' ],
|
|
'php' => 'if ( "[date_start]" ) echo date( "Y-m-d", strtotime( "[date_start]" ) ); else echo "-";'
|
|
],
|
|
[
|
|
'name' => 'Data zakończenia',
|
|
'th' => [ 'class' => 'g-center', 'style' => 'width: 140px;' ],
|
|
'td' => [ 'class' => 'g-center' ],
|
|
'php' => 'if ( "[date_end]" ) echo date( "Y-m-d", strtotime( "[date_end]" ) ); else echo "-";'
|
|
],
|
|
[
|
|
'name' => 'Edytuj',
|
|
'action' => [ 'type' => 'edit', 'url' => '/admin/banners/banner_edit/id=[id]' ],
|
|
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
|
'td' => [ 'class' => 'g-center' ]
|
|
],
|
|
[
|
|
'name' => 'Usuń',
|
|
'action' => [ 'type' => 'delete', 'url' => '/admin/banners/banner_delete/id=[id]' ],
|
|
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
|
|
'td' => [ 'class' => 'g-center' ]
|
|
]
|
|
];
|
|
$grid -> buttons = [
|
|
[
|
|
'label' => 'Dodaj baner',
|
|
'url' => '/admin/banners/banner_edit/',
|
|
'icon' => 'fa-plus-circle',
|
|
'class' => 'btn-success'
|
|
]
|
|
];
|
|
echo $grid -> draw(); |