silverstripe-framework/forms/DropdownTimeField.php
Ingo Schommer b7835f3721 API CHANGE DropdownTimeField uses same timeformat as parent class TimeField: "g:ia" instead of "H:i a"
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79358 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-16 07:03:53 +00:00

39 lines
896 B
PHP

<?php
/**
* Field for entering time that provides clock for selecting time.
* @package forms
* @subpackage fields-datetime
*/
class DropdownTimeField extends TimeField {
static function Requirements() {
Requirements::javascript( SAPPHIRE_DIR . '/javascript/DropdownTimeField.js' );
Requirements::css( SAPPHIRE_DIR . '/css/DropdownTimeField.css' );
}
static function HTMLField( $id, $name, $val ) {
return <<<HTML
<input type="text" id="$id" name="$name" value="$val"/>
<img src="sapphire/images/clock-icon.gif" id="$id-icon"/>
<div class="dropdownpopup" id="$id-dropdowntime"></div>
HTML;
}
function Field() {
self::Requirements();
$field = parent::Field();
$id = $this->id();
$val = $this->attrValue();
$innerHTML = self::HTMLField( $id, $this->name, $val );
return <<<HTML
<div class="dropdowntime">
$innerHTML
</div>
HTML;
}
}