summaryrefslogtreecommitdiff
path: root/app/Template/dashboard/notifications.php
blob: 4fb59e243bfcc1e47893385779cfb4ab3b85bb83 (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
<div class="page-header">
    <h2><?= t('My notifications') ?></h2>

<?php if (empty($notifications)): ?>
</div>
<p class="alert"><?= t('No new notifications.') ?></p>
<?php else: ?>
    <ul>
        <li>
            <i class="fa fa-check-square-o fa-fw"></i>
            <?= $this->url->link(t('Mark all as read'), 'WebNotificationController', 'flush', array('user_id' => $user['id'])) ?>
        </li>
    </ul>
</div>

    <table class="table-striped table-scrolling table-small">
        <tr>
            <th class="column-20"><?= t('Project') ?></th>
            <th><?= t('Notification') ?></th>
            <th class="column-15"><?= t('Date') ?></th>
            <th class="column-15"><?= t('Action') ?></th>
        </tr>
        <?php foreach ($notifications as $notification): ?>
        <tr>
            <td>
                <?php if (isset($notification['event_data']['task']['project_name'])): ?>
                    <?= $this->url->link(
                            $this->text->e($notification['event_data']['task']['project_name']),
                            'BoardViewController',
                            'show',
                            array('project_id' => $notification['event_data']['task']['project_id'])
                        )
                    ?>
                <?php elseif (isset($notification['event_data']['project_name'])): ?>
                    <?= $this->text->e($notification['event_data']['project_name']) ?>
                <?php endif ?>
            </td>
            <td>
                <?php if ($this->text->contains($notification['event_name'], 'subtask')): ?>
                    <i class="fa fa-tasks fa-fw"></i>
                <?php elseif ($this->text->contains($notification['event_name'], 'task.move')): ?>
                    <i class="fa fa-arrows-alt fa-fw"></i>
                <?php elseif ($this->text->contains($notification['event_name'], 'task.overdue')): ?>
                    <i class="fa fa-calendar-times-o fa-fw"></i>
                <?php elseif ($this->text->contains($notification['event_name'], 'task')): ?>
                    <i class="fa fa-newspaper-o fa-fw"></i>
                <?php elseif ($this->text->contains($notification['event_name'], 'comment')): ?>
                    <i class="fa fa-comments-o fa-fw"></i>
                <?php elseif ($this->text->contains($notification['event_name'], 'file')): ?>
                    <i class="fa fa-file-o fa-fw"></i>
                <?php endif ?>

                <?php if ($this->text->contains($notification['event_name'], 'task.overdue') && count($notification['event_data']['tasks']) > 1): ?>
                    <?= $notification['title'] ?>
                <?php else: ?>
                    <?= $this->url->link($notification['title'], 'WebNotificationController', 'redirect', array('notification_id' => $notification['id'], 'user_id' => $user['id'])) ?>
                <?php endif ?>
            </td>
            <td>
                <?= $this->dt->datetime($notification['date_creation']) ?>
            </td>
            <td>
                <i class="fa fa-check fa-fw"></i>
                <?= $this->url->link(t('Mark as read'), 'WebNotificationController', 'remove', array('user_id' => $user['id'], 'notification_id' => $notification['id'])) ?>
            </td>
        </tr>
        <?php endforeach ?>
    </table>
<?php endif ?>