コード例 #1
0
ファイル: verify_user.php プロジェクト: c-topherl/brewCom
function GetLandingPageContent($dbh, $user_id)
{
    $query = "SELECT COUNT(*) count FROM cart_headers where user_id = :user_id";
    $sth = $dbh->prepare($query);
    if (!$sth->execute(array(":user_id" => $user_id))) {
        throw new Exception($sth->errorInfo()[2]);
    }
    $count = (int) $sth->fetch(PDO::FETCH_ASSOC)['count'];
    if ($count > 0) {
        //user has details in cart
        $landing_page = get_cart(array('user_id' => $user_id));
    } else {
        //user does not have cart_details, so return delivery options page
        $landing_page = get_delivery_options();
    }
    //merge user_id to top level of array
    $landing_page = array_merge($landing_page, array('user_id' => $user_id));
    return $landing_page;
}
コード例 #2
0
        break;
    case 'add_order':
        include_once __DIR__ . '/orders/add_order.php';
        $responseArray['response'] = add_order($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Added order';
        break;
    case 'get_orders':
        include_once __DIR__ . '/orders/get_orders.php';
        $responseArray['response'] = get_orders($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Orders successfully read';
        break;
    case 'get_order_detail':
        include_once __DIR__ . '/orders/get_orders.php';
        $responseArray['response'] = get_order_detail($values);
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'Order details successfully read';
        break;
    case 'get_delivery_options':
        include_once __DIR__ . '/orders/get_delivery_options.php';
        $responseArray['status'] = 'success';
        $responseArray['message'] = 'This feature is not implemented, but always will return \'pickup\' for now';
        $responseArray['response'] = get_delivery_options($values);
        break;
    default:
        $responseArray['status'] = 'failure';
        $responseArray['message'] = "Unknown function: {$function}";
}
echo json_encode($responseArray);
exit;