Exemplo n.º 1
0
 static function getSpots()
 {
     $spots = Spot::getSpots();
     if ($spots) {
         $error = array('errno' => 0, 'error' => '');
         $arr = array('places' => $spots, 'error' => $error);
     } else {
         $error = array('errno' => -1, 'error' => 'System error');
         $arr = array('error' => $error);
     }
     return $arr;
 }
Exemplo n.º 2
0
 static function testSpot()
 {
     $logout = User::logout();
     $spot = new Spot();
     $uid = $_SESSION["uid"] = "378984";
     if (($create = $spot->createSpot()) !== NULL) {
         echo 'CREATE SPOT: <font color="green">STWORZONO: ' . $create . '</font></br>';
     } else {
         echo 'CREATE SPOT: <font color="red">ERROR!</font></br>';
         return false;
     }
     if ($spot->getSpots() !== NULL) {
         echo 'GET SPOTS: <font color="green">ODNALEZIONO</font></br>';
     } else {
         echo 'GET SPOTS: <font color="red">ERROR!</font></br>';
         return false;
     }
     if ($spot->getSpotsByUser() !== NULL) {
         echo 'GET SPOTS BY USER: <font color="green">ODNALEZIONO</font></br>';
     } else {
         echo 'GET SPOTS BY USER: <font color="red">ERROR!</font></br>';
         return false;
     }
     if ($spot->getSpotById($create) !== NULL) {
         echo 'GET SPOTS BY ID: <font color="green">ODNALEZIONO</font></br>';
     } else {
         echo 'GET SPOTS BY ID: <font color="red">ERROR!</font></br>';
         return false;
     }
     $spot = $spot->getSpotById($create);
     $oldMapIcon = $spot->map_icon;
     $oldBanner = $spot->map_banner;
     $oldLat = $spot->lat;
     $oldLng = $spot->lng;
     $oldAddress = $spot->address;
     $string = self::generateRandomString();
     $spot->updateTitle($string);
     $spot = $spot->getSpotById($create);
     if ($spot->title == $string) {
         echo 'UPDATE TITLE: <font color="green">UDANE</font></br>';
     } else {
         echo 'UPDATE TITLE: <font color="red">ERROR!</font></br>';
         return false;
     }
     $spot->updateMapIcon("312312");
     $spot = $spot->getSpotById($create);
     if ($oldMapIcon !== $spot->map_icon) {
         echo 'UPDATE MAP ICON: <font color="green">UDANE</font></br>';
     } else {
         echo 'UPDATE MAP ICON: <font color="red">ERROR!</font></br>';
         return false;
     }
     $spot->updateBanner("312312");
     $spot = $spot->getSpotById($create);
     if ($oldBanner !== $spot->map_banner) {
         echo 'UPDATE BANNER: <font color="green">UDANE</font></br>';
     } else {
         echo 'UPDATE BANNER: <font color="red">ERROR!</font></br>';
         return false;
     }
     $spot->updateLocation("312312", "312312", "312312");
     $spot = $spot->getSpotById($create);
     if ($oldLat !== $spot->lat && $oldLng !== $spot->lng && $oldAddress !== $spot->address) {
         echo 'UPDATE LOCATION: <font color="green">UDANE</font></br>';
     } else {
         echo 'UPDATE LOCATION: <font color="red">ERROR!</font></br>';
         return false;
     }
     $_POST["id"] = $create;
     $spot->deleteSpot();
     if (($spot = $spot->getSpotById($create)) == NULL) {
         echo 'DELETE SPOT: <font color="green">UDANE</font></br>';
     } else {
         echo 'DELETE SPOT: <font color="red">ERROR!</font></br>';
         return false;
     }
     return true;
 }