aboutsummaryrefslogtreecommitdiff
path: root/app/views/admin/cronjobs/schedules/index.php
blob: 12180a62fc0c009f5429eade0e4766bca1aa2c19 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
/**
 * @var CronjobTask[] $tasks
 * @var CronjobSchedule[] $schedules
 * @var Admin_Cronjobs_SchedulesController $controller
 * @var int $total
 * @var array $filter
 */

use Studip\Button, Studip\LinkButton;
?>

<form action="<?= $controller->filter() ?>" method="post" class="default cronjob-filters">
    <fieldset>
        <legend>
            <?= _('Darstellung einschränken') ?>
            <? if (count($schedules) != $total): ?>
                <?= sprintf(_('Passend: %u von %u Cronjobs'), count($schedules), $total) ?>
            <? endif; ?>
        </legend>
        <label class="col-3">
            <?= _('Aufgabe') ?>
            <select name="filter[task_id]" id="task_id" class="submit-upon-select">
                <option value=""><?= _('Alle Cronjobs anzeigen') ?></option>
                <? foreach ($tasks as $task): ?>
                    <option value="<?= $task->task_id ?>" <? if (isset($filter['task_id']) && $filter['task_id'] === $task->task_id) echo 'selected'; ?>>
                        <?= htmlReady($task->name) ?>
                    </option>
                <? endforeach; ?>
            </select>
        </label>
        <label class="col-3">
            <?= _('Status') ?>
            <select name="filter[status]" id="status" class="submit-upon-select">
                <option value=""><?= _('Alle Cronjobs anzeigen') ?></option>
                <option value="active" <? if ($filter['status'] === 'active') echo 'selected'; ?>>
                    <?= _('Nur aktive Cronjobs anzeigen') ?>
                </option>
                <option value="inactive" <? if ($filter['status'] === 'inactive') echo 'selected'; ?>>
                    <?= _('Nur deaktivierte Cronjobs anzeigen') ?>
                </option>
            </select>
        </label>
    </fieldset>
    <? if (!empty($filter)): ?>
        <footer>
            <?= LinkButton::createCancel(
                _('Zurücksetzen'),
                $controller->filterURL(),
                ['title' => _('Filter zurücksetzen')]
            ) ?>
        </footer>
    <? endif ?>
</form>


<form class="cronjobs" action="<?= $controller->bulk() ?>" method="post">
    <?= CSRFProtection::tokenTag() ?>

    <table class="default cronjobs sortable-table" data-sortlist="[[1, 0]]">
        <colgroup>
            <col style="width: 20px">
            <col>
            <col style="width: 40px">
            <col style="width: 30px">
            <col style="width: 30px">
            <col style="width: 30px">
            <col style="width: 30px">
            <col style="width: 30px">
            <col style="width: 106px">
        </colgroup>
        <thead>
        <tr>
            <th data-sort="false">
                <input type="checkbox" name="all" value="1"
                       data-proxyfor=":checkbox[name='ids[]']"
                       data-activates=".cronjobs select[name=action]">
            </th>
            <th data-sort="text"><?= _('Cronjob') ?></th>
            <th data-sort="htmldata"><?= _('Aktiv') ?></th>
            <th colspan="5" data-sort="false"><?= _('Ausführung') ?></th>
            <th data-sort="false"><?= _('Optionen') ?></th>
        </tr>
        </thead>
        <tbody>
        <? if (count($schedules) === 0): ?>
            <tr class="empty">
                <td colspan="10"><?= _('Keine Einträge vorhanden') ?></td>
            </tr>
        <? endif; ?>
        <? foreach ($schedules as $schedule): ?>
            <tr id="job-<?= htmlReady($schedule->id) ?>" <? if (!$schedule->task->active) echo 'class="inactivatible"'; ?>>
                <td style="text-align: center">
                    <input type="checkbox" name="ids[]" value="<?= htmlReady($schedule->id) ?>">
                </td>
                <td><?= htmlReady($schedule->title ?: $schedule->task->name) ?></td>
                <td style="text-align: center;"
                    data-sort-value="'<?= (int)($schedule->active && $schedule->task->active) ?>'">
                    <? if (!$schedule->task->active): ?>
                        <?= Icon::create('checkbox-unchecked', Icon::ROLE_INACTIVE)->asImg(['title' => _('Cronjob kann nicht aktiviert werden, da die zugehörige ' . 'Aufgabe deaktiviert ist.')]) ?>
                    <? elseif ($schedule->active): ?>
                        <a href="<?= $controller->deactivate($schedule) ?>"
                           data-behaviour="ajax-toggle">
                            <?= Icon::create('checkbox-checked')->asImg(['title' => _('Cronjob deaktivieren')]) ?>
                        </a>
                    <? else: ?>
                        <a href="<?= $controller->activate($schedule) ?>"
                           data-behaviour="ajax-toggle">
                            <?= Icon::create('checkbox-unchecked')->asImg(['title' => _('Cronjob aktivieren')]) ?>
                        </a>
                    <? endif; ?>
                </td>
                <?= $this->render_partial('admin/cronjobs/schedules/periodic-schedule', $schedule->toArray() + ['display' => 'table-cells']) ?>
                <td style="text-align: right">
                    <a data-dialog href="<?= $controller->display($schedule) ?>">
                        <?= Icon::create('admin')->asImg(['title' => _('Cronjob anzeigen')]) ?>
                    </a>
                    <a href="<?= $controller->edit($schedule) ?>">
                        <?= Icon::create('edit')->asImg(['title' => _('Cronjob bearbeiten')]) ?>
                    </a>
                    <a href="<?= $controller->link_for('admin/cronjobs/logs/schedule', $schedule) ?>">
                        <?= Icon::create('log')->asImg(['title' => _('Log anzeigen')]) ?>
                    </a>
                    <?= Icon::create('trash')->asInput([
                        'data-confirm' => _('Wollen Sie den ausgewählten Cronjob wirklich löschen?'),
                        'formaction'   => $controller->cancelURL($schedule),
                    ]) ?>
                </td>
            </tr>
        <? endforeach; ?>
        </tbody>
        <tfoot>
        <tr>
            <td colspan="9" class="groupactions">
                <select name="action" data-activates=".cronjobs button[name=bulk]" aria-label="<?= _('Aktion auswählen')?>">
                    <option value="">- <?= _('Aktion auswählen') ?> -</option>
                    <option value="activate"><?= _('Aktivieren') ?></option>
                    <option value="deactivate"><?= _('Deaktivieren') ?></option>
                    <option value="cancel"><?= _('Löschen') ?></option>
                </select>
                <?= Button::createAccept(_('Ausführen'), 'bulk') ?>
            </td>
        </tr>
        </tfoot>
    </table>
</form>