aboutsummaryrefslogtreecommitdiff
path: root/app/view/templates/user.php
blob: f973fee63138156c97a4a8b64d42368bcc1eb4d8 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php $this->layout('layout', ['title' => 'user', 'css' => $css . 'home.css']) ?>


<?php $this->start('page') ?>

<body>

    <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'user']) ?>


<main class="user">

<table>
<tr>
<th>id</th><th>password</th><th>level</th><th>action</th>
</tr>

<tr>
    <form action="<?= $this->url('useradd') ?>" method="post">
    <td>
            <input type="text" name="id" maxlength="128" required>
    </td>
    <td>
        <input type="password" name="password" minlength="4" maxlength="64" required>
    </td>
    <td>
        <select name="level" id="level">
            <option value="1">reader</option>
            <option value="2">invite</option>
            <option value="3">editor</option>
            <option value="4">super editor</option>
            <option value="10">admin</option>
        </select>
    </td>
    <td>
        <input type="submit" value="add">
    </td>
    </form>
</tr>


<?php
foreach ($userlist as $user ) {
    ?>
    
    <tr>
    <form action="<?= $this->url('userupdate') ?>" method="post">

    <td>
    <?= $user->id() ?>
    </td>

    <td>
    <input type="password" name="password" placeholder="<?= str_repeat('°', $user->password('int')) ?>" minlength="4" maxlength="64" >
    </td>

    <td>
    <select name="level" id="level">
            <option value="1" <?= $user->level() === 1 ? 'selected' : '' ?>>reader</option>
            <option value="2" <?= $user->level() === 2 ? 'selected' : '' ?>>invite</option>
            <option value="3" <?= $user->level() === 3 ? 'selected' : '' ?>>editor</option>
            <option value="4" <?= $user->level() === 4 ? 'selected' : '' ?>>super editor</option>
            <option value="10" <?= $user->level() === 10 ? 'selected' : '' ?>>admin</option>
    </select>
    </td>

    <td>
    <input type="hidden" name="id" value="<?= $user->id() ?>">
    <input type="submit" name="action" value="update">
    <input type="submit" name="action" value="delete">
    </form>

    </td>

    </tr>

    <?php
    }
?>

</table>

</main>
</body>

<?php $this->stop('page') ?>