/** * @todo This should be generated by JavaScript, but we don't have the date libraries' */ function Field($properties = array()) { $this->addExtraClass('timedropdownfield'); $html = parent::Field($properties); Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript('framework/thirdparty/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript('timedropdownfield/javascript/TimeDropdownField.js'); Requirements::css('timedropdownfield/css/TimeDropdownField.css'); $iteratedTime = new Zend_Date('00:00:00', 'h:mm:ss'); $options = array(); $count = 24 * (60 / $this->config['interval']); for ($i = 0; $i < $count; $i++) { $key = $iteratedTime->toString($this->getConfig('datavalueformat')); $options[$key] = $iteratedTime->toString($this->getConfig('timeformat')); $iteratedTime->add($this->config['interval'], Zend_Date::MINUTE); } $dropdownField = new DropdownField('dropdown_' . $this->getName(), false, $options, $this->Value()); $dropdownField->addExtraClass('presets'); $dropdownField->setHasEmptyDefault(true); $dropdownField->setForm($this->getForm()); $html .= $dropdownField->Field(); $html .= '<a href="#" class="presets-trigger"></a>'; return $html; }