fileFieldRow() public method

Renders a file field input row.
public fileFieldRow ( CModel $model, string $attribute, array $htmlOptions = [] ) : string
$model CModel the data model
$attribute string the attribute
$htmlOptions array additional HTML attributes
return string the generated row
Exemplo n.º 1
0
 /**
  * Create TbActiveForm widget.
  *
  * @param TbActiveForm $form
  * @param object $model Model
  * @param string $attribute Model attribute
  */
 public function createWidget($form, $model, $attribute)
 {
     $lang = Yii::app()->language;
     if ($lang == 'en_us') {
         $lang = 'en';
     }
     $widget = $this->getAttributeWidget($model, $attribute);
     switch ($widget) {
         case 'time':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-time"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'time', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('timeFormat' => 'HH:mm:ss', 'showSecond' => true));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'datetime':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-calendar"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'datetime', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('dateFormat' => 'yy-mm-dd', 'timeFormat' => 'HH:mm:ss', 'showSecond' => true));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'date':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-calendar"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'date', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('dateFormat' => 'yy-mm-dd'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'wysiwyg':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('model' => $model, 'attribute' => $attribute, 'options' => array('lang' => $lang, 'buttons' => array('formatting', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'link', '|', 'html')));
             $options = $this->getAttributeOptions($attribute, $options);
             if ($this->redactorUpload === true) {
                 $redactorOptions = array('options' => array('imageUpload' => Yii::app()->createUrl($this->name . '/model/redactorImageUpload', array('name' => get_class($model), 'attr' => $attribute)), 'imageGetJson' => Yii::app()->createUrl($this->name . '/model/redactorImageList', array('name' => get_class($model), 'attr' => $attribute)), 'imageUploadErrorCallback' => new CJavaScriptExpression('function(obj,json) { alert(json.error); }')));
                 $options = array_merge_recursive($options, $redactorOptions);
             }
             $this->controller->widget($this->name . '.extensions.redactor.ERedactorWidget', $options);
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'textArea':
             $options = array('rows' => 5, 'cols' => 50, 'class' => 'span8');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textAreaRow($model, $attribute, $options);
             break;
         case 'textField':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             break;
         case 'chosen':
             $options = array('empty' => Yii::t('YcmModule.ycm', 'Choose {name}', array('{name}' => $model->getAttributeLabel($attribute))), 'class' => 'span5 chosen-select');
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.chosen.EChosenWidget');
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'chosenMultiple':
             $options = array('data-placeholder' => Yii::t('YcmModule.ycm', 'Choose {name}', array('{name}' => $model->getAttributeLabel($attribute))), 'multiple' => 'multiple', 'class' => 'span5 chosen-select');
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.chosen.EChosenWidget');
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'taggable':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('name' => $attribute, 'value' => $model->{$attribute}->toString(), 'url' => Yii::app()->createUrl($this->name . '/model/suggestTags', array('name' => get_class($model), 'attr' => $attribute)), 'multiple' => true, 'mustMatch' => false, 'matchCase' => false, 'htmlOptions' => array('size' => 50, 'class' => 'span5'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget('CAutoComplete', $options);
             echo '<span class="help-inline">' . Yii::t('YcmModule.ycm', 'Separate words with commas.') . '</span>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'dropDown':
             $options = array('empty' => Yii::t('YcmModule.ycm', 'Choose {name}', array('{name}' => $model->getAttributeLabel($attribute))), 'class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'typeHead':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('model' => $model, 'attribute' => $attribute, 'htmlOptions' => array('class' => 'span5', 'autocomplete' => 'off'), 'options' => array('name' => 'typeahead', 'source' => $this->getAttributeChoices($model, $attribute), 'matcher' => "js:function(item) {\n\t\t\t\t\t\t\treturn ~item.toLowerCase().indexOf(this.query.toLowerCase());\n\t\t\t\t\t\t}"));
             $options = $this->getAttributeOptions($attribute, $options, true);
             $this->controller->widget('bootstrap.widgets.TbTypeahead', $options);
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'radioButton':
             $options = array();
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->radioButtonListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'boolean':
             $options = array();
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->checkboxRow($model, $attribute, $options);
             break;
         case 'password':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->passwordFieldRow($model, $attribute, $options);
             break;
         case 'disabled':
             $options = array('class' => 'span5', 'disabled' => true);
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             break;
         case 'file':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             if (!$model->isNewRecord && !empty($model->{$attribute})) {
                 ob_start();
                 echo '<p>';
                 $this->controller->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('YcmModule.ycm', 'Download'), 'type' => '', 'url' => $model->getFileUrl($attribute)));
                 echo '</p>';
                 $html = ob_get_clean();
                 $options['hint'] = $html;
             }
             echo $form->fileFieldRow($model, $attribute, $options);
             break;
         case 'image':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             if (!$model->isNewRecord && !empty($model->{$attribute})) {
                 $modalName = 'modal-image-' . $attribute;
                 $image = CHtml::image($model->getFileUrl($attribute), Yii::t('YcmModule.ycm', 'Image'), array('class' => 'modal-image'));
                 ob_start();
                 $this->controller->beginWidget('bootstrap.widgets.TbModal', array('id' => $modalName));
                 echo '<div class="modal-header"><a class="close" data-dismiss="modal">&times;</a><h4>';
                 echo Yii::t('YcmModule.ycm', 'Image preview') . '</h4></div>';
                 echo '<div class="modal-body">' . $image . '</div>';
                 $this->controller->endWidget();
                 echo '<p>';
                 $this->controller->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('YcmModule.ycm', 'Preview'), 'type' => '', 'htmlOptions' => array('data-toggle' => 'modal', 'data-target' => '#' . $modalName)));
                 echo '</p>';
                 $html = ob_get_clean();
                 $options['hint'] = $html;
             }
             echo $form->fileFieldRow($model, $attribute, $options);
             break;
         case 'hide':
             break;
         default:
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             break;
     }
 }
Exemplo n.º 2
0
 /**
  * Create TbActiveForm widget.
  *
  * @param TbActiveForm $form
  * @param object $model Model
  * @param string $attribute Model attribute
  */
 public function createWidget($form, $model, $attribute, $extraOptions = '', $extraHtml = '')
 {
     $lang = Yii::app()->language;
     if ($lang == 'en_us') {
         $lang = 'en';
     }
     $widget = $this->getAttributeWidget($model, $attribute);
     switch ($widget) {
         case 'time':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-time"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'time', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('timeFormat' => 'HH:mm', 'showSecond' => false, 'stepMinute' => '10'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'datetime':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-calendar"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'datetime', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('dateFormat' => 'yy-mm-dd', 'timeFormat' => 'HH:mm', 'showSecond' => false));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'date':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-calendar"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'date', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('dateFormat' => 'yy-mm-dd', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '1998:2030'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'wysiwyg':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('model' => $model, 'attribute' => $attribute, 'options' => array('lang' => $lang, 'buttons' => array('formatting', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'link', '|', 'html')));
             $options = $this->getAttributeOptions($attribute, $options);
             if ($this->redactorUpload === true) {
                 $redactorOptions = array('options' => array('imageUpload' => Yii::app()->createUrl($this->name . '/model/redactorImageUpload', array('name' => get_class($model), 'attr' => $attribute)), 'imageGetJson' => Yii::app()->createUrl($this->name . '/model/redactorImageList', array('name' => get_class($model), 'attr' => $attribute)), 'imageUploadErrorCallback' => new CJavaScriptExpression('function(obj,json) { alert(json.error); }')));
                 $options = array_merge_recursive($options, $redactorOptions);
             }
             $this->controller->widget($this->name . '.extensions.redactor.ERedactorWidget', $options);
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'textArea':
             $options = array('rows' => 5, 'cols' => 50, 'class' => 'span8');
             $data_caracters = '';
             foreach ($model->getValidators($attribute) as $validator) {
                 if ($validator instanceof CStringValidator && $validator->max !== null) {
                     $data_caracters = 'Cantidad de caracteres permitidos (' . $validator->max . ' max.)';
                     break;
                 }
             }
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textAreaRow($model, $attribute, $options);
             echo "<span class='textnum' data-caracters='{$data_caracters}'></span>";
             break;
         case 'textField':
             $options = array('class' => 'span5');
             if ($extraOptions != '' && isset($extraOptions[$attribute])) {
                 $options = $extraOptions[$attribute];
             }
             $data_caracters = '';
             foreach ($model->getValidators($attribute) as $validator) {
                 if ($validator instanceof CStringValidator && $validator->max !== null) {
                     $data_caracters = 'Cantidad de caracteres permitidos (' . $validator->max . ' max.)';
                     break;
                 }
             }
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             echo "<span class='textnum' data-caracters='{$data_caracters}'></span>";
             break;
         case 'chosen':
             $options = array('empty' => Yii::t('YcmModule.ycm', 'Selecciona {name}', array('{name}' => strtolower($model->getAttributeLabel($attribute)))), 'class' => 'span5 chosen-select');
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.chosen.EChosenWidget');
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             if ($extraHtml != '' && isset($extraHtml[$attribute])) {
                 echo $extraHtml[$attribute];
             }
             break;
         case 'chosenMultiple':
             $options = array('data-placeholder' => Yii::t('YcmModule.ycm', 'Selecciona {name}', array('{name}' => strtolower($model->getAttributeLabel($attribute)))), 'multiple' => 'multiple', 'class' => 'span5 chosen-select');
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.chosen.EChosenWidget');
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             if ($extraHtml != '' && isset($extraHtml[$attribute])) {
                 echo $extraHtml[$attribute];
             }
             break;
         case 'taggable':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('name' => $attribute, 'value' => $model->{$attribute}->toString(), 'url' => Yii::app()->createUrl($this->name . '/model/suggestTags', array('name' => get_class($model), 'attr' => $attribute)), 'multiple' => true, 'mustMatch' => false, 'matchCase' => false, 'htmlOptions' => array('size' => 50, 'class' => 'span5'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget('CAutoComplete', $options);
             echo '<span class="help-inline">' . Yii::t('YcmModule.ycm', 'Separate words with commas.') . '</span>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'dropDown':
             $options = array('empty' => Yii::t('YcmModule.ycm', 'Selecciona {name}', array('{name}' => strtolower($model->getAttributeLabel($attribute)))), 'class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'typeHead':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('model' => $model, 'attribute' => $attribute, 'htmlOptions' => array('class' => 'span5', 'autocomplete' => 'off'), 'options' => array('name' => 'typeahead', 'source' => $this->getAttributeChoices($model, $attribute), 'matcher' => "js:function(item) {\n\t\t\t\t\t\t\treturn ~item.toLowerCase().indexOf(this.query.toLowerCase());\n\t\t\t\t\t\t}"));
             $options = $this->getAttributeOptions($attribute, $options, true);
             $this->controller->widget('bootstrap.widgets.TbTypeahead', $options);
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'radioButton':
             $options = array();
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->radioButtonListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'boolean':
             $options = array();
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->checkboxRow($model, $attribute, $options);
             break;
         case 'password':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->passwordFieldRow($model, $attribute, $options);
             break;
         case 'disabled':
             $options = array('class' => 'span5', 'disabled' => true);
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             break;
         case 'file':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             if (!$model->isNewRecord && !empty($model->{$attribute})) {
                 ob_start();
                 echo '<p>';
                 $this->controller->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('YcmModule.ycm', 'Descargar'), 'type' => '', 'url' => $model->getFileUrl($attribute), 'htmlOptions' => array('target' => '_blank')));
                 echo '</p>';
                 $html = ob_get_clean();
                 $options['hint'] = $html;
             }
             echo $form->fileFieldRow($model, $attribute, $options);
             break;
         case 'image':
             $options = array('class' => 'span5');
             if ($extraOptions != '' && isset($extraOptions[$attribute])) {
                 $options = $extraOptions[$attribute];
             }
             $options = $this->getAttributeOptions($attribute, $options);
             if (!$model->isNewRecord && !empty($model->{$attribute})) {
                 $modalName = 'modal-image-' . $attribute;
                 $image = CHtml::image($model->getFileUrl($attribute), Yii::t('YcmModule.ycm', 'Image'), array('class' => 'modal-image'));
                 ob_start();
                 $this->controller->beginWidget('bootstrap.widgets.TbModal', array('id' => $modalName));
                 echo '<div class="modal-header"><a class="close" data-dismiss="modal">&times;</a><h4>';
                 echo Yii::t('YcmModule.ycm', 'Image preview') . '</h4></div>';
                 echo '<div class="modal-body">' . $image . '</div>';
                 $this->controller->endWidget();
                 echo '<p>';
                 $this->controller->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('YcmModule.ycm', 'Vista previa'), 'type' => '', 'htmlOptions' => array('data-toggle' => 'modal', 'data-target' => '#' . $modalName)));
                 echo '</p>';
                 $html = ob_get_clean();
                 $options['hint'] = $html;
             }
             echo $form->fileFieldRow($model, $attribute, $options);
             echo '<span class="filetext"></span>';
             if ($model->allowDelImage() && !$model->isAttributeRequired($attribute)) {
                 echo '<div class="control-group ">
                                         <label for="__link" class="control-label"></label>
                                         <div class="controls">
                                             <label for="eliminate_image_' . $attribute . '" class="checkbox">
                                                 <input type="hidden" name="eliminate_image[' . $attribute . ']" value="0" id="yteliminate_image_' . $attribute . '">
                                                 <input type="checkbox" value="1" id="eliminate_image_' . $attribute . '" name="eliminate_image[' . $attribute . ']"><span style="font-style: italic;">Eliminar imagen</span>
                                             </label>
                                         </div>
                                     </div>';
             }
             if ($extraHtml != '' && isset($extraHtml[$attribute])) {
                 echo $extraHtml[$attribute];
             }
             break;
         case 'hide':
             break;
         case 'label':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo '<div class="control-group">';
             echo '<label class="control-label">' . $model->getAttributeLabel($attribute) . ':</label>';
             echo '<div class="controls">';
             echo '<label style="font-style: italic; padding-top: 5px;">', $model->grado, '</label>';
             echo '</div>';
             echo '</div>';
             break;
         default:
             $options = array('class' => 'span5');
             $data_caracters = '';
             foreach ($model->getValidators($attribute) as $validator) {
                 if ($validator instanceof CStringValidator && $validator->max !== null) {
                     $data_caracters = 'Cantidad de caracteres permitidos (' . $validator->max . ' max.)';
                     break;
                 }
             }
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             echo "<span class='textnum' data-caracters='{$data_caracters}'></span>";
             break;
     }
 }