/** * @inheritdoc */ public function run() { $jsOptions = ['clientOptions' => $this->clientOptions]; $this->options['id'] = 'input-id'; if ($this->hasModel()) { echo Html::activeInput('file', $this->model, $this->attribute, $this->options); echo Html::img('#', ['id' => 'cropper-box']); echo Html::button('Crop', ['id' => 'cropImage']); $input_name = Html::getInputName($this->model, $this->attribute); $input_id = Html::getInputId($this->model, $this->attribute); echo Html::hiddenInput($input_name . '[file]', '', ['id' => $input_id . '_image']); $jsOptions['model'] = $this->model; $jsOptions['attribute'] = $this->attribute; } else { echo Html::fileInput($this->name, $this->value, $this->options); echo Html::img('#', ['id' => 'cropper-box']); echo Html::button('Crop', ['id' => 'cropImage']); } if ($this->uploadUrl) { $this->uploadUrl = \Yii::getAlias($this->uploadUrl); } $jsOptions['uploadUrl'] = $this->uploadUrl; $jsOptions['uploadCroppedUrl'] = $this->uploadCroppedUrl; $jsOptions['changeUrl'] = $this->changeUrl; $jsOptions['name'] = $this->name; $jsOptions['aspectRatio'] = $this->aspectRatio; $this->registerPlugin($jsOptions); }
protected function renderInput() { $fileButton = '<span class="input-group-addon"><span class="fileinput-button">' . '<i class="glyphicon glyphicon-plus"></i>' . '<span data-loading-text="上传中...">上传图片 ...</span>' . Html::fileInput($this->getFileInputName(), '', ['id' => $this->getFileInputId(), 'class' => 'single-file-upload']) . '</span></span>'; if ($this->hasModel()) { $input = Html::activeTextInput($this->model, $this->attribute, $this->options); } else { $input = Html::textInput($this->name, '', $this->options); } return '<div class="input-group">' . $input . $fileButton . '</div>'; }
/** * @inheritdoc */ public function run() { if ($this->hasModel()) { $field = Html::activeFileInput($this->model, $this->attribute, $this->options); } else { $field = Html::fileInput($this->name, $this->value, $this->options); } echo $this->renderTemplate($field); $this->registerPlugin(); }
/** * @inheritdoc */ public function run() { $input = $this->hasModel() ? Html::activeFileInput($this->model, $this->attribute, $this->options) : Html::fileInput($this->name, $this->value, $this->options); echo $this->render('uploadButton', ['input' => $input]); $this->registerClientScript(); }
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 = ArrayHelper::map($modelName::findAllByType($type), 'id', 'name'); $temp[''] = Yii::t('app', 'None'); //$label = Yii::t('app', $sModel->id) ; $field = Html::dropDownList($model . '[' . $key . '][value]', $value, $temp) . "<br/>"; } elseif (strpos($sModel, "list(") === 0) { $modelName = str_replace("list(", "", $sModel); $modelName = str_replace(")", "", $modelName); $temp = ArrayHelper::map($modelName::find()->All(), 'id', 'name'); $temp[''] = Yii::t('app', 'None'); //$label = Yii::t('app', $sModel->id) ; $field = \kartik\select2\Select2::widget(["name" => $model . '[' . $key . '][value]', "data" => $temp, "value" => $value]); } elseif (strpos($sModel, "select(") === 0) { $list = str_replace("select(", "", $sModel); //echo str_replace(")", "", $list); //exit; $list = Json::decode(str_replace(")", "", $list)); foreach ($list as &$item) { //print $item; $item = Yii::t('app', $item); } //$temp = Html::listData(\yii\helpers\Json::decode($list), 'id', 'name'); $temp[''] = Yii::t('app', 'None'); //$label = Yii::t('app', $sModel->id); $field = \kartik\select2\Select2::widget(["name" => $model . '[' . $key . '][value]', "data" => $list, "value" => $value]); } elseif ($sModel == 'file') { $rKey = str_replace(".", "", $key); //$label = Yii::t('app', $sModel->id) ; $field = "<div class='row'><div class='btn-group '>" . Html::fileInput($model . '[' . $key . '][value]', $value, ['style' => 'display:none;', 'id' => $model . "_" . $rKey . "_input", "accept" => "image/gif,image/jpeg"]) . Html::hiddenInput($model . '[' . $key . '][value]', $value) . Html::buttonInput(Yii::t('app', 'Chose'), ['id' => $model . "_" . $rKey . "_upload"]) . Html::buttonInput(Yii::t('app', 'Delete'), ['id' => $model . "_" . $rKey . "_remove"]) . "</div></div>"; $idf = $model . "_" . $rKey . "_input"; $script = "\n \$(document).on('click','#{$model}_{$rKey}_upload', function () {\n \$('#{$idf}').click();\n });\n \$(document).on('click','#{$model}_{$rKey}_remove', function () {\n //del();\n });\n \n "; Yii::$app->controller->view->registerJs($script, \yii\web\View::POS_READY); } elseif ($sModel == 'boolean') { //$label = Yii::t('app', $sModel->id); $field = Html::hiddenInput($model . '[' . $key . '][value]', false) . Html::checkbox($model . '[' . $key . '][value]', $value == 'true' ? true : false, ['class' => 'form-control']); } elseif ($sModel == 'date') { //$label = Yii::t('app', $sModel->id); $name = str_replace("[", "_", str_replace("]", "_", $model)); $id = $name . "-" . $key; $rname = $model . "[" . $key . "][value]"; $timezone = Yii::$app->timezone; $base = yii\helpers\BaseUrl::base(); $field = <<<java <div class="input-group date"> <span class="input-group-addon kv-date-calendar" title="Select date"> <i class="glyphicon glyphicon-calendar"></i> </span> <input type="text" id="{$id}-disp" class="form-control" name="{$rname}-w0" value="{$value}" data-krajee-datecontrol="datecontrol_b5142286" data-datepicker-type="2" data-krajee-kvdatepicker="kvDatepicker_158f0063"></div> <input type="hidden" id="{$id}" name="{$rname}"> <script> var kvDatepicker_158f0063 = {"autoclose":true,"format":"dd/mm/yyyy"}; var datecontrol_37eef6f1 = {"idSave":"{$id}","url":"{$base}/datecontrol/parse/convert","type":"date","saveFormat":"Y-m-d","dispFormat":"d/m/Y","asyncRequest":true}; jQuery('#{$id}-disp').datecontrol(datecontrol_37eef6f1); jQuery('#{$id}-disp').parent().kvDatepicker(kvDatepicker_158f0063); </script> java; //$field.="<script>jQuery('#{$name}{$key}_value').datepicker();</script>"; } else { //$label = Yii::t('app', $sModel->id); $field = Html::textInput($model . '[' . $key . '][value]', $value, ['class' => 'form-control']); } return $field; }
public function run() { if ($this->hasModel()) { $replace['{input}'] = Html::activeHiddenInput($this->model, $this->attribute, $this->options); $attributeId = Html::getInputId($this->model, $this->attribute); $id = Html::getInputId($this->model, 'hydra_' . $this->attribute); $name = Html::getInputName($this->model, 'hydra_' . $this->attribute); $this->value = $this->model[$this->attribute]; } else { $replace['{input}'] = Html::hiddenInput($this->name, $this->value, $this->options); $name = $id = 'hydra_' . $this->name; $attributeId = $this->name; } $fileInputName = empty($this->fileInputName) ? $name : $this->fileInputName; $replace['{preview}'] = 'Файл еще не загружен'; if (!empty($this->value)) { $replace['{preview}'] = $this->value; $extension = Yii::$app->hydra->getExtension($this->value); if (Yii::$app->hydra->isImage($extension)) { $replace['{preview}'] = Html::img(Yii::$app->hydra->getCacheUrl($this->value, $this->resolution), ['id' => $id . '_image']); } $replace['{reset-button}'] = Html::tag($this->resetButton['tag'], $this->resetButton['label'], ArrayHelper::merge(['onClick' => '$("#' . $attributeId . '").val("");$("#' . $id . '_image' . '").remove();$(this).remove();'], $this->resetButton['options'])); } $replace['{input}'] .= Html::fileInput($fileInputName, null, ArrayHelper::merge(['id' => $id], $this->fileInput['options'])); return strtr($this->template, $replace); }
/** * {@inheritdoc} */ public function run() { if ($this->hasModel()) { echo Html::activeFileInput($this->model, $this->attribute, $this->options); } else { echo Html::fileInput($this->name, $this->value, $this->options); } $this->registerClientScript(); }
/** * 输出模板内容 * @return string */ public function run() { $this->registerClientScript(); if ($this->hasModel()) { $input = Html::activeTextInput($this->model, $this->attribute, $this->options); $fileInput = Html::fileInput(Html::getInputName($this->model, $this->attribute)); } else { $input = Html::textInput($this->name, $this->value, $this->options); $fileInput = Html::fileInput($this->name, $this->value); } $button = Html::tag('div', $fileInput . '<span>' . $this->buttonText . '</span>', $this->buttonOptions); return strtr($this->template, ['{id}' => $this->getId(), '{input}' => $input, '{button}' => $button]); }
/** * @inheritdoc */ public function run() { if ($this->hasModel()) { echo Html::activeFileInput($this->model, $this->attribute, $this->options); if (!$this->ratio || !$this->crop_field || !$this->url) { foreach ($this->model->getBehaviors() as $beh) { if (!empty($beh->attribute) && $beh->attribute == $this->attribute) { if ($beh instanceof CropImageUploadBehavior) { if (!$this->ratio && $beh->ratio) { $this->ratio = $beh->ratio; } if (!$this->crop_field && $beh->crop_field) { $this->crop_field = $beh->crop_field; } if (!$this->url && $beh->url) { $this->url = $beh->url; } break; } } } } if (!$this->crop_value && $this->crop_field) { $this->crop_value = $this->model->{$this->crop_field}; } } else { echo Html::fileInput($this->name, $this->value, $this->options); } $crop_id = false; if ($this->crop_field) { if ($this->hasModel()) { $crop_id = Html::getInputId($this->model, $this->crop_field); echo Html::activeHiddenInput($this->model, $this->crop_field, ['value' => $this->crop_value]); } else { $crop_id = $this->options['id'] . '_' . $this->crop_field; echo Html::hiddenInput($this->crop_field, $this->crop_value); } } if ($this->url) { $this->url = \Yii::getAlias($this->url); } $jsOptions = ['crop_value' => $this->crop_value, 'crop_id' => $crop_id, 'ratio' => $this->ratio, 'url' => $this->resolvePath($this->url), 'clientOptions' => $this->clientOptions, 'is_crop_prev' => $crop_id || !$this->hasModel() ? false : true, 'crop_class' => $this->crop_class]; $this->registerPlugin($jsOptions); }
public function run() { echo Html::activeHiddenInput($this->model, $this->attribute, $this->options); $groups_id = $this->attribute; $items = array(); if ($this->model->{$groups_id}) { foreach (GlImgs::find()->where(['groups_id' => $this->model->{$groups_id}])->orderBy(['seq' => SORT_ASC])->all() as $i => $image) { $items[] = ['content' => Html::tag('div', Html::button(null, ['class' => 'btn btn-default btn-xs glyphicon glyphicon-remove', 'onclick' => 'removeUploadImage("' . $this->pluginOptions['url'] . '", ' . $image->id . ', "' . $image->basename_src . '", ' . $image->groups_id . ')']), ['style' => 'background:url("' . $image->img_small . '") 50% 50% no-repeat;', 'class' => 'upload-img', 'data-imgs-id' => $image->id, 'id' => 'upload-img-' . $image->id])]; } } $items[] = ['content' => '<span class="glyphicon glyphicon-plus"></span><br>Добавить фото' . Html::fileInput(null, null, ['multiple' => true, 'data-url' => $this->pluginOptions['url'], 'data-type' => $this->pluginOptions['type'], 'data-input-id' => strtolower($this->model->formName()) . '-' . $groups_id, 'onchange' => 'prepareUpload($(this))', 'id' => 'js-upload-action']), 'disabled' => true, 'options' => ['class' => 'js-upload', 'onclick' => 'openFileDiaolg()']]; echo Html::beginTag('div', ['class' => 'upload-gallery-content']); echo Sortable::widget(['type' => 'grid', 'items' => $items, 'pluginEvents' => ['sortupdate' => 'function(data) {reSortGallery("' . $this->pluginOptions['url'] . '")}'], 'options' => ['class' => 'js-upload-gallery']]); echo Html::tag('div', 'Основное изображение', ['class' => 'js-upload-image-default']); echo Html::endTag('div'); /*echo Html::tag('div', '<small>Вы можете прикрепить не более 5 фотографий</small>', [ 'class' => 'text-muted', ]);*/ $view = $this->view; UploadGalleryAsset::register($view); }
/** * @inheritdoc */ public function run() { $jsOptions = ['clientOptions' => $this->clientOptions, 'crop_class' => $this->crop_class]; if ($this->hasModel()) { echo Html::activeInput('file', $this->model, $this->attribute, $this->options); $crops = null; foreach ($this->model->getBehaviors() as $beh) { if (!empty($beh->attribute) && $beh->attribute == $this->attribute && $beh instanceof CropImageUploadBehavior) { $crops = $beh->getConfigurations(); $this->url = $beh->url; break; } } if (!$crops) { throw new InvalidConfigException("CropImageUploadBehavior is not found for {$this->attribute} attribute"); } $jsOptions['crops'] = []; $input_name = Html::getInputName($this->model, $this->attribute); $input_id = Html::getInputId($this->model, $this->attribute); echo Html::hiddenInput($input_name . '[file]', Html::getAttributeValue($this->model, $this->attribute), ['id' => $input_id . '_image']); foreach ($crops as $ind => $crop) { $crop_id = $input_id . '_crop' . $ind; echo Html::hiddenInput($input_name . '[' . $ind . ']', $crop['value'] === false ? '-' : $crop['value'], ['id' => $crop_id]); $jsOptions['crops'][] = ['input_id' => $crop_id, 'ratio' => $crop['ratio'], 'image' => $crop['image']]; } } else { echo Html::fileInput($this->name, $this->value, $this->options); $crop_id = (isset($this->options['id']) ? $this->options['id'] : $this->name . '_id') . '_' . $this->crop_field; echo Html::hiddenInput($this->crop_field, $this->crop_value, ['id' => $crop_id]); $jsOptions['crops'][] = ['input_id' => $crop_id, 'ratio' => $this->ratio]; } if ($this->url) { $this->url = \Yii::getAlias($this->url); } $jsOptions['url'] = $this->url; $this->registerPlugin($jsOptions); }
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Products'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="product-form"> <?php $form = ActiveForm::begin(['options' => ['class' => 'form-horizontal', 'enctype' => 'multipart/form-data']]); ?> <div class="form-group"> <?php echo Html::label(Yii::t('app', 'Import File CSV'), 'importFile', ['class' => 'col-lg-1 control-label']); ?> <?php echo Html::fileInput('importFile'); ?> </div> <div class="form-group"> <label class="col-lg-1 control-label" for=""> </label> <?php echo Html::submitButton(Yii::t('app', 'Submit'), ['class' => 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
/** * Render data block * @return string */ protected function renderData() { $data = ''; //file $options = ['accept' => 'image/jpeg,image/png,image/gif', 'id' => 'upload-image']; if ($this->multiple) { $options['multiple'] = 'multiple'; } $data .= Html::fileInput($this->fileInputName, '', $options); //attributes $a = []; $a[$this->fileKey] = ''; if ($this->thumbKey !== null) { $a[$this->thumbKey] = ''; } $a = array_merge($a, $this->data); foreach ($a as $key => $value) { $data .= Html::hiddenInput($this->baseName . '[' . $key . ']', $value, ['disabled' => $this->disabledInput]); } return Html::tag('div', $data, ['class' => 'uploadimage-data']); }
/** * @return string */ public function run() { $this->registerClientScript(); $content = Html::beginTag('div'); $content .= Html::hiddenInput($this->name, null, ['class' => 'empty-value', 'id' => $this->options['id']]); $content .= Html::fileInput($this->getFileInputName(), null, ['name' => $this->getFileInputName(), 'id' => $this->getId(), 'multiple' => $this->multiple]); $content .= Html::endTag('div'); return $content; }
<?php // $context->model instanceof \yii\base\Model && $context->attribute !== null // ? Html::activeFileInput($context->model, $context->attribute, $context->fieldOptions) // : Html::fileInput($context->name, $context->value, $context->fieldOptions); ?> <!-- </span> --> <div class="file-upload"> <div class="div-file"> <input type="file"> <span class="btn-admin gray fileinput-button">Choose New File</span> <span class="text">No file chosen</span> </div> <button type="submit" class="btn-admin start">upload</button> <?php echo $context->model instanceof \yii\base\Model && $context->attribute !== null ? Html::activeFileInput($context->model, $context->attribute, $context->fieldOptions) : Html::fileInput($context->name, $context->value, $context->fieldOptions); ?> </div> <!-- <button type="submit" class="btn btn-primary start"> --> <!-- <i class="glyphicon glyphicon-upload"></i> --> <!-- <span>Start upload</span> --> <!-- </button> --> <!-- <button type="reset" class="btn btn-warning cancel"> --> <!-- <i class="glyphicon glyphicon-ban-circle"></i> --> <!-- <span>Cancel upload</span> --> <!-- </button> --> <!-- <button type="button" class="btn btn-danger delete"> --> <!-- <i class="glyphicon glyphicon-trash"></i> --> <!-- <span>Delete</span> --> <!-- </button> --> <!-- <input type="checkbox" class="toggle"> -->
<?php use yii\helpers\Html; use kartik\sortable\Sortable; use backend\widgets\gallery\Gallery; /** @var $group */ /** @var $gallery_groups_id */ /** @var $gallery_images_id */ if ($gallery_groups_id) { $images = array(); if ($group) { $images = (new Gallery())->getImages($gallery_groups_id); } elseif ($gallery_images_id) { $images[0] = (new Gallery())->getImage($gallery_images_id); } foreach ($images as $image) { $items[] = ['content' => Html::tag('div', Html::button(null, ['class' => 'btn btn-default btn-xs glyphicon glyphicon-remove btn-flat btn-sm', 'onclick' => 'galleryManager.deleteImage("' . $image['id'] . '")']), ['style' => 'background:url("' . $image['small'] . '") 50% 50% no-repeat; background-size:cover;', 'class' => 'upload-image', 'data-image-id' => $image['id'], 'id' => 'upload-image-' . $image['id']])]; } } $items[] = ['content' => '<span class="glyphicon glyphicon-plus"></span><br>Добавить фото' . Html::fileInput(null, null, ['multiple' => $group, 'class' => 'image-upload-action', 'id' => $this->context->id . '-image-upload-action', 'onchange' => 'galleryManager.prepareUpload($(this))']), 'disabled' => true, 'options' => ['onclick' => 'document.getElementById("' . $this->context->id . '-image-upload-action").click()']]; ?> <?php echo Sortable::widget(['type' => 'grid', 'items' => $items, 'options' => ['class' => 'list-gallery-manager']]);
/** * Executes the widget. * @return string the result of widget execution to be outputted. */ public function run() { $html[] = ''; $tag = ArrayHelper::remove($this->containerOptions, 'tag', 'div'); $html[] = Html::beginTag($tag, $this->containerOptions); // hidden file input element $html[] = Html::fileInput("{$this->name}_original", null, ['class' => "cropit-image-input {$this->containerOptions['id']}_image-input"]); // cropped image data if ($this->hasModel()) { $html[] = Html::activeHiddenInput($this->model, $this->attribute, ['class' => "{$this->containerOptions['id']}_crop-image-data"]); } else { $html[] = Html::hiddenInput($this->name, null, ['class' => "{$this->containerOptions['id']}_crop-image-data"]); } // Preview $html[] = $this->renderPreview(); // Controls $html[] = $this->renderControls(); $html[] = Html::endTag($tag); $this->registerAssets(); return implode("\n", $html); }
"> <img src="<?php echo $avatar; ?> "/> </div> <div class="image-actions"> <span class="btn btn-primary btn-file" title="<?php echo Yii::t('yee/auth', 'Change profile picture'); ?> " data-toggle="tooltip" data-placement="left"> <i class="fa fa-folder-open fa-lg"></i> <?php echo Html::fileInput('image', null, ['class' => 'image-input']); ?> </span> <?php echo Html::submitButton('<i class="fa fa-save fa-lg"></i>', ['class' => 'btn btn-primary image-submit', 'title' => Yii::t('yee/auth', 'Save profile picture'), 'data-toggle' => 'tooltip', 'data-placement' => 'top']); ?> <span class="btn btn-primary image-remove" data-action="<?php echo Url::to(['/auth/default/remove-avatar']); ?> " title="<?php echo Yii::t('yee/auth', 'Remove profile picture'); ?>
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; ?> <?php $activeForm = ActiveForm::begin(['id' => 'upload-image', 'options' => ['class' => 'form-horizontal', 'method' => 'post', 'enctype' => 'multipart/form-data']]); ?> <?php echo \yii\helpers\Html::fileInput('file'); ?> <input name="thumbsCategoryId"> <?php echo $activeForm->field($form, 'name'); echo $activeForm->field($form, 'url'); echo $activeForm->field($form, 'title'); echo $activeForm->field($form, 'description'); ?> <button>Submit</button> <?php ActiveForm::end(); ?> <?php
public function testFileInput() { $this->assertEquals('<input type="file" name="test">', Html::fileInput('test')); $this->assertEquals('<input type="file" class="t" name="test" value="value">', Html::fileInput('test', 'value', ['class' => 't'])); }
public static function fileForm($model, $value = null, $isBackForm = true, $appendOptions = []) { $value = self::getValue($model, $value, $isBackForm); $options = self::getOptions($model, $isBackForm, $appendOptions); return Html::fileInput(self::getInputName($model, $options), $value, $options); }
<!-- The file upload form used as target for the file upload widget --> <?php echo Html::beginTag('div', $context->options); ?> <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> <div class="row fileupload-buttonbar"> <div class="col-lg-7"> <!-- The fileinput-button span is used to style the file input field as button --> <span class="btn btn-success fileinput-button"> <i class="glyphicon glyphicon-plus"></i> <span><?php echo Yii::t('media', 'Add files'); ?> ...</span> <?php echo Html::fileInput($context->fileInputName, null, $context->fileInputOptions); ?> </span> <?php if ($context->clientOptions['autoUpload'] === false) { ?> <a class="btn btn-primary start"> <i class="glyphicon glyphicon-upload"></i> <span><?php echo Yii::t('media', 'Start upload'); ?> </span> </a> <a class="btn btn-warning cancel"> <i class="glyphicon glyphicon-ban-circle"></i> <span><?php
* @var $this \yii\web\View; */ ?> <?php Modal::begin(['header' => 'Загрузить изображение', 'toggleButton' => $toggleButton]); ?> <form action="<?php echo Url::toRoute(['/images/images-common/upload-modal']); ?> " method="post" class="js_mitrm_img_upload_form" enctype="multipart/form-data"> <div class="col-md-8"> <?php echo Html::fileInput('images', '', ['class' => 'form-control', 'placeholder' => '', 'accept' => 'image/*']); ?> </div> <div class="4"> <?php echo Html::submitButton('Отправить', ['class' => 'js_mitrm_img_upload_submit pull-right btn btn-primary']); ?> </div> <div class="clearfix"></div> <?php echo Html::hiddenInput(Yii::$app->request->csrfParam, Yii::$app->request->csrfToken); ?> </form> <div class="js_short_link_content" style="display: none; margin-top: 30px;"> <?php
$baseurl = $asset->baseUrl; $img = $baseurl . '/file-add.png'; if (!$picture->getIsNewRecord()) { $img = $picture->directlink('preview'); } ?> <div class="medialib-widget-select" style="background-image: url(<?php echo $img; ?> )" data-add="<?php echo $baseurl; ?> /file-add.png" data-uploading="<?php echo $baseurl; ?> /file-uploading.gif" id="<?php echo $widget->options['id'] . '-select'; ?> "> <?php echo \yii\helpers\Html::activeTextInput($widget->model, $widget->attribute, $widget->options); echo Html::fileInput('Picture[file]', null, ['class' => 'fileupload', 'data-url' => \yii\helpers\Url::to($widget->uploadurl), 'multiple' => true]); ?> <br /> <div class="progr"> <div class="bar" style="width: 0%;"></div> </div> </div>
<th><?php echo Yii::t('easyii', 'Description'); ?> </th> <th width="150"></th> </tr> </thead> <tbody> <?php foreach ($photos as $photo) { ?> <?php echo str_replace(['{{photo_id}}', '{{photo_thumb}}', '{{photo_image}}', '{{photo_description}}'], [$photo->primaryKey, $photo->thumb, $photo->image, $photo->description], $photoTemplate); ?> <?php } ?> </tbody> </table> <p class="empty" style="display: <?php echo count($photos) ? 'none' : 'block'; ?> ;"><?php echo Yii::t('easyii', 'No photos uploaded yet'); ?> .</p> <?php echo Html::beginForm(Url::to(['/admin/photos/upload'] + $linkParams), 'post', ['enctype' => 'multipart/form-data']); echo Html::fileInput('', null, ['id' => 'photo-file', 'class' => 'hidden', 'multiple' => 'multiple']); Html::endForm();
* @var $this \yii\web\View; */ ?> <?php Modal::begin(['header' => 'Загрузить изображение', 'toggleButton' => $toggleButton]); ?> <form action="<?php echo Url::toRoute(['/mitrm_images/images-common/upload-modal']); ?> " method="post" class="js_mitrm_img_upload_form" enctype="multipart/form-data"> <div class="col-md-4"> <?php echo Html::fileInput('images', '', ['class' => 'form-control js_mitrm_input_clear', 'placeholder' => '', 'accept' => 'image/*']); ?> </div> <div class="col-md-8"> <?php echo Html::textInput('name', '', ['class' => 'form-control js_mitrm_input_clear', 'placeholder' => 'Название изображения']); ?> </div> <div class="clearfix"></div> <div class="col-md-4 pull-right"> <?php echo Html::submitButton('Отправить', ['class' => 'js_mitrm_img_upload_submit pull-right btn btn-primary']); ?> </div> <div class="clearfix"></div>
<div class="add-directory-filed"> <input type="text" id="directory-name-selector" placeholder="<?php echo Yii::t('Site', 'Add Directory'); ?> "> </div> <div class="add-directory-button" title="<?php echo Yii::t('Site', 'Add Directory'); ?> "></div> <div class="download-button" id="<?php echo $fileManagerContainerId; ?> " > <?php echo Html::fileInput($fileManagerContainerId . 'Uploader[]', null, ['id' => $fileManagerContainerId . 'Uploader', 'class' => 'uploadInput', 'multiple' => 'multiple']); ?> </div> </div> <div class="body-area"> <div class="directory-up" title="<?php echo Yii::t('Site', 'Up'); ?> ">..</div> <ul id="file-list-container"> </ul> </div> <div class="footer-panel"></div> </div>
/** * @inheritdoc */ public function fileInput($options = []) { $options = $this->mergeInputOptions($options, ['data-role' => 'upload', 'placeholder' => null]); $this->parts['{input}'] = Html::fileInput($this->attribute, null, $options); return $this; }
echo $form->field($model, 'nombre_usuario')->dropDownList(ArrayHelper::map(Usuario::find()->all(), 'nombre', 'nombre'), ['prompt' => 'Seleccione un usuario']); } ?> <?php echo $form->field($model, 'carnet_minoridad')->textInput(['maxlength' => true]); ?> <?php echo '<div class="cflex">'; echo '<span style="order: 1; flex-grow: 1; margin-right:10px;">'; if ($model->isNewRecord) { echo Html::label('Es Informante', 'esinfor'); echo Html::radioList('informante', 'No', ['Si' => 'Si', 'No' => 'No'], ['id' => 'esinfor']); echo Html::label('Firma', 'firin'); echo Html::fileInput('firma', null, ['id' => 'firin', 'enable' => false, 'class' => 'form-control']); } else { $objInformante = Informante::find()->select('codigo')->where('cod_persona = :valor', [':valor' => $model->codigo])->one(); if (isset($objInformante)) { echo Html::a('Ver informante', '/sgm/web/informante/update/' . $objInformante->codigo, ['target' => '_blank', 'class' => 'form-control']); } } echo '</span>'; echo '</div>'; ?> <div class="form-group"> <?php echo Html::button($model->isNewRecord ? 'Crear' : 'Actualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'id' => 'procesar']); ?> </div>
/** * @inheritdoc */ public function run() { $options = ['data-url' => $this->action, 'id' => $this->options['id']]; //allow to load multiple files if ($this->multiple) { $options['multiple'] = ''; $this->attribute .= '[]'; } $btnOptions = $this->options; unset($btnOptions['id'], $btnOptions['plugin']); Html::addCssClass($btnOptions, 'btn fileinput-button'); $this->registerPlugin('file-upload'); echo Html::beginTag('span', $btnOptions) . "\n"; echo $this->content . "\n"; echo Html::fileInput($this->attribute, '', $options) . "\n"; echo Html::endTag('span') . "\n"; }