Exemplo n.º 1
0
    $state = $_POST['state'];
    $zip_code = $_POST['zip_code'];
    $address = $street_address . ", " . $city . ", " . $state . " " . $zip_code;
    $type = $_POST['type'];
    $marker = new Marker($name, $address, null, null, $type);
    $marker->getLatLngFromGoogleMaps($address);
    $marker->save();
    $unisex = $_POST['unisex'];
    $key_required = $_POST['key_required'];
    $public = $_POST['public'];
    $handicap = $_POST['handicap'];
    $changing_table = $_POST['changing_table'];
    $marker_id = $marker->getId();
    $bathroom = new Bathroom($unisex, $key_required, $public, $handicap, $changing_table, $marker_id);
    $bathroom->save();
    return $app['twig']->render('add_bathroom.html.twig', array('bathrooms' => Bathroom::getAll(), 'markers' => Marker::getAll(), 'form_check' => false));
});
$app->get('/bathroom/{id}', function ($id) use($app) {
    $bathroom = Bathroom::find($id);
    $marker = Marker::find($id);
    $reviews = Review::getReviewsForBathroom($bathroom);
    return $app['twig']->render('bathroom.html.twig', array('bathroom' => $bathroom, 'marker' => $marker, 'reviews' => $reviews));
});
// reviews
$app->get('/add_review/{id}', function ($id) use($app) {
    $marker = Marker::find($id);
    return $app['twig']->render('add_review.html.twig', array('marker' => $marker));
});
$app->post('/add_review/{id}', function ($id) use($app) {
    $review = $_POST['review'];
    $rating = $_POST['rating'];
Exemplo n.º 2
0
 function test_delete()
 {
     $test_marker = new Marker("Pok Pok", "123 abcd street", 34.343534, 41.89089, "Restaurant");
     $test_marker->save();
     $test_marker2 = new Marker("Whiskey Soda Lounge", "678 DEF street", 41.89089, 34.343534, "Bar");
     $test_marker2->save();
     $test_marker->delete();
     $this->assertEquals([$test_marker2], Marker::getAll());
 }
Exemplo n.º 3
0
 static function find($search_id)
 {
     $found_marker = null;
     $markers = Marker::getAll();
     foreach ($markers as $marker) {
         $marker_id = $marker->getId();
         if ($marker_id == $search_id) {
             $found_marker = $marker;
         }
     }
     return $found_marker;
 }