Alpha V1.4b
This commit is contained in:
parent
12241ba85d
commit
a3bcb701ab
32
admin.php
32
admin.php
@ -1022,13 +1022,30 @@ if ($tab === 'users') {
|
||||
<strong><?php echo htmlspecialchars($r['name']); ?></strong><br>
|
||||
<small style="color: #8c92a3; font-size: 10px;">
|
||||
<?php
|
||||
$conds = [];
|
||||
if($r['is_empty_case']) $conds[] = "Case Vide";
|
||||
if($r['orbital_count_op']) $conds[] = "Orbital Factions " . $r['orbital_count_op'] . " " . $r['orbital_count_val'];
|
||||
if($r['terrestrial_count_op']) $conds[] = "Ground Factions " . $r['terrestrial_count_op'] . " " . $r['terrestrial_count_val'];
|
||||
if($r['orbital_dominance']) $conds[] = "Orbital IN (" . $r['orbital_dominance'] . ")";
|
||||
if($r['terrestrial_dominance']) $conds[] = "Ground IN (" . $r['terrestrial_dominance'] . ")";
|
||||
echo !empty($conds) ? implode(' AND ', $conds) : '<em>Toujours vrai</em>';
|
||||
$orb_conds = [];
|
||||
if($r['orbital_count_op']) $orb_conds[] = "Factions " . $r['orbital_count_op'] . " " . $r['orbital_count_val'];
|
||||
if($r['orbital_dominance']) $orb_conds[] = "IN (" . $r['orbital_dominance'] . ")";
|
||||
|
||||
$terr_conds = [];
|
||||
if($r['terrestrial_count_op']) $terr_conds[] = "Factions " . $r['terrestrial_count_op'] . " " . $r['terrestrial_count_val'];
|
||||
if($r['terrestrial_dominance']) $terr_conds[] = "IN (" . $r['terrestrial_dominance'] . ")";
|
||||
|
||||
$final_parts = [];
|
||||
if ($r['is_empty_case']) $final_parts[] = "Case Vide";
|
||||
|
||||
$orb_str = !empty($orb_conds) ? "Orbital (" . implode(' AND ', $orb_conds) . ")" : "";
|
||||
$terr_str = !empty($terr_conds) ? "Ground (" . implode(' AND ', $terr_conds) . ")" : "";
|
||||
|
||||
if ($orb_str && $terr_str) {
|
||||
$sep = ($r['combine_mode'] == 'AND') ? ' AND ' : ' OR ';
|
||||
$final_parts[] = $orb_str . $sep . $terr_str;
|
||||
} elseif ($orb_str) {
|
||||
$final_parts[] = $orb_str;
|
||||
} elseif ($terr_str) {
|
||||
$final_parts[] = $terr_str;
|
||||
}
|
||||
|
||||
echo !empty($final_parts) ? implode(' AND ', $final_parts) : '<em>Toujours vrai</em>';
|
||||
?>
|
||||
</small>
|
||||
</td>
|
||||
@ -1539,6 +1556,7 @@ function editStatus(data) {
|
||||
updateMSLabel('ms_terr');
|
||||
|
||||
document.getElementById('rule_empty').checked = data.is_empty_case == 1;
|
||||
document.getElementById('rule_combine').value = data.combine_mode || "OR";
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
function resetRuleForm() {
|
||||
|
||||
10
db/add_combine_mode_to_rules.php
Normal file
10
db/add_combine_mode_to_rules.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/config.php';
|
||||
$db = db();
|
||||
try {
|
||||
$db->exec("ALTER TABLE celestial_object_status_rules ADD COLUMN combine_mode VARCHAR(10) DEFAULT 'OR'");
|
||||
echo "Column combine_mode added successfully.\n";
|
||||
} catch (Exception $e) {
|
||||
echo "Error adding column: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
@ -54,51 +54,75 @@ function calculateCelestialStatus($planet, $db, $statuses_map) {
|
||||
|
||||
// Évaluation des règles
|
||||
foreach ($rules as $rule) {
|
||||
$match = true;
|
||||
// Condition Case Vide (doit matcher avant de tester le reste)
|
||||
if ($rule['is_empty_case'] && !$is_empty) continue;
|
||||
|
||||
// Condition Case Vide
|
||||
if ($rule['is_empty_case'] && !$is_empty) $match = false;
|
||||
$match_orbite = true;
|
||||
$match_sol = true;
|
||||
|
||||
$has_orb_cond = !empty($rule['orbital_count_op']) || !empty($rule['orbital_dominance']);
|
||||
$has_sol_cond = !empty($rule['terrestrial_count_op']) || !empty($rule['terrestrial_dominance']);
|
||||
|
||||
// Condition Nombre Factions Orbite
|
||||
if ($match && $rule['orbital_count_op']) {
|
||||
$match = evaluateOperator($orb_count, $rule['orbital_count_op'], $rule['orbital_count_val']);
|
||||
// Evaluation Orbite
|
||||
if ($rule['orbital_count_op']) {
|
||||
if (!evaluateOperator($orb_count, $rule['orbital_count_op'], $rule['orbital_count_val'])) {
|
||||
$match_orbite = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Condition Nombre Factions Sol
|
||||
if ($match && $rule['terrestrial_count_op']) {
|
||||
$match = evaluateOperator($terr_count, $rule['terrestrial_count_op'], $rule['terrestrial_count_val']);
|
||||
}
|
||||
|
||||
// Condition Dominance Orbite (Multi-select)
|
||||
if ($match && !empty($rule['orbital_dominant_factions'])) {
|
||||
$allowed = explode(',', $rule['orbital_dominant_factions']);
|
||||
if ($match_orbite && !empty($rule['orbital_dominance'])) {
|
||||
$allowed = explode(',', $rule['orbital_dominance']);
|
||||
$isIn = false;
|
||||
if (!$orb_dom) {
|
||||
if (in_array('none', $allowed)) $isIn = true;
|
||||
} else {
|
||||
if (in_array((string)$orb_dom, $allowed)) $isIn = true;
|
||||
}
|
||||
if (!$isIn) $match = false;
|
||||
if (!$isIn) $match_orbite = false;
|
||||
}
|
||||
|
||||
// Condition Dominance Sol (Multi-select)
|
||||
if ($match && !empty($rule['ground_dominant_factions'])) {
|
||||
$allowed = explode(',', $rule['ground_dominant_factions']);
|
||||
// Evaluation Sol
|
||||
if ($rule['terrestrial_count_op']) {
|
||||
if (!evaluateOperator($terr_count, $rule['terrestrial_count_op'], $rule['terrestrial_count_val'])) {
|
||||
$match_sol = false;
|
||||
}
|
||||
}
|
||||
if ($match_sol && !empty($rule['terrestrial_dominance'])) {
|
||||
$allowed = explode(',', $rule['terrestrial_dominance']);
|
||||
$isIn = false;
|
||||
if (!$terr_dom) {
|
||||
if (in_array('none', $allowed)) $isIn = true;
|
||||
} else {
|
||||
if (in_array((string)$terr_dom, $allowed)) $isIn = true;
|
||||
}
|
||||
if (!$isIn) $match = false;
|
||||
if (!$isIn) $match_sol = false;
|
||||
}
|
||||
|
||||
// Condition Croisée
|
||||
if ($match && ($rule['dominance_diff_required'] ?? 0)) {
|
||||
if ($orb_dom == $terr_dom) $match = false;
|
||||
// Application de la combinaison
|
||||
$combine = $rule['combine_mode'] ?? 'OR';
|
||||
$final_match = false;
|
||||
|
||||
if (!$has_orb_cond && !$has_sol_cond) {
|
||||
// Pas de conditions spécifiques (ex: règle par défaut ou juste is_empty_case)
|
||||
$final_match = true;
|
||||
} elseif ($has_orb_cond && !$has_sol_cond) {
|
||||
$final_match = $match_orbite;
|
||||
} elseif (!$has_orb_cond && $has_sol_cond) {
|
||||
$final_match = $match_sol;
|
||||
} else {
|
||||
// Les deux côtés ont des conditions
|
||||
if ($combine === 'AND') {
|
||||
$final_match = $match_orbite && $match_sol;
|
||||
} else {
|
||||
$final_match = $match_orbite || $match_sol;
|
||||
}
|
||||
}
|
||||
|
||||
if ($match) {
|
||||
// Condition Croisée (Dominance différente requise)
|
||||
if ($final_match && ($rule['dominance_diff_required'] ?? 0)) {
|
||||
if ($orb_dom == $terr_dom) $final_match = false;
|
||||
}
|
||||
|
||||
if ($final_match) {
|
||||
return $rule['status_slug'];
|
||||
}
|
||||
}
|
||||
@ -117,4 +141,4 @@ function evaluateOperator($val, $op, $target) {
|
||||
case '!=': return $val != $target;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
187
patch_admin_v5.php
Normal file
187
patch_admin_v5.php
Normal file
@ -0,0 +1,187 @@
|
||||
<?php
|
||||
$file = 'admin.php';
|
||||
$content = file_get_contents($file);
|
||||
|
||||
// 1. Update Handler logic
|
||||
$handlerOld = '$terrestrial_dominance = isset($_POST[\'terrestrial_dominance\']) ? implode(\'\',\',(array)$_POST[\'terrestrial_dominance\']) : null;
|
||||
$is_empty_case = isset($_POST[\'is_empty_case\']) ? 1 : 0;
|
||||
|
||||
if ($id > 0) {
|
||||
$stmt = $db->prepare("UPDATE celestial_object_status_rules SET name = ?, status_id = ?, profile_id = ?, priority = ?, orbital_count_op = ?, orbital_count_val = ?, terrestrial_count_op = ?, terrestrial_count_val = ?, orbital_dominance = ?, terrestrial_dominance = ?, is_empty_case = ? WHERE id = ?");
|
||||
$stmt->execute([$name, $status_id, $profile_id, $priority, $orbital_count_op, $orbital_count_val, $terrestrial_count_op, $terrestrial_count_val, $orbital_dominance, $terrestrial_dominance, $is_empty_case, $id]);
|
||||
} else {
|
||||
$stmt = $db->prepare("INSERT INTO celestial_object_status_rules (name, status_id, profile_id, priority, orbital_count_op, orbital_count_val, terrestrial_count_op, terrestrial_count_val, orbital_dominance, terrestrial_dominance, is_empty_case) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$name, $status_id, $profile_id, $priority, $orbital_count_op, $orbital_count_val, $terrestrial_count_op, $terrestrial_count_val, $orbital_dominance, $terrestrial_dominance, $is_empty_case]);
|
||||
}';
|
||||
|
||||
$handlerNew = '$terrestrial_dominance = isset($_POST[\'terrestrial_dominance\']) ? implode(\'\',\',(array)$_POST[\'terrestrial_dominance\']) : null;
|
||||
$is_empty_case = isset($_POST[\'is_empty_case\']) ? 1 : 0;
|
||||
$combine_mode = $_POST[\'combine_mode\'] ?? \'OR\';
|
||||
|
||||
if ($id > 0) {
|
||||
$stmt = $db->prepare("UPDATE celestial_object_status_rules SET name = ?, status_id = ?, profile_id = ?, priority = ?, orbital_count_op = ?, orbital_count_val = ?, terrestrial_count_op = ?, terrestrial_count_val = ?, orbital_dominance = ?, terrestrial_dominance = ?, is_empty_case = ?, combine_mode = ? WHERE id = ?");
|
||||
$stmt->execute([$name, $status_id, $profile_id, $priority, $orbital_count_op, $orbital_count_val, $terrestrial_count_op, $terrestrial_count_val, $orbital_dominance, $terrestrial_dominance, $is_empty_case, $combine_mode, $id]);
|
||||
} else {
|
||||
$stmt = $db->prepare("INSERT INTO celestial_object_status_rules (name, status_id, profile_id, priority, orbital_count_op, orbital_count_val, terrestrial_count_op, terrestrial_count_val, orbital_dominance, terrestrial_dominance, is_empty_case, combine_mode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$name, $status_id, $profile_id, $priority, $orbital_count_op, $orbital_count_val, $terrestrial_count_op, $terrestrial_count_val, $orbital_dominance, $terrestrial_dominance, $is_empty_case, $combine_mode]);
|
||||
}';
|
||||
|
||||
$content = str_replace($handlerOld, $handlerNew, $content);
|
||||
|
||||
// 2. Update UI
|
||||
$uiOld = '<div style="background: rgba(0,0,0,0.2); padding: 15px; border-radius: 4px; border: 1px solid #334155; margin-bottom: 15px;">
|
||||
<div style="display: flex; gap: 15px; align-items: center; margin-bottom: 10px;">
|
||||
<div style="flex: 0 0 180px; font-size: 11px; color: #88c0d0; font-weight: bold;"> NOMBRE DE FACTIONS :</div>
|
||||
<div class="form-group" style="flex: 1; margin-bottom: 0;">
|
||||
<label style="font-size: 10px;">En Orbite</label>
|
||||
<div style="display: flex; gap: 5px;">
|
||||
<select name="orbital_count_op" id="rule_orb_op" style="width: 70px;">
|
||||
<option value="">-</option>
|
||||
<option value="=">=</option><option value=">">></option><option value="<"><</option>
|
||||
<option value=">=">>=</option><option value="<="><=</option>
|
||||
</select>
|
||||
<input type="number" name="orbital_count_val" id="rule_orb_val" placeholder="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="flex: 1; margin-bottom: 0;">
|
||||
<label style="font-size: 10px;">Au Sol</label>
|
||||
<div style="display: flex; gap: 5px;">
|
||||
<select name="terrestrial_count_op" id="rule_terr_op" style="width: 70px;">
|
||||
<option value="">-</option>
|
||||
<option value="=">=</option><option value=">">></option><option value="<"><</option>
|
||||
<option value=">=">>=</option><option value="<="><=</option>
|
||||
</select>
|
||||
<input type="number" name="terrestrial_count_val" id="rule_terr_val" placeholder="0">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; gap: 15px; align-items: flex-start; margin-bottom: 10px;">
|
||||
<div style="flex: 0 0 180px; font-size: 11px; color: #88c0d0; font-weight: bold; padding-top: 5px;">FILTRE DOMINANCE :</div>
|
||||
|
||||
<!-- Orbite -->
|
||||
<div class="form-group" style="flex: 1; margin-bottom: 0;">
|
||||
<label style="font-size: 10px;">En Orbite</label>
|
||||
<div class="ms-container" id="ms_orb">
|
||||
<div class="ms-display" onclick="toggleMS(\'ms_orb_list\')">Toutes / Peu importe</div>
|
||||
<div class="ms-dropdown" id="ms_orb_list">
|
||||
<label class="ms-item"><input type="checkbox" value="none" onchange="updateMSLabel(\'ms_orb\')"> Aucune (Vide)</label>
|
||||
<?php foreach($factions_list as $f): if($f[\'name\'] !== \'Aucune\'): ?>
|
||||
<label class="ms-item"><input type="checkbox" value="<?php echo $f[\'id\']; ?>" name="orbital_dominance[]" onchange="updateMSLabel(\'ms_orb\')"> <?php echo htmlspecialchars($f[\'name\']); ?></label>
|
||||
<?php endif; endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sol -->
|
||||
<div class="form-group" style="flex: 1; margin-bottom: 0;">
|
||||
<label style="font-size: 10px;">Au Sol</label>
|
||||
<div class="ms-container" id="ms_terr">
|
||||
<div class="ms-display" onclick="toggleMS(\'ms_terr_list\')">Toutes / Peu importe</div>
|
||||
<div class="ms-dropdown" id="ms_terr_list">
|
||||
<label class="ms-item"><input type="checkbox" value="none" onchange="updateMSLabel(\'ms_terr\')"> Aucune (Vide)</label>
|
||||
<?php foreach($factions_list as $f): if($f[\'name\'] !== \'Aucune\'): ?>
|
||||
<label class="ms-item"><input type="checkbox" value="<?php echo $f[\'id\']; ?>" name="terrestrial_dominance[]" onchange="updateMSLabel(\'ms_terr\')"> <?php echo htmlspecialchars($f[\'name\']); ?></label>
|
||||
<?php endif; endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid #334155;">
|
||||
<input type="checkbox" name="is_empty_case" id="rule_empty" style="width: auto;">
|
||||
<label for="rule_empty" style="margin-bottom: 0; color: #ebcb8b;">Cas "CASE VIDE" (Aucune faction nulle part)</label>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$uiNew = '<div style="background: rgba(0,0,0,0.2); padding: 15px; border-radius: 4px; border: 1px solid #334155; margin-bottom: 15px;">
|
||||
<div style="display: flex; gap: 20px; align-items: stretch;">
|
||||
<!-- ORBITE -->
|
||||
<div style="flex: 1; display: flex; flex-direction: column; gap: 10px;">
|
||||
<div style="font-size: 11px; color: #88c0d0; font-weight: bold; text-align: center; border-bottom: 1px solid #334155; padding-bottom: 5px;">EN ORBITE</div>
|
||||
<div class="form-group" style="margin-bottom: 0;">
|
||||
<label style="font-size: 10px;">Nombre de factions</label>
|
||||
<div style="display: flex; gap: 5px;">
|
||||
<select name="orbital_count_op" id="rule_orb_op" style="width: 70px;">
|
||||
<option value="">-</option>
|
||||
<option value="=">=</option><option value=">">></option><option value="<"><</option>
|
||||
<option value=">=">>=</option><option value="<="><=</option>
|
||||
</select>
|
||||
<input type="number" name="orbital_count_val" id="rule_orb_val" placeholder="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom: 0;">
|
||||
<label style="font-size: 10px;">Dominance (Factions)</label>
|
||||
<div class="ms-container" id="ms_orb">
|
||||
<div class="ms-display" onclick="toggleMS(\'ms_orb_list\')">Toutes / Peu importe</div>
|
||||
<div class="ms-dropdown" id="ms_orb_list">
|
||||
<label class="ms-item"><input type="checkbox" value="none" onchange="updateMSLabel(\'ms_orb\')"> Aucune (Vide)</label>
|
||||
<?php foreach($factions_list as $f): if($f[\'name\'] !== \'Aucune\'): ?>
|
||||
<label class="ms-item"><input type="checkbox" value="<?php echo $f[\'id\']; ?>" name="orbital_dominance[]" onchange="updateMSLabel(\'ms_orb\')"> <?php echo htmlspecialchars($f[\'name\']); ?></label>
|
||||
<?php endif; endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- COMBINAISON -->
|
||||
<div style="flex: 0 0 100px; display: flex; flex-direction: column; justify-content: center; align-items: center; background: rgba(136, 192, 208, 0.1); border: 1px solid #88c0d0; border-radius: 4px; padding: 10px;">
|
||||
<label style="font-size: 10px; color: #88c0d0; font-weight: bold; margin-bottom: 8px;">COMBINAISON</label>
|
||||
<select name="combine_mode" id="rule_combine" style="width: 100%; text-align: center; font-weight: bold; color: #88c0d0; background: #2e3440; border-color: #88c0d0;">
|
||||
<option value="OR">OU</option>
|
||||
<option value="AND">ET</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- SOL -->
|
||||
<div style="flex: 1; display: flex; flex-direction: column; gap: 10px;">
|
||||
<div style="font-size: 11px; color: #a3be8c; font-weight: bold; text-align: center; border-bottom: 1px solid #334155; padding-bottom: 5px;">AU SOL</div>
|
||||
<div class="form-group" style="margin-bottom: 0;">
|
||||
<label style="font-size: 10px;">Nombre de factions</label>
|
||||
<div style="display: flex; gap: 5px;">
|
||||
<select name="terrestrial_count_op" id="rule_terr_op" style="width: 70px;">
|
||||
<option value="">-</option>
|
||||
<option value="=">=</option><option value=">">></option><option value="<"><</option>
|
||||
<option value=">=">>=</option><option value="<="><=</option>
|
||||
</select>
|
||||
<input type="number" name="terrestrial_count_val" id="rule_terr_val" placeholder="0">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom: 0;">
|
||||
<label style="font-size: 10px;">Dominance (Factions)</label>
|
||||
<div class="ms-container" id="ms_terr">
|
||||
<div class="ms-display" onclick="toggleMS(\'ms_terr_list\')">Toutes / Peu importe</div>
|
||||
<div class="ms-dropdown" id="ms_terr_list">
|
||||
<label class="ms-item"><input type="checkbox" value="none" onchange="updateMSLabel(\'ms_terr\')"> Aucune (Vide)</label>
|
||||
<?php foreach($factions_list as $f): if($f[\'name\'] !== \'Aucune\'): ?>
|
||||
<label class="ms-item"><input type="checkbox" value="<?php echo $f[\'id\']; ?>" name="terrestrial_dominance[]" onchange="updateMSLabel(\'ms_terr\')"> <?php echo htmlspecialchars($f[\'name\']); ?></label>
|
||||
<?php endif; endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; align-items: center; gap: 10px; padding-top: 15px; margin-top: 15px; border-top: 1px solid #334155;">
|
||||
<input type="checkbox" name="is_empty_case" id="rule_empty" style="width: auto;">
|
||||
<label for="rule_empty" style="margin-bottom: 0; color: #ebcb8b;">Cas "CASE VIDE" (Aucune faction nulle part)</label>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$content = str_replace($uiOld, $uiNew, $content);
|
||||
|
||||
// 3. Update JS (editRule)
|
||||
$jsOld = ' document.getElementById(\'rule_empty\').checked = data.is_empty_case == 1;
|
||||
window.scrollTo(0,0);
|
||||
}';
|
||||
|
||||
$jsNew = ' document.getElementById(\'rule_empty\').checked = data.is_empty_case == 1;
|
||||
document.getElementById(\'rule_combine\').value = data.combine_mode || "OR";
|
||||
window.scrollTo(0,0);
|
||||
}';
|
||||
|
||||
$content = str_replace($jsOld, $jsNew, $content);
|
||||
|
||||
file_put_contents($file, $content);
|
||||
echo "admin.php updated successfully.\n";
|
||||
|
||||
46
patch_admin_v6.php
Normal file
46
patch_admin_v6.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
$file = 'admin.php';
|
||||
$content = file_get_contents($file);
|
||||
|
||||
$oldDisplay = ' <?php
|
||||
$conds = [];
|
||||
if($r[\'is_empty_case\']) $conds[] = "Case Vide";
|
||||
if($r[\'orbital_count_op\']) $conds[] = "Orbital Factions " . $r[\'orbital_count_op\'] . " " . $r[\'orbital_count_val\'];
|
||||
if($r[\'terrestrial_count_op\']) $conds[] = "Ground Factions " . $r[\'terrestrial_count_op\'] . " " . $r[\'terrestrial_count_val\'];
|
||||
if($r[\'orbital_dominance\']) $conds[] = "Orbital IN (" . $r[\'orbital_dominance\'] . ")";
|
||||
if($r[\'terrestrial_dominance\']) $conds[] = "Ground IN (" . $r[\'terrestrial_dominance\'] . ")";
|
||||
echo !empty($conds) ? implode(\' AND \', $conds) : \'<em>Toujours vrai</em>\';
|
||||
?>';
|
||||
|
||||
$newDisplay = ' <?php
|
||||
$orb_conds = [];
|
||||
if($r[\'orbital_count_op\']) $orb_conds[] = "Factions " . $r[\'orbital_count_op\'] . " " . $r[\'orbital_count_val\'];
|
||||
if($r[\'orbital_dominance\']) $orb_conds[] = "IN (" . $r[\'orbital_dominance\'] . ")";
|
||||
|
||||
$terr_conds = [];
|
||||
if($r[\'terrestrial_count_op\']) $terr_conds[] = "Factions " . $r[\'terrestrial_count_op\'] . " " . $r[\'terrestrial_count_val\'];
|
||||
if($r[\'terrestrial_dominance\']) $terr_conds[] = "IN (" . $r[\'terrestrial_dominance\'] . ")";
|
||||
|
||||
$final_parts = [];
|
||||
if ($r[\'is_empty_case\']) $final_parts[] = "Case Vide";
|
||||
|
||||
$orb_str = !empty($orb_conds) ? "Orbital (" . implode(\' AND \', $orb_conds) . ")" : "";
|
||||
$terr_str = !empty($terr_conds) ? "Ground (" . implode(\' AND \', $terr_conds) . ")" : "";
|
||||
|
||||
if ($orb_str && $terr_str) {
|
||||
$sep = ($r[\'combine_mode\'] == \'AND\') ? \' AND \' : \' OR \';
|
||||
$final_parts[] = $orb_str . $sep . $terr_str;
|
||||
} elseif ($orb_str) {
|
||||
$final_parts[] = $orb_str;
|
||||
} elseif ($terr_str) {
|
||||
$final_parts[] = $terr_str;
|
||||
}
|
||||
|
||||
echo !empty($final_parts) ? implode(\' AND \', $final_parts) : \'<em>Toujours vrai</em>\';
|
||||
?>';
|
||||
|
||||
$content = str_replace($oldDisplay, $newDisplay, $content);
|
||||
|
||||
file_put_contents($file, $content);
|
||||
echo "admin.php table display updated successfully.\n";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user