<?php
global $gdb;

$grid = new \grid( 'pp_langs_translations' );
$grid -> gdb_opt      = $gdb;
$grid -> order        = [ 'column' => 'text', 'type' => 'ASC' ];
$grid -> search       = [
                            [ 'name' => 'Tekst', 'db' => 'text', 'type' => 'text' ]
                        ];
$grid -> columns_view = [
                          [ 
                            'name' => 'Lp.',
                            'th' => [ 'class' => 'g-lp' ],
                            'td' => [ 'class' => 'g-center' ],
                            'autoincrement' => true 
                          ],
                          [
                            'name'  => 'Tekst',
                            'db'    => 'text',
                            'php'   => 'echo "<a href=\'/admin/languages/translation_edit/id=[id]\'>[text]</a>";',
                            'sort'  => true
                          ],
                          [ 
                            'name' => 'Edytuj', 
                            'action' => [ 'type' => 'edit', 'url' => '/admin/languages/translation_edit/id=[id]' ], 
                            'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
                            'td' => [ 'class' => 'g-center' ]
                          ],
                          [ 
                            'name' => 'Usuń', 
                            'action' => [ 'type' => 'delete', 'url' => '/admin/languages/translation_delete/id=[id]' ], 
                            'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
                            'td' => [ 'class' => 'g-center' ]
                          ]
                        ];
$grid -> buttons      = [
                          [ 
                            'label' => 'Dodaj tłumaczenie', 
                            'url'   => '/admin/languages/translation_edit/', 
                            'icon'  => 'fa-plus-circle',
                            'class' => 'btn-success'
                          ]
                        ];
echo $grid -> draw();