本文整理汇总了PHP中kartik\file\FileInput类的典型用法代码示例。如果您正苦于以下问题:PHP FileInput类的具体用法?PHP FileInput怎么用?PHP FileInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileInput类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1:
for(var i = 0; i < arr.length; i++){
if(arr[i] === fileName){
arr.splice(i, 1);
}
}
$("#tour-smallimg").val("");
}']]);
?>
<?php
echo $form->field($model, 'smallimg')->label("")->textInput(['maxlength' => true, 'class' => 'sr-only']);
?>
<?php
echo $form->field($model, 'limg', ['options' => ['name' => 'limg', 'class' => 'form-group']])->label('Largeimg')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*', 'multiple' => true, 'name' => 'smallimg'], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::to(['/file-upload/upload']), 'maxFileCount' => 10], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index){
var lag = $("#tour-largeimg").val().split(" "),
//fileName = data.files[index].name.replace(" (Copy)", "1").replace(" ", "_");
fileName = data.response.files.name;
for(var i = 0; i < lag.length; i++){
if(lag[i] === ""){
lag.splice(i, 1);
}
}
lag.push(fileName);
$("#tour-largeimg").val(lag.join(" "));
}', 'filesuccessremove' => 'function(event, id){
var name = $("#" + id + " img").attr("title"),
fileName = name.replace(" ", "_");
开发者ID:nguyendtu,项目名称:VietvietTravel,代码行数:31,代码来源:_form.php
示例2: run
/**
* @inheritdoc
*/
public function run()
{
$id = Html::getInputId($this->model, 'image_deleted');
$options = ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['showUpload' => false], 'pluginEvents' => ['fileclear' => "function() { \$('#{$id}').val(1);}"]];
if ($this->model->imageUrl !== null) {
$options['pluginOptions']['initialPreview'] = [Html::img($this->model->imageUrl, ['class' => 'file-preview-image'])];
}
echo $this->form->field($this->model, 'image_deleted', ['template' => '{input}'])->hiddenInput();
echo $this->form->field($this->model, 'image')->widget(FileInput::classname(), $options);
}
开发者ID:jlorente,项目名称:yii2-model-image,代码行数:13,代码来源:ImageUploadWidget.php
示例3:
<?php
echo $form->field($model, 'o4')->textInput();
?>
<?php
echo $form->field($model, 'o5')->textInput();
?>
<?php
echo $form->field($model, 'o6')->textInput();
?>
<?php
} else {
?>
<div class="form-group">
<?php
echo '<label class="control-label">เพิ่มไฟล์</label>';
echo FileInput::widget(['model' => $model, 'attribute' => 'myfile[]', 'id' => 'upfile', 'options' => ['multiple' => true, 'accept' => '.xlsx', 'style' => 'width: 300px'], 'pluginOptions' => ['showUpload' => false, 'maxFileCount' => 30]]);
?>
</div>
<?php
}
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'บันทึกข้อมูล' : 'แก้ไขข้อมูล', ['id' => 'btnsub', 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
开发者ID:nirantarnoy,项目名称:Tapp_Final,代码行数:30,代码来源:_form.php
示例4: run
public function run()
{
if (!$this->model || !$this->attribute) {
return null;
}
$extraData = $this->model->isNewRecord ? ['sign' => $this->model->sign] : ['id' => $this->model->id];
$previewImages = [];
$previewImagesConfig = [];
$existModelImages = EntityToFile::find()->where('entity_model_name = :emn', [':emn' => $this->model->formName()]);
if ($this->saveAttribute !== null) {
$existModelImages->andWhere('attribute = :attr', [':attr' => $this->saveAttribute]);
}
$existModelImages = $this->model->isNewRecord ? $existModelImages->andWhere('temp_sign = :ts', [':ts' => $this->model->sign]) : $existModelImages->andWhere('entity_model_id = :id', [':id' => $this->model->id]);
$existModelImages = $existModelImages->orderBy('position DESC')->all();
/**
* @var \common\models\EntityToFile $file
*/
foreach ($existModelImages as $image) {
$fileName = $image->file->base_name . '.' . $image->file->extension;
$previewImages[] = Html::img(FPM::originalSrc($image->file_id), ['class' => 'file-preview-image', 'id' => 'preview-image-' . $image->file_id]);
$previewImagesConfig[] = ['caption' => $fileName, 'width' => '120px', 'url' => ImagesUploadModel::deleteImageUrl(['id' => $image->id]), 'key' => $image->id];
}
$output = Html::hiddenInput('urlForSorting', ImagesUploadModel::sortImagesUrl(), ['id' => 'urlForSorting']);
$output .= Html::hiddenInput('aspectRatio', $this->aspectRatio, ['class' => 'aspect-ratio']);
$output .= FileInput::widget(['model' => $this->model, 'attribute' => $this->attribute, 'options' => ['multiple' => $this->multiple, 'accept' => 'image/*'], 'pluginOptions' => ['dropZoneEnabled' => false, 'browseClass' => 'btn btn-success', 'browseIcon' => '<i class="glyphicon glyphicon-picture"></i> ', 'removeClass' => "btn btn-danger", 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i> ', 'uploadClass' => "btn btn-info", 'uploadIcon' => '<i class="glyphicon glyphicon-upload"></i> ', 'uploadUrl' => Url::to($this->uploadUrl), 'allowedFileTypes' => ['image'], 'allowedPreviewTypes' => ['image'], 'uploadExtraData' => $extraData, 'initialPreview' => $previewImages, 'initialPreviewConfig' => $previewImagesConfig, 'overwriteInitial' => false, 'showRemove' => false, 'otherActionButtons' => $this->render('_crop_button'), 'fileActionSettings' => ['indicatorSuccess' => $this->render('_success_buttons_template')]], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index) {
var elem = $("#"+previewId).find(".file-actions .file-upload-indicator .kv-file-remove");
var cropElem = $("#"+previewId).find(".file-actions .crop-link");
var img = $("#"+previewId).find("img");
//id for cropped image replace
img.attr("id", "preview-image-"+data.response.imgId);
elem.attr("data-url", data.response.deleteUrl);
elem.attr("data-key", data.response.id);
cropElem.attr("href", data.response.cropUrl);
//Resort images
saveSort();
//Fix crop url for old images
fixMultiUploadImageCropUrl();
}', 'fileloaded' => 'function(file, previewId, index, reader) {
//Fix url for old images
fixMultiUploadImageCropUrl();
}']]);
$output .= '<br>';
$output .= $this->render('_modal');
return $output;
}
开发者ID:tolik505,项目名称:bl,代码行数:48,代码来源:ImageUpload.php
示例5:
echo $form->field($model, 'description')->textarea(['rows' => 6]);
?>
<?php
echo $form->field($model, 'type')->dropDownList(['hot' => 'Hot', 'usual' => 'Usual'], ['prompt' => '']);
?>
<?php
echo $form->field($model, 'price')->textInput();
?>
<?php
echo $form->field($model, 'quantity')->textInput();
?>
<?php
echo $form->field($model, 'photo')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*']]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
开发者ID:asus4851,项目名称:shop,代码行数:30,代码来源:_form.php
示例6: run
public function run()
{
if ($this->label === null) {
$this->label = Yii::t('mediafile', 'Files');
}
if ($this->newFileLabel === null) {
$this->newFileLabel = Yii::t('mediafile', 'New file');
}
$html = '';
$html .= '<div class="form-group file-preview-wrapper ">';
$html .= '<label class="control-label col col-sm-3">' . $this->label . '</label>';
$html .= '<div class="col col-sm-6">';
foreach ($this->model->mediafiles as $mediafile) {
// Steal classes from kartik's plugin.
if (preg_match('/^image\\//', $mediafile->mediafiletype->mimetype)) {
$html .= '<div class="file-preview-frame">';
} else {
$html .= '<div class="file-preview-frame" style="width: 160px; height: auto; ">';
}
if (preg_match('/^image\\//', $mediafile->mediafiletype->mimetype)) {
$html .= '<img src="' . Url::to(['mediafile/view', 'id' => $mediafile->primaryKey]) . '" style="width: auto; height: 160px;" />';
} else {
//$html .= '<div class="file-preview-other"><i class="glyphicon glyphicon-file"></i></div>';
$name = $mediafile->title;
if (!$name) {
$name = Yii::t('mediafile', 'File') . ' ' . $mediafile->primaryKey;
}
$name = preg_replace('/\\.[^\\.]+$/', '', $name);
$html .= '<div class="file-caption-name">';
$html .= $name;
$html .= '</div>';
$html .= '<div class="file-caption-name">';
$html .= $mediafile->mediafiletype->extension . Yii::t('mediafile', '-file');
$html .= '</div>';
}
$html .= '<br />';
$html .= '<br />';
$html .= '<a href="' . Url::to([$this->unassignAction, 'id' => $this->model->primaryKey, 'mediafile' => $mediafile->primaryKey]) . '" class="btn btn-warning center-block">' . Yii::t('mediafile', 'Unassign') . '</a>';
$html .= '<br />';
$html .= '</div>';
// preview pane
}
$html .= '</div>';
// col
$html .= '</div>';
// form-group
$html .= '<div class="file-upload-wrapper">';
// HACK: if you do not manually append [] to the name of the
// attribute, only one file will be uploaded.
$html .= $this->form->field($this->model, 'newFiles[]')->widget(FileInput::classname(), ['options' => ['accept' => ['image/*', 'video/*'], 'multiple' => true], 'pluginOptions' => ['showUpload' => false, 'maxFileCount' => $this->maxFileCount, 'autoReplace' => true]])->label($this->newFileLabel);
$html .= '</div>';
return $html;
}
开发者ID:icalab,项目名称:yii2-ica-mediafile,代码行数:53,代码来源:AttachMediafileWidget.php
示例7: explode
?>
<?php
echo $form->field($model, 'mode')->dropDownList(Ad::getAdMode());
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'short_code')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'pic_url')->hint('<i class="fa fa-info-circle"></i> ' . Yii::t('fileinput', 'Note: Limit upload one picture.'))->widget(FileInput::classname(), ['options' => ['accept' => 'image/*', 'multiple' => false], 'pluginOptions' => ['uploadUrl' => Url::to(['/cms/ad/file-upload']), 'uploadAsync' => true, 'initialPreview' => General::showImages($model->pic_url), 'initialPreviewConfig' => General::showLinks($model->pic_url, 'pic_url', 'ad', '/cms/ad/file-upload'), 'previewFileType' => 'any', 'overwriteInitial' => true, 'maxFileSize' => Yii::$app->params['config']['config_pic_size'], 'allowedFileExtensions' => explode(',', Yii::$app->params['config']['config_pic_extension']), 'allowedFileTypes' => ['image'], 'maxFileCount' => 1, 'uploadExtraData' => ['dir' => 'ad', 'name' => 'Ad[pic_url]', 'route' => '/cms/ad/file-upload', 'field' => 'pic_url']]]);
?>
<?php
/*
FileInput::widget([
'name' => 'pic_url',
'options'=>[
'accept' => 'image/*',//只接收图片类型
'multiple'=>false,//这里不需要多选
],
'pluginOptions' => [
'uploadUrl' => Url::to(['/cms/ad/file-upload']),
// 'uploadAsync' => true,//异步上传
'initialPreview'=>[
//Html::img("/images/moon.jpg", ['class'=>'file-preview-image', 'alt'=>'The Moon', 'title'=>'The Moon']),
开发者ID:jorry2008,项目名称:turen,代码行数:31,代码来源:_form.php
示例8:
/* @var $model common\models\User */
$this->title = 'Profile: ' . $model->username;
$this->params['breadcrumbs'][] = ['label' => 'Profile', 'url' => ['view']];
?>
<div class="user-view">
<h1><?php
echo Html::encode($model->username);
?>
</h1>
<?
$form = ActiveForm::begin();
echo $form->field($model, 'imgsource')->widget(FileInput::className(), [
'options' => [
'accept' => 'image/*',
],
'pluginOptions' => [
'uploadUrl' => Url::to(['file-upload-avatar']),
'allowedFileExtensions' => ['jpg', 'png', 'gif', 'jpeg'],
'initialPreview' => $image,
'showUpload' => true,
'showRemove' => false,
'dropZoneEnabled' => false,
]
]);
?>
开发者ID:scorp7mix,项目名称:yii,代码行数:30,代码来源:view.php
示例9:
?>
-image">
<?php
Modal::end();
}
?>
<div id="field-<?php
echo $selector;
?>
" class="form-group uploader">
<div class="fullinput">
<div class="uploader-browse">
<?php
echo FileInput::widget(['model' => $model, 'attribute' => $attribute, 'options' => ['id' => $selector, 'onchange' => 'readFile(this, "' . $selector . '", ' . (int) $crop . ', ' . Json::encode($jcropSettings) . ')'], 'pluginOptions' => ['showRemove' => false, 'uploadAsync' => false, 'showUpload' => false, 'showUploadedThumbs' => false, 'showPreview' => false, 'previewFileType' => false]]);
?>
</div>
</div>
<?php
if ($crop) {
?>
<?php
echo Html::hiddenInput($model->formName() . "[{$attribute}-coords][x]", null, ['id' => "{$selector}-coords-x"]);
?>
<?php
echo Html::hiddenInput($model->formName() . "[{$attribute}-coords][w]", null, ['id' => "{$selector}-coords-w"]);
?>
<?php
echo Html::hiddenInput($model->formName() . "[{$attribute}-coords][y]", null, ['id' => "{$selector}-coords-y"]);
?>
开发者ID:elgorm,项目名称:yii2-uploadable-cropable-image,代码行数:31,代码来源:view.php
示例10:
</div>
</div>
<div class="row">
<div class="col-md-4"><?php
echo $form->field($model, 'drivers_passport')->textInput(['maxlength' => true]);
?>
</div>
<div class="col-md-4"> <?php
echo $form->field($model, 'drivers_licence')->textInput(['maxlength' => true]);
?>
</div>
</div>
<div class="row">
<div class=" col-md-12">
<?php
echo $form->field($model, 'docs[]')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*', 'multiple' => true], 'pluginOptions' => ['initialPreview' => $model->initialPreview($model->docs, 'docs', 'file'), 'initialPreviewConfig' => $model->initialPreview($model->docs, 'docs', 'config'), 'allowedFileExtensions' => ['pdf', 'jpg'], 'showPreview' => true, 'showCaption' => true, 'showRemove' => true, 'showUpload' => true, 'overwriteInitial' => false]])->label(false);
?>
</div>
</div>
<?php
if ($model->isNewRecord) {
echo $form->field($model, 'appilcant_id')->hiddenInput(['maxlength' => true, 'value' => $id])->label(false);
} else {
echo $form->field($model, 'appilcant_id')->hiddenInput(['maxlength' => true])->label(false);
}
?>
<?php
//$form->field($model, 'appilcant_id')->textInput(['maxlength' => true, 'value' => $id])->label(false)
?>
开发者ID:aekkapun,项目名称:dlt-tcplch,代码行数:30,代码来源:_form.php
示例11:
<div class="modal-body">
<div class="row">
<div class="col-xs-12">
<?php
echo $form->field($model, 'nombre', $inputOpciones)->textInput(['class' => $inputClase, 'autocomplete' => 'off']);
?>
<span class="glyphicon glyphicon-ok form-control-feedback"></span>
<?php
//$form->field($model, 'icono', $inputOpciones)->fileInput(['class' => $inputClase])
?>
<?php
// your fileinput widget for single file upload
echo $form->field($model, 'imagenes')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showCaption' => true, 'showRemove' => false, 'showUpload' => false, 'showPreview' => false, 'browseClass' => 'btn ink-reaction btn-primary btn-block', 'browseIcon' => '<i class="md md-photo-camera"></i> ', 'browseLabel' => 'Seleccionar icono']])->label(false);
?>
<?php
echo $form->field($model, 'estado')->radioList($model->listadoEstados(), $inputRadioListOpciones)->label($model->getAttributeLabel('tipo'), ['style' => 'margin-bottom: 10px;']);
?>
<span class="opacity-50"><?php
echo $model->getAttributeLabel('descripcion');
?>
</span>
<?php
echo $form->field($model, 'descripcion')->textarea(['class' => $inputClase . ' editorTexto control-3-rows', 'style' => 'margin-top:10px', 'placeholder' => 'Me describo como...'])->label(false);
?>
</div>
</div>
开发者ID:alejandrososa,项目名称:AB,代码行数:30,代码来源:_formModal.php
示例12:
* @var app\models\TESTIMONIALS $model
* @var yii\widgets\ActiveForm $form
*/
$this->registerJsFile("//cdn.tinymce.com/4/tinymce.min.js");
?>
<div class="testimonials-form">
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
echo $form->field($model, 'comment')->textarea(['rows' => 6]);
?>
<?php
echo FileInput::widget(['model' => $model, 'attribute' => 'image', 'pluginOptions' => ['initialPreview' => [], 'initialCaption' => "User Image", 'overwriteInitial' => false, 'options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png']]]]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
<?php
开发者ID:syedmaaz,项目名称:marxmall-,代码行数:31,代码来源:_form.php
示例13: UploadedFiles
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
use kartik\dynagrid\DynaGrid;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel app\models\Fregat\DocfilesSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Загруженные файлы';
$this->params['breadcrumbs'] = Proc::Breadcrumbs($this);
?>
<div class="docfiles-index">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'docFile')->widget(FileInput::classname(), ['pluginOptions' => ['uploadUrl' => Url::to(['Fregat/docfiles/create']), 'dropZoneEnabled' => false, 'previewZoomSettings' => ['image' => ['width' => 'auto', 'height' => '100%']]], 'pluginEvents' => ["fileuploaded" => 'function(event, data, previewId, index) { UploadedFiles("docfilesgrid", event, data); }']]);
?>
<?php
ActiveForm::end();
?>
<?php
$result = Proc::GetLastBreadcrumbsFromSession();
$foreign = isset($result['dopparams']['foreign']) ? $result['dopparams']['foreign'] : '';
echo DynaGrid::widget(Proc::DGopts(['options' => ['id' => 'docfilesgrid'], 'columns' => Proc::DGcols(['columns' => [['attribute' => 'docfiles_ext', 'format' => 'raw', 'value' => 'docfiles_iconshow', 'contentOptions' => ['style' => 'width: 40px; text-align: center;'], 'filter' => false], ['attribute' => 'docfiles_name', 'format' => 'raw', 'value' => 'docfiles_name_html'], ['attribute' => 'docfiles_hash', 'visible' => false]], 'buttons' => array_merge(empty($foreign) ? [] : ['chooseajax' => ['Fregat/docfiles/assign-to-select2']], Yii::$app->user->can('DocfilesEdit') ? ['deleteajax' => ['Fregat/docfiles/delete']] : [])]), 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'panel' => ['heading' => '<i class="glyphicon glyphicon-file"></i> ' . $this->title]]]));
?>
</div>
开发者ID:vovancho,项目名称:yii2test,代码行数:30,代码来源:index.php
示例14: array
<?php
$language_items = [];
foreach ($languages as $key => $language) {
$field = $form->field($model, "name_{$language->url}")->textInput(['maxlength' => true])->label('Name');
if ($languageDefault->url == $language->url) {
$field = $form->field($model, "name")->textInput(['maxlength' => true]);
}
$language_items[] = ['label' => Yii::t('backend', $language->name), 'content' => "<p>{$field}</p>", 'active' => $key == 0];
}
echo Tabs::widget(['items' => $language_items]);
?>
<?php
echo $form->field($model, 'file')->widget(FileInput::classname(), ['options' => ['multiple' => false, 'accept' => 'pdf/*'], 'pluginOptions' => ['previewFileType' => 'image', 'showUpload' => false]])->label(Yii::t('backend', 'PDF File'));
?>
<?php
echo Html::a($model->file, $model->getUploadedFileUrl('file'), array('target' => '_blank'));
?>
<br/><br/>
<?php
echo $form->field($model, 'order')->textInput();
?>
<?php
echo $form->field($model, 'id')->hiddenInput();
?>
开发者ID:skamnev,项目名称:members,代码行数:29,代码来源:_form.php
示例15: replace
var tpl = '<div class = "col-md-4"><div class="thumbnail"><p>'
+ '<a href="{$editAction}" class="imgaction blue" title="Редактировать">'
+ '<i class="glyphicon glyphicon-pencil"></i></a>'
+ '<a href="#" class="imgaction red pull-right" title="Удалить" data-id="{id}">'
+ '<i class="glyphicon glyphicon-trash"></i></a></p>'
+ '<img src="{thumb}">'
+ '<p><a href="#" class="imgaction grey" title="Сделать главным" data-id="{id}">'
+ '<i class="glyphicon glyphicon-ok"></i></a></p></div></div>';
for(var i in data.response) {
var el = tpl.replace('{id}', data.response[i].id).
replace('{thumb}', data.response[i].thumb);
\$(el).appendTo('#page-images');
}
}
fileuploaded;
echo FileInput::widget(['name' => 'files', 'options' => ['accept' => 'image/*', 'multiple' => true], 'pluginOptions' => ['uploadUrl' => Url::to(['image/ajax-upload', 'table' => $model::$tableId, 'id' => $model->id]), 'maxFileCount' => 5, 'browseClass' => 'btn btn-success', 'uploadClass' => 'btn btn-info', 'removeClass' => 'btn btn-danger', 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i> ', 'dropZoneEnabled' => false], 'pluginEvents' => ['fileuploaded' => $jsUploaded]]);
?>
</div>
<hr>
<div id="page-images" class="row">
<?php
if ($files != null) {
foreach ($files as $f) {
$f->attachBehavior('imageBehavior', ['class' => \app\components\imageBehavior::className()]);
?>
<div class = "col-md-4">
<div class="thumbnail">
<p>
<a href="<?php
echo Url::to(['image/edit', 'id' => $f->id]);
?>
开发者ID:kintastish,项目名称:mobil,代码行数:31,代码来源:_images.php
示例16:
<?php
echo $form->field($model, 'detail_image')->widget(\kartik\file\FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['initialPreview' => $model->getFileUrl('detail_image') ? [Html::img($model->getFileUrl('detail_image'), ['class' => 'file-preview-image'])] : [], 'initialPreviewConfig' => [['caption' => $model->getFileUrl('detail_image'), 'url' => \yii\helpers\Url::to(['delete-file', 'pk' => $model->id, 'attribute' => 'detail_image'])]], 'showUpload' => false, 'showRemove' => false]]);
?>
<?php
//= $form->field($model, 'path')->textInput(['maxlength' => 2000])
?>
</div>
<div id="advanced-options" class="tab-pane">
<?php
echo $form->field($model, 'preview_text')->textarea(['rows' => 10]);
?>
<?php
echo $form->field($model, 'preview_image')->widget(\kartik\file\FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['initialPreview' => $model->getFileUrl('preview_image') ? [Html::img($model->getFileUrl('preview_image'), ['class' => 'file-preview-image'])] : [], 'initialPreviewConfig' => [['caption' => $model->getFileUrl('preview_image'), 'url' => \yii\helpers\Url::to(['delete-file', 'pk' => $model->id, 'attribute' => 'preview_image'])]], 'showUpload' => false, 'showRemove' => false]]);
?>
</div>
<div id="meta-options" class="tab-pane">
<?php
echo $form->field($model, 'metakey')->textInput(['maxlength' => 255]);
?>
<?php
echo $form->field($model, 'metadesc')->textarea(['maxlength' => 2048]);
?>
</div>
</div>
<?php
echo Html::activeHiddenInput($model, 'lock');
开发者ID:gromver,项目名称:yii2-platform-basic,代码行数:30,代码来源:_form.php
示例17: date
/* @var $model app\models\Books */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="books-form">
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'preview')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['showPreview' => true, 'showCaption' => true, 'showRemove' => true, 'showUpload' => false]]);
?>
<?php
echo $form->field($model, 'date')->widget(DatePicker::classname(), ['value' => date('Y-m-d', strtotime('today')), 'options' => ['placeholder' => Yii::t('books', 'select Date')], 'pluginOptions' => ['hideInput' => true, 'format' => 'yyyy-mm-dd', 'todayHighlight' => true]]);
?>
<?php
echo $form->field($model, 'author_id')->dropDownList(ArrayHelper::map(Authors::find()->all(), 'id', 'fullName'), ['prompt' => Yii::t('books', 'select Author')]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
开发者ID:IuriiP,项目名称:test160107,代码行数:31,代码来源:_form.php
示例18:
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
?>
<div class="containerqq" style="background-color: #FFFFFF;border-radius: 10px">
<div style=" clear:both;display:block;">
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']], ['data-pjax' => '']);
?>
<?php
echo $form->field($model, 'imageFiles')->widget(\kartik\file\FileInput::classname(), ['options' => ['accept' => 'image/*']]);
?>
<?php
ActiveForm::end();
?>
</div>
<?php
foreach ($pic as $pc) {
?>
<div class=" col-xs-6 col-sm-3" style="position: relative;width: 19%"> <?php
$a = Html::img('@web/' . $pc->pic_name, ['alt' => ')))))))', 'data-lightbox' => "roadtrip", 'id' => $pc->id, 'style' => ['cursor' => 'pointer', 'width' => '206px', 'height' => '206px'], 'class' => '']);
?>
<?php
echo Html::a($a, ['@web/' . $pc->pic_name], ['data-lightbox' => "roadtrip", 'data-toggle' => "confirmation"]);
?>
<div class="nkr "> <div aria-expanded="false" data-toggle="tooltip" title="Edit options" class=" dropdown ">
<a href="#" data-toggle="dropdown" class="dropdown-toggle edopt"> </a>
开发者ID:saqbest,项目名称:social.dev,代码行数:31,代码来源:upload.php
示例19:
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use kartik\file\FileInput;
?>
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data'], 'action' => Url::to(['upload', 'id' => $model->id])]);
?>
<?php
echo $form->field($model, 'files[]')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*', 'multiple' => true], 'pluginOptions' => ['maxFileCount' => 5, 'browseClass' => 'btn btn-success', 'uploadClass' => 'btn btn-info', 'removeClass' => 'btn btn-danger', 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i> ']])->label(false);
?>
<?php
ActiveForm::end();
开发者ID:kintastish,项目名称:mobil_old,代码行数:17,代码来源:_uploadform.php
示例20:
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
echo $form->field($model, 'amount_text')->widget(TouchSpin::classname(), ['pluginOptions' => ['min' => 0.25, 'max' => 9.0, 'step' => 0.25, 'decimals' => 2, 'boostat' => 1, 'maxboostedstep' => 1]])->label(Yii::t('backend', 'Amount') . ' <span style="color: red;">*</span>');
?>
<?php
$unit_data = backend\models\Unit::find()->select(['unit_id', 'unit_text'])->orderBy('unit_text')->all();
$unit_list = \yii\helpers\ArrayHelper::map($unit_data, 'unit_id', 'unit_text');
echo $form->field($model, 'unit_id')->dropDownList($unit_list, ['prompt' => Yii::t('backend', 'Select...')])->label(Yii::t('backend', 'Use Unit') . ' <span style="color: red;">*</span>');
?>
<?php
echo $form->field($model, 'amount_img_temp')->widget(FileInput::classname(), ['options' => ['accept' => 'image/jpeg, image/gif, image/png, image/svg+xml'], 'pluginOptions' => ['showCaption' => true, 'showRemove' => true, 'showUpload' => false, 'browseLabel' => '', 'removeLabel' => '', 'removeClass' => 'btn btn-danger', 'initialPreview' => !empty($model->amount_img) ? [Html::img($model->amount_img, ['class' => 'file-preview-image'])] : [], 'initialCaption' => !empty($model->amount_img) ? ' /' . $model->amount_img : ' ']])->label(Yii::t('backend', 'Image') . ' <span style="color: red;">*</span>');
?>
<?php
echo $form->field($model, 'note')->textarea(['rows' => 6]);
?>
<div class="form-group">
<?php
echo Html::submitButton(Yii::t('backend', 'Save'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-warning']);
?>
</div>
<?php
ActiveForm::end();
?>
开发者ID:gearger,项目名称:imagenizer,代码行数:31,代码来源:_form.php
注:本文中的kartik\file\FileInput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论