timeformat = $timeformat;
}
/**
* Change the setValue to store the time (in a datetime field)
* we store the current date as well (although we don't use it for this field)
*/
function setValue($val) {
$this->value = (date("Y-m-d",time()) . " " . date("H:i",strtotime($val)) );
}
/**
* Creates a new readonly field specified below
*/
function performReadonlyTransformation() {
return new TimeField_Readonly( $this->name, $this->title, $this->dataValue(),$this->timeformat);
}
/**
* Added to the value of the input, put the date into the format
* specified in the constructer.
*/
function attrValue(){
if($this->value){
return date($this->timeformat,strtotime($this->value));
}else{
return "";
}
}
}
/**
* The readonly class for our TimeField
*/
class TimeField_Readonly extends TimeField {
function Field() {
$extraClass = $this->extraClass();
$fieldSize = $this->maxLength ? min( $this->maxLength, 30 ) : 30;
if($this->maxLength) {
return "id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" maxlength=\"$this->maxLength\" size=\"$fieldSize\" />";
} else {
return "id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" />";
}
}
}