<?php require_once('_backend/templates/header.php'); 

    print_header();
?>

<div class="left" style="height: 220px;">
    <ul style="max-width: 260px;" class="nav nav-pills nav-stacked" id="gridTabs">
        <li class="active"><a tab="_functions">Dostęp do funkcji</a></li>
        <li><a tab="_categories">Dostęp do kategorii</a></li>
    </ul><br>
        
</div>

<div class="right">

    <form id="record" method="post">
        <table class="verticalTh grid table table-striped table-hover table-bordered table-condensed" tab="_functions">
            <thead>              
                <tr><th>&nbsp;</th>
                    <?php foreach($all_items as $key=>$item) { ?>
                        <th><?php echo $item['title']; ?></th>
                    <?php } ?>
                </tr>                                    
            </thead>
            <tbody>                       
                <tr class="warning"><th>&nbsp;</th><th colspan="<?php echo (count($all_items))?>">System</th></tr>  
                <?foreach($elems as $key=>$item) { ?>
                    <?php if(substr($key,0,4)=='tab_')  { ?>
                        <tr class="warning"><th>&nbsp;</th><th colspan="<?php echo (count($all_items))?>"><?php echo $item['title']?></th></tr>
                    <?php } else { ?>
                        <tr>
                            <th><?php echo $item['title'] ?>
                                <?php foreach($all_items as $k=>$it) { ?>
                                    <td><?php if(array_search($k, (array)$item['items'])!==false) echo '<input name="perm_'.$key.'[]" value="'.$k.'" type="checkbox"'.(array_search($k, (array)$_perms[$key])!==false?' checked="checked"':'').'/>'; ?></td>                            
                                <?php } ?>
                            </th>
                        </tr>
                    <?php } ?>                        
                <?php } ?>            
            </tbody>
        </table>
        <table class="verticalTh grid table table-striped table-hover table-bordered" tab="_categories" style="display: none;">
            <tbody>
                <tr><th>Odcień menu</th><td><select style="width: auto;" class="form-control" name="admAppHeader"><option value="">Jasny</option><option value=" navbar-inverse">Ciemny</option></select></td></tr>
                <tr><th>Wyświetlaj komunikaty o błędach</th><td><div class="checkbox"><label><input type="hidden" name="admAppAlertsError" value=""><input class="grid_checkbox" type="checkbox" switch="admAppAlertsError" value="1"></label></div></td></tr>
                <tr><th>Wyświetlaj komuniakty informacyjne</th><td><div class="checkbox"><label><input type="hidden" name="admAppAlertsSuccess" value=""><input class="grid_checkbox" type="checkbox" switch="admAppAlertsSuccess" value="1"></label></div></td></tr>
            </tbody>
        </table>
        <input type="hidden" name="uid" value="<?php echo $_GET['uid']?>"/>
        <input type="hidden" name="table" value="admins"/>
        <input type="hidden" name="action" value="set_permissions"/>
    </form>
</div>

<div class="panel-footer"><a id="saveRecord" class="btn btn-success" style="float: right;">Zapisz</a><div class="clear"></div></div>
        
        
<?php require_once('_backend/templates/footer.php'); ?>