00001 <?php
00011 class OneLineLayout extends BaseLayout
00012 {
00016 public $errors = array();
00017
00023 public function drawBeginning()
00024 {
00025 echo '<div class="OneLineForm">';
00026 }
00027
00033 public function drawEnd()
00034 {
00035 echo '</div>';
00036
00037 $this->drawHiddenFields();
00038 $this->drawErrors();
00039 }
00040
00045 public function drawField($field)
00046 {
00047 if($field instanceof HiddenField)
00048 {
00049 $this->hiddenFields[] = $field;
00050 return;
00051 }
00052
00053
00054 if (!($field instanceOf ButtonField) && !($field instanceOf StaticField))
00055 echo "<span class=\"OneLineTitle\">" . $field->getTitle() . "</span>";
00056
00057 if($js = $field->getJs())
00058 echo "<script type='text/javascript'>$js</script>";
00059
00060 echo '<span class="OneLineField">';
00061 $field->drawInput();
00062 echo '</span>';
00063
00064 try
00065 {
00066 if($field->hasError())
00067 $this->errors[] = "<span class='FormError'>$field->errorMessage</span>";
00068 }
00069 catch (NotValidatedException $e){};
00070 }
00071
00077 public function drawErrors()
00078 {
00079 if (count($this->errors))
00080 {
00081 echo '<div class="OneLineFormErrors">';
00082 echo implode("<br/>", $this->errors);
00083 echo '</div>';
00084 }
00085 }
00086 }
00087 ?>