Пример #1
0
function prepareTrackPage($dbh, $bountyID)
{
    $template_array['company'] = $company;
    $args[':bountyID'] = $bountyID;
    $template_array['bounty'] = getBountyFromBountyID($dbh, $args);
    $template_array['submittedReports'] = getReportsFromBountyID($dbh, $args);
    //$template_array['reports'] = getReportsFromBountyID($dbh, $args);
    $template_array['numReports'] = sizeof($template_array['submittedReports']['result']);
    return $template_array;
}
Пример #2
0
$app->get('/api/getPastBounties/:username', function ($username) use($dbh) {
    $args[':username'] = $username;
    echo json_encode(getPastBounties($dbh, $args));
});
/*
Michael Gilbert
getReportsFromBountyID
returns all reports on a certain bounty
Error Codes:
Returns

Incomplete
*/
$app->get('/api/getReportsFromBountyID/:bountyID', function ($bountyID) use($dbh) {
    $args[':bountyID'] = $bountyID;
    echo json_encode(getReportsFromBountyID($dbh, $args));
});
$app->get('/api/getNumberReportsFiled/:username', function ($username) use($dbh) {
    $args[':username'] = $username;
    echo json_encode(getNumberReportsFiled($dbh, $args));
});
function getNumberReportsApproved($dbh, $args)
{
    $functionArray = array();
    $statement = $dbh->prepare("SELECT reportID FROM Report\n  WHERE username = :username\n  AND paidAmount != -1");
    if ($statement->execute($args)) {
        $functionArray['result'] = array();
        while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
            array_push($functionArray['result'], $row);
        }
        $functionArray['error'] = '0';