- <?php if ($cfg['availabilities']['minute']) { ?>
- <option value = "minute"><?php echo t('One minute'); ?></option>
- <?php } ?>
- <?php if ($cfg['availabilities']['hour']) { ?>
- <option value = "hour"><?php echo t('One hour'); ?></option>
- <?php } ?>
- <?php if ($cfg['availabilities']['day']) { ?>
- <option value = "day"><?php echo t('One day'); ?></option>
- <?php } ?>
- <?php if ($cfg['availabilities']['week']) { ?>
- <option value = "week"><?php echo t('One week'); ?></option>
- <?php } ?>
- <?php if ($cfg['availabilities']['month']) { ?>
- <option value = "month"><?php echo t('One month');?></option>
- <?php } ?>
- <?php if ($cfg['availabilities']['year']) { ?>
- <option value = "year"><?php echo t('One year');?></option>
- <?php } ?>
- <?php if ($cfg['availabilities']['none']) { ?>
- <option value="none"><?php echo t('None'); ?></option>
- <?php } ?>
+ <?php
+ $expirationTimeOptions = array(
+ array(
+ 'value' => 'minute',
+ 'label' => '1_MIN'
+ ),
+ array(
+ 'value' => 'hour',
+ 'label' => '1_H'
+ ),
+ array(
+ 'value' => 'day',
+ 'label' => '1_D'
+ ),
+ array(
+ 'value' => 'week',
+ 'label' => '1_W'
+ ),
+ array(
+ 'value' => 'fortnight',
+ 'label' => '2_W'
+ ),
+ array(
+ 'value' => 'month',
+ 'label' => '1_M'
+ ),
+ array(
+ 'value' => 'quarter',
+ 'label' => '1_Q'
+ ),
+ array(
+ 'value' => 'year',
+ 'label' => '1_Y'
+ ),
+ array(
+ 'value' => 'none',
+ 'label' => 'NONE'
+ )
+ );
+ foreach ($expirationTimeOptions as $expirationTimeOption) {
+ $selected = ($expirationTimeOption['value'] === $cfg['availability_default'])? 'selected="selected"' : '';
+ if (true === $cfg['availabilities'][$expirationTimeOption['value']]) {
+ echo '<option value="' . $expirationTimeOption['value'] . '" ' .
+ $selected . '>' . t($expirationTimeOption['label']) . '</option>';
+ }
+ }
+ ?>