public function html($property)
{
global $prefs;
$options = array();
$attributes = '';
$sel = false;
$label = '';
switch ($property) {
case 'start[year]':
return '<label for="' . $this->_formIDEncode($property) . '" class="hidden">' . _("Start Year") . '</label>' . '<input name="' . $property . '" value="' . $this->start->year . '" type="text"' . ' id="' . $this->_formIDEncode($property) . '" size="4" maxlength="4" />';
case 'start[month]':
$sel = $this->start->month;
for ($i = 1; $i < 13; ++$i) {
$options[$i] = strftime('%b', mktime(1, 1, 1, $i, 1));
}
$label = _("Start Month");
break;
case 'start[day]':
$sel = $this->start->mday;
for ($i = 1; $i < 32; ++$i) {
$options[$i] = $i;
}
$label = _("Start Day");
break;
case 'start_hour':
$sel = $this->start->format($prefs->getValue('twentyFour') ? 'G' : 'g');
$hour_min = $prefs->getValue('twentyFour') ? 0 : 1;
$hour_max = $prefs->getValue('twentyFour') ? 24 : 13;
for ($i = $hour_min; $i < $hour_max; ++$i) {
$options[$i] = $i;
}
$label = _("Start Hour");
break;
case 'start_min':
$sel = sprintf('%02d', $this->start->min);
for ($i = 0; $i < 12; ++$i) {
$min = sprintf('%02d', $i * 5);
$options[$min] = $min;
}
$label = _("Start Minute");
break;
case 'end[year]':
return '<label for="' . $this->_formIDEncode($property) . '" class="hidden">' . _("End Year") . '</label>' . '<input name="' . $property . '" value="' . $this->end->year . '" type="text"' . ' id="' . $this->_formIDEncode($property) . '" size="4" maxlength="4" />';
case 'end[month]':
$sel = $this->end ? $this->end->month : $this->start->month;
for ($i = 1; $i < 13; ++$i) {
$options[$i] = strftime('%b', mktime(1, 1, 1, $i, 1));
}
$label = _("End Month");
break;
case 'end[day]':
$sel = $this->end ? $this->end->mday : $this->start->mday;
for ($i = 1; $i < 32; ++$i) {
$options[$i] = $i;
}
$label = _("End Day");
break;
case 'end_hour':
$sel = $this->end ? $this->end->format($prefs->getValue('twentyFour') ? 'G' : 'g') : $this->start->format($prefs->getValue('twentyFour') ? 'G' : 'g') + 1;
$hour_min = $prefs->getValue('twentyFour') ? 0 : 1;
$hour_max = $prefs->getValue('twentyFour') ? 24 : 13;
for ($i = $hour_min; $i < $hour_max; ++$i) {
$options[$i] = $i;
}
$label = _("End Hour");
break;
case 'end_min':
$sel = $this->end ? $this->end->min : $this->start->min;
$sel = sprintf('%02d', $sel);
for ($i = 0; $i < 12; ++$i) {
$min = sprintf('%02d', $i * 5);
$options[$min] = $min;
}
$label = _("End Minute");
break;
case 'dur_day':
$dur = $this->getDuration();
return '<label for="' . $property . '" class="hidden">' . _("Duration Day") . '</label>' . '<input name="' . $property . '" value="' . $dur->day . '" type="text"' . ' id="' . $property . '" size="4" maxlength="4" />';
case 'dur_hour':
$dur = $this->getDuration();
$sel = $dur->hour;
for ($i = 0; $i < 24; ++$i) {
$options[$i] = $i;
}
$label = _("Duration Hour");
break;
case 'dur_min':
$dur = $this->getDuration();
$sel = $dur->min;
for ($i = 0; $i < 13; ++$i) {
$min = sprintf('%02d', $i * 5);
$options[$min] = $min;
}
$label = _("Duration Minute");
break;
case 'recur_end[year]':
if ($this->end) {
$end = $this->recurs() && $this->recurrence->hasRecurEnd() ? $this->recurrence->recurEnd->year : $this->end->year;
} else {
$end = $this->start->year;
}
return '<label for="' . $this->_formIDEncode($property) . '" class="hidden">' . _("Recurrence End Year") . '</label>' . '<input name="' . $property . '" value="' . $end . '" type="text"' . ' id="' . $this->_formIDEncode($property) . '" size="4" maxlength="4" />';
case 'recur_end[month]':
if ($this->end) {
$sel = $this->recurs() && $this->recurrence->hasRecurEnd() ? $this->recurrence->recurEnd->month : $this->end->month;
} else {
$sel = $this->start->month;
}
for ($i = 1; $i < 13; ++$i) {
$options[$i] = strftime('%b', mktime(1, 1, 1, $i, 1));
}
$label = _("Recurrence End Month");
break;
case 'recur_end[day]':
if ($this->end) {
$sel = $this->recurs() && $this->recurrence->hasRecurEnd() ? $this->recurrence->recurEnd->mday : $this->end->mday;
} else {
$sel = $this->start->mday;
}
for ($i = 1; $i < 32; ++$i) {
$options[$i] = $i;
}
$label = _("Recurrence End Day");
break;
}
if (!$this->_varRenderer) {
$this->_varRenderer = Horde_Core_Ui_VarRenderer::factory('Html');
}
return '<label for="' . $this->_formIDEncode($property) . '" class="hidden">' . $label . '</label>' . '<select name="' . $property . '"' . $attributes . ' id="' . $this->_formIDEncode($property) . '">' . $this->_varRenderer->selectOptions($options, $sel) . '</select>';
}