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