aboutsummaryrefslogtreecommitdiff
path: root/app/view/templates/timeline.php
blob: 2db861c3134e53a0f6ae7d1cfec9530e9013f907 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php $this->layout('layout', ['title' => 'timeline', 'css' => $css . 'home.css', 'favicon' => '']) ?>




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


<body>

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

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

<main class="timeline">

<section>

<article id="live">

<h1>Timeline</h1>

<ul>

<?php
foreach ($groupedeventlist as $eventuser) {

        if($user->id() === $eventuser['user']) {
            $class = 'class="self user"';
        } else {
            $class = 'class="user"';
        }
        echo '<li '. $class .'>';
        echo '<h3>'. $eventuser['user'] .'</h3>';
        echo' <ul>';
    foreach ($eventuser as $key => $event) {
        if($key !== 'user') {
            echo '<li class="event">';
            switch ($event->type()) {
                case 'message':
                echo '<p class="eline">'. $event->message() .'</p>';
                break;
            }

            ?>


            <?= !empty($event->clap()) ? '<b class="eline">'. $event->clap() .'</b>' : '' ?>

            <span class="details">

            <?php if($user->id() !== $eventuser['user']) {?>
            <form class="eline" method="post" action="<?= $this->url('timelineclap') ?>">
            <input type="hidden" name="id" value="<?= $event->id() ?>">
            <input type="submit" name="clap" value="👌">
            </form>
            <?php } ?>


            <i class="eline"><?= $event->date('hrdi') ?> ago</i>
            
            </span>

            </li>

            <?php
        }
    }
    echo '</ul></li>';
}
?>

</ul>

</article>

<article id="message">

<h2>Message</h2>

<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" autofocus></textarea>
<input type="submit" value="send">
</form>

</main>

<?php } ?>

</article>

</section>

</body>



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