2007-11-02 04:21:07 +01:00
|
|
|
<?php
|
2008-01-09 05:18:36 +01:00
|
|
|
/**
|
|
|
|
* Field for entering time that provides clock for selecting time.
|
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-datetime
|
|
|
|
*/
|
2007-11-02 04:21:07 +01:00
|
|
|
class DropdownTimeField extends TimeField {
|
|
|
|
|
|
|
|
static function Requirements() {
|
ENHANCEMENT Introduced constants for system paths like /sapphire in preparation for a more flexible directory reorganisation. Instead of hardcoding your path, please use the following constants: BASE_PATH, BASE_URL, SAPPHIRE_DIR, SAPPHIRE_PATH, CMS_DIR, CMS_PATH, THIRDPARTY_DIR, THIRDPARTY_PATH, ASSETS_DIR, ASSETS_PATH, THEMES_DIR, THEMES_PATH
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63154 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-09-27 18:02:38 +02:00
|
|
|
Requirements::javascript( SAPPHIRE_DIR . '/javascript/DropdownTimeField.js' );
|
|
|
|
Requirements::css( SAPPHIRE_DIR . '/css/DropdownTimeField.css' );
|
2007-11-02 04:21:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|