<?php 
include('session.php');
$topic = "";
$instructions = "";
$link = "";
$due_date = ""; 
$due_time = "";
$attached_file = "";
$date_posted = "";
$time_posted = "";

if($_SERVER["REQUEST_METHOD"] == "GET")
{   
    $ID = $_GET["ID"];
    $sql_evaluation = mysqli_query($db, "SELECT * FROM evaluations WHERE ID='$ID'");
    while($DB_ROW = mysqli_fetch_array($sql_evaluation)) {

        $topic = $DB_ROW["Topic"];
        $link = $DB_ROW["Link"];
        $instructions = $DB_ROW["Instructions"];
        $due_date = $DB_ROW['Due_Date'];
        $due_time = $DB_ROW['Due_Time'];
        $date_posted = $DB_ROW['Date_Posted'];
        $time_posted = $DB_ROW['Time_Posted'];
        $turned_in = $DB_ROW['Turned_in'];
    }
}

if($topic != ""){
    $enable_topic = "";
}
else{
    $enable_topic = "";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
    <!-- SEO Meta Tags -->
    <meta name="description" content="Tivo is a HTML landing page template built with Bootstrap to help you crate engaging presentations for SaaS apps and convert visitors into users.">
    <meta name="author" content="Inovatik">

    <!-- OG Meta Tags to improve the way the post looks when you share the page on LinkedIn, Facebook, Google+ -->
    <meta property="og:site_name" content="" /> <!-- website name -->
    <meta property="og:site" content="" /> <!-- website link -->
    <meta property="og:title" content=""/> <!-- title shown in the actual shared post -->
    <meta property="og:description" content="" /> <!-- description shown in the actual shared post -->
    <meta property="og:image" content="" /> <!-- image link, make sure it's jpg -->
    <meta property="og:url" content="" /> <!-- where do you want your post to link to -->
    <meta property="og:type" content="article" />

    <!-- Website Title -->
    <title>Files - MinSU Office of Planning, Monitoring and Evaluation </title>

    <!-- Styles -->
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700&display=swap&subset=latin-ext" rel="stylesheet">
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/fontawesome-all.css" rel="stylesheet">
    <link href="css/swiper.css" rel="stylesheet">
    <link href="css/magnific-popup.css" rel="stylesheet">
    <link href="css/sstyle.css" rel="stylesheet">
    <link href="css/mystyle.css" rel="stylesheet">
    <link href="css/pme_style.css" rel="stylesheet">

    <!-- Favicon  -->
    <link rel="icon" href="images/logos.png">
</head>
<style>
    button {
    border: 1px solid #0066cc;
    background-color: #1a870e;
    color: #ffffff;
    padding: 5px 10px;
    }

    button:hover {
    border: 1px solid #0099cc;
    background-color: #3d8735;
    color: #ffffff;
    padding: 5px 10px;
    }

    button:disabled,
    button[disabled]{
    border: 1px solid #999999;
    background-color: #cccccc;
    color: #666666;
    }

    /* Unsubmit Modal Box */
    .modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 10000000; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    right: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    }

    /* Modal Content */
    .modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    }
    .close {
    color: #aaaaaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    }
    .close:hover,
    .close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
    }

    /* Private Comments */
    .modal3 {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 10000000; /* Sit on top */
    padding-top: 100px; /* Location of the box */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    }

    .modal-content3 {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    }

    .close3 {
    color: #aaaaaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    }

    .close3:hover,
    .close3:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
    }


</style>
<body data-spy="scroll" data-target=".fixed-top">

    <!-- Preloader -->
    <div class="spinner-wrapper">
        <div class="spinner">
            <div class="bounce1"></div>
            <div class="bounce2"></div>
            <div class="bounce3"></div>
        </div>
    </div>
    <!-- end of preloader -->

    

    <!-- Navigation -->
    <nav class="navbar navbar-expand-lg navbar-dark navbar-custom fixed-top" style="background-color: #11823b; ">
        <div class="container">

            <!-- Text Logo - Use this if you don't have a graphic logo -->
            <!-- <a class="navbar-brand logo-text page-scroll" href="index.html">Tivo</a> -->

            <!-- Image Logo -->
            <a class="navbar-brand logo-image" href="home.php"><img src="images/Minsu.png" alt="alternative" style="height:100px; width: 100px; "></a> 
            
            <!-- Mobile Menu Toggle Button -->
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-awesome fas fa-bars"></span>
                <span class="navbar-toggler-awesome fas fa-times"></span>
            </button>
            <!-- end of mobile menu toggle button -->

            <div class="collapse navbar-collapse" id="navbarsExampleDefault">
                <ul class="navbar-nav ml-auto">
                    <li class="nav-item">
                        <a class="nav-link page-scroll" href="home.php">HOME <span class="sr-only">(current)</span></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link page-scroll" href="index.html#features">ABOUT</a>
                    </li>

                    <!-- Dropdown Menu -->
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle page-scroll" href="profile.php" id="navbarDropdown" role="button" aria-haspopup="true" aria-expanded="false">PROFILE</a>
                        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                            <a class="dropdown-item" href="gallery.php"><span class="item-text">GALLERY</span></a>
                            <div class="dropdown-items-divide-hr"></div>
                            <a class="dropdown-item" href="files.php"><span class="item-text">FILES</span></a>
                            <div class="dropdown-items-divide-hr"></div>
                            <a class="dropdown-item" href="min-sahe.php"><span class="item-text">MIN-SAHE</span></a>
                        </div>
                    </li>
                    <!-- end of dropdown menu -->

                    <li class="nav-item">
                        <a class="nav-link page-scroll" href="announcements.php">ANNOUNCEMENTS</a>
                    </li>
                </ul>
                <span class="nav-item">
                    <a class="btn-outline-sm" href="logout.php">LOGOUT</a>
                </span>
            </div>
        </div> <!-- end of container -->
    </nav> <!-- end of navbar -->
    <!-- end of navigation -->
     <br><br><br><br><br><br><br>
     <div id="page-inner" style="padding-left: 30px; padding-right: 30px; margin-top: 20px; width: 100%;">
                <div class="row">
                    <div class="col-md-12">
                    <a href="evaluations.php"><button style="float: left; margin-top: 20px; cursor: pointer; background-color: #313131; border-radius: 5px; margin-left: 10px;" title="Click to go back"><img src="images/back_btn.png" width="25px" height= "25px" style="border: none; background-color: #313131; border-radius: 5px; padding: 3px;"></button></a><p style="color: white; background-color: #3c5755; padding: 18px; margin-top: -0.1px; font-family: Arial; font-weight: bold; font-size: 27px;">&nbsp<img src="images/comments_white.png" style="width: 40px; height: 40px; margin-top: 2px; padding:-5px;">&nbsp Evaluation</p>   
                </div>
                <?php
                    if($due_date == "None" || $due_time == "None"){
                      $due = "No due date";
                      $due_date = "";
                      $due_time = "";
                    }
                    else{
                      $due = "Due";
                    }
                    echo '<div style="background-color: #f9f9f9; padding-bottom: 30px; width: 100%;">';
                    echo '<p style="margin-left: 40px; font-size: 14px; color: #696969;">Posted '.$date_posted. ' <span style="float: right; padding-right: 80px; font-weight: bold;">'.$due. ' ' . $due_date . ' ' . $due_time .'</span></p>';
                    echo '<p style="margin-left: 40px; font-size: 16px; font-weight: bold; ">'.$enable_topic.' '.$topic.'</p>';
                    echo '<br><p style="margin-left: 40px; margin-top: -20px; font-size: 14px; padding-right: 30px; ">'.$instructions.'</p>';
                    echo '<hr><a href="' .$link. '" style="margin-left: 40px;" target="_blank">'.$link.'</a>';
                    echo '</div><hr>';
                ?>

                <div style="border-style: solid; border-radius: 10px; width: 300px; margin-left:35px; height: 160px; border-width: thin; border-color: #d6d6d6; background-color: #f4f4f4;">
                <p style="margin-left:20px; margin-top: 20px; font-size: 15px; font-family: Arial; font-size: 22px; color:;">Your work</p>
                
                <?php
                    require_once "config.php";
                    $sess = $_SESSION['login_user'];
                    $already_evaluated = 0;
                    $sql_eval = "SELECT * FROM submitted_evaluation WHERE Email='$sess' AND Eval_ID='$ID'";
                    if($result1 = $db->query($sql_eval)){
                        if($result1->num_rows > 0){
                            while($eval_row = $result1->fetch_array()){
                                $stat = $eval_row['Eval_Stat'];
                            }
                            if($stat == "2"){
                                $already_evaluated = 2;
                            }
                            else if($stat == "1"){
                                $already_evaluated = 1;
                            }
                        }
                        else{
                            $already_evaluated = 0;
                        }
                    }
                ?>

                <?php
                if($already_evaluated == 0){
                    echo '<form method="post" action="mark_as_done_eval.php">
                            <input name="eval_stat" value="1" type="hidden">
                            <input name="eval_id" value="'.$ID.'" type="hidden">
                            <input name="email" value="'.$sess.'" type="hidden">
                          <button id="submitID" type="submit" name="eval_btn" style="float: left; margin-left: 16px; border-radius: 5px; padding:5px; margin-top: 20px; border: none; padding-left: 30px; padding-right: 30px; padding-top: 10px; padding-bottom: 10px; font-weight: bold; font-family: Arial; width: 87%;">Mark as done</button>
                          </form>';
                }
                else if($already_evaluated == 1){
                    echo '<form method="post" action="unsubmit_eval.php">';
                    echo '<input name="eval_stat" value="0" type="hidden">';
                    echo '<input name="eval_id" value="'.$ID.'" type="hidden">'; 
                    echo '<input name="email" value="'.$sess.'" type="hidden">';
                    echo '<button id="myBtn" name="unsubmit" style="cursor: pointer; float: left; margin-left: 16px; border-radius: 5px; padding:5px; margin-top: 20px; border: none; padding-left: 30px; padding-right: 30px; padding-top: 10px; padding-bottom: 10px; font-weight: bold; font-family: Arial; width: 87%; border-style:solid; border-width: thin; border-color: #d6d6d6; background-color: #d11a2a ; color: white; text-align: center;" >Unsubmit</button>
                          </form>';
                }
                else if($already_evaluated == 2){
                    echo '<form method="post" action="mark_as_done_eval.php">
                            <input name="eval_stat" value="1" type="hidden">
                            <input name="eval_id" value="'.$ID.'" type="hidden">
                            <input name="email" value="'.$sess.'" type="hidden">
                          <button id="submitID" type="submit" name="update_eval_btn" style="float: left; margin-left: 16px; border-radius: 5px; padding:5px; margin-top: 20px; border: none; padding-left: 30px; padding-right: 30px; padding-top: 10px; padding-bottom: 10px; font-weight: bold; font-family: Arial; width: 87%;">Mark as done</button>
                          </form>';
                }
                ?>

            </div>

            </div>
                </div>
            <br><br><br><br><br><br><br><br><br><br><br>

<!-- Footer -->
<svg class="ex-footer-frame" data-name="Layer 2" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none" viewBox="0 0 1920 79"><defs><style>.cls-2{fill:#11823b;}</style></defs><title>footer-frame</title><path class="cls-2" d="M0,72.427C143,12.138,255.5,4.577,328.644,7.943c147.721,6.8,183.881,60.242,320.83,53.737,143-6.793,167.826-68.128,293-60.9,109.095,6.3,115.68,54.364,225.251,57.319,113.58,3.064,138.8-47.711,251.189-41.8,104.012,5.474,109.713,50.4,197.369,46.572,89.549-3.91,124.375-52.563,227.622-50.155A338.646,338.646,0,0,1,1920,23.467V79.75H0V72.427Z" transform="translate(0 -0.188)"/></svg>
<div class="footer">
    <div class="container">
        <div class="row">
            <div class="col-md-4">
                <div class="footer-col first">
                    <h4>About Tivo</h4>
                    <p class="p-small">We're passionate about offering some of the best business growth services for start more words</p>
                </div>
            </div> <!-- end of col -->
            <div class="col-md-4">
                <div class="footer-col middle">
                    <h4>Important Links</h4>
                    <ul class="list-unstyled li-space-lg p-small">
                        <li class="media">
                            <i class="fas fa-square"></i>
                            <div class="media-body">Our business partners <a class="white" href="#your-link">startupguide.com</a></div>
                        </li>
                        <li class="media">
                            <i class="fas fa-square"></i>
                            <div class="media-body">Read our <a class="white" href="terms-conditions.html">Terms & Conditions</a>, <a class="white" href="privacy-policy.html">Privacy Policy</a></div>
                        </li>
                    </ul>
                </div>
            </div> <!-- end of col -->
            <div class="col-md-4">
                <div class="footer-col last">
                    <h4>Contact</h4>
                    <ul class="list-unstyled li-space-lg p-small">
                        <li class="media">
                            <i class="fas fa-map-marker-alt"></i>
                            <div class="media-body">22 Innovative, San Francisco, CA 94043, US</div>
                        </li>
                        <li class="media">
                            <i class="fas fa-envelope"></i>
                            <div class="media-body"><a class="white" href="mailto:contact@Tivo.com">contact@Tivo.com</a> <i class="fas fa-globe"></i><a class="white" href="#your-link">www.Tivo.com</a></div>
                        </li>
                    </ul>
                </div> 
            </div> <!-- end of col -->
        </div> <!-- end of row -->
    </div> <!-- end of container -->
</div> <!-- end of footer -->  
<!-- end of footer -->


<!-- Copyright -->
<div class="copyright">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <p class="p-small">Copyright © 2020 <a href="https://inovatik.com">Template by Inovatik</a></p>
            </div> <!-- end of col -->
        </div> <!-- enf of row -->
    </div> <!-- end of container -->
</div> <!-- end of copyright --> 
<!-- end of copyright -->


<!-- Scripts -->
<script src="js/jquery.min.js"></script> <!-- jQuery for Bootstrap's JavaScript plugins -->
<script src="js/popper.min.js"></script> <!-- Popper tooltip library for Bootstrap -->
<script src="js/bootstrap.min.js"></script> <!-- Bootstrap framework -->
<script src="js/jquery.easing.min.js"></script> <!-- jQuery Easing for smooth scrolling between anchors -->
<script src="js/swiper.min.js"></script> <!-- Swiper for image and text sliders -->
<script src="js/jquery.magnific-popup.js"></script> <!-- Magnific Popup for lightboxes -->
<script src="js/validator.min.js"></script> <!-- Validator.js - Bootstrap plugin that validates forms -->
<script src="js/scripts.js"></script> <!-- Custom scripts -->
<script>
    $('input[type=file]').change(function(){
    if($('input[type=file]').val()==''){
        $('button').attr('disabled',true)
    } 
    else{
      $('button').attr('disabled',false);
    }
})
</script>

<script>
    // Get the modal
    var modal = document.getElementById("myModal");

    // Get the button that opens the modal
    var btn = document.getElementById("myBtn");

    // Get the <span> element that closes the modal
    var span = document.getElementsByClassName("close")[0];

    // When the user clicks the button, open the modal 
    btn.onclick = function() {
    modal.style.display = "block";
    }

    // When the user clicks on <span> (x), close the modal
    span.onclick = function() {
    modal.style.display = "none";
    }

    // When the user clicks anywhere outside of the modal, close it
    window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
    }
</script>

<script>
    // Get the modal
    var modal3 = document.getElementById("myModal3");

    // Get the button that opens the modal
    var btn = document.getElementById("com");

    // Get the <span> element that closes the modal
    var span = document.getElementsByClassName("close3")[0];

    // When the user clicks the button, open the modal 
    btn.onclick = function() {
    modal3.style.display = "block";
    }

    // When the user clicks on <span> (x), close the modal
    span.onclick = function() {
      modal3.style.display = "none";
    }

    // When the user clicks anywhere outside of the modal, close it
    window.onclick = function(event) {
    if (event.target == modal3) {
      modal3.style.display = "none";
    }
    }
    </script>

</body>
</html>