Esempio n. 1
0
function createActivity($userId, $timezone)
{
    //Check
    if (!parameterExists(APIKeys::$ACTIVITY_NAME) && !parameterExists(APIKeys::$ACTIVITY_DURATION)) {
        displayError("Create Activity: Please supply an activity name and activty duration as part of the request");
    } else {
        if (!parameterExists(APIKeys::$ACTIVITY_NAME)) {
            displayError("Create Activity: Please supply an activity name as part of the request");
        } else {
            if (!parameterExists(APIKeys::$ACTIVITY_DURATION)) {
                displayError("Create Activity: Please supply an activity duration as part of the request");
            }
        }
    }
    //Get values
    $activityName = getParameter(APIKeys::$ACTIVITY_NAME);
    $activityDuration = getParameter(APIKeys::$ACTIVITY_DURATION);
    //Create activity
    $result = APIDb::createActivity($userId, $activityName, $activityDuration, $timezone);
    //Show Response
    response($result);
}
Esempio n. 2
0
File: api.php Progetto: nikilster/I
function getParameter($param)
{
    if (parameterExists($param)) {
        //Possible TODO: Abstract the post here
        return $_GET[$param];
    } else {
        return "";
    }
}