예제 #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
    echo json_encode($result);
});
/*
Andre Gras
getMarshalFromUsername
Get the basics of a Marshal from username
Error Codes:
  0 = user returned all good
  1 = username  doesnt exists
Returns
  username
  userType
*/
$app->get('/api/getMarshalFromUsername/:username', function ($username) use($dbh) {
    $args[':username'] = $username;
    $result = getMarshalFromUsername($dbh, $args);
    echo json_encode($result);
});
/*
Michael Gilbert
getUserFromEmail
Get the basics of a user from email
Error Codes:
  0 = user returned all good
  1 = email doesnt exists
Returns
  username
  userType

complete
*/