Framework  3.9
TableBasedFormLayout Class Reference

Lays out the AutoForm using table-based layout. More...

+ Inheritance diagram for TableBasedFormLayout:
+ Collaboration diagram for TableBasedFormLayout:

Public Member Functions

 __construct ($form)
 
 startGroup ($name, $collapsible=false, $collapsed=false)
 
 endGroup ()
 
 startField ($field, $renderer, $colspan=1, $styles="")
 
 endField ($field, $renderer)
 
 printLabel ($field, $renderer, $styles="", $annotation="")
 Internal method to generate the HTML for the field label. More...
 
 startUngrouped ()
 
 endUngrouped ()
 
 startButtonLine ()
 
 endButtonLine ()
 
 errorBox ()
 
 requiredFields ($text)
 
- Public Member Functions inherited from AutoFormLayout
 getGroupClass ($name, $collapsible, $collapsed, $additionalClass="")
 
 getLabel ($field, $renderer, $addSuffix=true)
 
 getLabelID ($field)
 
 finalizeLayout ()
 

Additional Inherited Members

- Static Public Member Functions inherited from AutoFormLayout
static create ($type, $form)
 
- Public Attributes inherited from AutoFormLayout
 $form
 
 $externalErrorBox = false
 Flag indicating whether the error box should be rendered inside the form grouping. More...
 

Detailed Description

Lays out the AutoForm using table-based layout.

Definition at line 129 of file auto_form_layout.inc.

Constructor & Destructor Documentation

◆ __construct()

TableBasedFormLayout::__construct (   $form)

Reimplemented from AutoFormLayout.

Reimplemented in UngroupedFormLayout.

Definition at line 131 of file auto_form_layout.inc.

132  {
133  parent::__construct($form);
134  }

Member Function Documentation

◆ endButtonLine()

TableBasedFormLayout::endButtonLine ( )

Reimplemented from AutoFormLayout.

Definition at line 256 of file auto_form_layout.inc.

257  {
258  echo "</td></tr>";
259  }

◆ endField()

TableBasedFormLayout::endField (   $field,
  $renderer 
)

Reimplemented from AutoFormLayout.

Definition at line 194 of file auto_form_layout.inc.

195  {
196  if ($renderer->parent->showAnnotations && !$renderer->annotateBefore && $renderer->parent->annotations[$field])
197  {
198  if ($renderer->annotateNextLine)
199  {
200  echo "<br/>";
201  }
202  else
203  {
204  echo "&nbsp;&nbsp;";
205  }
206  echo $renderer->parent->annotations[$field];
207  }
208 
209  echo "</td>\n</tr>\n";
210  }

◆ endGroup()

TableBasedFormLayout::endGroup ( )

Reimplemented from AutoFormLayout.

Reimplemented in UngroupedFormLayout.

Definition at line 153 of file auto_form_layout.inc.

154  {
155  $this->endUngrouped();
156 
157  $name = $this->groupName;
158 
159  $desc = $this->form->getGroupDescription($name, "end");
160  if ($desc)
161  {
162  $id = $this->form->id . "_" . codify($name) . "_group";
163  echo "<div id='{$id}_description' class='{$this->form->groupDescriptionCSS}'>{$desc}</div>";
164  }
165 
166  unset($this->groupName);
167 
168  echo "</fieldset>";
169  }
codify($name)
Takes a text string and converts it into a code-compliant format, suitable for use as a variable name...
Definition: functions.inc:1399

◆ endUngrouped()

TableBasedFormLayout::endUngrouped ( )

Reimplemented from AutoFormLayout.

Definition at line 245 of file auto_form_layout.inc.

246  {
247  echo "</table>";
248  }

◆ errorBox()

TableBasedFormLayout::errorBox ( )

Reimplemented from AutoFormLayout.

Definition at line 261 of file auto_form_layout.inc.

262  {
263  echo "<tr>\n <td colspan='2' id='{$this->form->id}__error' class='error' style='display: ".($this->form->msg ? 'table-cell' : 'none')."'>{$this->form->msg}</td></tr>\n";
264  }

◆ printLabel()

TableBasedFormLayout::printLabel (   $field,
  $renderer,
  $styles = "",
  $annotation = "" 
)

Internal method to generate the HTML for the field label.

Parameters
string$fieldthe field name
int$colspanthe number of columns to span
string$stylesoptional special styles that need to be applied
string$annotationannotation text for the field

Reimplemented from AutoFormLayout.

Definition at line 220 of file auto_form_layout.inc.

221  {
222  $colspan = $renderer->colspan;
223  if ($renderer->hideLabel && $colspan > 1 && !$annotation) return;
224 
225  $label = $this->getLabel($field, $renderer);
226 
227  echo "<td colspan='$colspan'";
228  if ($renderer->parent->labelCSS) echo " class='{$renderer->parent->labelCSS}'";
229  if ($styles) echo " style='$styles'";
230  echo ">";
231 
232  if (!$renderer->hideLabel) echo "<label id='".$this->getLabelID($field)."' for='$field'>$label</label> ";
233 
234  echo "$annotation</td>\n";
235  }
getLabel($field, $renderer, $addSuffix=true)

◆ requiredFields()

TableBasedFormLayout::requiredFields (   $text)

Reimplemented from AutoFormLayout.

Definition at line 266 of file auto_form_layout.inc.

267  {
268  echo "<tr>\n <td colspan='2'><span class='required_text'>{$text}</span></td></tr>\n";
269  }

◆ startButtonLine()

TableBasedFormLayout::startButtonLine ( )

Reimplemented from AutoFormLayout.

Definition at line 250 of file auto_form_layout.inc.

251  {
252  echo "<tr>\n";
253  echo " <td colspan='2' class='{$this->form->buttonLineCSS}' style='text-align: {$this->form->buttonAlignment}'><br/>";
254  }

◆ startField()

TableBasedFormLayout::startField (   $field,
  $renderer,
  $colspan = 1,
  $styles = "" 
)

Reimplemented from AutoFormLayout.

Definition at line 171 of file auto_form_layout.inc.

172  {
173  if ($renderer->colspan > 1) $styles = "text-align: left;$styles";
174 
175  echo "<tr class='{$renderer->parent->id}_{$field}_field'>\n";
176 
177  $this->printLabel($field, $renderer, $styles, ($renderer->annotateBefore && $renderer->colspan > 1) ? "<br/>".$renderer->parent->annotations[$field] : "");
178 
179  if ($renderer->colspan > 1)
180  {
181  echo "</tr>\n";
182  echo "<tr class='{$renderer->parent->id}_{$field}_field'>\n";
183  }
184  echo "<td colspan='{$renderer->colspan}'";
185  if ($renderer->parent->valueCSS) echo " class='{$renderer->parent->valueCSS}'";
186  echo ">";
187 
188  if ($renderer->parent->showAnnotations && $renderer->annotateBefore && $renderer->parent->annotations[$field] && $renderer->colspan == 1)
189  {
190  echo $renderer->parent->annotations[$field]."<br/>";
191  }
192  }
printLabel($field, $renderer, $styles="", $annotation="")
Internal method to generate the HTML for the field label.

◆ startGroup()

TableBasedFormLayout::startGroup (   $name,
  $collapsible = false,
  $collapsed = false 
)

Reimplemented from AutoFormLayout.

Reimplemented in UngroupedFormLayout.

Definition at line 136 of file auto_form_layout.inc.

137  {
138  $class = $this->getGroupClass($name, $collapsible, $collapsed);
139 
140  $id = $this->form->id . "_" . codify($name) . "_group";
141 
142  echo "<fieldset id='$id'$class><legend>$name</legend>";
143 
144  $desc = $this->form->getGroupDescription($name, "start");
145  if ($desc)
146  {
147  echo "<div id='{$id}_description' class='{$this->form->groupDescriptionCSS}'>{$desc}</div>";
148  }
149  $this->groupName = $name;
150  $this->startUngrouped();
151  }
getGroupClass($name, $collapsible, $collapsed, $additionalClass="")

◆ startUngrouped()

TableBasedFormLayout::startUngrouped ( )

Reimplemented from AutoFormLayout.

Definition at line 237 of file auto_form_layout.inc.

238  {
239  echo "<table";
240  if ($this->form->formCSS) echo " class='{$this->form->formCSS}'";
241  if ($this->form->style) echo " style='{$this->form->style}'";
242  echo ">\n";
243  }

The documentation for this class was generated from the following file: