<?php include("../elemetns_web/header.php") ?>
<?php include("../../assets/script/login/login_check.php") ?>
<?php include("../../assets/script/manipulationpost_function/manipulationpost.php") ?>

<div class="continer">

    <section class="postmanipulation">

        <?php include("../../assets/script/postviewsman/script.php"); ?>

        <header class="much">

            <span> ilość postów: <?php echo $data ?></span>

            <?php if ($user_data["rola"] == "admin") { ?>

                <span>posty należące do

                    <form id="form_select_user" method="get">

                        <select id="select_user" name="name">
                            <?php echo $options ?>
                        </select>

                    </form>

                </span>

            <?php } ?>

        </header>

        <div class="post_list">

            <form method="post" id="dellmulti" class="manipul">

                <?php foreach ($post_data as $post) { ?>

                    <div class="block">

                        <article class="article-block">
                            <img src="../../assets/img<?php echo $post["img"] ?>" class="img_miniature">
                            <p class="descryption-article-block">
                            <h2 class="title-article-block"><?php echo $post["title"] ?></h2>
                            <?php echo $post["content"] ?> ... </p>
                        </article>

                        <div class="block_group_post">
                            <button class="button_post yellow" name="add" form="<?php echo $post["id"] ?>.copy">kopiuj</button>
                            <button class="button_post green" name="editpostview" form="<?php echo $post["id"] ?>.edit">edytuj</button>
                            <button class="button_post red" name="dellone" form="<?php echo $post["id"] ?>.dell">usuń</button>
                            <input class="button_post red" type="checkbox" name="dellmas[]" value="<?php echo $post["id"] ?>">
                        </div>

                    </div>

                <?php } ?>

            </form>

            <div class="button_group">
                <a href="../manipulation/manipulationpost.php" class="green">dodaj posta</a>
                <button class="red" name="delmulti" form="dellmulti">usuń</button>
                <button class="red" id="multi_check">-</button>
            </div>

        </div>


        <aside class="hidden">

            <?php foreach ($post_data as $post) { ?>

                <form method="post" id="<?php echo $post["id"] ?>.edit" action="../manipulation/manipulationpost.php">
                    <input type="hidden" name="edit" value="<?php echo $post["id"] ?>">
                </form>

                <form method="post" id="<?php echo $post["id"] ?>.dell">
                    <input type="hidden" name="dell" value="<?php echo $post["id"] ?>">
                </form>


                <form method="post" id="<?php echo $post["id"] ?>.copy">
                    <input type="hidden" name="tytul" value="<?php echo $post["title"] ?>">
                    <input type="hidden" name="tresc" value="<?php echo $post["content_max"] ?>">
                    <input type="hidden" name="filedir" value="<?php echo $post["img"] ?>">
                </form>

            <?php } ?>

        </aside>

    </section>

    <?php include("../elemetns_web/aside.php") ?>
</div>
<script src="../../assets/js/manipulation.js"></script>
<?php include('../elemetns_web/footer.php') ?>