<?php
    $table = "reviews";

    $fields = [];
    //$fields["video"] = "";
    //$fields['title'] = "";
    $fields['reviews'] = "";
    $fields['login'] = "";
    $fields['status'] = "bool";
    if ($settings_show_img_reviews) {
        $fields['img'] = "file";
    }
//    if (is_post()) {
//        $_POST['video'] = str_replace("https://www.youtube.com/watch?v=", "https://www.youtube.com/embed/", post("video"));
//    }
    if (!DEMO) {
        $report = form_update($table, $fields);
    }
?>

<div id="page-wrapper">
    <?php include(ROOT."/adg/pages/show_report.php"); ?>
    <div class="container-fluid">
        <!-- Flot Charts -->
        <div class="row">
            <div class="col-lg-12">
                <h2 class="page-header"><?php echo $page_title; ?></h2>
            </div>
        </div>
        <!-- /.row -->

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-bar-chart-o"></i> Обновить</h3>
                    </div>
                    <div class="panel-body">
                        <div class="flot-chart">
                            <div class="flot-chart-content" id="flot-line-chart">
                                <div>
                                    <form enctype="multipart/form-data" action = "" method = "POST">
                                        <!-- <?php input("title", "Заголовок"); ?>
                                        <br> -->
                                        <?php input_select("login", "Логин", "users", "1 = 1", "login", "login", $class="form-control") ?>
                                        <br>
<!--                                        --><?php //input("video", "Видео"); ?>
<!--                                        <br>-->
                                        <?php  if ($settings_show_img_reviews) { ?>
                                            <?php if (file_exists(ROOT."/".post("img"))) { ?>
                                            <img src="<?php echo images_thumbnail_resize("/".post("img"), 300, 200); ?>" width=300 height=200><br>
                                            <?php } ?>
                                            <?php input_file("img", "Изображение"); ?>
                                            <br>
                                        <?php } ?>
                                        <label>Содержание</label>
                                        <br>
                                        <?php input_text("reviews", "Содержание"); ?>
                                        <br>
                                        <?php input_checkbox("status", "Включено"); ?>
                                        <br>
                                        <?php input_hidden("id"); ?>
                                        <br>
                                        <?php button_update(); ?>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /.container-fluid -->

</div>
<!-- /#page-wrapper -->
