<?php

    $_table = 'texts';

    if(file_exists('_backend/internals/texts/l18n/'.$cfg['admin']['language'].'.php')) {
        require_once('_backend/internals/texts/l18n/'.$cfg['admin']['language'].'.php');
    }
    $table_config = array(
        'table' => 'texts',
        'multiSelect' => true,    
        'idField'=>'txtId',
        'languages'=>true,
        'categories'=>true,
        'status'=>true,
        'sequence'=>true,
        'default_status'=>0,
    );
    $table_fields = array(
        'txtId' => array(
            'type' => 'id', 
            'default_list' => true,           
        ),
        'txtName' => array(
            'type' => 'text',
            'size' => '300',
            'length' => '200',
            'default_list' => true,                        
        ),
        'txtContent' => array(
            'type' => 'htmlarea',            
            'editor' => 'advanced',
            'height' => '400',
            'language' => true,
            'default_list' => true,
            //'language' => true        
        ),   
                
    );

    require_once('_backend/grid.php');


    function print_header() {
        global $_url, $cfg;
        echo '<h4>'._t('moduleName').'</h4>';
        if(!$_url[2]) $_url[2]='view';
        $active[$_url[2]]=' class="active"';
        echo '<ul class="nav nav-tabs">
        
        <li'.$active['view'].perm_display('admins','view').'><a href="/'.$_url[0].'/'.$_url[1].'/view"><span class="glyphicon glyphicon-eye-open"></span> Przeglądaj</a></li>
        <li'.$active['add'].perm_display('texts','add').'><a href="/'.$_url[0].'/'.$_url[1].'/add"><span class="glyphicon glyphicon-plus"></span> Dodaj</a></li>
        <li'.$active['structure'].perm_display('texts','structure').'><a href="/'.$_url[0].'/'.$_url[1].'/structure"><span class="glyphicon glyphicon-list"></span> Struktura</a></li>';
        //<li'.$active['sql'].'><a href="/'.$_url[0].'/'.$_url[1].'/sql"><span class="glyphicon glyphicon-cloud"></span> SQL</a></li>';        
        
        if($_url[2]=='edit') echo '<li class="active"><a href="#"><span class="glyphicon glyphicon-edit"></span> Edycja #'.$_GET['id'].'</a></li>';
        
        
        renderHeaderSearch('texts');
        renderEditLanguage();
        if($_url[2]=='view') renderSorting('texts');
           echo '</ul><div class="nice_bar"></div>';
   
    }
    



    function action_index() {  
        global $table_config;          
        grid_view($table_config['table']);            
    }
    
    function action_view() {
        global $table_config;   
        grid_view($table_config['table']);   
         
    }    
    
    function action_structure() {
        global $table_config;  
        grid_structure($table_config['table']);
          
    }     
    
    function action_edit() { 
        global $table_config;  
        grid_record($table_config['table'], true);
    }
    
    function action_add() { 
        global $table_config;  
        grid_record($table_config['table'], false);
    }    
    
     

?>