HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
TbForm.php
Go to the documentation of this file.
1 <?php
14 class TbForm extends CForm {
15 
21  public $inputElementClass = 'TbFormInputElement';
22 
28  public $buttonElementClass = 'TbFormButtonElement';
29 
39  public $activeForm = array('class' => 'TbActiveForm');
40 
45  public function renderButtons() {
46 
47  $output = '';
48  foreach ($this->getButtons() as $button) {
49  $output .= $this->renderElement($button);
50  }
51 
52  if ($output !== '' && $this->activeFormWidget->type !== TbActiveForm::TYPE_INLINE) {
53  $output = "<div class=\"form-actions\">\n" . $output . "</div>\n";
54  }
55 
56  return $output;
57  }
58 
63  public function renderBegin() {
64 
65  if (!($this->getParent() instanceof self) and !isset($this->activeForm['class'])) {
66  $this->activeForm['class'] = 'TbActiveForm';
67  }
68 
69  return parent::renderBegin();
70  }
71 
78  public function renderElement($element) {
79 
80  if (is_string($element)) {
81  if (($e = $this[$element]) === null && ($e = $this->getButtons()->itemAt($element)) === null)
82  return $element;
83  else
84  $element = $e;
85  }
86 
87  if ($element->getVisible()) {
88  if ($element instanceof TbFormInputElement) {
89  if ($element->type === 'hidden') {
90  return "<div style=\"visibility:hidden\">\n" . $element->render() . "</div>\n";
91  } else {
92  return $element->render();
93  }
94  } elseif ($element instanceof TbFormButtonElement) {
95  return $element->render() . "\n";
96  } else {
97  return $element->render();
98  }
99  }
100  return '';
101  }
102 }