aboutsummaryrefslogtreecommitdiffstats
path: root/view/tpl/field_duration.qmc.tpl
diff options
context:
space:
mode:
authorme <none@none.me>2020-11-14 23:37:18 +0100
committerme <none@none.me>2020-11-14 23:37:18 +0100
commit78f150cfbc1b713bfba3101fdc3f1fd624120637 (patch)
tree8c0ac65880da053c8f0b2e35908540702a058820 /view/tpl/field_duration.qmc.tpl
parent06273e980e7aa978d0145f1e5ecd92cbc2aef66e (diff)
downloadvolse-hubzilla-78f150cfbc1b713bfba3101fdc3f1fd624120637.tar.gz
volse-hubzilla-78f150cfbc1b713bfba3101fdc3f1fd624120637.tar.bz2
volse-hubzilla-78f150cfbc1b713bfba3101fdc3f1fd624120637.zip
air.s1: field templates checkbox/input/select and one new
Diffstat (limited to 'view/tpl/field_duration.qmc.tpl')
-rw-r--r--view/tpl/field_duration.qmc.tpl87
1 files changed, 87 insertions, 0 deletions
diff --git a/view/tpl/field_duration.qmc.tpl b/view/tpl/field_duration.qmc.tpl
new file mode 100644
index 000000000..5ef11a6b9
--- /dev/null
+++ b/view/tpl/field_duration.qmc.tpl
@@ -0,0 +1,87 @@
+{{if $wrapper!="no"}}<div id="{{$qmc}}{{$field.name}}_wrapper" class="form-group">{{/if}}
+
+<label for="{{$qmc}}{{$field.name}}fs">{{$label}}
+ {{if $qmcid}}<sup class="zuiqmid required">{{$qmcid}}</sup>{{/if}}
+</label>
+<fieldset name="{{$qmc}}{{$field.name}}fs" id="id_{{$qmc}}{{$field.name}}_fs" title="{{$field.title}}">
+
+<input id="{{$qmc}}{{$field.name}}n"
+ name="{{$qmc}}{{$field.name}}n"
+ class="inline-block mr-1 text-center" style="width: 5rem;"
+ type="number"
+{{if $field.min}} min="{{$field.min}}"{{/if}}
+{{if $field.max}} max="{{$field.max}}"{{/if}}
+ size="{{$field.size}}"
+ value="{{$field.value}}"
+ title="{{$field.title}}">
+
+{{foreach $rabot as $k=>$v}}
+ <input id="{{$qmc}}{{$field.name}}{{$k}}" name="{{$qmc}}{{$field.name}}"
+ type="radio" value="{{$k}}" {{if $field.default==$k}} checked="checked"{{/if}}>
+ <label for="{{$qmc}}{{$field.name}}{{$k}}">{{$v}}</label>
+{{/foreach}}
+
+</fieldset>
+
+<span id="{{$qmc}}{{$field.name}}_help" class="form-text text-muted">{{$help}}</span>
+
+{{if $wrapper!="no"}}</div>{{/if}}
+
+{{*
+ * Template field_duration.qmc.tpl
+ * **********************************
+ * Hilmar Runge, 2020.02
+ * The template generates one input field for numeric values and a radio button group, where one
+ * (and only one or no) selection can be active. The primary intented use is for entering time/date
+ * data in the form of amount (numeric) and the units (ie hours, days etc).
+ * Instead of using positional array parameters, keyed (named) parameters are treated. Imo, named parameters
+ * are easier to apply, the position does not matter and if one is not wanted or required, only omit it.
+ *
+ * The parameters in this template are:
+ * ************************************
+ * label A label for the whole. Optional.
+ * help An optional explanation text.
+ * qmc Optional a qualified message component prefix, best use case is 3 letters lowercase and depends
+ * on the module or component used in the system. Part of id's and names in html and css.
+ * qmcid The qmc message id. Optional. Should be qmc+4digits+1charsufffix (8 chars uppercase).
+ * field keyed array parameters:
+ * name The (unique) name of the elements also used for html ids,
+ * will be suffixed by 'n' for the numeric input and 'u' for the units
+ * title The title of the element
+ * legend a headline for the radio buttons (optional)
+ * rabot the keyed array of radio buttons, where:
+ * k the key becomes the submitted value
+ * v the string value is the label text for the radio button.
+ *
+ * Example to apply in php like:
+ * *****************************
+ $testcase = replace_macros(get_markup_template('field_radio_group.qmc.tpl'),
+ array(
+ 'label' => t('Exiration duration',
+ 'qmc' => 'zai', // not required
+ 'qmcid' => 'ZAI0000I', // not required
+ 'wrapper' => 'no', // when no wrapper around is desired
+ 'field' => // fieldset properties
+ array(
+ 'name' => 'due',
+ 'min' => "1", // the minimum value for the numeric input
+ 'max' => "99", // the maximum value for the numeric input
+ 'size' => "2", // the max digits for the numeric input
+ 'title' => 'time/date unit',
+ 'default' => 'd' // say 'default' => '' if none defaults (or omit)
+ ),
+ 'rabot' => // the radio buttons
+ array(
+ 'i' => 'Minute(s)',
+ 'h' => 'Hour(s)' ,
+ 'd' => 'Day(s)' ,
+ 'w' => 'Week(s)' ,
+ 'm' => 'Month(s)' ,
+ 'y' => 'Year(s)'
+ )
+ )
+ );
+ *
+ *}}
+
+