1<?php /* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ ?>
2<table>
3<tr>
4	<th>Name</th>
5	<th colspan="3">Count</th>
6</tr>
7<?php foreach ($tpl->get('labels') as $label): ?>
8<tr>
9	<?php if (  in_array($tpl->param('action'), array('edit', 'update')) &&
10                $tpl->param('id') === $label->id): ?>
11        <form action="
12        <?php echo $tpl->url('types', 'action', 'update', 'id', $label->id) ?>"
13        method="POST">
14            <td>
15                <input name="name" value="<?php echo $tpl->value('name') ?>" />
16            </td>
17            <td colspan="2">
18                <input type="submit"
19                    value="<?php echo $tpl->getLang('save') ?>" />
20                <a href="<?php echo $tpl->url('types') ?>">
21                    <?php echo $tpl->getLang('cancel') ?>
22                </a>
23            </td>
24        </form>
25	<?php else: ?>
26        <td><?php echo $label->name ?></td>
27        <td <?php if ($label->count > 0) echo 'colspan="2"'; ?>>
28            <a href="<?php echo $tpl->url('types', 'action', 'edit', 'id', $label->id) ?>">
29                <?php echo $tpl->getLang('edit') ?>
30            </a>
31        </td>
32        <?php if ($label->count == 0): ?>
33            <td>
34            <a onclick="return confirm('<?php echo $tpl->getLang('js')['remove_confirm'] ?>')"
35                href="<?php echo $tpl->url('types', 'action', 'remove', 'id', $label->id) ?>">
36                <?php echo $tpl->getLang('delete') ?>
37            </a>
38            </td>
39        <?php endif ?>
40    <?php endif ?>
41
42        <td>
43        <a href="<?php echo $tpl->url('threads', 'label_id', $label->id) ?>">
44            <?php echo $label->count ?>
45        </a>
46    </td>
47</tr>
48<?php endforeach ?>
49<?php if (  $tpl->param('action') !== 'edit' &&
50            $tpl->param('action') !== 'update'): ?>
51<form action="<?php echo $tpl->url('types', 'action', 'add') ?>" method="POST">
52<tr>
53	<td><input name="name" value="<?php echo $tpl->value('name') ?>" /></td>
54	<td colspan="3"><input type="submit" value="<?php echo $tpl->getLang('save') ?>" /></td>
55</tr>
56<?php endif ?>
57</form>
58</table>
59