summaryrefslogtreecommitdiff
path: root/resources/views/admin/module-components.php
blob: a40e46194d87c0d821f9e74940281da3497f34f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php use Fisharebest\Webtrees\Bootstrap4; ?>
<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?>
<?php use Fisharebest\Webtrees\I18N; ?>
<?php use Fisharebest\Webtrees\Module\ModuleConfigInterface; ?>
<?php use Fisharebest\Webtrees\Tree; ?>

<?= view('admin/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-modules') => I18N::translate('Modules'), $title]]) ?>

<h1><?= $title ?></h1>

<form action="<?= e(route('admin-update-module-access')) ?>" method="post">
	<input type="hidden" name="component" value="<?= e($component) ?>">
	<?= csrf_field() ?>
	<table class="table table-bordered">
		<thead>
			<tr>
				<th><?= $component_title ?></th>
				<th class="d-none d-sm-table-cell"><?= I18N::translate('Description') ?></th>
				<th><?= I18N::translate('Access level') ?></th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($modules as $module_name => $module): ?>
				<tr>
					<td>
						<?php if ($module instanceof ModuleConfigInterface): ?>
							<a href="<?= e($module->getConfigLink()) ?>"><?= $module->getTitle() ?> <i class="fas fa-cogs"></i></a>
						<?php else: ?>
							<?= $module->getTitle() ?>
						<?php endif ?>
					</td>
					<td class="d-none d-sm-table-cell">
						<?= $module->getDescription() ?>
					</td>
					<td>
						<table class="table table-sm">
							<tbody>
								<?php foreach (Tree::getAll() as $tree): ?>
									<tr>
										<td>
											<?= $tree->getTitleHtml() ?>
										</td>
										<td>
											<?= Bootstrap4::select(FunctionsEdit::optionsAccessLevels(), $module->getAccessLevel($tree, $component), ['name' => 'access-' . $module->getName() . '-' . $tree->getTreeId()]) ?>
										</td>
									</tr>
								<?php endforeach ?>
							</tbody>
						</table>
					</td>
				</tr>
			<?php endforeach ?>
		</tbody>
	</table>
	<button class="btn btn-primary" type="submit">
		<i class="fas fa-check"></i>
		<?= I18N::translate('save') ?>
	</button>
</form>