aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/ilias_interface/add_object.php
blob: 6e015a7efb4454df0151786f3536dac526dffe8e (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
<form class="default" action="<?= $controller->url_for('course/ilias_interface/add_object/'.$mode.'/'.$ilias_index) ?>" method="post">
    <?= CSRFProtection::tokenTag() ?>
<? if (empty($ilias_index)) : ?>
    <label>
        <span class="required"><?= _('ILIAS-Installation auswählen') ?></span>
        <select name="ilias_index" required>
            <option></option>
        <? foreach ($ilias_list as $ilias_list_index => $ilias) : ?>
            <option value="<?= htmlReady($ilias_list_index) ?>">
                <?= htmlReady($ilias->getName()) ?>
            </option>
        <? endforeach ?>
        </select>
    </label>
<? elseif ($mode === 'search' && count($ilias_modules) === 0) : ?>
    <label>
        <span><?= _('Suche nach Lernobjekten') ?></span>
        <input type="text" name="ilias_search" value="<?= htmlReady($ilias_search) ?>"
               size="50" maxlength="50" required>
    </label>
<? elseif ($mode === 'new_course') : ?>
    <div>
        <input type="hidden" name="cmd" value="add_course">
        <?=sprintf(_('Sie können nun einen leeren Kurs in der %s-Installation anlegen.'), $ilias->getName())?>
    </div>
<? elseif ($mode === 'assign_course') : ?>
    <div>
        <input type="hidden" name="cmd" value="assign_course">
        <label>
            <span><?= _('Veranstaltung wählen') ?></span>
            <select name="ilias_course_id" required>
                <option></option>
            <? foreach ($studip_course_list as $ilias_course_id => $studip_course_name) : ?>
                <option value="<?= htmlReady($ilias_course_id) ?>">
                    <?= htmlReady($studip_course_name) ?>
                </option>
            <? endforeach ?>
            </select>
        </label>
    </div>
<? elseif ($mode === 'assign_own_course') : ?>
    <div>
        <input type="hidden" name="cmd" value="assign_course">
    <? if (!empty($submit_text)) : ?>
        <label>
            <span><?= _('ILIAS-Kurs wählen') ?></span>
            <select name="ilias_course_id" required>
                <option></option>
            <? foreach ($studip_course_list as $ilias_course_id => $studip_course_name) : ?>
                <option value="<?= htmlReady($ilias_course_id) ?>">
                    <?= htmlReady($studip_course_name) ?>
                </option>
            <? endforeach ?>
            </select>
        </label>
    <? else : ?>
        <?= sprintf(
            _('Es wurden keine Kurse in der %s-Installation gefunden, in denen Sie als Kursadministrator/-in eingetragen sind.'),
            htmlReady($ilias->getName())
        ) ?>
    <? endif ?>
    </div>
<? elseif ($mode === 'search' || $mode === 'my_modules') : ?>
    <table class="default">
        <caption>
        <? if ($mode === 'search') : ?>
            <?= _('Gefundene Lernobjekte') ?>
        <? elseif ($mode === 'my_modules') : ?>
            <?= _('Meine Lernobjekte') ?>
        <? endif ?>
        </caption>
        <colgroup>
            <col style="width: 5%">
            <col style="width: 65%">
            <col style="width: 20%">
            <col style="width: 10%">
        </colgroup>
        <thead>
            <th></th>
            <th><?= _('Name') ?></th>
            <th><?= _('Typ') ?></th>
            <th class="actions"><?= _('Aktionen') ?></th>
        </thead>
        <tbody>
        <? foreach ($ilias_modules as $module_id => $module) : ?>
            <tr>
                <td>
                    <?= Icon::create('learnmodule')->asSvg([
                        'title' => $module->getModuleTypeName(),
                    ]) ?>
                </td>
                <td>
                    <a href="<?= $controller->link_for($module->getRoute('view_course'), ['ilias_search' => !empty($ilias_search) ? $ilias_search : '', 'mode' => !empty($mode) ? $mode : '']) ?>" <?= !empty($dialog) ? 'data-dialog=""' : ''?>>
                        <?= htmlReady($module->getTitle()) ?>
                    </a>
                </td>
                <td><?= $module->getModuleTypeName() ?></td>
                <td class="actions">
                    <?= ActionMenu::get()->setContext($module->getTitle())->addButton(
                        'view',
                        _('Info'),
                        Icon::create('info-circle'),
                        [
                            'title'        => _('Info'),
                            'formaction'   => $controller->url_for($module->getRoute('view_course') . (!empty($ilias_search) ? '?ilias_search='.urlencode($ilias_search) : '')),
                            'data-dialog'  => ''
                        ]
                    )->condition($edit_permission)->addButton(
                        'add',
                        _('Hinzufügen'),
                        Icon::create('add'),
                        [
                            'title'        => _('Hinzufügen'),
                            'formaction'   => $controller->url_for($module->getRoute('add')),
                            'data-dialog'  => ''
                        ]
                    )->render() ?>
                </td>
            </tr>
        <? endforeach ?>
        </tbody>
    </table>
    <? endif ?>
    <footer data-dialog-button>
    <? if (!empty($ilias) && $ilias->isActive() && !empty($submit_text)) : ?>
        <?= Studip\Button::create($submit_text, 'submit', ($dialog && !empty($keep_dialog)) ? ['data-dialog' => 'size=auto;reload-on-close'] : []) ?>
    <? endif ?>
        <?= Studip\Button::createCancel(_('Schließen'), 'cancel', $dialog ? ['data-dialog' => 'close'] : []) ?>
    </footer>
</form>