aboutsummaryrefslogtreecommitdiff
path: root/app/view/templates/timeline.php
blob: 8ddc7f1251da141417286e8c94f8069dbb98558c (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
<?php $this->layout('layout', ['title' => 'timeline', 'css' => $css . 'home.css', 'favicon' => '']) ?>




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


<body>

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

<?php if($user->iseditor()) { ?>

<main class="timeline">

<h1>Timeline</h1>

<ul>

<?php
foreach ($eventlist as $event) {
    if($user->id() === $event->user()) {
        $class = 'class="self event"';
    } else {
        $class = 'class="event"';
    }
    echo '<li '. $class .'>';
    switch ($event->type()) {
        case 'message':
            echo '<h3>'. $event->user() .'</h3>';
            echo '<p>'. $event->message() .'</p>';
            echo '<i>'. $event->date('hrdi') .' ago</i>';
            break;
        
        default:
            
            break;
    echo '</li>';
    }
}
?>

</ul>

<form action="<?= $this->url('timelineadd') ?>" method="post">

<input type="hidden" name="type" value="message">

<input type="hidden" name="user" value="<?= $user->id() ?>">

<label for="message">message</label>
<textarea name="message" id="message" cols="30" rows="10"></textarea>
<input type="submit" value="send">
</form>

</main>

<?php } ?>

</body>



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