示例#1
0
function prepareCompanyProfilePage($dbh, $companyUsername)
{
    // for discover, the template array must contain
    // 	1)  the username
    // 	2)  the email of the username
    // 	3)  the top 10 bounties
    $template_array = array("username" => $_SESSION['userLogin'], "email" => $_SESSION['email']);
    $args[':username'] = $companyUsername;
    $template_array['company'] = getMarshalFromUsername($dbh, $args);
    if ($template_array['company']['error'] == 2) {
        return $template_array;
    }
    $template_array['company']['name'] = $companyUsername;
    $template_array['company']['active'] = getActiveBounties($dbh, $args);
    $template_array['company']['inactive'] = getPastBounties($dbh, $args);
    $template_array['company']['numActive'] = sizeof($template_array['company']['active']['result']);
    $template_array['company']['numBounties'] = $template_array['company']['numActive'] + sizeof($template_array['company']['inactive']['result']);
    return $template_array;
}
示例#2
0
function prepareMarshallProfile($dbh, $username)
{
    // for marshall profile we need
    // 	1)  email
    // 	2) company name
    // 	3) username
    // 	4) all bounties currently active for user
    // 	5) all bounties that have expired
    //call for current bounties in database
    //call for past bounties in database
    //call for profile picture
    $template_array["error"] = 0;
    //for time being
    $args[':username'] = $username;
    $template_array['user'] = getMarshalFromUsername($dbh, $args);
    $template_array['activeBounties'] = getActiveBounties($dbh, $args);
    $template_array['pastBounties'] = getPastBounties($dbh, $args);
    $template_array['user']['numActive'] = sizeof($template_array['activeBounties']['result']);
    $template_array['user']['numTotal'] = sizeof($template_array['activeBounties']['result']) + sizeof($template_array['pastBounties']['result']);
    return $template_array;
}
示例#3
0
/*
Andre Gras
getPastBounties
returns past bounties for logged in Marshall
Error Codes:
0 - profile path returned
1 - logged in user is a hunter
2 - statement did not execute
Returns
All past bounties with all fields from BountyPool

complete
*/
$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) {