<?php foreach ($privTable as $i => $table) : ?>
    <fieldset>
        <legend>
            <input type="checkbox" class="sub_checkall_box" id="checkall_<?= $privTable_names[$i] ?>_priv"
                title="<?= __('Check all') ?>" />
            <label for="checkall_<?= $privTable_names[$i] ?>_priv"><?= $privTable_names[$i] ?></label>
        </legend>
        <?php foreach ($table as $priv) : ?>
            <?php $checked = ((isset($row[$priv[0] . '_priv']) && $row[$priv[0] . '_priv'] == 'Y')
                ?  'checked="checked"' : ''); ?>
            <?php $formatted_priv = PMA_formatPrivilege($priv, true);?>
            <?=
                PMA\libraries\Template::get('privileges/global_priv_tbl_item')->render(
                    array(
                        'checked'        => $checked,
                        'formatted_priv' => $formatted_priv,
                        'priv'           => $priv
                    )
                );
            ?>
        <?php endforeach; ?>
    </fieldset>
<?php endforeach; ?>