<?php

include_once ROOT . '/components/islogin.php';
if (CheckForLogIn::isLogin()) {
    $get_reg_id = base64_decode(base64_decode($_COOKIE['h3']));
    if (isAdmin::amIAdmin($get_reg_id)) {
        include ROOT . '/views/main/header.php';
        echo '<div class="container">';
        echo '<div class="row">';
        echo '<div class="col-sm-12 adm_desc">';
        $newFeedbacks = FeedbacksModeration::showNewFeedbacks();
        echo '<p class="new_feedbacks_title"><b>Новые отзывы</b></p><hr>';
        foreach ($newFeedbacks as $value) {
            echo '<div class="container">';
            echo '<div class="row">';
            echo '<div class="col-sm-8">';
            echo '<p id="feedback_person"><i class="fa fa-commenting-o"></i> ' . $value['cunsumer_name'] . '</p>';
            echo '<p id="grey_date"><i class="fa fa-calendar"></i> ' . $value['feedback_publication_date'] . '</p>';
            echo '<p><b>Отзыв:</b> ' . $value['feedback_text'] . '</p>';
            echo '<p><b>Плюсы: </b>' . $value['positive'] . '</p>';
            echo '<p><b>Минусы: </b>' . $value['negative'] . '</p>';
            echo '<hr>';
            echo '</div>';
            echo '<div class="col-sm-4" id="area1">';
            echo '<br>';
            echo '<p><a id="release_feedback" href="/feedback-publish/' . $value['id'] . '" class="public_feedback"><i class="fa fa-check-circle-o"></i> Опубликовать</a></p>';
            // echo '<p><a id="edit_feedback" href=""><i class="fa fa-pencil"></i> Редактировать</a></p>';
            echo '<p><a id="remove_feedback" href="/feedback-remove/' . $value['id'] . '" class="remove_feedback"><i class="fa fa-trash"></i> Удалить</a></p>';
            echo '</div>';
            echo '</div>';
            echo '</div>';
<?php

include_once ROOT . '/components/islogin.php';
include_once ROOT . '/models/AdminModel.php';
if (isset($_COOKIE['h3'])) {
    if (CheckForLogIn::isLogin()) {
        if (isAdmin::amIAdmin(base64_decode(base64_decode($_COOKIE['h3'])))) {
            include ROOT . '/views/main/header.php';
            echo '<div class="container messages">';
            echo '<div class="row">';
            echo '<div class="col-sm-12">';
            include_once ROOT . '/models/AdminModel.php';
            $messagesArray = Messages::getUserFeedback();
            echo '<br><p>Входящие сообщения</p><hr>';
            foreach ($messagesArray as $key => $singleMessage) {
                echo '<div class="container">';
                echo '<div class="row">';
                echo '<div class="col-md-8">';
                echo '<p>От: <b>' . $singleMessage['user_feedback_name'] . '</b>, email: ' . $singleMessage['user_feedback_email'] . '</p>';
                // echo '<p>Email: '.$singleMessage['user_feedback_email'].'</p>';
                echo '<p>Сообщение: ' . $singleMessage['user_feedback_message'] . '</p>';
                echo '<p>Получено: ' . $singleMessage['user_feedback_time'] . '</p>';
                echo '<hr>';
                echo '</div>';
                echo '<div class="col-md-4">';
                echo '<p><a href="/respond-message">Ответить</a></p>';
                echo '<p><a href="/hide-message">Отметить как прочитанное</a></p>';
                echo '<p><a href="/delete-message">Удалить</a></p>';
                echo '</div>';
            }
            echo '</div>';