예제 #1
0
파일: slim.php 프로젝트: ssolanki/website1
$app->get("/auth/isLoggedIn", function () use($app) {
    if (isset($_SESSION['user'])) {
        $data = array("loggedInStatus" => "true");
    } else {
        $data = array("loggedInStatus" => "false");
    }
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
});
$app->get("/auth/logout", function () use($app) {
    unset($_SESSION['user']);
});
$app->get('/tourepedia/our_trips(/:place_id)', function ($place_id) use($app, $db) {
    if ($place_id != null) {
        $data = array();
        foreach ($db->our_trips()->where('places_id', $place_id) as $p) {
            $data[] = array_map('utf8_encode', array('id' => $p["id"], 'trip_name' => $p['trip_name'], 'trip_img1' => $p['our_trips_img1'], 'trip_stay' => $p['trip_stay'], 'trip_timeSpan' => $p['trip_timeSpan'], 'trip_cost' => $p['trip_cost'], 'trip_place_about' => stripslashes($p['trip_place_about'])));
        }
    }
    $app->response()->header('content-type', 'application/json');
    echo json_encode(array('places_data' => $data));
});
$app->post('/tourepedia/submitPlan', function () use($app, $db) {
    $data = array();
    $array = (array) json_decode($app->request()->getBody());
    $attractionsList = (array) $array['attractionsList'];
    $plan = (array) $array['plan'];
    $book = (array) $array['book'];
    $startingDateDay = $array['startingDateDay'];
    $startingDateMonth = $array['startingDateMonth'];
    $startingDateYear = $array['startingDateYear'];
예제 #2
0
파일: slim.php 프로젝트: Tourepedia/v1.1
                $trip_attractions = $db->trip_attractions()->where('trips_id', $trip['id']);
                $attractions = array();
                foreach ($trip_attractions as $attr) {
                    $attractions[] = array('id' => $attr['id'], 'attraction_id' => $attr['attractions_id']);
                }
                $planTrips[] = array("trip_id" => $trip['id'], "places_id" => $trip["places_id"], "trip_place_name" => $trip["trip_place_name"], "trip_booktype" => $trip["trip_booktype"], "trip_starting_date" => $trip["trip_starting_date"], "user_name" => $trip["user_name"], "user_email" => $trip["user_email"], "users_id" => $trip["users_id"], "user_address" => $trip["user_address"], "user_contact_no1" => $trip["user_contact_no1"], "user_contact_no2" => $trip["user_contact_no2"], "isOrderOk" => $trip["isOrderOk"], "isOrderDone" => $trip["isOrderDone"], "our_plan_id" => $trip["our_plan_id"], "no_of_persons" => $planned_trip["no_of_persons"], "no_of_days" => $planned_trip["no_of_days"], "price_to_pay" => $planned_trip["price_to_pay"], "attractions" => $attractions);
            }
        }
    }
    $app->response()->header('content-type', 'application/json');
    echo json_encode(array('plan_trips' => $planTrips, 'book_trips' => $bookTrips));
});
$app->get('/our_trips(/:place_id)', function ($place_id) use($app, $db) {
    if ($place_id != null) {
        $data = array();
        $query = $db->our_trips()->where('places_id', $place_id);
        foreach ($query as $p) {
            $our_trips_id = $p['id'];
            $data[] = array_map('utf8_encode', array('our_trips_id' => $our_trips_id, 'our_trips_name' => $p['trip_name'], 'our_trips_img1' => $p['our_trips_img1'], 'our_trips_img2' => $p['our_trips_img2'], 'our_trips_placeId' => $place_id, 'our_trips_timeSpan' => $p['trip_timeSpan'], 'our_trips_cost' => $p['trip_cost']));
        }
        $app->response()->header('content-type', 'application/json');
        echo json_encode(array('our_trips' => $data));
    }
});
$app->get('/our_trips_data(/:our_trip_id)', function ($our_place_id) use($app, $db) {
    if ($our_place_id != null) {
        $query = $db->our_trips()->where('id', $our_place_id);
        foreach ($query as $p) {
            $our_trips_id = $p['id'];
            $sights = array();
            $travel = array();