-
-
Save motin/5962332 to your computer and use it in GitHub Desktop.
YiiBooster TbInputHorizontal vs TbInputVertical
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This patch file was generated by NetBeans IDE | |
# It uses platform neutral UTF-8 encoding and \n newlines. | |
--- vendor/clevertech/yiibooster/src/widgets/input/TbInputHorizontal.php | |
+++ vendor/clevertech/yiibooster/src/widgets/input/TbInputVertical.php | |
@@ -1,62 +1,33 @@ | |
<?php | |
/** | |
- * TbInputHorizontal class file. | |
+ * TbInputVertical class file. | |
* @author Christoffer Niska <ChristofferNiska@gmail.com> | |
* @copyright Copyright © Christoffer Niska 2011- | |
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License | |
* @package bootstrap.widgets.input | |
+ * @since 11/25/12 10:49 AM updated by Antonio Ramirez <antonio@clevertech.biz> | |
*/ | |
Yii::import('bootstrap.widgets.input.TbInput'); | |
/** | |
- * Bootstrap horizontal form input widget. | |
+ * Bootstrap vertical form input widget. | |
* @since 0.9.8 | |
*/ | |
-class TbInputHorizontal extends TbInput | |
+class TbInputVertical extends TbInput | |
{ | |
/** | |
- * Runs the widget. | |
- */ | |
- public function run() | |
- { | |
- echo CHtml::openTag('div', array('class' => 'control-group ' . $this->getContainerCssClass())); | |
- parent::run(); | |
- echo '</div>'; | |
- } | |
- | |
- /** | |
- * Returns the label for this block. | |
- * @return string the label | |
- */ | |
- protected function getLabel() | |
- { | |
- if (isset($this->labelOptions['class'])) { | |
- $this->labelOptions['class'] .= ' control-label'; | |
- } else { | |
- $this->labelOptions['class'] = 'control-label'; | |
- } | |
- | |
- if (isset($this->htmlOptions['id'])) { | |
- $this->labelOptions['for'] = $this->htmlOptions['id']; | |
- } | |
- | |
- return parent::getLabel(); | |
- } | |
- | |
- /** | |
* Renders a checkbox. | |
* @return string the rendered content | |
*/ | |
protected function checkBox() | |
{ | |
$attribute = $this->attribute; | |
- echo '<div class="controls">'; | |
echo '<label class="checkbox" for="' . $this->getAttributeId($attribute) . '">'; | |
- echo $this->form->checkBox($this->model, $attribute, $this->htmlOptions) . PHP_EOL; | |
+ echo $this->form->checkBox($this->model, $this->attribute, $this->htmlOptions) . PHP_EOL; | |
echo $this->model->getAttributeLabel($attribute); | |
echo $this->getError() . $this->getHint(); | |
- echo '</label></div>'; | |
+ echo '</label>'; | |
} | |
/** | |
@@ -77,10 +48,8 @@ | |
$options['htmlOptions'] = $this->htmlOptions; | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
$this->widget('bootstrap.widgets.TbToggleButton', $options); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -90,10 +59,8 @@ | |
protected function checkBoxList() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->form->checkBoxList($this->model, $this->attribute, $this->data, $this->htmlOptions); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -125,13 +92,9 @@ | |
$this->labelOptions = array('for' => $label_for); | |
} | |
- $this->htmlOptions['class'] = 'pull-left'; | |
- | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->form->checkBoxGroupsList($this->model, $this->attribute, $this->data, $this->htmlOptions); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -141,10 +104,8 @@ | |
protected function dropDownList() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->form->dropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -154,10 +115,8 @@ | |
protected function fileField() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->form->fileField($this->model, $this->attribute, $this->htmlOptions); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -167,12 +126,10 @@ | |
protected function passwordField() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
echo $this->form->passwordField($this->model, $this->attribute, $this->htmlOptions); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -182,12 +139,11 @@ | |
protected function radioButton() | |
{ | |
$attribute = $this->attribute; | |
- echo '<div class="controls">'; | |
echo '<label class="radio" for="' . $this->getAttributeId($attribute) . '">'; | |
- echo $this->form->radioButton($this->model, $attribute, $this->htmlOptions) . PHP_EOL; | |
+ echo $this->form->radioButton($this->model, $this->attribute, $this->htmlOptions) . PHP_EOL; | |
echo $this->model->getAttributeLabel($attribute); | |
echo $this->getError() . $this->getHint(); | |
- echo '</label></div>'; | |
+ echo '</label>'; | |
} | |
/** | |
@@ -197,10 +153,8 @@ | |
protected function radioButtonList() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->form->radioButtonList($this->model, $this->attribute, $this->data, $this->htmlOptions); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -232,13 +186,9 @@ | |
$this->labelOptions = array('for' => $label_for); | |
} | |
- $this->htmlOptions['class'] = 'pull-left'; | |
- | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->form->radioButtonGroupsList($this->model, $this->attribute, $this->data, $this->htmlOptions); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -248,10 +198,8 @@ | |
protected function textArea() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->form->textArea($this->model, $this->attribute, $this->htmlOptions); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -261,12 +209,10 @@ | |
protected function textField() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -276,12 +222,10 @@ | |
protected function maskedTextField() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
echo $this->form->maskedTextField($this->model, $this->attribute, $this->data, $this->htmlOptions); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -290,12 +234,11 @@ | |
*/ | |
protected function captcha() | |
{ | |
- echo $this->getLabel(); | |
- echo '<div class="controls"><div class="captcha">'; | |
+ echo $this->getLabel() . '<div class="captcha">'; | |
echo '<div class="widget">' . $this->widget('CCaptcha', $this->captchaOptions, true) . '</div>'; | |
echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div></div>'; | |
+ echo '</div>'; | |
} | |
/** | |
@@ -305,10 +248,8 @@ | |
protected function uneditableField() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo CHtml::tag('span', $this->htmlOptions, $this->model->{$this->attribute}); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -329,7 +270,6 @@ | |
} | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
$this->widget( | |
'bootstrap.widgets.TbDatePicker', | |
@@ -343,7 +283,6 @@ | |
); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -365,7 +304,6 @@ | |
} | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
$this->widget( | |
'bootstrap.widgets.TbColorPicker', | |
@@ -379,11 +317,10 @@ | |
); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
- * Renders a redactor. | |
+ * Renders a redactorJs. | |
* @return string the rendered content | |
*/ | |
protected function redactorJs() | |
@@ -401,7 +338,6 @@ | |
unset($this->htmlOptions['height']); | |
} | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
$this->widget( | |
'bootstrap.widgets.TbRedactorJs', | |
array( | |
@@ -414,7 +350,6 @@ | |
) | |
); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -433,7 +368,6 @@ | |
unset($this->htmlOptions['height']); | |
} | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo '<div class="wmd-panel">'; | |
echo '<div id="wmd-button-bar" class="btn-toolbar"></div>'; | |
$this->widget( | |
@@ -450,69 +384,63 @@ | |
echo '<div id="wmd-preview" class="wmd-panel wmd-preview" style="width:' . (isset($width) ? $width | |
: '100%') . '"></div>'; | |
echo '</div>'; // wmd-panel | |
- echo '</div>'; // controls | |
} | |
/** | |
- * Renders Bootstrap wysihtml5 editor. | |
- * @return mixed|void | |
+ * Renders a ckEditor. | |
+ * @return string the rendered content | |
*/ | |
- protected function html5Editor() | |
+ protected function ckEditor() | |
{ | |
if (isset($this->htmlOptions['options'])) { | |
$options = $this->htmlOptions['options']; | |
unset($this->htmlOptions['options']); | |
} | |
- if (isset($this->htmlOptions['width'])) { | |
- $width = $this->htmlOptions['width']; | |
- unset($this->htmlOptions['width']); | |
- } | |
- if (isset($this->htmlOptions['height'])) { | |
- $height = $this->htmlOptions['height']; | |
- unset($this->htmlOptions['height']); | |
- } | |
+ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
$this->widget( | |
- 'bootstrap.widgets.TbHtml5Editor', | |
+ 'bootstrap.widgets.TbCKEditor', | |
array( | |
'model' => $this->model, | |
'attribute' => $this->attribute, | |
'editorOptions' => isset($options) ? $options : array(), | |
- 'width' => isset($width) ? $width : '100%', | |
- 'height' => isset($height) ? $height : '400px', | |
'htmlOptions' => $this->htmlOptions | |
) | |
); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
- * Renders a ckEditor. | |
+ * Renders a bootstrap wysihtml5 editor. | |
* @return string the rendered content | |
- * @author antonio ramirez <antonio@clevertech.biz> | |
*/ | |
- protected function ckEditor() | |
+ protected function html5Editor() | |
{ | |
if (isset($this->htmlOptions['options'])) { | |
$options = $this->htmlOptions['options']; | |
unset($this->htmlOptions['options']); | |
} | |
- | |
+ if (isset($this->htmlOptions['width'])) { | |
+ $width = $this->htmlOptions['width']; | |
+ unset($this->htmlOptions['width']); | |
+ } | |
+ if (isset($this->htmlOptions['height'])) { | |
+ $height = $this->htmlOptions['height']; | |
+ unset($this->htmlOptions['height']); | |
+ } | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
$this->widget( | |
- 'bootstrap.widgets.TbCKEditor', | |
+ 'bootstrap.widgets.TbHtml5Editor', | |
array( | |
'model' => $this->model, | |
'attribute' => $this->attribute, | |
'editorOptions' => isset($options) ? $options : array(), | |
+ 'width' => isset($width) ? $width : '100%', | |
+ 'height' => isset($height) ? $height : '400px', | |
'htmlOptions' => $this->htmlOptions | |
) | |
); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -533,7 +461,6 @@ | |
} | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
$this->widget( | |
'bootstrap.widgets.TbDateRangePicker', | |
@@ -547,7 +474,6 @@ | |
); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -568,7 +494,7 @@ | |
} | |
echo $this->getLabel(); | |
- echo '<div class="controls bootstrap-timepicker">'; | |
+ echo '<div class="bootstrap-timepicker">'; | |
echo $this->getPrepend(); | |
$this->widget( | |
'bootstrap.widgets.TbTimePicker', | |
@@ -613,7 +539,6 @@ | |
} | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
$this->widget( | |
'bootstrap.widgets.TbSelect2', | |
@@ -630,22 +555,19 @@ | |
); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
- * Renders a typeAhead field. | |
+ * Renders a typeahead field | |
* @return string the rendered content | |
*/ | |
protected function typeAheadField() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
echo $this->form->typeAheadField($this->model, $this->attribute, $this->data, $this->htmlOptions); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
@@ -655,27 +577,22 @@ | |
protected function numberField() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
echo $this->form->numberField($this->model, $this->attribute, $this->htmlOptions); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
/** | |
- * Renders a relation field. | |
+ * Renders a relation field | |
* @return string the rendered content | |
*/ | |
protected function relationField() | |
{ | |
echo $this->getLabel(); | |
- echo '<div class="controls">'; | |
echo $this->getPrepend(); | |
echo $this->form->relationField($this->model, $this->attribute, $this->data, $this->htmlOptions); | |
echo $this->getAppend(); | |
echo $this->getError() . $this->getHint(); | |
- echo '</div>'; | |
} | |
- | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment