aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/wiki/import.php
blob: 7c602ef16698f835cbe6317928c03bd8fa8bf72a (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
<?php
/**
 * @var bool $show_wiki_page_form
 * @var Course_WikiController $controller
 * @var Range $range
 * @var bool $success
 * @var bool $bad_course_search
 * @var QuickSearch $course_search
 * @var Course $selected_course
 * @var array $wiki_pages
 */
?>
<form class="default" method="post"
      name="wiki_import_form"
      data-dialog="size=auto;<?= $show_wiki_page_form ? 'reload-on-close' : '' ?>"
      action="<?= $controller->import() ?>">
    <?= CSRFProtection::tokenTag() ?>

    <? if (!$show_wiki_page_form && !$success): ?>
        <fieldset>
            <legend><?= _('Suche nach Veranstaltungen') ?></legend>
            <label class="with-action">
                <? if ($bad_course_search): ?>
                    <?= _('Meinten Sie eine der folgenden Veranstaltungen?') ?>
                <? else: ?>
                    <?= _('Sie können hier eine Veranstaltung mit zu importierenden Wiki-Seiten suchen.') ?>
                <? endif ?>
                <?= $course_search->render() ?>
                <? if ($bad_course_search): ?>
                    <a href="<?= $controller->import() ?>"
                       data-dialog="1">
                        <?= Icon::create('decline')->asImg([
                            'class'   => 'text-bottom',
                            'title'   => _('Suche zurücksetzen'),
                            'onclick' => "STUDIP.QuickSearch.reset('wiki_import_form', 'selected_range_id');"
                        ]) ?>
                    </a>
                <? else : ?>
                    <?= Icon::create('search')->asImg([
                        'class'   => 'text-bottom',
                        'title'   => _('Suche starten'),
                        'onclick' => "jQuery(this).closest('form').submit();"
                    ]) ?>
                <? endif ?>
            </label>
            <div data-dialog-button>
                <? if ($bad_course_search): ?>
                    <?= Studip\LinkButton::create(
                        _('Neue Suche'),
                        $controller->importURL(),
                        ['data-dialog' => 'size=auto']
                    ) ?>
                <? endif ?>
                <?= Studip\LinkButton::createCancel(
                    _('Abbrechen'),
                    $controller->pageURL()
                ) ?>
            </div>
        </fieldset>
    <? endif ?>

    <? if ($show_wiki_page_form): ?>
        <input type="hidden" name="selected_range_id"
               value="<?= htmlReady($selected_course->id) ?>">
        <? if ($wiki_pages): ?>
            <table class="default">
                <colgroup>
                    <col style="width: 20px">
                    <col>
                </colgroup>
                <caption>
                    <?= sprintf(
                        _('%s: Importierbare Wiki-Seiten'),
                        htmlReady($selected_course->getFullName())
                    ) ?>
                </caption>
                <thead>
                <tr>
                    <th>
                        <input type="checkbox"
                               data-proxyfor=":checkbox[name='selected_wiki_page_ids[]']">
                    </th>
                    <th><?= _('Seitenname') ?></th>
                </tr>
                </thead>
                <tbody>
                <? foreach ($wiki_pages as $wiki_page): ?>
                    <? if ($wiki_page->isReadable()) : ?>
                        <tr>
                            <td>
                                <input type="checkbox"
                                       name="selected_wiki_page_ids[]"
                                       value="<?= htmlReady($wiki_page->getId()) ?>">
                            </td>
                            <td><?= htmlReady($wiki_page->name) ?></td>
                        </tr>
                    <? endif ?>
                <? endforeach ?>
                </tbody>
            </table>
            <div data-dialog-button>
                <?= Studip\Button::create(_('Importieren'), 'import') ?>
                <?= Studip\LinkButton::create(
                    _('Neue Suche'),
                    $controller->importURL(),
                    ['data-dialog' => 'size=auto']
                ) ?>
                <?= Studip\LinkButton::createCancel(
                    _('Abbrechen'),
                    $controller->pageURL()
                ) ?>
            </div>
        <? else: ?>
            <?= MessageBox::info(
                _('Die gewählte Veranstaltung besitzt keine Wiki-Seiten!')
            ) ?>
        <? endif ?>
    <? endif ?>
    <? if ($success): ?>
        <div data-dialog-button>
            <?= Studip\LinkButton::create(
                _('Import neu starten'),
                $controller->importURL(),
                ['data-dialog' => 'size=auto']
            ) ?>
            <?= Studip\LinkButton::createCancel(
                _('Zurück zum Wiki'),
                $controller->pageURL()
            ) ?>
        </div>
    <? endif ?>
</form>