<?php $signedIn = false; include "SaveElection.php"; session_start(); if (isset($_POST['signIn'])) { if ($_POST['signIn'] == "yes") { $signedIn = true; } } if (isset($_POST['username']) && isset($_POST['password'])) { $signedIn = checkUser($_POST['username'], $_POST['password']); } if ($signedIn) { $_SESSION['election_id'] = $_POST['election']; //set editable status of election $result = getCurrentElectionInfo(); $_SESSION['is_active'] = $result['is_active']; echo "<script>\n \$(document).ready(function() {\n \$('#districts').load('sidebar.php');\n var auto_refresh = setInterval(\n function ()\n {\n \$('#districts').load('sidebar.php').fadeIn('slow');\n }, 5000); // refresh every 5000 milliseconds\n \$.ajaxSetup({ cache: true });\n });\n </script>"; } else { echo "<br><br><br><h2>Invalid username or password. Hit back button on browser to try again.</h2>"; } ?> </head> <body style="text-align: center; background-color: #F3E2A9"> <table><tr><td id="main"> <div class="sidebar"> <?php // <button class='link' onclick='saveAllForMap()'>Save For Map</button> if ($signedIn) { echo " <h2>Choose Districts and Machines:</h2>\n <div id='districts'></div>\n <hr>\n <button class='link' onclick='showSpreadsheet()'>Spreadsheet Overview</button>\n\n <form action = './saveInputs.php' name='choices' method ='post'>\n <input type=submit class='input' name='output' value=' Download CSV '><br>\n <input type=submit class='input' name='output' value=' Download Json '><br>\n <input type=submit class='input' name='output' value=' Get Spreadsheet '><br>\n </form>";
function getResultsOutputWithDelimiter($delimiter) { //Prior $joinQueryPrior = getJoinQueryPrior(); //TODO $dPrior = "Nov 04, 2014"; // $date = new DateTime($election['election_date']); // $d = date_format($date, "M d, Y"); $output = getResultsOutputWithDelimiterWithJoinQuery($delimiter, $joinQueryPrior, $dPrior, "true"); //Current $joinQuery = getJoinQuery(); $election = getCurrentElectionInfo(); $date = new DateTime($election['election_date']); $d = date_format($date, "M d, Y"); $output .= getResultsOutputWithDelimiterWithJoinQuery($delimiter, $joinQuery, $d, "false"); return $output; }