mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
6d57cd7fe1
Honour the per-user auto-completion checkboxes on the rally point and the marketplace, where the target village is typed by name (dname field): - v1: own villages - v2: villages in the surroundings of the active village - v3: villages of the player's alliance members A new Database::getAutoCompleteVillages() builds the bounded, de-duplicated name list from the enabled categories (system accounts excluded). A shared Templates/villageAutocomplete.tpl renders a native <datalist> consumed by the dname input via list="dnameSuggest"; nothing is emitted when every box is unchecked, keeping the previous behaviour. Removes the "not coded yet" tag from the auto-completion section in the preferences form. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
33 lines
982 B
Smarty
33 lines
982 B
Smarty
<?php
|
|
/**
|
|
* Village-name autocomplete datalist for the rally point and the marketplace.
|
|
* Honours the player's auto-completion preferences (issue #198): v1 own
|
|
* villages, v2 surrounding villages, v3 alliance villages. Renders a
|
|
* <datalist id="dnameSuggest"> consumed by the dname input via
|
|
* list="dnameSuggest". Nothing is emitted when every box is unchecked.
|
|
*/
|
|
global $database, $session, $village;
|
|
|
|
$acV1 = !empty($session->userinfo['v1']);
|
|
$acV2 = !empty($session->userinfo['v2']);
|
|
$acV3 = !empty($session->userinfo['v3']);
|
|
|
|
if ($acV1 || $acV2 || $acV3) {
|
|
$acNames = $database->getAutoCompleteVillages(
|
|
$session->uid,
|
|
$session->alliance,
|
|
$village->coor['x'] ?? 0,
|
|
$village->coor['y'] ?? 0,
|
|
$acV1,
|
|
$acV2,
|
|
$acV3
|
|
);
|
|
|
|
echo '<datalist id="dnameSuggest">';
|
|
foreach ($acNames as $acName) {
|
|
echo '<option value="' . htmlspecialchars($acName, ENT_QUOTES) . '">';
|
|
}
|
|
echo '</datalist>';
|
|
}
|
|
?>
|