2007-11-02 04:21:07 +01:00
|
|
|
<?php
|
|
|
|
|
2008-01-09 05:18:36 +01:00
|
|
|
/**
|
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-datetime
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 {
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|