public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); if($this->isReadonly) $tagOptions['disabled'] = true; if($this->value) { $oldOptions = array('readonly'=>true); if($this->isReadonly) $tagOptions['disabled'] = true; echo CHtml::textField("{$inputName}[old]", $this->value, $oldOptions); unset($oldOptions['readonly']); ?> <label class="delfile"> <?php echo Yii::t('AutoAdmin.form', '<b class="warning">Delete</b> the file')?> <span class="tip">(<?php echo Yii::t('AutoAdmin.form', 'set checkbox on for confirm')?>)</span>: <?php echo CHtml::checkBox("{$inputName}[del]", false, $oldOptions);?> </label> <?php } $tagOptions['id'] = $inputID; echo CHtml::label(Yii::t('AutoAdmin.form', 'New file').':', $inputID); ?> <div class="tip inline"><a href=<?php echo $this->options['directoryPath']?>/</div> <?php echo CHtml::fileField(AutoAdmin::INPUT_PREFIX."[{$this->name}_new]", null, $tagOptions); return ob_get_clean(); }
/** * @param $attribute * @param null $value * @param null $name * @param array $htmlOptions * @return mixed|null|string */ public static function renderField($attribute, $value = null, $name = null, $htmlOptions = []) { $name = $name ?: 'Attribute[' . $attribute->id . ']'; switch ($attribute->type) { case Attribute::TYPE_SHORT_TEXT: return CHtml::textField($name, $value, $htmlOptions); break; case Attribute::TYPE_TEXT: return Yii::app()->getController()->widget(Yii::app()->getModule('store')->getVisualEditor(), ['name' => $name, 'value' => $value], true); break; case Attribute::TYPE_DROPDOWN: $data = CHtml::listData($attribute->options, 'id', 'value'); return CHtml::dropDownList($name, $value, $data, array_merge($htmlOptions, ['empty' => '---'])); break; case Attribute::TYPE_CHECKBOX_LIST: $data = CHtml::listData($attribute->options, 'id', 'value'); return CHtml::checkBoxList($name . '[]', $value, $data, $htmlOptions); break; case Attribute::TYPE_CHECKBOX: return CHtml::checkBox($name, $value, CMap::mergeArray(['uncheckValue' => 0], $htmlOptions)); break; case Attribute::TYPE_NUMBER: return CHtml::numberField($name, $value, $htmlOptions); break; case Attribute::TYPE_FILE: return CHtml::fileField($name . '[name]', null, $htmlOptions); break; } return null; }
/** * Runs the widget. * This method registers all needed client scripts and renders * the multiple file uploader. */ public function run() { if ($this->name !== null) { $name = $this->name; } else { if (isset($this->htmlOptions['name'])) { $name = $this->htmlOptions['name']; } else { throw new CException(Yii::t('yii', 'CMultiFileUpload.name is required.')); } } if (substr($name, -2) !== '[]') { $name .= '[]'; } if (($id = $this->getId(false)) === null) { if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $id = CHtml::getIdByName($name); } } $this->htmlOptions['id'] = $id; $this->registerClientScript(); echo CHtml::fileField($name, '', $this->htmlOptions); }
/** * Renders the input file field */ public function renderField() { if ($this->hasModel()) { echo \CHtml::activeFileField($this->model, $this->attribute, $this->options); } else { echo \CHtml::fileField($this->options['name'], $this->value, $this->options); } }
/** * Generates the required HTML and Javascript */ public function run() { list($name, $id) = $this->resolveNameID(); $model = $this->model; if (!isset($this->options['uploadTable'])) { $uploadTable = "files"; $this->options['uploadTable'] = "#files"; } else { $uploadTable = $this->options['uploadTable']; $this->options['uploadTable'] = "#{$uploadTable}"; } if (!isset($this->options['downloadTable'])) { $downloadTable = "files"; $this->options['downloadTable'] = "#files"; } else { $downloadTable = $this->options['downloadTable']; $this->options['downloadTable'] = "#{$downloadTable}"; } if (!isset($this->options['buildUploadRow'])) { $this->options['buildUploadRow'] = $this->_getBuildUploadRow(); } if (!isset($this->options['buildDownloadRow'])) { $this->options['buildDownloadRow'] = $this->_getBuildDownloadRow(); } if (!isset($this->htmlOptions['enctype'])) { $this->htmlOptions['enctype'] = 'multipart/form-data'; } if (!isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] = 'xupload-form file_upload'; } if (!isset($this->htmlOptions['id'])) { $this->htmlOptions['id'] = get_class($model) . "_form"; } $options = CJavaScript::encode($this->options); CVarDumper::dumpAsString($options, 10, true); Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->htmlOptions['id'], "jQuery('#{$this->htmlOptions['id']}').fileUploadUI({$options});", CClientScript::POS_READY); echo CHtml::beginForm($this->url, 'post', $this->htmlOptions); $htmlOptions = array(); if ($this->multiple) { $htmlOptions["multiple"] = true; } if ($this->hasModel()) { echo CHtml::activeFileField($this->model, $this->attribute, $htmlOptions); } else { echo CHtml::fileField($name, $this->value, $htmlOptions); } echo CHtml::tag("button", array(), "Upload", true); echo CHtml::tag("div", array(), "Upload file", true); echo CHtml::endForm(); if ($uploadTable == $downloadTable) { echo CHtml::tag("table", array("id" => $uploadTable), "", true); } else { echo CHtml::tag("table", array("id" => $uploadTable), "", true); echo CHtml::tag("table", array("id" => $downloadTable), "", true); } }
/** * Renders the input file field */ public function renderField() { list($name, $id) = $this->resolveNameID(); $this->htmlOptions = WhHtml::defaultOption('id', $id, $this->htmlOptions); $this->htmlOptions = WhHtml::defaultOption('name', $name, $this->htmlOptions); $this->htmlOptions['data-url'] = $this->uploadAction; if ($this->hasModel()) { echo CHtml::activeFileField($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::fileField($name, $this->value, $this->htmlOptions); } }
/** * Runs the widget. * This method registers all needed client scripts and renders * the multiple file uploader. */ public function run() { list($name, $id) = $this->resolveNameID(); if (substr($name, -2) !== '[]') { $name .= '[]'; } if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } $this->registerClientScript(); echo CHtml::fileField($name, '', $this->htmlOptions); }
private static function field($key, $value, $sModel, $model) { if (strpos($sModel, "listT(") === 0) { $modelName = str_replace("listT(", "", $sModel); $modelName = str_replace(")", "", $modelName); $type = substr($modelName, strpos($modelName, '[') + 1, strpos($modelName, '[') - strpos($modelName, ']') + 1); //echo $type; //exit; $modelName = str_replace("[" . $type . "]", "", $modelName); $temp = CHtml::listData($modelName::model()->findAllByType($type), 'id', 'name'); $temp[''] = Yii::t('app', 'None'); //$label = Yii::t('app', $sModel->id) ; $field = CHtml::dropDownList($model . '[' . $key . '][value]', $value, $temp) . "<br/>"; } elseif (strpos($sModel, "list(") === 0) { $modelName = str_replace("list(", "", $sModel); $modelName = str_replace(")", "", $modelName); $temp = CHtml::listData($modelName::model()->findAll(), 'id', 'name'); $temp[''] = Yii::t('app', 'None'); //$label = Yii::t('app', $sModel->id) ; $field = CHtml::dropDownList($model . '[' . $key . '][value]', $value, $temp) . "<br/>"; } elseif (strpos($sModel, "select(") === 0) { $list = str_replace("select(", "", $sModel); $list = CJSON::decode(str_replace(")", "", $list)); foreach ($list as &$item) { //print $item; $item = Yii::t('app', $item); } //$temp = CHtml::listData(CJSON::decode($list), 'id', 'name'); $temp[''] = Yii::t('app', 'None'); //$label = Yii::t('app', $sModel->id); $field = CHtml::dropDownList($model . '[' . $key . '][value]', $value, $list) . "<br/>"; } elseif ($sModel == 'file') { //$label = Yii::t('app', $sModel->id) ; $field = CHtml::fileField($model . '[' . $key . '][value]', $value) . CHtml::hiddenField($model . '[' . $key . '][value]', $value) . "<a href='javascript:del();'>" . Yii::t('app', 'Delete') . "</a><br />"; } elseif ($sModel == 'boolean') { //$label = Yii::t('app', $sModel->id); $field = CHtml::hiddenField($model . '[' . $key . '][value]', false) . CHtml::checkbox($model . '[' . $key . '][value]', $value == 'true' ? true : false); } elseif ($sModel == 'date') { //$label = Yii::t('app', $sModel->id); $field = CHtml::textField($model . '[' . $key . '][value]', $value, array('class' => 'date')); $name = str_replace("[", "_", str_replace("]", "_", $model)); $field .= "<script>\njQuery('#{$name}{$key}_value').datepicker();</script>"; } else { //$label = Yii::t('app', $sModel->id); $field = CHtml::textField($model . '[' . $key . '][value]', $value); } return $field; }
public function actionIndex($path = '/') { $fsw = new FilesystemWrapper('/home/rosko/WWW/hosts/test/public_html/test/', array('baseUrl' => 'http://test/test/')); $fsw->filter = array('excludeHidden' => true); $fsw->sort = array('directoriesFirst' => true); if ($fsw) { echo CHtml::beginForm('', 'post', array('enctype' => 'multipart/form-data')); echo CHtml::fileField('file'); echo CHtml::submitButton(); echo CHtml::endForm(); if (CUploadedFile::getInstanceByName('file')) { echo $fsw->uploadFile('/', 'file', true, 'upload.jpg'); } //echo $fsw->delete('/mydir.txt'); //print_r ($fsw->createFile('/', 'mydir.txt', 'sdfsdfsвавів')); print_r($fsw->getDirectory($path)); } }
/** * Make the code to be inserted in the view */ public function run() { $clientScript = Yii::app()->getClientScript(); $dir = dirname(__FILE__); $this->baseUrl = Yii::app()->getAssetManager()->publish($dir); // $clientScript->registerScriptFile($this->baseUrl . '/uploadify-v3.1/swfobject.js', CClientScript::POS_HEAD); // $clientScript->registerScriptFile($this->baseUrl . '/uploadify-v3.1/jquery.uploadify-3.1.min.js', CClientScript::POS_HEAD); // $clientScript->registerCssFile($this->baseUrl . '/uploadify-v3.1/uploadify.css'); list($name, $id) = $this->resolveNameID(); $options = $this->makeOptions(); $js = <<<EOP \$("#{$id}").uploadify({$options}); EOP; $clientScript->registerScript('Yii.' . get_class($this) . '#' . $id, $js, CClientScript::POS_READY); $this->htmlOptions['id'] = $id; $this->htmlOptions['name'] = $id; $this->htmlOptions['type'] = 'file'; // $html = CHtml::tag('input', $this->htmlOptions, $this->body); $html = CHtml::fileField($id, null, $this->htmlOptions); echo $html; }
<label><?php echo 'Manual outcome to update:'; ?> </label> <?php echo CHtml::dropDownList('outcome_id', null, CHtml::listData($Outcomes, 'id', 'name'), array('class' => 'form-control', (sizeof($Outcomes) ? 'not' : '') . 'disabled' => 'disabled')); ?> </div> <div class="form-group"> <label><?php echo 'User id csv file:'; ?> </label> <?php echo CHtml::fileField('file', '', array('class' => 'form-control', (sizeof($Outcomes) ? 'not' : '') . 'disabled' => 'disabled')); ?> </div> <div class=""> <?php echo CHtml::submitButton('Upload', array('class' => 'btn btn-primary', (sizeof($Outcomes) ? 'not' : '') . 'disabled' => 'disabled')); ?> <?php echo CHtml::link('cancel', array('campaign/result', 'id' => $Campaign->id), array('class' => 'btn')); ?> </div> <?php $this->endWidget(); ?>
echo CHtml::fileField('data', '', array('id' => 'data')) . "<br>"; echo CHtml::hiddenField('model', $model); echo "<i>" . Yii::t('app', 'Allowed filetypes: .csv') . "</i><br><br>"; echo "<h3>" . Yii::t('admin', 'Import Map') . " <a class='pseudo-link' id='toggle-map-upload'>" . X2Html::fa('fa-caret-down') . "</a></h3>"; echo "<div id='upload-map' style='display:none;'>"; echo Yii::t('admin', "You may select a predefined map here, or upload your own.") . "<br />"; $availImportMaps = $this->availableImportMaps($model); if (empty($availImportMaps)) { echo "<div style='color:red'>"; echo Yii::t('app', "No related import maps were found."); echo "</div>"; } else { echo CHtml::radioButtonList('x2maps', null, $availImportMaps, array('labelOptions' => array('style' => 'display:inline'))); } echo "<br /><br />"; echo CHtml::fileField('mapping', '', array('id' => 'mapping')) . "<br>"; echo "<i>" . Yii::t('app', 'Allowed filetypes: .json') . "</i>"; echo "</div><br><br>"; echo CHtml::submitButton(Yii::t('app', 'Submit'), array('class' => 'x2-button')); echo CHtml::endForm(); echo "</div>"; } else { echo "<h3>" . Yii::t('admin', 'Please select a module to import records into.') . "</h3>"; foreach ($modelList as $class => $modelName) { echo CHtml::link($modelName, array('/admin/importModels', 'model' => $class)) . "<br />"; } } ?> </div> <script>
<?php echo CHtml::form($model->formTarget, 'post', array('id' => 'Import')); ?> <?php echo CHtml::hiddenField("MAX_FILE_SIZE", ConfigUtil::getMaxUploadSize() - 1000); ?> <?php echo CHtml::hiddenField("Import", "true"); ?> <fieldset> <legend><?php echo Yii::t('core', 'importFile'); ?> </legend> <?php echo CHtml::fileField('file', '', array()); ?> (<?php echo Yii::t('core', 'maximum'); ?> : <?php echo ConfigUtil::getMaxUploadSize(true); ?> ) <br /> <br /> <?php //echo Yii::t('core', 'characterSet', array(1)); ?> <br />
<div class="row"> <div class="col-lg-12 content-right"> <?php echo CHtml::form(array("admin/tokens/sa/import/surveyid/{$iSurveyId}"), 'post', array('id' => 'tokenimport', 'name' => 'tokenimport', 'class' => 'form-horizontal', 'enctype' => 'multipart/form-data')); ?> <!-- Choose the CSV file to upload --> <div class="form-group"> <label class="col-sm-2 control-label" for='the_file'><?php eT("Choose the CSV file to upload:"); ?> </label> <div class="col-sm-10"> <?php echo CHtml::fileField('the_file', '', array('required' => 'required', 'accept' => '.csv')); ?> </div> </div> <!-- "Character set of the file --> <div class="form-group"> <label class="col-sm-2 control-label" for='csvcharset'><?php eT("Character set of the file:"); ?> </label> <div class="col-sm-5"> <?php echo CHtml::dropDownList('csvcharset', 'auto', $aEncodings, array('size' => '1', 'class' => 'form-control')); ?> </div>
} ?> <div style="display: none;" id="td_upload_form_block"> <?php echo CHtml::fileField('reviews', null, array('class' => 'normal')); ?> </div> <?php echo CHtml::link(Yii::t('app', 'Отмена'), 'javascript:void(0)', array('id' => 'td_upload_link_cancel', 'style' => 'display: none;')); ?> <?php } else { ?> <div style="display: block;" id="td_upload_form_block"> <?php echo CHtml::fileField('reviews', null, array('class' => 'normal')); ?> </div> <?php } ?> </div> </div> <?php if ($reviewsSettings->is_allowed_show_at_home) { ?> <tr> <td width ="150"><?php echo CHtml::activeLabelEx($model, 'show_at_home');
<p> <?php echo Yii::t('lazy8', 'Fields with a red star are required') . ' <span class="required">*</span>'; ?> </p> <?php echo CHtml::beginForm(CHtml::normalizeUrl(array('import', 'importing' => 'true')), 'post', array('enctype' => 'multipart/form-data')); echo CHtml::errorSummary($this); ?> <div class="simple"> <?php echo CHtml::label(Yii::t('lazy8', "Upload a valid lazy8web import file"), false); echo CHtml::fileField('importfile'); echo CHtml::hiddenField('importnow', 'asdfasdf'); ?> </div> <div class="action"> <?php echo CHtml::submitButton(Yii::t('lazy8', 'Import'), array('title' => Yii::t('lazy8', 'contexthelp.Import'))); ?> </div> <?php echo CHtml::endForm(); ?> </div><!-- yiiForm -->
} ?> <div class="row fileupload-buttonbar"> <div class="span7"> <!-- The fileinput-button span is used to style the file input field as button --> <span class="btn btn-success fileinput-button"> <i class="icon-plus icon-white"></i> <span><?php echo $this->t('1#Agregar fotos|0#Choose file', $this->multiple); ?> </span> <?php if ($this->hasModel()) { echo CHtml::activeFileField($this->model, $this->attribute, $htmlOptions) . "\n"; } else { echo CHtml::fileField($name, $this->value, $htmlOptions) . "\n"; } ?> </span> <?php if ($this->multiple) { ?> <button type="submit" class="btn btn-primary start"> <i class="icon-upload icon-white"></i> <span>Subir</span> </button> <button type="reset" class="btn btn-warning cancel"> <i class="icon-ban-circle icon-white"></i> <span>Cancelar</span> </button> <button type="button" class="btn btn-danger delete">
echo '<div class="product_variation product_variation_' . $i . '">'; echo CHtml::label($variation[0]->specification->title, $field, array('class' => 'lbl-header')); if ($variation[0]->specification->required) { echo ' <span class="required">*</span>'; } echo '<br />'; if ($variation[0]->specification->input_type == 'textfield') { echo CHtml::textField($field); } else { if ($variation[0]->specification->input_type == 'select') { // If the specification is required, preselect the first field. Otherwise // let the customer choose which one to pick echo CHtml::radioButtonList($field, $variation[0]->specification->required ? $variation[0]->id : null, ProductVariation::listData($variation)); } else { if ($variation[0]->specification->input_type == 'image') { echo CHtml::fileField($field); } } } echo '</div>'; if ($i % 2 == 0) { echo '<div style="clear: both;"></div>'; } } } echo '<div style="clear: both;"></div>'; echo '<br />'; echo CHtml::hiddenField('product_id', $model->product_id); echo CHtml::label(Shop::t('Amount'), 'ShoppingCart_amount'); echo ': '; echo CHtml::textField('amount', 1, array('size' => 3));
?> </div> </div> <?php } else { ?> <?php echo CHtml::beginForm('import', 'post', array('enctype' => 'multipart/form-data')); ?> <div class="row-fluid"> <div class="span5"><?php echo CHtml::label(Yii::t('admin', 'Choose your .csv file (Max size: {max}):', array('{max}' => ini_get('upload_max_filesize'))), 'csv_file'); ?> </div> <div class="span5"><?php echo CHtml::fileField('csv_file', '', array('id' => 'csv_file')); ?> </div> </div> <div class="row-fluid"> <div class="span5"><span>Folder Import<span style="font-size:11px;color:#ff0000"> (import images need to upload into this folder)</span></span></div> <div class="span5"><input type="text" name="dirimg" id="dirimg" value="/images/import/" /></div> </div> <div class="row-fluid"> <div class="span12"><p> </p></div> </div> <div class="row-fluid"> <h4>Structure of csv import file. </h4> <pre> <span style="float: left; width: 10%;">Product Code</span><span style="float: left; width: 15%;">Image</span><span style="float: left; width: 10%;">Is Main Image</span>
echo CHtml::beginForm(NULL, 'POST', array('enctype' => 'multipart/form-data')); ?> <div class="form-body"> <?php if (Yii::app()->isModuleInstall('Attachment', '1.0.5') && !(bool) $is_attached) { ?> <div class="form-group"> <?php echo CHtml::activeLabelEx($model, 'attachment__id', array('class' => 'col-md-3 control-label')); ?> </td> <div class="col-md-9"> <div class="input-group choose-file input-large"> <input type="text" class="form-control file-path" readonly /> <?php echo CHtml::fileField('slidebar', null, array('class' => 'hidden', 'accept' => 'image/*')); ?> <span class="input-group-btn"> <span class="btn blue-chambray">Обзор</span> </span> </div> <p class="help-block small"><?php echo Yii::t('app', 'Рекомендуется загружать изображения с соотношением сторон 1.85 : 1'); ?> </p> </div> </div> <?php } ?> <div class="form-group">
<!-- BEGIN SAMPLE FORM PORTLET--> <div class="portlet box blue"> <div class="portlet-title"> <div class="caption"> <i class="glyphicon glyphicon-save"></i> Загрузка и установка </div> </div> <div class="portlet-body form"> <?php echo CHtml::beginForm('', 'post', array('enctype' => 'multipart/form-data')); ?> <div class="form-body"> <div class="form-group"> <label>Список в виде XML</label> <?php echo CHtml::fileField('upload_modules_xml'); ?> </div> <div class="checkbox-list"> <label> <div class="checker"> <span> <?php echo CHtml::checkBox('skip_upload'); ?> </span> </div> Пропустить загрузку </label> </div> <div class="form-group">
<?php if ($tableExists) { ?> <?php echo CHtml::form(array('admin/dataentry/sa/vvimport/surveyid/' . $surveyid), 'post', array('enctype' => 'multipart/form-data', 'id' => 'vvexport')); ?> <ul class="list-unstyled"> <li> <label for='csv_vv_file'><?php eT("File:"); ?> </label> <?php echo CHtml::fileField('csv_vv_file'); ?> </li> <li> <label for='noid'><?php eT("Exclude record IDs?"); ?> </label> <?php echo CHtml::checkBox('noid', true, array('value' => "noid", 'onChange' => 'javascript:form.insertmethod.disabled=this.checked')); ?> <!-- <input type='checkbox' id='noid' name='noid' value='noid' checked=checked onchange='form.insertmethod.disabled=this.checked;' /> --> </li> <li> <label for='insertmethod'><?php eT("When an imported record matches an existing record ID:");
echo CHtml::fileField('Company[iconupload]', '', array('class' => 'col-xs-12 btn btn-user')); ?> <?php echo $form->error($model, 'iconupload'); ?> </div> <div class="row"> <?php echo CHtml::image(Yii::app()->getBaseUrl() . '/' . $model->getFilesPath() . '/' . $model->logo, 'logo'); ?> <br /> <?php echo CHtml::label(ProjectModule::t('Attach file'), 'fileupload'); ?> <?php echo CHtml::fileField('Company[fileupload]', '', array('class' => 'col-xs-12 btn btn-user')); ?> <?php echo $form->error($model, 'fileupload'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'header'); ?> <?php echo $form->textArea($model, 'header', array('rows' => 12, 'cols' => 50, 'class' => 'form-control')); ?> <?php echo $form->error($model, 'header'); ?>
<div id="errors-block"></div> </div> </div> <div id="new-changes-block" class="row zero-edge"> <div id="new-changes-link"><a data-toggle="collapse" data-parent="#new-changes-block" href="#new-changes-collapse">Новая доработка</a></div> <div id="new-changes-collapse" class="collapse"> <?php echo CHtml::form('', 'post', array('id' => 'up_file', 'enctype' => 'multipart/form-data')); ?> <div class="col-xs-12"> <?php echo CHtml::label('Прикрепить файл', 'fileupload'); ?> <?php echo CHtml::fileField('ProjectChanges[fileupload]', $fileupload, array('class' => 'col-xs-12 btn btn-user')); ?> </div> <div class="col-xs-12"> <?php echo CHtml::label('Комментарий', 'comment'); ?> <?php echo CHtml::textArea('ProjectChanges[comment]', $comment, array('class' => 'col-xs-12')); ?> </div> <?php echo CHtml::endForm(); ?> <?php
} break; case 2: $file = $element->getFile($issueId); if ($file) { if ($file->image) { echo CHtml::link(CHtml::image(Yii::app()->request->baseUrl . '/files/' . $file->link), Yii::app()->request->baseUrl . '/files/' . $file->link, array('target' => '_blank')); } else { echo CHtml::link($file->fileSelected, Yii::app()->request->baseUrl . '/files/' . $file->link, array('target' => '_blank')); } if ($issueId && $this->uniqueid == "result") { echo " - " . CHtml::ajaxLink(Yii::t('default', 'delete'), Yii::app()->createUrl('/file/delete', array('id' => $file->id, 'ajax' => 'delete')), array('type' => 'POST', 'success' => "function( ){window.location.reload(true);}")); } echo "<br><p style='background-color:rgb(220,220,220); display:none; font-size:small; padding:4px; border-radius:3px;' class='info'>" . $element->getUserDate($issueId) . "</p>"; } else { echo CHtml::fileField("File[elementid][{$element->id}]"); } break; case 4: echo "<div title='" . $element->getUserDate($issueId) . "'>"; $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => "Result[elementid][{$element->id}]", 'value' => $element->getResult($issueId), 'options' => array('showAnim' => 'fold', 'dateFormat' => 'HH:mm dd/mm/yy'), 'htmlOptions' => array('style' => 'height:20px;', 'readonly' => true))); $url = Yii::app()->request->baseUrl . "/index.php/step/excelComp/" . $issueId . "?" . "elementId=" . $element->id; //funciona echo "</div><div class='exceltools' style='display:none'><input class='Excel' type='button' value='Excel Chart' onclick=location.href='" . $url . "';></div>"; if ($element->getUserDate($issueId)) { echo "</br><p style='background-color:rgb(220,220,220);font-size:small; display:none; padding:4px; border-radius:3px;' class='info'>" . $element->getUserDate($issueId) . "</p>"; } break; } echo "</li></div></ul>"; }
/** * Generates a file field input. * @param string $name the input name. * @param string $value the input value. * @param array $htmlOptions additional HTML attributes. * @return string the generated input field. * @see CHtml::fileField */ public static function fileField($name, $value = '', $htmlOptions = array()) { return parent::fileField($name, $value, $htmlOptions); }
<?php echo $form->errorSummary($model); ?> <?php echo $form->textFieldRow($model, 'title', array('class' => 'span5', 'maxlength' => 20)); ?> <?php echo $form->textFieldRow($model, 'description', array('class' => 'span5', 'maxlength' => 100)); ?> <?php echo $form->labelEx($model, 'image_url'); echo $form->hiddenField($model, 'image_url', array('size' => 60, 'maxlength' => 255)); echo CHtml::fileField('tmp_image_url', '', array('class' => '', 'id' => 'Person_tmp_image_url', 'value' => '选择PC端图片上传')); echo CHtml::button('上传', array('class' => 'v_butn', 'id' => 'upload_img')); echo $form->error($model, 'image_url'); ?> <br /> <ul id="image_preview" class="thumbnails"> <?php if (!$model->isNewRecord) { ?> <li class="span2"> <a href="javascript:;" class="thumbnail" rel="tooltip" data-title="Tooltip"> <img src="<?php echo $model->image_url; ?> " alt=""> </a>
} ?> <div style="display: none;" id="td_upload_form_block"> <?php echo CHtml::fileField('blog', null, array('class' => 'normal')); ?> </div> <?php echo CHtml::link(Yii::t('app', 'Отмена'), 'javascript:void(0)', array('id' => 'td_upload_link_cancel', 'style' => 'display: none;')); ?> <?php } else { ?> <div style="display: block;" id="td_upload_form_block"> <?php echo CHtml::fileField('blog', null, array('class' => 'normal')); ?> </div> <?php } ?> <p style="padding-top: 10px;"><?php echo Yii::t('app', 'Допустимые форматы для загрузки картинки: jpg,png.'); ?> </p> <p class="help-block text-error" style="color:red"><?php echo $post->getError('attachment__id'); ?> </p> </div> </div>
?> <?php echo $form->error($model, 'idexposicion'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'imagen'); ?> <?php //echo $form->fileField($model,'imagen', array('multiple' => 'true')); ?> <!--<input type="file" name="imagen[]" multiple>--> <?php echo CHtml::fileField('imagen[]', '', array('multiple' => 'true')); ?> <?php echo $form->error($model, 'imagen'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'descripcion'); ?> <?php echo $form->textArea($model, 'descripcion', array('rows' => 6, 'cols' => 50)); ?> <?php
public function run() { // here render procedures echo CHtml::beginForm($this->action, $this->method, array('id' => $this->id, 'enctype' => $this->enctype, 'target' => $this->target)); // you better create a function but // for the sake of the example... foreach ($this->attributes as $attr) { // here we can actually say i // this is very simple but you get the idea echo CHtml::label($attr['label'], $attr['name']); if ($attr['type'] == 'text') { echo CHtml::textField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'textarea') { echo CHtml::textArea($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'password') { echo CHtml::passwordField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'checkbox') { echo CHtml::checkBox($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'checkboxlist') { echo CHtml::checkBoxList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'date') { echo CHtml::dateField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'dropdownlist') { echo CHtml::dropDownList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'file') { echo CHtml::fileField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'hidden') { echo CHtml::hiddenField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'radio') { echo CHtml::radioButton($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'radiolist') { echo CHtml::radioButtonList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } } } } } } } } } } } // do more here } echo "<br/><br/><div class='row-fluid'>"; echo CHtml::submitButton($this->submit['label'], $this->submit['options']); echo "</div>"; echo CHtml::endForm(); }