function createMachineSumRow($category_id) { $row = "<tr><td class='overviewNoWrapRight'>(Machine Totals)</td>"; $machineArray = getArrayOfMachines(); $total = 0; foreach ($machineArray as $machineInfo) { $district = $machineInfo[0]; $machine = $machineInfo[1]; $name = getDistrictName($district); $machine_total = getMachineTotal($category_id, $district, $machine); $total += $machine_total; $row .= "<td class='overview'>"; $row .= $machine_total; $row .= "</td>"; } $row .= "<td class='overview'>{$total}</td></tr>"; return $row; }
function createDistrictMachineHeader($categoryName) { $header = "<tr><th class='overview'>{$categoryName}</th>"; $machineArray = getArrayOfMachines(); foreach ($machineArray as $machineInfo) { $district = $machineInfo[0]; $machine = $machineInfo[1]; $header .= "<th class='overview'>"; $header .= "D{$district} M{$machine}"; $header .= "</th>"; } $header .= "</tr>"; return $header; }
<html> <head> <title>Election</title> <link rel="stylesheet" type="text/css" href="./elections.css" /> <script src="elections.js"></script> </head> <body style="text-align: center; background-color: #F3E2A9"> <table><tr><td id="main"> <div class="sidebar"> <br> <h2>Choose Districts and Machines:</h2> <?php include "SaveElection.php"; connect(); $machineArray = getArrayOfMachines(); foreach ($machineArray as $machineInfo) { $d = $machineInfo[0]; $m = $machineInfo[1]; $districtMachineString = "{$d}.{$m}"; echo "<button class='link' onclick='showInfo({$districtMachineString})'>"; if (dataEntered($d, $m) == true) { echo "<div class='highlight'>"; } else { echo "<div class='lowlight'>"; } echo "District {$d}, Machine {$m}</div></button>"; } ?> <hr> <button class='link' onclick='showSpreadsheet()'>Spreadsheet Overview</button>