'; $out .= self::render_tabs($listings, $addon_id); $out .= ''; return $out; } // --------------------------------------------------------------------------- // TABS // --------------------------------------------------------------------------- private static function render_tabs($listings, $addon_id) { $tabs = [ ['id' => 'core', 'label' => 'Core', 'active' => true], ['id' => 'tier1', 'label' => 'Tier-I', 'active' => false], ['id' => 'tier2', 'label' => 'Tier-II', 'active' => false], ['id' => 'other', 'label' => 'Other', 'active' => false], ]; $uid = $addon_id . '-dir'; $out = ''; $out .= '
'; foreach ($tabs as $tab) { $show = $tab['active'] ? ' show active' : ''; $out .= '
'; if ($tab['id'] === 'core') { $out .= self::render_core_tab($listings['core'] ?? []); } else { $placeholders = [ 'tier1' => 'Mediators, subject matter experts, advisors, and authors will be listed here.', 'tier2' => 'Attorneys who have concluded HOA homeowner cases in Illinois will be listed here.', 'other' => 'Civic organizations, consumer protection entities, and oversight agencies will be listed here.', ]; $out .= self::render_tier_tab( $listings[$tab['id']] ?? [], $placeholders[$tab['id']] ?? '' ); } $out .= '
'; } $out .= '
'; return $out; } // --------------------------------------------------------------------------- // CORE TAB — three fixed slots with pending-card images // --------------------------------------------------------------------------- private static function render_core_tab($core_entries) { $slots = [ [ 'slot' => 'taxonomy-authority', 'role' => 'Taxonomy Authority', 'description' => 'The institutional source of the case law categories this diagnostic record is organized by.', 'image' => '/addon/vs01/view/img/directory-core-taxonomy-authority.png', ], [ 'slot' => 'methodology-certifier', 'role' => 'Methodology Certifier', 'description' => 'The law firm whose professional association with this project certifies the diagnostic record meets a standard the legal community can use.', 'image' => '/addon/vs01/view/img/directory-core-methodology-certifier.png', ], [ 'slot' => 'peer-operator', 'role' => 'Peer Operator', 'description' => 'The cooperating Civic Infrastructure host who can independently verify, support, and if necessary continue this diagnostic record.', 'image' => '/addon/vs01/view/img/directory-core-peer-operator.png', ], ]; $populated = []; foreach ($core_entries as $entry) { if (!empty($entry['slot']) && ($entry['status'] ?? '') === 'active') { $populated[$entry['slot']] = $entry; } } $out = ''; foreach ($slots as $slot) { if (isset($populated[$slot['slot']])) { $e = $populated[$slot['slot']]; $name = self::h($e['name'] ?? ''); $url = self::h($e['url'] ?? ''); $image = self::h($e['image'] ?? $slot['image']); $out .= '
'; $out .= '
'; $out .= '
'; $out .= '
' . self::h($slot['role']) . '
'; if ($url) { $out .= ''; } else { $out .= '
' . $name . '
'; } $out .= '
'; } else { $out .= '
'; $out .= '
' . self::h($slot['role']) . ' — reserved
'; $out .= '
'; $out .= '
' . self::h($slot['description']) . '
'; $out .= '
'; } } return $out; } // --------------------------------------------------------------------------- // TIER TABS — Tier-I, Tier-II, Other // --------------------------------------------------------------------------- private static function render_tier_tab($entries, $placeholder) { if (empty($entries)) { return '
' . self::h($placeholder) . '
'; } $out = ''; foreach ($entries as $entry) { $name = self::h($entry['name'] ?? ''); $role = self::h($entry['role'] ?? ''); $desc = self::h($entry['description'] ?? ''); $url = self::h($entry['url'] ?? ''); $image = self::h($entry['image'] ?? '/addon/vs01/view/img/directory-tier-default.png'); $out .= '
'; $out .= '
'; $out .= '
'; if ($role) $out .= '
' . $role . '
'; if ($url) { $out .= ''; } else { $out .= '
' . $name . '
'; } if ($desc) $out .= '
' . $desc . '
'; $out .= '
'; } return $out; } // --------------------------------------------------------------------------- // HELPER // --------------------------------------------------------------------------- public static function h($value) { return htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8'); } }