aboutsummaryrefslogtreecommitdiff
path: root/app/views/tour/admin_conflicts.php
blob: 4860287337caa4e5aba9eedd37fbfa412c88fd2b (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
<?php
/**
 * @var TourController $controller
 * @var array $conflicts
 * @var array $diff_fields
 * @var array $diff_step_fields
 */

use Studip\LinkButton;
?>
<h1><?= _('Versions-Konflikte der Touren') ?></h1>
<form action="<?= $controller->link_for('tour/admin_conflicts') ?>" id="admin_tour_form" method="post">
    <?= CSRFProtection::tokenTag(); ?>
<? if (count($conflicts) > 0) : ?>
    <? foreach ($conflicts as $conflict) : ?>
        <table class="default">
            <? $keys = array_keys($conflict); ?>
            <colgroup>
                <col style="width: 20%">
                <col style="width: 40%">
                <col style="width: 40%">
            </colgroup>
            <tbody>
                <tr>
                    <th><?= _('Feld') ?></th>
                    <th><?= sprintf(_('Lokale Version (%s)'), $conflict[$keys[0]]->studip_version) ?></th>
                    <th><?= sprintf(_('Offizielle Version (%s)'), $conflict[$keys[1]]->studip_version) ?></th>
                </tr>
                <tr>
                    <td><?= _('Titel') ?></td>
                    <td><?= htmlReady($conflict[$keys[0]]->name) ?></td>
                    <td><?= htmlReady($conflict[$keys[1]]->name) ?></td>
                </tr>
                <? foreach ($diff_fields as $field => $title) : ?>
                    <? if ($conflict[$keys[0]]->$field !== $conflict[$keys[1]]->$field) : ?>
                        <tr>
                            <td><?= htmlReady($title) ?></td>
                            <td><?= htmlReady($conflict[$keys[0]]->$field) ?></td>
                            <td><?= htmlReady($conflict[$keys[1]]->$field) ?></td>
                        </tr>
                    <? endif ?>
                <? endforeach ?>
                <? $max_steps = max(
                    count($conflict[$keys[0]]->steps),
                    count($conflict[$keys[1]]->steps)
                ); ?>
                <? for ($nr = 1; $nr <= $max_steps; $nr++) : ?>
                    <? foreach ($diff_step_fields as $field => $title) : ?>
                        <? if ($conflict[$keys[0]]->steps[$nr]->$field != $conflict[$keys[1]]->steps[$nr]->$field) : ?>
                            <tr>
                                <td><?= htmlReady($title) ?> <?= sprintf(_('(Schritt %s)'), $nr) ?></td>
                                <td><?= htmlReady($conflict[$keys[0]]->steps[$nr]->$field) ?></td>
                                <td><?= htmlReady($conflict[$keys[1]]->steps[$nr]->$field) ?></td>
                            </tr>
                        <? endif ?>
                    <? endforeach ?>
                <? endfor ?>
            </tbody>
            <tfoot>
                <tr>
                    <td></td>
                    <td><?= LinkButton::create(_('Übernehmen'), $controller->url_for('tour/resolve_conflict/' . $conflict[$keys[0]]->getId() . '/accept')) ?></td>
                    <td><?= LinkButton::create(_('Löschen'), $controller->url_for('tour/resolve_conflict/' . $conflict[$keys[0]]->getId() . '/delete')) ?></td>
                </tr>
            </tfoot>
        </table>
    <? endforeach ?>
<? else : ?>
    <?= MessageBox::info(_('Keine Konflikte vorhanden.')) ?>
<? endif ?>
</form>