<?php
/**
 * Shop-Reviews
 *
 * @released under the GNU General Public License
 * inspired and in parts based on
 * Copyright (c) 2003 osCommerce
 * @author H-P Sausen
 * @copyright (c) since 2010 web4design.de
 * @contact webmaster@web4design.de
 * @version 3.0
 */

include(MH_DIR_CONFIG . 'config_shopvoting/admin/common.php');
include(MH_DIR_CONFIG . 'config_shopvoting/admin/common_header.php');

?>

<div id="borderbox">
<!--    <form action="--><?php //echo shopvoting_admin_page_link(Shopvoting::FILENAME_SHOPREVIEW_MANAGE_TEMPLATE); ?><!--" method="post">-->

        <?php echo mh_draw_form('shopvoting', shopvoting_admin_page_link(Shopvoting::FILENAME_SHOPREVIEW_MANAGE_TEMPLATE, '', true), '', 'post'); ?>


<div class="leftupdatebox">
<?php echo WEB4DESIGN_DE_SR_SAVE_INFO; ?>&nbsp;&nbsp;&nbsp; <input type="submit" name="" value="<?php echo WEB4DESIGN_DE_SR_SAVE_SETTINGS; ?>"/>
</div>   
    
        <table class="maintab">
            <tr>
                <td colspan="3">
                    <?php
                    if (isset($_POST) && count($_POST) > 0) {
                        $voting->setTemplateBox(mh_post('template_box_character'),mh_post('template_box_show_text'),mh_post('template_box_show_total'),mh_post('template_box_show_link'),mh_post('template_style'));

                        if(is_array(mh_post('delete_template_files')) && sizeof(mh_post('delete_template_files')) > 0) {
                            $voting->deleteUnnecessaryTemplateFiles(mh_post('delete_template_files'));
                        }

                        $voting->__construct();
                        ?>
                        <div class="speichern"><?php echo WEB4DESIGN_DE_SR_UPDATED; ?></div>
                    <?php } ?>
                </td>
            </tr>
            <tr>
                <td width="49%" style="vertical-align: top;">

                <p class="adminConfigHeader"><strong><?php echo WEB4DESIGN_DE_SR_TEMPLATE_STYLE; ?></strong></p>

               <table>
                    <tr>
                        <td style="vertical-align:top;">
                        <select name="template_style">
                <?php 

                        if(sizeof($voting->getTemplateStyles()) > 0) {
                            foreach($voting->getTemplateStyles() as $single_template_style) {

                                if($single_template_style == $voting->template_style) {
                                    echo '<option value="' . $single_template_style . '" selected="selected">' . $single_template_style . '</option>';
                                } else {
                                    echo '<option value="' . $single_template_style . '">' . $single_template_style . '</option>';
                                }
                            }
                        }
                ?>
                </select>

                        </td>
                        <td style="vertical-align:top;padding-left: 10px;">
                        <?php 

                                $check_individual_style = $voting->checkAllSelectedTstyleFilesExists();

                                if($check_individual_style == 0) {
                                    echo WEB4DESIGN_DE_SR_TEMPLATE_MISSING_FILES;
                                }


                    ?>
                        </td>
                    </tr>
               </table>




 <p class="adminConfigHeader"><strong><?php echo WEB4DESIGN_DE_SR_TEMPLATE_BOX; ?></strong></p>


<table class="templatetable">
    <tr>
        <td><?php echo WEB4DESIGN_DE_SR_MAX_CHARACTER; ?></td>
        <td><input type="text" name="template_box_character" value="<?php echo $voting->template_box_character; ?>" /></td>
    </tr>
    <tr>
        <td><?php echo WEB4DESIGN_DE_SR_SHOW_REVIEW_TEXT; ?></td>
        <td>
            <select name="template_box_show_text">
                <option value="1"<?php if($voting->template_box_show_text == 1) {echo ' selected="selected"';}?>><?php echo WEB4DESIGN_DE_SR_DROPDOWN_YES; ?></option>
                <option value="0"<?php if($voting->template_box_show_text == 0) {echo ' selected="selected"';}?>><?php echo WEB4DESIGN_DE_SR_DROPDOWN_NO; ?></option>
            </select>
        </td>
    </tr>
    <tr>
        <td><?php echo WEB4DESIGN_DE_SR_SHOW_TOTAL; ?></td>
        <td>
            <select name="template_box_show_total">
                <option value="1"<?php if($voting->template_box_show_total == 1) {echo ' selected="selected"';}?>><?php echo WEB4DESIGN_DE_SR_DROPDOWN_YES; ?></option>
                <option value="0"<?php if($voting->template_box_show_total == 0) {echo ' selected="selected"';}?>><?php echo WEB4DESIGN_DE_SR_DROPDOWN_NO; ?></option>
            </select>
        </td>
    </tr>

    <tr>
        <td><?php echo WEB4DESIGN_DE_SR_SHOW_LINK; ?></td>
        <td>
            <select name="template_box_show_link">
                <option value="1"<?php if($voting->template_box_show_link == 1) {echo ' selected="selected"';}?>><?php echo WEB4DESIGN_DE_SR_DROPDOWN_YES; ?></option>
                <option value="0"<?php if($voting->template_box_show_link == 0) {echo ' selected="selected"';}?>><?php echo WEB4DESIGN_DE_SR_DROPDOWN_NO; ?></option>
            </select>
        </td>
    </tr>

    <tr>
        <td style="vertical-align: top;"><?php echo WEB4DESIGN_DE_SR_PREVIEW; ?></td>
        <td>
            <div id="overshopreviewbox0">
            <div class="detailshopreviewbox">
                <h3 style="margin:0 0 5px 0; padding-left:0.5em; padding-right:0.5em;"><?php echo WEB4DESIGN_DE_SR_TEMPLATE_TITLE; ?></h3>
                <div class="starBlock" title="5.00 - <?php echo WEB4DESIGN_DE_SR_TEMPLATE_RATING_TEXT; ?>">
                    <div class="ratingBlock ratingBlockStars1">&nbsp;</div>
                </div>
                <p class="reviewValue"><?php echo WEB4DESIGN_DE_SR_TEMPLATE_RATING_TEXT; ?></p>
                <p class="ratingValue">5.00 / 5.00</p>
                <?php if($voting->template_box_show_text == 1) { ?><p class="reviewtext"><?php echo substr(WEB4DESIGN_DE_SR_TEMPLATE_RATING_DEMO_TEXT,0,$voting->template_box_character); ?></p><?php } ?>
                <?php if($voting->template_box_show_total == 1) { ?><p class="totalreview"><?php echo WEB4DESIGN_DE_SR_TEMPLATE_RATING_COUNT; ?></p><?php } ?>
            </div>
    </div>

        </td>
    </tr>
</table>
                </td>
                <td width="2%">&nbsp;</td>
                <td width="49%" style="vertical-align: top;">
                <?php
                    $unnecessary_data_array = $voting->getUnnecessaryTemplateFiles();

                    if(sizeof($unnecessary_data_array) > 0) { // start if
                ?>
                <p class="adminConfigHeader"><strong><?php echo WEB4DESIGN_DE_SR_TEMPLATE_OLD_TITLE; ?></strong></p>
                <p><?php echo WEB4DESIGN_DE_SR_TEMPLATE_OLD_BACKUP_INFO; ?></p>
                <p><?php echo WEB4DESIGN_DE_SR_TEMPLATE_OLD_TEXT; ?></p>
                <p><?php echo WEB4DESIGN_DE_SR_TEMPLATE_OLD_DELETE_INFO; ?></p>

                

                <br />
                
                <?php
                    echo '<table>';
                        foreach($unnecessary_data_array as $key => $value) {
                            echo '<tr>';
                            echo '<td>';
                            echo '<input type="checkbox" value="' . $value . '" name="delete_template_files[]" id="' . $value . '" />';
                            echo '</td>';
                            echo '<td><label for="' . $value . '">';
                            echo $value;
                            echo '</label></td>';
                                echo '<tr>';
                        }




                } // end of of

                ?>
                
                </td>
            </tr>
        </table>

    </form>
    <p class="clr">&nbsp;</p>
</div>
