aboutsummaryrefslogtreecommitdiff
path: root/views/list/add/index.php
blob: 272efdac60dd85909c4432217f03f33fb4b8f305 (plain) (blame)
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
<?php
    $user = require_login();
    $webpage = null;
    $list = null;

    try {
        $list = $user->archiveLists();
        $webpage = Database\Webpage::fromDBwid($_GET['wid']);
    }
    catch (Exception $e) {}
?>

<?php if ($webpage !== null && $list !== null && $list): ?>
    <h2>
        To which list do you want to add</br>
        <?= $webpage->URL ?></br>
        from</br>
        <?= $webpage->Date ?>?
    </h2>

    <form action="#" method="POST" class="font-125 flex-row width-100 center-margin">
        <input type="hidden" name="method" value="PATCH">
        <?php if (isset($list_status)): ?>
            <?php if ($list_status !== ""): ?>
                <p class="item error"><span>
                    <strong>Error:</strong> <?= $list_status ?>
                </span></p>
            <?php endif; ?>
        <?php endif; ?>
        <select name="lid" class="flex-expand">
            <?php foreach ($list as $list): ?>
                <option value="<?= $list->LID ?>"><?= $list->Name ?></option>
            <?php endforeach; ?>
        </select>
        <input type="hidden" name="type" value="add">
        <input type="hidden" name="wid" value="<?= $_GET['wid'] ?>">
        <input type="submit" value="Select">
    </form>

<?php elseif ($webpage === null): ?>
    <h2>No page with identifier <?= $_GET['wid'] ?> exists!</h2>

<?php else: ?>
    <h2>You have no lists!</h2>

    <form action="/list/new" method="GET">
        <input type="submit" value="Create a new list">
    </form>

<?php endif; ?>