Files
FamilyBook/templates/people/_settings_menu.php
T

45 lines
2.5 KiB
PHP
Raw Normal View History

<?php
/**
* 名册模块的「设置」下拉(v52 用户 2026-10-15 第 6 条)。
*
* 用户原话:「名册右侧,**只保留一个添加成员按钮**,右侧再加一个设置按钮,
* 点击后下拉设置,第一个就是**导入联系人**,第二个就是原来个人设置那里的
* **名册分组**,这样个人设置中就不显示名册分组的内容了。」
*
* ⇒ 名册页右上角从此只有两颗:**添加成员** + **☰ 设置**(设置恒在最右,全站统一)。
* 原来散着的那几颗(从已有家里人里挑 / 导入联系人 / …)全部收进这个下拉。
*
* 两行(顺序是用户点名的):
* ① 导入联系人 → `people/import`
* ② 名册分组 → `people/settings`(从个人设置搬过来的那一块)
*
* 用法(require 前 set 好):
* $plSetCurrent 当前页 key('import'|'groups')用来高亮;'' 也行
*/
$plSetCurrent = (string)($plSetCurrent ?? '');
$plSetOn = static function (string $key) use ($plSetCurrent): string {
return $plSetCurrent === $key ? ' class="on"' : '';
};
$plSetIcon = static function (string $name): string {
$paths = [
'import' => '<path d="M8 2.6v7.2M5 6.8l3 3 3-3M3.2 13.4h9.6"/>',
'groups' => '<rect x="2" y="2.6" width="5" height="5" rx="1"/><rect x="9" y="2.6" width="5" height="5" rx="1"/>'
. '<rect x="2" y="8.6" width="5" height="5" rx="1"/><rect x="9" y="8.6" width="5" height="5" rx="1"/>',
];
$d = $paths[$name] ?? '';
if ($d === '') {
return '';
}
return '<svg class="mi" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"'
. ' fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"'
. ' stroke-linejoin="round">' . $d . '</svg>';
};
?>
<details class="movie-set menu">
<summary class="btn btn-icon" title="名册设置" aria-label="名册设置"><svg viewBox="0 0 16 16" width="18" height="18" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M2.5 4.5h11M2.5 8h11M2.5 11.5h11"/></svg></summary>
<div class="menu-list">
<a href="<?= e(url('people/import')) ?>"<?= $plSetOn('import') ?>><?= $plSetIcon('import') ?><span>导入联系人</span></a>
<a href="<?= e(url('people/settings')) ?>"<?= $plSetOn('groups') ?>><?= $plSetIcon('groups') ?><span>名册分组</span></a>
</div>
</details>
<?php unset($plSetCurrent, $plSetOn, $plSetIcon); ?>