Asked for: normal members must not see anything of the alliances - not the alliance member list, not their
calendar entries - and the alliance things out of the patch notes.
- consilium_can_view() is now consilium.view only (before: every legion member). Normal members get no menu entry,
no Consilium page, no member-list tab, no Consilium raids (raids page, dashboard, calendar) and no share button
or Consilium hints on the map (tactics_api.php: consilium flag and consilium_share need consilium.view).
- Calendar: Consilium entries only with consilium.view - calendar_can_view(), the iCal subscription, the "Für wen?"
option and the moderation queue and its counter.
- member.php: profiles of allied members only for those who see the Consilium.
- Allies no longer counted in legion lists: Lumipunkte rank on the dashboard, premade invite candidates, class
counts on the professions page.
- Map: normal members in a shared session see guests like other participants, without 🤝 and legion.
- Patch note about the Consilium removed; permission description updated (schema 70); admin setup hint and README.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
199 lines
11 KiB
PHP
199 lines
11 KiB
PHP
<?php
|
||
/**
|
||
* Berufe der Legion (includes/professions.php): je Handwerksberuf, wer ihn ausuebt (Stufe, Hauptberuf), fuer welche
|
||
* Klassen er die Waffen baut und - von der Leitung festgelegt (professions.manage) - wie viele ihn als Hauptberuf
|
||
* haben sollten; darunter die Sammel-Spezialisierungen. Eingetragen wird bei den Charakteren auf der eigenen
|
||
* Profilseite (member_edit.php).
|
||
*/
|
||
require_once __DIR__ . '/includes/bootstrap.php';
|
||
require_once __DIR__ . '/includes/professions.php';
|
||
require_permission('members.view');
|
||
|
||
$canManage = user_has_permission('professions.manage');
|
||
$rows = professions_all_rows();
|
||
$counts = profession_member_counts($rows);
|
||
$targets = profession_targets();
|
||
$wanted = professions_wanted($counts);
|
||
|
||
// Je Beruf die Charaktere: Hauptberufe zuerst, sonst wie geladen (Stufe, Level, Name)
|
||
$byProfession = array_fill_keys(array_keys(PROFESSIONS), []);
|
||
$stageCounts = array_fill_keys(array_keys(PROFESSIONS), array_fill_keys(array_keys(PROFESSION_STAGES), 0));
|
||
foreach ($rows as $row) {
|
||
$byProfession[$row['profession']][] = $row;
|
||
$stageCounts[$row['profession']][max(1, min(3, (int) $row['stage']))]++;
|
||
}
|
||
foreach ($byProfession as &$list) {
|
||
usort($list, static fn (array $a, array $b): int => (int) $b['is_main'] <=> (int) $a['is_main']);
|
||
}
|
||
unset($list);
|
||
|
||
// Main-Klassen der aktiven Mitglieder der Legion (ohne Verbuendete) - fuer "Waffen fuer …: so viele spielen sie"
|
||
$classCounts = db()->query(
|
||
"SELECT u.class_name, COUNT(*) FROM users u WHERE u.status = 'active' AND u.class_name IS NOT NULL AND u.class_name <> ''
|
||
AND " . sql_is_legion_member('u') . ' GROUP BY u.class_name'
|
||
)->fetchAll(PDO::FETCH_KEY_PAIR);
|
||
|
||
// Sammeln: Charaktere je Rohstoff
|
||
$byMaterial = array_fill_keys(array_keys(GATHERING_MATERIALS), []);
|
||
try {
|
||
$gatherRows = db()->query(
|
||
"SELECT c.name AS character_name, c.gathering, u.id AS user_id, u.username, u.display_name, u.avatar_filename
|
||
FROM member_characters c JOIN users u ON u.id = c.user_id
|
||
WHERE u.status = 'active' AND c.gathering IS NOT NULL AND c.gathering <> ''
|
||
ORDER BY COALESCE(NULLIF(u.display_name, ''), u.username), c.name"
|
||
)->fetchAll();
|
||
} catch (PDOException $e) {
|
||
$gatherRows = []; // Spalte entsteht erst beim naechsten Schema-Abgleich
|
||
}
|
||
foreach ($gatherRows as $row) {
|
||
foreach (gathering_parse($row['gathering']) as $material) {
|
||
$byMaterial[$material][] = $row;
|
||
}
|
||
}
|
||
|
||
$memberName = static fn (array $row): string => $row['display_name'] !== '' ? (string) $row['display_name'] : (string) $row['username'];
|
||
|
||
$pageTitle = 'Berufe';
|
||
include __DIR__ . '/includes/header.php';
|
||
?>
|
||
<div class="panel">
|
||
<div class="raid-header">
|
||
<h1>Berufe</h1>
|
||
<a class="button button-secondary" href="/member_edit.php#charaktere"><?= icon('edit') ?> Meine Berufe eintragen</a>
|
||
</div>
|
||
<p class="text-muted">
|
||
Wer in der Legion was herstellen kann. Eingetragen wird bei den Charakteren auf der eigenen Profilseite: Beruf, Stufe und
|
||
welcher der Hauptberuf ist – also der, auf den sich ein Charakter konzentriert. Gezählt werden Mitglieder; hat jemand
|
||
denselben Beruf auf mehreren Charakteren, zählt er einmal.
|
||
</p>
|
||
<?= professions_wanted_html($wanted) ?>
|
||
</div>
|
||
|
||
<div class="profession-grid">
|
||
<?php foreach (PROFESSIONS as $key => $profession): ?>
|
||
<?php
|
||
$list = $byProfession[$key];
|
||
$target = $targets[$key];
|
||
$count = $counts[$key];
|
||
$players = array_sum(array_map(static fn (string $class): int => (int) ($classCounts[$class] ?? 0), $profession['classes']));
|
||
?>
|
||
<section class="panel profession-card<?= isset($wanted[$key]) ? ' is-wanted' : '' ?>" id="beruf-<?= e($key) ?>">
|
||
<header class="profession-card-head">
|
||
<span class="profession-card-icon" aria-hidden="true"><?= $profession['icon'] ?></span>
|
||
<div class="profession-card-title">
|
||
<h2><?= e($profession['label']) ?> <span class="profession-card-en"><?= e($profession['en']) ?></span></h2>
|
||
<p class="text-muted"><?= e($profession['makes']) ?></p>
|
||
</div>
|
||
<?php if (isset($wanted[$key])): ?><span class="badge profession-wanted-badge">Gesucht</span><?php endif; ?>
|
||
</header>
|
||
<div class="profession-card-stats">
|
||
<div class="profession-stat">
|
||
<strong><?= $count['main'] ?><?= $target > 0 ? '<span class="profession-stat-target"> / ' . $target . '</span>' : '' ?></strong>
|
||
<span>als Hauptberuf<?= $target > 0 ? ' (Ziel ' . $target . ')' : '' ?></span>
|
||
</div>
|
||
<div class="profession-stat">
|
||
<strong><?= $count['any'] ?></strong>
|
||
<span>üben ihn aus</span>
|
||
</div>
|
||
<div class="profession-stat profession-stat-stages">
|
||
<?php foreach (array_reverse(PROFESSION_STAGES, true) as $stage => $stageLabel): ?>
|
||
<span class="profession-stage-count profession-stage-<?= $stage ?>" title="Charaktere mit Stufe <?= e($stageLabel) ?>"><?= e($stageLabel) ?> <strong><?= $stageCounts[$key][$stage] ?></strong></span>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<?php if ($target > 0): ?>
|
||
<div class="profession-progress" role="img" aria-label="<?= $count['main'] ?> von <?= $target ?> als Hauptberuf">
|
||
<span style="width: <?= min(100, (int) round($count['main'] / $target * 100)) ?>%"></span>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php if ($profession['classes']): ?>
|
||
<p class="profession-card-need">
|
||
Waffen für
|
||
<?php foreach ($profession['classes'] as $class): ?><span class="profession-class" title="<?= e($class) ?>"><?= class_badge_html($class, 18) ?><?= e($class) ?></span><?php endforeach; ?>
|
||
<span class="text-muted">– <?= $players ?> <?= $players === 1 ? 'Mitglied spielt' : 'Mitglieder spielen' ?> sie als Main-Klasse</span>
|
||
</p>
|
||
<?php endif; ?>
|
||
<?php if ($list): ?>
|
||
<ul class="profession-people">
|
||
<?php foreach ($list as $row): ?>
|
||
<?php $name = $memberName($row); ?>
|
||
<li class="<?= (int) $row['is_main'] === 1 ? 'is-main' : '' ?>">
|
||
<a href="/member.php?id=<?= (int) $row['user_id'] ?>">
|
||
<?= avatar_html(['id' => $row['user_id'], 'username' => $row['username'], 'display_name' => $row['display_name'], 'avatar_filename' => $row['avatar_filename']], 26) ?>
|
||
<span class="profession-person">
|
||
<span class="profession-person-name"><?= e($name) ?></span>
|
||
<?php if (mb_strtolower((string) $row['character_name']) !== mb_strtolower($name)): ?>
|
||
<span class="profession-person-character"><?= class_badge_html($row['character_class'], 14) ?><?= e((string) $row['character_name']) ?></span>
|
||
<?php endif; ?>
|
||
</span>
|
||
</a>
|
||
<span class="profession-person-stage profession-stage-<?= (int) $row['stage'] ?>">
|
||
<?= e(profession_stage_text((int) $row['stage'], $row['level'] !== null ? (int) $row['level'] : null)) ?>
|
||
<?php if ((int) $row['is_main'] === 1): ?><span class="profession-main-star" title="Hauptberuf">★</span><?php endif; ?>
|
||
</span>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
</ul>
|
||
<?php else: ?>
|
||
<p class="text-muted profession-empty">Noch niemand eingetragen.</p>
|
||
<?php endif; ?>
|
||
</section>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
|
||
<div class="panel" id="sammeln">
|
||
<h2>Sammeln</h2>
|
||
<p class="text-muted">
|
||
Sammeln ist in Aion 2 kein eigener Beruf, sondern eine gemeinsame Fertigkeit für alle Rohstoffe. Mit ihren Punkten
|
||
spezialisiert man sich auf einzelne – für alle reichen sie nicht. Hier steht, wer sich worauf spezialisiert hat.
|
||
</p>
|
||
<div class="gathering-grid">
|
||
<?php foreach (GATHERING_MATERIALS as $material => $info): ?>
|
||
<?php $list = $byMaterial[$material]; ?>
|
||
<div class="gathering-card">
|
||
<div class="gathering-card-head">
|
||
<span class="gathering-card-icon" aria-hidden="true"><?= $info['icon'] ?></span>
|
||
<strong><?= e($info['label']) ?></strong>
|
||
<span class="badge"><?= count($list) ?></span>
|
||
</div>
|
||
<?php if ($list): ?>
|
||
<ul class="gathering-people">
|
||
<?php foreach ($list as $row): ?>
|
||
<?php $name = $memberName($row); ?>
|
||
<li>
|
||
<a href="/member.php?id=<?= (int) $row['user_id'] ?>"><?= e($name) ?></a>
|
||
<?php if (mb_strtolower((string) $row['character_name']) !== mb_strtolower($name)): ?><span class="text-muted">· <?= e((string) $row['character_name']) ?></span><?php endif; ?>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
</ul>
|
||
<?php else: ?>
|
||
<p class="text-muted">Noch niemand.</p>
|
||
<?php endif; ?>
|
||
</div>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if ($canManage): ?>
|
||
<div class="panel" id="ziele">
|
||
<h2>Zielzahlen</h2>
|
||
<p class="text-muted">
|
||
Wie viele Mitglieder den Beruf als Hauptberuf haben sollten. Liegt ein Beruf darunter, steht er oben und beim Eintragen der
|
||
Berufe im Profil als „Gerade gesucht“ – zugeteilt wird dadurch niemandem etwas. 0 = kein Ziel.
|
||
</p>
|
||
<form method="post" action="/professions_action.php" class="profession-targets">
|
||
<?= csrf_field() ?>
|
||
<input type="hidden" name="action" value="targets">
|
||
<div class="profession-targets-grid">
|
||
<?php foreach (PROFESSIONS as $key => $profession): ?>
|
||
<label class="profession-target">
|
||
<span><span aria-hidden="true"><?= $profession['icon'] ?></span> <?= e($profession['label']) ?></span>
|
||
<input type="number" name="target[<?= e($key) ?>]" min="0" max="<?= PROFESSION_TARGET_MAX ?>" value="<?= $targets[$key] ?>" inputmode="numeric">
|
||
</label>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
<div class="actions"><button type="submit">Zielzahlen speichern</button></div>
|
||
</form>
|
||
</div>
|
||
<?php endif; ?>
|
||
<?php include __DIR__ . '/includes/footer.php'; ?>
|