function printCheckBox($data, $hour, $netID) { global $db; //Declare variables $bidID = $netID . "_" . $data['ID'] . "_" . $hour; $returnMe = '<input type="checkbox" class = "tradeCheckbox" onclick="if(!this.checked){deleteBid("' . $bidID . '")}else{submitBid("' . $bidID . '")}" id="' . $bidID . '"'; //Check for bids try { $bidsQuery = $db->prepare("SELECT * FROM `scheduleTradeBids` WHERE tradeID = :id AND hour = :hour AND `deleted`=0"); $bidsQuery->execute(array(':id' => $data['ID'], ':hour' => $hour)); } catch (PDOException $e) { exit("error in query"); } if ($bid = $bidsQuery->fetch(PDO::FETCH_ASSOC)) { if ($bid['employee'] == $netID) { $returnMe .= " checked >"; } else { $returnMe = nameByNetId($bid['employee']); } //else } else { //Check for already being scheduled $perm = getHourPermissionById($data['hourType']); if ($netID == $data['postedBy']) { $returnMe = ""; } else { if ($perm != "" && !checkPermissionByPermissionID($perm)) { $returnMe = "(Unavailable)"; } else { if ($conflict = checkConflictingShift($data, $netID, $hour)) { if ($conflict['nonwork']) { $returnMe .= "> (Scheduled: " . $conflict['longName'] . ")"; } else { $returnMe = "(Scheduled: " . $conflict['longName'] . ")"; } } else { $returnMe .= ">"; } } } //else } //else return $returnMe; }
<?php require '../includes/includeMeBlank.php'; $grantee = $_GET['netID']; $index = $_GET['index']; $grantor = $netID; //Development Purposes: //if(true){ if (checkPermission('development') || checkPermission('permissions') && checkPermissionByPermissionID($index)) { $results = grantUserPermissionByIndex($grantee, $index); if (!$results) { echo "There has been an error with granting " . nameByNetID($grantee) . " this permission. 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 grant " . nameByNetID($grantee) . " this permission. If you feel this is in error, please contact your supervisor."; }