mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
DropdownTimeField adding
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44172 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
dbf72b83cd
commit
402e59bca5
39
forms/DropdownTimeField.php
Normal file
39
forms/DropdownTimeField.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
class DropdownTimeField extends TimeField {
|
||||
|
||||
function __construct( $name, $title = null, $value = "", $timeformat = 'H:i a' ){
|
||||
parent::__construct( $name, $title, $value, $timeformat );
|
||||
}
|
||||
|
||||
static function Requirements() {
|
||||
Requirements::javascript( 'sapphire/javascript/DropdownTimeField.js' );
|
||||
Requirements::css( 'sapphire/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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user