<commit_before><!doctype html>
<!--[if IE 9]><html class="lt-ie10" lang="en" > <![endif]-->
<html class="no-js" lang="en" data-useragent="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)">
   <head>
      <meta charset="utf-8"/>
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
      
      <title>Food Wasted Input - Magic Bin </title>
      <meta name="description" content="Food waste input page for individuals who wish to know how they fair against other students on the campus."/>
      <meta name="copyright" content="Food Fighter. Copyright (c) 2014"/>

      <!-- Stylesheets -->
      <link rel="stylesheet" href="css/foundation.css" />
      <link rel="stylesheet" href="css/styles.css" />

      <!-- JavaScript -->
      <script src="js/vendor/modernizr.js"></script>
   </head>
   
   <body>
      <!-- Header Section  -->
     <?php include 'header.php' ?>

      <br>

      <!-- User Input -->
      <div class="row">
         <!-- Individual Graph Result -->
         <div id="userResultSection" class="large-6 columns">
            <img id="thumbImg" src="img/blankImg.png" />
            <!--<img src="http://placehold.it/500x500&text=Image"><br>-->
            <!-- Google Map -->
            <div id="individualResult"></div>
         </div><!--columns-->

         <!-- Instructions -->
         <div class="large-6 columns">
            <h3 class="show-for-small">Header<hr/></h3>
            <div class="panel">
               <h4 class="hide-for-small">Add Results<hr/></h4>
               <h5 class="subheader">
                  Add your food waste results and then see your
                  reduction goals and see how much waste you're saving as well as money.
                  <br> 
                  <br> 
                  Note: Results are entered in grams.
               </h5>
            </div><!--panel-->
         </div><!--columns-->

         <div class="large-6 columns">
            <div class="radius panel">
               <form>
                  <div class="row collapse">
                     <h4 class="hide-for-small">Add Start or End Weight<hr/></h4>
                     
                     <div class="large-12 small-12 columns">
                        <input id = searchBox placeholder="Start Weight (grams)" type="text"/>
                     </div><!--columns-->

                     <div class="large-12 small-12 columns">
                        <input id = searchBox placeholder="End Weight (grams)" type="text"/>
                     </div><!--columns-->
                  </div><!--columns-->
                  
                  <!-- Add button -->
                  <div class="row collapse">
                        <a id = search href="#" class="postfix button expand" onclick='individualResult()'>Add</a>
                  </div><!--row-->
                  
               </form><!--forms-->
            </div><!--panel-->
         </div><!--columns-->
      </div><!--row-->

      <br>
      <br>

      <!-- Other Individual Information Header -->
      <div class="row">
         <div class="large-12 columns">
            <h3>Recent Wasters</h3>
         </div><!--columns-->
      </div>
      
      <!-- Other Individual Information Data --> 
      <?php
       $datalist = array();


// Create connection
       $conn = new mysqli("localhost", "idk2008_fwAdmin", "food123", "idk2008_foodwaste");

// Check connection
       if ($conn->connect_error) {
           die("Connection failed: " . $conn->connect_error);
       }
                        $query = "SELECT * FROM MagicBin ";
                        $result = mysqli_query($conn, $query);
                        $row = mysqli_fetch_assoc($result);

                        while ($row != null) {
                            $line = array();
                            foreach ($row as $cell) {
                                //echo $cell;

                                array_push($line, $cell);
                            }
                            array_push($datalist, $line);
                            //print_r( $line);
                            unset($line);
                            $row = mysqli_fetch_assoc($result);
                        }
                        
            echo end($datalist);
                        
       ?>
      
      
           
      <div class="row">
         <div class="large-3 small-6 columns">
            <div class="imgSize">
               <img id="pastResult1" src="http://placehold.it/500x500&text=Thumbnail">
            </div>
            <div class="panel">
               <p>Description</p>
            </div>
         </div><!--columns-->


         <div class="large-3 small-6 columns">
            <div class="">
               <img id ="pastResult1" src="http://placehold.it/500x500&text=Thumbnail">
            </div>
            <div class="panel">
               <p>Description</p>
            </div>
         </div><!--columns-->

         <div class="large-3 small-6 columns">
            <div class="imgSize">
               <img id ="pastResult1" src="http://placehold.it/500x500&text=Thumbnail">
            </div>
            <div class="panel">
               <p>Description</p>
            </div>
         </div><!--columns-->


         <div class="large-3 small-6 columns">
            <div class="imgSize">
               <img id ="pastResult1" src="http://placehold.it/500x500&text=Thumbnail">
            </div>
            <div class="panel">
               <p>Description</p>
            </div>
         </div><!--columns-->
      </div><!--row-->

      <!-- Footer -->
      <?php include 'footer.php' ?>


      <!-- JavaScripts -->
      <script src="./Foundation Framework/js/jquery-1.7.min.js"></script>
      <script src="./Foundation Framework/js/foundation.min.js"></script>

      <script>
         $(document).foundation();
      </script>

      <script src="js/jquery-1.7.min.js"></script>
      <script src="js/foundation/foundation.js"></script>

      <script>
         $(document).foundation();

         var doc = document.documentElement;
         doc.setAttribute('data-useragent', navigator.userAgent);
      </script><commit_msg>Got recent waster section done<commit_after><!doctype html>
<!--[if IE 9]><html class="lt-ie10" lang="en" > <![endif]-->
<html class="no-js" lang="en" data-useragent="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)">
   <head>
      <meta charset="utf-8"/>
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
      
      <title>Food Wasted Input - Magic Bin </title>
      <meta name="description" content="Food waste input page for individuals who wish to know how they fair against other students on the campus."/>
      <meta name="copyright" content="Food Fighter. Copyright (c) 2014"/>

      <!-- Stylesheets -->
      <link rel="stylesheet" href="css/foundation.css" />
      <link rel="stylesheet" href="css/styles.css" />

      <!-- JavaScript -->
      <script src="js/vendor/modernizr.js"></script>
   </head>
   
   <body>
      <!-- Header Section  -->
     <?php include 'header.php' ?>

      <br>

      <!-- User Input -->
      <div class="row">
         <!-- Individual Graph Result -->
         <div id="userResultSection" class="large-6 columns">
            <img id="thumbImg" src="img/blankImg.png" />
            <!--<img src="http://placehold.it/500x500&text=Image"><br>-->
            <!-- Google Map -->
            <div id="individualResult"></div>
         </div><!--columns-->

         <!-- Instructions -->
         <div class="large-6 columns">
            <h3 class="show-for-small">Header<hr/></h3>
            <div class="panel">
               <h4 class="hide-for-small">Add Results<hr/></h4>
               <h5 class="subheader">
                  Add your food waste results and then see your
                  reduction goals and see how much waste you're saving as well as money.
                  <br> 
                  <br> 
                  Note: Results are entered in grams.
               </h5>
            </div><!--panel-->
         </div><!--columns-->

         <div class="large-6 columns">
            <div class="radius panel">
               <form>
                  <div class="row collapse">
                     <h4 class="hide-for-small">Add Start or End Weight<hr/></h4>
                     
                     <div class="large-12 small-12 columns">
                        <input id = searchBox placeholder="Start Weight (grams)" type="text"/>
                     </div><!--columns-->

                     <div class="large-12 small-12 columns">
                        <input id = searchBox placeholder="End Weight (grams)" type="text"/>
                     </div><!--columns-->
                  </div><!--columns-->
                  
                  <!-- Add button -->
                  <div class="row collapse">
                        <a id = search href="#" class="postfix button expand" onclick='individualResult()'>Add</a>
                  </div><!--row-->
                  
               </form><!--forms-->
            </div><!--panel-->
         </div><!--columns-->
      </div><!--row-->

      <br>
      <br>

      <!-- Other Individual Information Header -->
      <div class="row">
         <div class="large-12 columns">
            <h3>Recent Wasters</h3>
         </div><!--columns-->
      </div>
      
      <!-- Other Individual Information Data --> 
      <?php
       $datalist = array();


// Create connection
       $conn = new mysqli("localhost", "idk2008_fwAdmin", "food123", "idk2008_foodwaste");

// Check connection
       if ($conn->connect_error) {
           die("Connection failed: " . $conn->connect_error);
       }
                        $query = "SELECT * FROM MagicBin ";
                        $result = mysqli_query($conn, $query);
                        $row = mysqli_fetch_assoc($result);

                        while ($row != null) {
                            $line = array();
                            foreach ($row as $cell) {
                                //echo $cell;

                                array_push($line, $cell);
                            }
                            array_push($datalist, $line);
                            //print_r( $line);
                            unset($line);
                            $row = mysqli_fetch_assoc($result);
                        }
                        
            $endPt=end($datalist);
            $percent= $endPt[5]/$endPt[4]*100;
            
           
            $query = "SELECT InitialWeight, WasteWeight FROM  MagicBin WHERE  Date = curdate()";
                        $avResult = mysqli_query($conn, $query);
                        $avRow = mysqli_fetch_assoc($avResult);

$datelist=array();
                        while ($avRow != null) {
                            $line = array();
                            foreach ($avRow as $cell) {
                              //  echo $cell." ! ";

                                array_push($line, $cell);
                            }
                            array_push($datelist, $line);
                            unset($line);
                            $avRow = mysqli_fetch_assoc($avResult);
                        }
                       
$totalInitial=0;
$totalWaste=0;
foreach($datelist as $x){
$totalInitial+= $x[0];
$totalWaste+= $x[1];
$avg= $totalWaste/$totalInitial * 100;

    
}
// Determine if the user is below or above the average
    if ($percent <= $avg) {
   $src= "img/ThumbsUp.png";
    }
    else{
    $src = "img/ThumbsDown.png";
}
            
                                    
       ?>
      
      
           
      <div class="row">
         <div class="large-3 small-6 columns">
            <div class="imgSize">
            
               <?php echo '<img src="' . $src . '" />'; ?>
            </div>
            <div class="panel">
               <p><?php echo round($percent,2) ?>%</p>
            </div>
         </div><!--columns-->

<?php
            $endPt=prev($datalist);
            $percent= $endPt[5]/$endPt[4]*100;
            // Determine if the user is below or above the average
    if ($percent <= $avg) {
     $src= "img/ThumbsUp.png";
    }
    else{
    $src = "\"img/ThumbsDown.png\"";
}
          ?>

         <div class="large-3 small-6 columns">
            <div class="">
               <?php echo '<img src="' . $src . '" />'; ?>
            </div>
            <div class="panel">
               <p><?php echo round($percent,2) ?>%</p>
            </div>
         </div><!--columns-->


<?php
            $endPt=prev($datalist);
            $percent= $endPt[5]/$endPt[4]*100;
            // Determine if the user is below or above the average
    if ($percent <= $avg) {
    $src= "img/ThumbsUp.png";
    }
    else{
    $src = "img/ThumbsDown.png";
    }
          ?>

         <div class="large-3 small-6 columns">
            <div class="imgSize">
               <?php echo '<img src="' . $src . '" />'; ?>
            </div>
            <div class="panel">
               <p><?php echo round($percent,2) ?>%</p>
            </div>
         </div><!--columns-->


<?php
            $endPt=prev($datalist);
            $percent= $endPt[5]/$endPt[4]*100;
            // Determine if the user is below or above the average
    if ($percent <= $avg) {
      $src= "img/ThumbsUp.png";
    }
    else{
    $src = "img/ThumbsDown.png";
}
          ?>

         <div class="large-3 small-6 columns">
            <div class="imgSize">
               <?php echo '<img src="' . $src . '" />'; ?>
            </div>
            <div class="panel">
               <p><?php echo round($percent,2) ?>%</p>
            </div>
         </div><!--columns-->
      </div><!--row-->

      <!-- Footer -->
      <?php include 'footer.php' ?>


      <!-- JavaScripts -->
      <script src="./Foundation Framework/js/jquery-1.7.min.js"></script>
      <script src="./Foundation Framework/js/foundation.min.js"></script>

      <script>
         $(document).foundation();
      </script>

      <script src="js/jquery-1.7.min.js"></script>
      <script src="js/foundation/foundation.js"></script>

      <script>
         $(document).foundation();

         var doc = document.documentElement;
         doc.setAttribute('data-useragent', navigator.userAgent);
      </script>
{'fraction_non_alphanumeric': 0.16476683937823836, 'fraction_numerical': 0.0138860103626943, 'mean_word_length': 1.3507632348164988, 'pattern_counts': {'":': 0, '<': 326, '<?xml version=': 0, '>': 326, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1303348', 'n_tokens_mistral': 4164, 'n_tokens_neox': 3901, 'n_words': 878}