<div class="page-headline">
    <img src="<?php echo $this->imagePath; ?>/icons/settings.svg" alt="">
    <h3><?php _ex('Blocked Content Types', 'Headline right of icon', 'borlabs-cookie'); ?></h3>
</div>
<div class="content">

    <div class="messages">
    <?php echo \BorlabsCookie\Cookie\Backend\Backend::getInstance()->getMessages(); ?>
    </div>

    <?php
    if (\BorlabsCookie\Cookie\Backend\License::getInstance()->isPluginUnlocked()) {
    ?>
    <h4><?php _ex('Blocked Content Types', 'Headline', 'borlabs-cookie'); ?> <a href="?page=borlabs_cookie_settings&amp;tab=blocked_content_types&amp;new=1" class="page-title-action"><?php _ex('Add New', 'Button title', 'borlabs-cookie'); ?></a></h4>

    <table class="full-width">
        <thead>
            <tr>
                <th><?php _ex('Name', 'Table head', 'borlabs-cookie'); ?></th>
                <th><?php _ex('ID', 'Table head', 'borlabs-cookie'); ?></th>
                <th><?php _ex('Host(s)', 'Table head', 'borlabs-cookie'); ?></th>
                <th><?php _ex('Status', 'Table head', 'borlabs-cookie'); ?></th>
                <th><span class="dashicons dashicons-trash"></span></th>
                <th><span class="dashicons dashicons-edit"></span></th>
            </tr>
        </thead>
        <tbody>
            <?php
            if (!empty($blockedContentTypes)) {
                foreach ($blockedContentTypes as $bctData) {
                ?>
                <tr>
                    <td><?php echo $bctData->type_id == 'default' ? '<span class="dashicons dashicons-warning"></span> ' : ''; ?><?php echo esc_html($bctData->name); ?></td>
                    <td><?php echo $bctData->type_id; ?></td>
                    <td><?php echo $bctData->hosts; ?></td>
                    <td class="align-center">
                        <a href="<?php echo wp_nonce_url('?page=borlabs_cookie_settings&amp;tab=blocked_content_types&amp;changeStatusId='.$bctData->id.'&amp;changeStatus='.(!empty($bctData->status) ? '0' : '1'), 'changeStatus_'.$bctData->id); ?>"><i class="dashicons dashicons-lightbulb <?php echo !empty($bctData->status) ? 'text-green' : 'text-red'; ?>"></i></a>
                    </td>
                    <td class="align-center">
                    <?php
                        if($bctData->undeletable === 0) {
                            ?>
                            <a href="<?php echo wp_nonce_url('?page=borlabs_cookie_settings&amp;tab=blocked_content_types&amp;deleteId='.$bctData->id, 'delete_'.$bctData->id); ?>" data-bc-bct-delete-id="<?php echo $bctData->id; ?>" data-bc-bct-delete-msg="<?php printf(_x('Do you really want to delete &quot;%s&quot;?', 'Message', 'borlabs-cookie'), esc_html($bctData->name)); ?>"><span class="dashicons dashicons-trash"></span></a>
                            <?php
                        } else {
                            ?>-<?php
                        }
                    ?>
                    </td>
                    <td class="align-center">
                        <a href="?page=borlabs_cookie_settings&amp;tab=blocked_content_types&amp;editId=<?php echo $bctData->id; ?>"><span class="dashicons dashicons-edit"></span></a>
                    </td>
                </tr>
                <?php
                }
            } else {
                ?>
                <tr>
                    <td colspan="6" class="align-center"><?php _ex('No Blocked Content Types configured.', 'No result', 'borlabs-cookie'); ?></td>
                </tr>
                <?php
            }
            ?>
        </tbody>
    </table>

    <div class="messages">
        <p class="tip">
            <?php _ex('Using Blocked Content Types (BCTs), you can automatically block content such as videos from YouTube or posts from Facebook.', 'Blocked Content Type Description', 'borlabs-cookie'); ?><br>
            <?php _ex('Your visitor sees a message that a content has been blocked and has the possibility to reload this content by clicking on it.', 'Blocked Content Type Description', 'borlabs-cookie'); ?><br>
            <?php _ex('The design and text of the blocking message can be customized for each BCT.', 'Blocked Content Type Description', 'borlabs-cookie'); ?><br>
            <?php _ex('Select a BCT, click on the edit icon and change the content in the <strong>Preview</strong> field.', 'Blocked Content Type Description', 'borlabs-cookie'); ?><br>
            <?php _ex('If you do not want to use this feature, deactivate all Blocked Content Types.', 'Blocked Content Type Description', 'borlabs-cookie'); ?>
        </p>
        <p class="tip">
            <span class="dashicons dashicons-warning"></span> <?php _ex('The BCT <strong>Default</strong> is used for all external contents, for which no own BCT was created.', 'Blocked Content Type Description', 'borlabs-cookie'); ?>
        </p>
    </div>

    <p class="bottom-margin">
        <span class="dashicons dashicons-trash"></span> <?php _ex('Delete the Blocked Content Type. Not available for the default Blocked Content Types.', 'Table icon', 'borlabs-cookie'); ?><br>
        <span class="dashicons dashicons-edit"></span> <?php _ex('Edit the Blocked Content Type.', 'Table icon', 'borlabs-cookie'); ?><br>
        <span class="dashicons dashicons-lightbulb text-green"></span> <?php _ex('The Blocked Content Type is active and does block content (iframes) of the configured hosts.', 'Table icon', 'borlabs-cookie'); ?><br>
        <span class="dashicons dashicons-lightbulb text-red"></span> <?php _ex('The Blocked Content Type is inactive and does not block content (iframes) of the configured hosts.', 'Table icon', 'borlabs-cookie'); ?>
    </p>

    <form method="post" id="BorlabsCookieForm">
        <fieldset>
            <legend><?php _ex('Exception list', 'Headline of a fieldset', 'borlabs-cookie'); ?></legend>

            <div class="form-group">
                <div class="form-title">
                    <label for="bctHostExceptions"><?php _ex('Host(s)', 'Form', 'borlabs-cookie'); ?></label>
                </div>
                <div class="form-field">
                    <textarea name="bctHostExceptions" id="bctHostExceptions" cols="80" rows="5"><?php echo $textareaBCTHostExceptions; ?></textarea>
                    <span class="description"><?php _ex('One host per line. When one host is recognized (for example within the src-attribute of an iframe) the content will not be blocked.', 'Setting description', 'borlabs-cookie'); ?></span>
                </div>
            </div>

            <hr>
            <?php wp_nonce_field('borlabs_cookie_blocked_content_type'); ?>
            <input type="hidden" name="formSendExceptionList" value="1">
            <input class="button-primary" type="submit" value="<?php _ex('Save', 'Button title', 'borlabs-cookie'); ?>">
        </fieldset>
    </form>

    <form method="post">
        <fieldset>
            <legend><?php _ex('Reset default Blocked Content Types', 'Headline of a fieldset', 'borlabs-cookie'); ?></legend>

            <div class="form-group">
                <div class="form-title"><?php _ex('Confirmation', 'Setting title', 'borlabs-cookie'); ?></div>
                <div class="form-field">
                    <label for="bctResetConfirmation">
                        <input type="checkbox" name="bctResetConfirmation" id="bctResetConfirmation" value="yes"> <span class="option-title"><?php _ex('Confirmed', 'Setting checkbox', 'borlabs-cookie'); ?></span>
                    </label>
                    <span class="description"><?php _ex('Please confirm that you want to reset the settings of the default Blocked Content Types.', 'Setting description', 'borlabs-cookie'); ?></span>
                    <span class="description"><?php _ex('Your own Blocked Content Types remain unchanged.', 'Setting description', 'borlabs-cookie'); ?></span>
                </div>
            </div>
            <?php wp_nonce_field('borlabs_cookie_reset_default_blocked_content_types'); ?>
            <input type="hidden" name="resetDefaultBCT" value="1">
            <input disabled id="executeBCTReset" class="button-primary red-button" type="submit" value="<?php _ex('Reset default Blocked Content Types', 'Button title', 'borlabs-cookie'); ?>">
        </fieldset>
    </form>

    <?php
    } else {
        echo \BorlabsCookie\Cookie\Backend\License::getInstance()->getNoLicenseMessage();
    }
    ?>

</div>