Base application
[infodrom.org/touren.infodrom.org] / templates / input / select.phtml
diff --git a/templates/input/select.phtml b/templates/input/select.phtml
new file mode 100644 (file)
index 0000000..80f5dd6
--- /dev/null
@@ -0,0 +1,26 @@
+<div class="form-group">
+     <?php if (isset($title)) { ?>
+         <label for="<?php echo $name;?>"><?php echo $title;?></label>
+     <?php } ?>
+     <select
+        class="form-control"
+        id="<?php echo $name;?>"
+        name="<?php echo $name;?>"
+        <?php if (isset($help)) { ?>
+            aria-describedby="<?php echo $name;?>Help"
+        <?php } ?>
+        <?php if (isset($readonly) && $readonly) { ?>
+            readonly="readonly"
+        <?php } ?>
+        >
+        <?php if (isset($empty)) { ?>
+            <option value=""><?php echo $empty;?></option>
+        <?php } ?>
+        <?php if (isset($options)) foreach ($options as $item) { ?>
+            <option value="<?php echo $item->value; ?>"<?php if (isset($selected) && $item->value == $selected) echo " selected"; ?>><?php echo $item->text; ?></option>
+        <?php } ?>
+     </select>
+     <?php if (isset($help)) { ?>
+         <small id="<?php echo $name;?>Help" class="form-text text-muted"><?php echo $help; ?></small>
+     <?php } ?>
+</div>
\ No newline at end of file