Zoo Arcadia provides several features for visitors to interact with the zoo online. These features don’t require authentication and are accessible to anyone visiting the website.
The /animals/pages/allanimals page displays all animals with filtering options:
public function allanimals() { // Get Hero for Animals Page $heroModel = new Hero(); $hero = $heroModel->getByPage('animals'); $slides = []; if ($hero && $hero->has_sliders) { $slideModel = new Slide(); $slides = $slideModel->getByHeroId($hero->id_hero); } // Get all animals $animalModel = new AnimalFull(); $animals = $animalModel->getAll(); // Get latest health state for each animal $healthReportModel = new HealthStateReport(); foreach ($animals as $animal) { $latestReport = $healthReportModel->getLatestByAnimalId( $animal->id_full_animal ); $animal->latest_health_state = $latestReport ? $latestReport->hsr_state : null; } // Get filter data $species = $specieModel->getAll(); $habitats = $habitatModel->getAll(); $nutritions = $nutritionModel->getAll(); include_once __DIR__ . '/../views/pages/allanimals.php';}
/habitats/pages/habitats displays all zoo habitats:
public function habitats() { // Get all habitats $habitatModel = new Habitat(); $habitats = $habitatModel->getAll(); // Get Hero for Habitats Page $heroModel = new Hero(); $hero = $heroModel->getByPage('habitats'); $slides = []; if ($hero && $hero->has_sliders) { $slideModel = new Slide(); $slides = $slideModel->getByHeroId($hero->id_hero); } include_once __DIR__ . '/../views/pages/habitats.php';}
/habitats/pages/habitat1?id=X shows a specific habitat with all its animals:
public function habitat1() { $id = $_GET['id'] ?? null; // Get habitat details $habitat = $habitatModel->getById($id); // Get animals in this habitat $animals = $habitatModel->getAnimalsByHabitatId($id); // Get latest health state for each animal foreach ($animals as $animal) { $latestReport = $healthReportModel->getLatestByAnimalId( $animal->id_full_animal ); $animal->latest_health_state = $latestReport->hsr_state ?? null; } // Get filter data $species = $specieModel->getAll(); $nutritions = $nutritionModel->getAll(); include_once __DIR__ . '/../views/pages/habitat1.php';}
Only validated testimonials appear on public pages:
// Get validated testimonials for public displaypublic function getValidated(){ $sql = "SELECT * FROM testimonials WHERE status = 'validated' ORDER BY created_at DESC"; $stmt = $this->db->prepare($sql); $stmt->execute(); return $stmt->fetchAll(PDO::FETCH_OBJ);}// Get best testimonial for homepagepublic function getBest(){ // Get highest rated, or most recent if tie $sql = "SELECT * FROM testimonials WHERE status = 'validated' ORDER BY rating DESC, created_at DESC LIMIT 1"; $stmt = $this->db->prepare($sql); $stmt->execute(); return $stmt->fetch(PDO::FETCH_OBJ);}
public function getStats(){ $sql = "SELECT COUNT(*) as total, SUM(CASE WHEN status = 'pending' THEN 1 ELSE 0 END) as pending, SUM(CASE WHEN status = 'validated' THEN 1 ELSE 0 END) as validated, SUM(CASE WHEN status = 'rejected' THEN 1 ELSE 0 END) as rejected, AVG(rating) as avg_rating FROM testimonials"; $stmt = $this->db->prepare($sql); $stmt->execute(); return $stmt->fetch(PDO::FETCH_OBJ);}
Session-based deduplication prevents spam while still allowing accurate popularity tracking. Each visitor can only register one click per animal per session.
// Top 10 most popular animals$topAnimals = $clickModel->getTopAnimals(10);// Current month statistics$monthStats = $clickModel->getCurrentMonthStats();// Total clicks across all animals$totalClicks = $clickModel->getTotalClicks();