function ImportKingdomParks($number = 20) { global $STATES; echo "<h2>Import Kingdom Parks</h2>"; list($chapterID, $detail) = $this->LastStatus('chapters', array("69", "149", "161", "175", "176", "178", "240", "264", "297", "298", "299", "342", "344", "345")); $sql = "select * from chapters where chapterID > {$chapterID} and (principID is null or principID = 0) and kingdomID != 14 order by chapterID limit {$number}"; $chapters = $this->ORK2->query($sql); $Park = new APIModel('Park'); echo $sql . "<p>"; if ($chapters->size() > 0) { do { set_time_limit(120); if ($chapters->kingdomID == 2) { continue; } echo "Create Kingdom Park {$chapters->name}<br />"; list($tmp, $kingdom_id) = $this->CacheMap('kingdoms', $chapters->kingdomID); $park = $Park->CreatePark(array('Token' => $this->token, 'Name' => $chapters->name, 'Abbreviation' => $chapters->abbre, 'KingdomId' => $kingdom_id, 'ParkTitleId' => 0)); $Park->SetParkDetails(array('Token' => $this->token, 'ParkId' => $park['Detail'], 'Heraldry' => '', 'HeraldryMimeType' => '', 'Url' => $chapters->URL, 'Address' => $chapters->ParkAddress, 'City' => $chapters->ParkCity, 'Province' => $STATES[$chapters->ParkStateID], 'PostalCode' => $chapters->ParkZip, 'MapUrl' => '', 'Directions' => str_replace("'", ""e;", str_replace("\n", "<br>", str_replace("\r", "", $chapters->ParkInfo))), 'GeoCode' => $chapters->GeoCode)); $this->RecordTransfer('chapters', 'Park', $chapters->chapterID, $park['Detail'], array()); } while ($chapters->next()); } echo "<h3>Import Kingdom Parks Complete</h3>"; }