aboutsummaryrefslogtreecommitdiff
path: root/app/views/userfilter/field/configure.php
blob: 5d07203164f165832c1335416d4f11ff97e5c8f0 (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
<?php
/**
 * @var string $className
 * @var UserFilterField $field
 * @var array $conditionFields
 * @var Userfilter_FieldController $controller
 */
?>
<?php if (!empty($className)) : ?>
    <? if (count($field->getValidCompareOperators()) > 1) : ?>
        <select name="compare_operator[]" size="1" class="conditionfield_compare_op">
            <?php foreach ($field->getValidCompareOperators() as $op => $text) : ?>
                <option value="<?= $op ?>"><?= htmlReady($text) ?></option>
            <?php endforeach ?>
        </select>
    <? else : ?>
        <input type="hidden" class="conditionfield_compare_op" name="compare_operator[]"
               value="<?= key($field->getValidCompareOperators()) ?>">
    <? endif ?>
    <? if (count($field->getValidValues()) > 1) : ?>
        <select name="value[]" class="conditionfield_value">
            <?php foreach ($field->getValidValues() as $id => $name) : ?>
                <option value="<?= $id ?>"><?= htmlReady($name) ?></option>
            <?php endforeach ?>
        </select>
    <? elseif (count($field->getValidValues()) == 1) : ?>
        <input type="hidden" name="value[]" class="conditionfield_value" value="<?= key($field->getValidValues()) ?>">
    <? else : ?>
        <input type="text" name="value[]" class="conditionfield_value" value="">
    <? endif ?>
<?php else : ?>
    <?= (empty($is_first) ? '<strong>' . _('und') . '</strong>' : '') ?>
    <div class="conditionfield">
        <select name="field[]" class="conditionfield_class" size="1"
                onchange="STUDIP.UserFilter.getConditionFieldConfiguration(this, '<?= $controller->configure() ?>')">
            <option value="">-- <?= _('Bitte auswählen') ?> --</option>
            <?php foreach ($conditionFields as $className => $displayName) : ?>
                <option value="<?= $className ?>"><?= htmlReady($displayName) ?></option>
            <?php endforeach ?>
        </select>
        <a href="#" onclick="return STUDIP.UserFilter.removeConditionField($(this).parent())"
           class="conditionfield_delete">
            <?= Icon::create('trash') ?></a>
    </div>
<?php endif ?>