/** * Runs the widget. */ public function run() { list($name, $id) = $this->resolveNameID(); $this->resolveId($id); if ($this->hasModel()) { $input = TbHtml::activeFileField($this->model, $this->attribute, $this->htmlOptions); } else { $input = TbHtml::fileField($name, $this->value, $this->htmlOptions); } echo TbHtml::tag('span', $this->buttonOptions, $this->label . ' ' . $input); if ($this->assetPath !== false) { $this->publishAssets($this->assetPath); $this->registerCssFile('css/jquery.fileupload-ui.css'); if ($this->registerJs) { $this->getClientScript()->registerCoreScript('jquery'); $this->registerScriptFile('js/vendor/jquery.ui.widget.js', CClientScript::POS_END); $this->registerScriptFile('js/jquery.iframe-transport.js', CClientScript::POS_END); $this->registerScriptFile('js/jquery.fileupload.js', CClientScript::POS_END); } } if ($this->bindPlugin) { TbArray::defaultValue('dataType', 'json', $this->pluginOptions); $options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : ''; $script = <<<EOD jQuery('#{$id}') .fileupload({$options}) .prop('disabled', !jQuery.support.fileInput) .parent().addClass(jQuery.support.fileInput ? undefined : 'disabled'); EOD; $this->getClientScript()->registerScript(__CLASS__ . '#' . $id, $script); } }
public function testFileField() { $I = $this->codeGuy; $html = TbHtml::fileField('file', '', array('class' => 'input')); $input = $I->createNode($html, 'input[type=file]'); $I->seeNodeAttributes($input, array('class' => 'input', 'id' => 'file', 'name' => 'file', 'value' => '')); }
<div class='box3 text-right'> <div class="input-append"> <?php //echo TbHtml::label('Rango de fechas:','archivo', array('style'=>'display:inline-table;')); $this->widget('yiiwheels.widgets.daterangepicker.WhDateRangePicker', array('name' => 'fechas', 'pluginOptions' => array('format' => 'YYYY-MM-DD'), 'htmlOptions' => array('id' => 'fechas', 'placeholder' => 'Seleccione el rango de fechas'))); ?> <span class="add-on"><icon class="icon-calendar"></icon></span> </div> <br /> <br /> <?php //echo TbHtml::label('Archivo txt:','archivo', array('style'=>'display:inline-table;')); ?> <?php echo TbHtml::fileField('archivo'); ?> </div> <br /> <?php echo TbHtml::button(' Conciliar', array('id' => 'btn-subir', 'class' => 'btn btn-primary fa fa-compress')); $this->endWidget(); ?> </div> <div id='pbar' style="display:none"> <?php echo TbHtml::animatedProgressBar(100); ?> </div>
?> </div> <div class='span4 white-box box'> <h3><?php echo TbHtml::i('', array('class' => 'fa fa-picture-o')); ?> Imagen para PV</h3> <?php echo TbHtml::imagePolaroid(strlen($model->EventoImaMin) > 3 ? "../imagesbd/" . $model->EventoImaMin : 'holder.js/130x130', '', array('id' => 'img-imamin')); ?> <br /><br /> <?php echo TbHtml::fileField('imamin', '', array('span' => 2, 'maxlength' => 200, 'class' => 'hidden')); ?> <?php echo $form->textField($model, 'EventoImaMin', array('append' => TbHtml::button('Seleccionar imagen', array('class' => 'btn btn-success', 'id' => 'btn-subir-imamin')), 'placeholder' => 'Nombre de la imagen miniatura')); ?> </div> <?php if ($model->scenario == 'update' and !empty($funciones)) { ?> <style> .modal-body { max-height: 100%; } .modal-footer{ padding: 2px 15px;