public function GetByPlace($place)
 {
     if (get_class($place) != "PhoenixSNS\\Modules\\World\\Objects\\Place") {
         return array();
     }
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "PlaceClippingRegions WHERE region_PlaceID = " . $id;
     $result = $MySQL->query($query);
     $count = $result->num_rows;
     $retval = array();
     for ($i = 0; $i < $count; $i++) {
         $values = $result->fetch_assoc();
         $retval[] = PlaceClippingRegion::GetByAssoc($values);
     }
     return $retval;
 }
Exemple #2
0
 public function GetClippingRegions()
 {
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "PlaceClippingRegions WHERE clippingregion_PlaceID = " . $this->ID;
     $result = $MySQL->query($query);
     $count = $result->num_rows;
     $retval = array();
     for ($i = 0; $i < $count; $i++) {
         $values = $result->fetch_assoc();
         $retval[] = PlaceClippingRegion::GetByAssoc($values);
     }
     return $retval;
 }
    $q = $_GET;
}
switch ($q["Action"]) {
    case "Retrieve":
        if (isset($q["PlaceID"])) {
            $id = $q["PlaceID"];
            if (!is_numeric($id)) {
                echo "{ \"Success\": false, \"ErrorMessage\": \"ID must be an integer\" }";
                return;
            }
            $place = Place::GetByID($id);
            if ($place == null) {
                echo "{ \"Success\": false, \"ErrorMessage\": \"Place with ID " . $id . " does not exist\" }";
                return;
            }
            $items = PlaceClippingRegion::GetByPlace($place);
            $count = count($items);
            echo "{ \"Success\": true, \"Items\": [ ";
            for ($i = 0; $i < $count; $i++) {
                echo $items[$i]->ToJSON();
                if ($i < $count - 1) {
                    echo ", ";
                }
            }
            echo " ] }";
        } else {
            echo "{ \"Success\": false, \"ErrorMessage\": \"Retrieval of all 'PlaceClippingRegion' objects not supported\" }";
            return;
        }
        return;
}