function compileTableFromArray($month, $sortBy)
{
    global $area, $db;
    echo "<table class='sortable' id='summary' name='summary' >";
    echo "<tr>\n\t\t\t\t\t<th>Employee</th>\n\t\t\t\t\t<th><span style='cursor:pointer'>Missed Punches</span></th>\t\t\t\t\t\n\t\t\t\t\t<th><span style='cursor:pointer'>Absences</span></th>\n\t\t\t\t\t<th><span style='cursor:pointer'>Tardies</span></th>\n\t\t\t\t\t<th><span style='cursor:pointer'>Commendable Performances</span></th>\n\t\t\t\t\t<th><span style='cursor:pointer'>Policy Reminders</span></th>";
    if ($area == 4) {
        //Only show for campus operators, to show for all areas, remove if statement.
        echo "<th><span style='cursor:pointer'>Quizzes</span></th>";
        echo "<th><span style='cursor:pointer'>Comments</span></th>";
    }
    if ($area == 2) {
        echo "<th><span style='cursor:pointer'>Security Violations</span></th>";
    }
    echo "<th><span style='cursor:pointer'>Meeting Requested</span></th>\n\t\t\t\t\t<th><span style='cursor:pointer'>Performance Reviewed</span></th>\n\t\t\t\t</tr>";
    try {
        $employeeQuery = $db->prepare("SELECT * FROM employee WHERE area = :area AND active = '1' ORDER BY firstName ASC");
        $employeeQuery->execute(array(':area' => $area));
    } catch (PDOException $e) {
        exit("error in query");
    }
    $performanceArray = array();
    while ($curNetID = $employeeQuery->fetch(PDO::FETCH_ASSOC)) {
        $performanceArray[$curNetID['netID']] = compileArrayRow($curNetID['netID']);
    }
    $col = array();
    //Sort array by the given Field
    if ($sortBy != "employee") {
        foreach ($performanceArray as $key => $val) {
            $col[$key] = $val[$sortBy];
        }
        array_multisort($col, SORT_DESC, $performanceArray);
    }
    foreach ($performanceArray as $key => $val) {
        echo "<tr><td><a href='summaryIndiv.php?employee=" . $key . "' >" . nameByNetID($key) . "</a></td>";
        foreach ($val as $k => $v) {
            echo "<td>" . $v . "</td>";
        }
        echo "</tr>";
    }
    echo "</table>";
}
<div id='closeResults'>
</div>
<input type="hidden" id="checkList" name="checkList" value="">
</form>
<div id='itemEditor' style='display:none;'>
	<h2>Add/Edit Item</h2>
	<table>
	<tr>
		<th>Text</th><td><input type='text' id='itemText' /></td>
	</tr>
	</table>
</div>
<div id='loadDraftForm'>
	<?php 
try {
    $draftQuery = $db->prepare("SELECT * FROM `supervisorReportDraft` WHERE `area` = :area");
    $draftQuery->execute(array(':area' => $area));
} catch (PDOException $e) {
    exit("error in query");
}
while ($row = $draftQuery->fetch(PDO::FETCH_ASSOC)) {
    echo "<div id='draft" . $row['ID'] . "'>";
    echo "<input type='radio' name='draftSelect' value='" . $row['ID'] . "' />";
    echo "<label for='draftSelect'>Report by " . nameByNetID($row['submitter']) . " started on " . $row['date'] . "</label>";
    echo "<input type='button' name='deleteDraft" . $row['ID'] . "' id='deleteDraft" . $row['ID'] . "' value='Delete' onClick='deleteDraft(" . $row['ID'] . ")'><br />";
    echo "</div>";
}
?>
</div>
<?php 
require '../includes/includeAtEnd.php';
<?php

require '../includes/includeMeBlank.php';
$grantee = $_GET['netID'];
$group = $_GET['index'];
$grantor = $netID;
//Development Purposes:
//if(true){
if (checkPermission('permissions')) {
    $perms = pullGroupPermissionIdsCurrentGroup($group);
    foreach ($perms as $cur) {
        $permissionsIndex = pullPermissionIndexByNameCurrentArea('permissions');
        if ($grantee == $grantor && $cur == $permissionsIndex) {
            echo "You can not revoke the 'permissions' permission for your own account.";
        } else {
            $results = revokeUserPermissionByIndex($grantee, $cur);
            if (!$results) {
                echo "There has been an error with revoking this permission from " . nameByNetID($grantee) . ".";
                echo " Please refresh your page and try again. If you continue to recieve this error, please contact a member of the development team.";
            }
        }
    }
} else {
    echo "You do not have permissions to revoke this permission from " . nameByNetID($grantee) . " If you feel this is in error, please contact your supervisor.";
}
        /* Create table of test results. */
        echo "<div>";
        echo "<table>";
        echo "<th>Name</th><th>Attempt</th><th>Grader</th><th>Score</th><th>Passed</th><th>Notes</th>";
        /* Get test results from database. */
        try {
            $resultsQuery = $db->prepare("SELECT * FROM `assessmentsResults` RIGHT JOIN `assessmentsGroupRequiredTests` ON assessmentsResults.test = assessmentsGroupRequiredTests.test RIGHT JOIN `assessmentsGroup` ON assessmentsGroupRequiredTests.group = assessmentsGroup.ID WHERE assessmentsResults.employee = :employee AND assessmentsGroup.name = :group GROUP BY assessmentsResults.ID");
            $resultsQuery->execute(array(':employee' => $rowEmployees['employee'], ':group' => $group));
        } catch (PDOException $e) {
            exit("error in query");
        }
        while ($row = $resultsQuery->fetch(PDO::FETCH_ASSOC)) {
            echo "<tr>";
            echo "<td>" . $row['name'] . "</td>";
            echo "<td>" . $row['attempt'] . "</td>";
            echo "<td>" . nameByNetID($row['grader']) . "</td>";
            echo "<td>" . $row['score'] . "</td>";
            if ($row['passed'] == 1) {
                echo "<td>Passed</td>";
            } else {
                echo "<td>Failed</td>";
            }
            echo "<td>" . $row['notes'] . "</td>";
            echo "</tr>";
        }
        echo "</table>";
        echo "</div>";
    }
    echo "</div>\r\n\t\t</div>";
}
?>
            //If count is greater than 0 then there is info to be emailed to paroll
            //Call formatEmailBody and pass it the index of supressed Indexes
            $body = formatEmailBody($supressedIndex);
            //Send Email. The rest is self explanitory, see the variable names.
            if ($env < 2) {
                $to = getenv("DEVEMAILADDRESS");
                //Dev site
            } else {
                $to = getenv("PAYROLLEMAIL");
                //Prod site
            }
            $subject = "Wage Increase for Students";
            $emailBody = "<html><body>Dear Payroll Official:";
            $emailBody .= "\nWould you please make the following wage changes for some of the following employees :<br/><br/>";
            $emailBody .= $body;
            $emailBody .= "<br/>Thanks,<br/>" . nameByNetID($netID);
            $emailBody .= "</body></html>";
            $from = 'From: ' . getenv("NOREPLYADDRESS") . "\r\n";
            $from .= "CC: " . getEmployeeEmailByNetId($netID) . "\r\n";
            $from .= "MIME-Version: 1.0\r\n";
            $from .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
            //send the Email
            mail($to, $subject, $emailBody, $from);
        }
        $_POST = '';
    }
    ?>
<script type='text/javascript'>
	window.onload = printRaises;
	
	//This opens a new window for editing
	if( num > 0){
		num--;
	}
	document.getElementById(num).innerHTML = "";
}
</script>		

<style type='text/css'>
	#notes{
	font-size:120%;
	}
</style>

<div id="info" align="center">
<h1>Y-Time Edit Request for <?php 
    echo nameByNetID($netID);
    ?>
</h1>
<div id='notes' align="center">
	<h3 style='color:red'>*Before submitting a time edit request please try to correct the changes yourself through Y-time.</h3>
	<b>Instructions</b><br/><br/>
	<table>
	<td>
	<b>1.</b> All fields are required in order to submit the edit request(s).<br/>
	<b>2.</b> When the edit request(s) are submitted, an email will be sent to OIT_Payroll@byu.edu.<br/>
	<b>3.</b> You and your supervisor(s) will receive a copy of the email.<br/>
	</td>
	</table>

</div>
<br/>
function listPendingHours($data)
{
    global $hourSize;
    global $area;
    global $netID;
    //This will need to be changed so we can allow trades to be taken as someone other than the logged in individual
    $time = date('H:i:s', strtotime($data['startTime']));
    $returnMe = "";
    //Get hour color for the trade
    $color = getHourColor($data['hourType']);
    while ($time != $data['endTime']) {
        $printTime = date('g:i A', strtotime($time));
        $returnMe .= "<tr><td style='background-color:" . $color . ";' >" . $printTime . "</td>";
        if (bidforHour($time, $data['ID'])) {
            //This checks if there is actually a bid for this hour
            $bid = getBid($time, $data['ID']);
            //If so, get that bid from the DB
            $totalHours = weeklyHourTotal($bid['employee'], $data['startDate']);
            //Check the total hours of the employee for the given week
            $returnMe .= "<td style='text-align: center; background-color:#FFFFFF'><a target=_blank href='../newSchedule/index.php?employee=" . $bid['employee'] . "' >" . nameByNetID($bid['employee']) . "</a>";
            $returnMe .= " (" . $totalHours . "+" . computeTotalHoursAddedByTrade($bid['employee'], $data['ID']) . ")";
            $returnMe .= "</td><td style='background-color:#FFFFFF'>";
            $returnMe .= "<input type='button' id='remove' name='remove' value='Remove Person' onclick='deleteBid(\"" . $bid['employee'] . "_" . $bid['tradeID'] . "_" . $bid['hour'] . "\")'/>";
            $returnMe .= "</td></tr>";
        } else {
            //This prints a blank row so the person approving can see that the hours are continuous
            $returnMe .= "<td style='text-align: center'>Up for Grabs</td><td style='text-align: center'>-</td></tr>";
        }
        //update Hour for next pass through
        $timestamp = strtotime($time) + 60 * (60 * $hourSize);
        $time = date('H:i:s', $timestamp);
    }
    return $returnMe;
}
<?php

require '../includes/includeMeBlank.php';
echo nameByNetID($_GET['netID']);