Phundament App Class Reference
  • Package
  • Class
  • Tree

Packages

  • bootstrap
    • widgets
      • input
  • Image
  • None
  • p3admin
  • p3extensions
    • behaviors
    • commands
    • components
    • helpers
    • widgets
  • p3media
    • actions
    • controllers
    • models
  • p3pages
    • models
  • p3widgets
    • components
    • models
  • PHP
  • system
    • db
      • ar
    • gii
    • web
      • auth
      • helpers
      • widgets
  • yiiext
    • widgets
      • fancybox
      • lipsum
  • zii
    • widgets
      • grid

Classes

  • TbInput
  • TbInputHorizontal
  • TbInputInline
  • TbInputSearch
  • TbInputVertical
  1 <?php
  2 /**
  3  * TbInputHorizontal class file.
  4  * @author Christoffer Niska <ChristofferNiska@gmail.com>
  5  * @copyright Copyright &copy; Christoffer Niska 2011-
  6  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  7  * @package bootstrap.widgets.input
  8  */
  9 
 10 Yii::import('bootstrap.widgets.input.BootInput');
 11 
 12 /**
 13  * Bootstrap horizontal form input widget.
 14  * @since 0.9.8
 15  */
 16 class TbInputHorizontal extends TbInput
 17 {
 18     /**
 19      * Runs the widget.
 20      */
 21     public function run()
 22     {
 23         echo CHtml::openTag('div', array('class'=>'control-group '.$this->getContainerCssClass()));
 24         parent::run();
 25         echo '</div>';
 26     }
 27 
 28     /**
 29      * Returns the label for this block.
 30      * @return string the label
 31      */
 32     protected function getLabel()
 33     {
 34         if (isset($this->labelOptions['class']))
 35             $this->labelOptions['class'] .= ' control-label';
 36         else
 37             $this->labelOptions['class'] = 'control-label';
 38 
 39         return parent::getLabel();
 40     }
 41 
 42     /**
 43      * Renders a checkbox.
 44      * @return string the rendered content
 45      */
 46     protected function checkBox()
 47     {
 48         $attribute = $this->attribute;
 49         echo '<div class="controls">';
 50         echo '<label class="checkbox" for="'.$this->getAttributeId($attribute).'">';
 51         echo $this->form->checkBox($this->model, $attribute, $this->htmlOptions).PHP_EOL;
 52         echo $this->model->getAttributeLabel($attribute);
 53         echo $this->getError().$this->getHint();
 54         echo '</label></div>';
 55     }
 56 
 57     /**
 58      * Renders a list of checkboxes.
 59      * @return string the rendered content
 60      */
 61     protected function checkBoxList()
 62     {
 63         echo $this->getLabel();
 64         echo '<div class="controls">';
 65         echo $this->form->checkBoxList($this->model, $this->attribute, $this->data, $this->htmlOptions);
 66         echo $this->getError().$this->getHint();
 67         echo '</div>';
 68     }
 69 
 70     /**
 71      * Renders a list of inline checkboxes.
 72      * @return string the rendered content
 73      */
 74     protected function checkBoxListInline()
 75     {
 76         $this->htmlOptions['inline'] = true;
 77         $this->checkBoxList();
 78     }
 79 
 80     /**
 81      * Renders a drop down list (select).
 82      * @return string the rendered content
 83      */
 84     protected function dropDownList()
 85     {
 86         echo $this->getLabel();
 87         echo '<div class="controls">';
 88         echo $this->form->dropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
 89         echo $this->getError().$this->getHint();
 90         echo '</div>';
 91     }
 92 
 93     /**
 94      * Renders a file field.
 95      * @return string the rendered content
 96      */
 97     protected function fileField()
 98     {
 99         echo $this->getLabel();
100         echo '<div class="controls">';
101         echo $this->form->fileField($this->model, $this->attribute, $this->htmlOptions);
102         echo $this->getError().$this->getHint();
103         echo '</div>';
104     }
105 
106     /**
107      * Renders a password field.
108      * @return string the rendered content
109      */
110     protected function passwordField()
111     {
112         echo $this->getLabel();
113         echo '<div class="controls">';
114         echo $this->getPrepend();
115         echo $this->form->passwordField($this->model, $this->attribute, $this->htmlOptions);
116         echo $this->getAppend();
117         echo $this->getError().$this->getHint();
118         echo '</div>';
119     }
120 
121     /**
122      * Renders a radio button.
123      * @return string the rendered content
124      */
125     protected function radioButton()
126     {
127         $attribute = $this->attribute;
128         echo '<div class="controls">';
129         echo '<label class="radio" for="'.$this->getAttributeId($attribute).'">';
130         echo $this->form->radioButton($this->model, $attribute, $this->htmlOptions).PHP_EOL;
131         echo $this->model->getAttributeLabel($attribute);
132         echo $this->getError().$this->getHint();
133         echo '</label></div>';
134     }
135 
136     /**
137      * Renders a list of radio buttons.
138      * @return string the rendered content
139      */
140     protected function radioButtonList()
141     {
142         echo $this->getLabel();
143         echo '<div class="controls">';
144         echo $this->form->radioButtonList($this->model, $this->attribute, $this->data, $this->htmlOptions);
145         echo $this->getError().$this->getHint();
146         echo '</div>';
147     }
148 
149     /**
150      * Renders a list of inline radio buttons.
151      * @return string the rendered content
152      */
153     protected function radioButtonListInline()
154     {
155         $this->htmlOptions['inline'] = true;
156         $this->radioButtonList();
157     }
158 
159     /**
160      * Renders a textarea.
161      * @return string the rendered content
162      */
163     protected function textArea()
164     {
165         echo $this->getLabel();
166         echo '<div class="controls">';
167         echo $this->form->textArea($this->model, $this->attribute, $this->htmlOptions);
168         echo $this->getError().$this->getHint();
169         echo '</div>';
170     }
171 
172     /**
173      * Renders a text field.
174      * @return string the rendered content
175      */
176     protected function textField()
177     {
178         echo $this->getLabel();
179         echo '<div class="controls">';
180         echo $this->getPrepend();
181         echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
182         echo $this->getAppend();
183         echo $this->getError().$this->getHint();
184         echo '</div>';
185     }
186 
187     /**
188      * Renders a CAPTCHA.
189      * @return string the rendered content
190      */
191     protected function captcha()
192     {
193         echo $this->getLabel();
194         echo '<div class="controls"><div class="captcha">';
195         echo '<div class="widget">'.$this->widget('CCaptcha', $this->captchaOptions, true).'</div>';
196         echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
197         echo $this->getError().$this->getHint();
198         echo '</div></div>';
199     }
200 
201     /**
202      * Renders an uneditable field.
203      * @return string the rendered content
204      */
205     protected function uneditableField()
206     {
207         echo $this->getLabel();
208         echo '<div class="controls">';
209         echo CHtml::tag('span', $this->htmlOptions, $this->model->{$this->attribute});
210         echo $this->getError().$this->getHint();
211         echo '</div>';
212     }
213 }
214 
Phundament App Class Reference API documentation generated by ApiGen 2.8.0