当前位置: 首页>>代码示例>>PHP>>正文


PHP FileInput::widget方法代码示例

本文整理汇总了PHP中kartik\file\FileInput::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP FileInput::widget方法的具体用法?PHP FileInput::widget怎么用?PHP FileInput::widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kartik\file\FileInput的用法示例。


在下文中一共展示了FileInput::widget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

   <?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

示例2: 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

示例3: Document

<?php 
echo $form->field($model, 'limit', ['enableClientValidation' => true]);
?>

<?php 
echo $form->field($model, 'options')->checkboxList($model::optionItems());
?>

<?php 
if (!$model->isNewRecord) {
    ?>
    <div class="form-group">
        <label class="control-label">Новые документы</label>
        <?php 
    echo FileInput::widget(['model' => new Document(), 'attribute' => 'file[]', 'options' => ['multiple' => true], 'pluginOptions' => ['showPreview' => false, 'uploadUrl' => Url::to(['attach-document', 'ownerId' => (string) $model->getPrimaryKey()]), 'maxFileCount' => 10], 'pluginEvents' => ['filebatchuploadsuccess' => 'function(e, data){$(\'#documents-panel-body\').empty().append(data.response.view);}']]);
    ?>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading" role="tab">
            <div class="panel-title">
                <a class="h5" data-toggle="collapse" href="#documents-panel-body">Прикрепленные документы</a>
            </div>
        </div>
        <div id="documents-panel-body" class="panel-collapse collapse list-group" role="tabpanel">
            <?php 
    echo $this->render('_document', ['ownerId' => $model->getPrimaryKey()]);
    ?>
        </div>
    </div>
    <?php 
开发者ID:shubnikofff,项目名称:mobiles,代码行数:30,代码来源:_form.php

示例4:

            </div>

        <?php 
}
?>


        <div class="clear"></div>
        <div class="spacer30"></div>

        <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
            <div class="form-group">
                <?php 
echo FileInput::widget(['model' => $user, 'attribute' => 'image[]', 'options' => ['accept' => 'image/*', 'multiple' => true], 'pluginOptions' => ['showCaption' => false, 'overwriteInitial' => true, 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => ' Add Photos']]);
?>
            </div>
        <?php 
ActiveForm::end();
?>
    </div>

    <h3>Bio</h3>
    <?php 
if ($user->bio) {
    ?>
        <p><?php 
    echo $user->bio;
    ?>
</p>
开发者ID:jcshep,项目名称:FrontRunner,代码行数:31,代码来源:view.php

示例5: UploadForm

<?php

use yii\helpers\Url;
use kartik\file\FileInput;
use app\models\UploadForm;
/* @var $this yii\web\View */
/* @var $model app\models\Post */
/* @var $form yii\widgets\ActiveForm */
$oUploadForm = new UploadForm();
$iPostValue = $_GET['id'];
?>

<div class="post-form">
<div class="add_picture">
                        <?php 
echo FileInput::widget(['model' => $oUploadForm, 'name' => 'attachment_' . $iPostValue . '[]', 'language' => 'pl', 'options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => Url::to(['upload-form/upload?id=' . $iPostValue . '']), 'uploadAsync' => false, 'showRemove' => false, 'allowedFileTypes' => array('image')]]);
?>
                    </div>
</div>
开发者ID:skony20,项目名称:olgaz2,代码行数:19,代码来源:_uploadfiles.php

示例6: ProductFiles

                      </ul>

                      <div class="col-md-12 save_sort_order_btn_wrap" style="">
                          <a class="btn btn-sm btn-primary pull-right save_sort_order_btn" href="#">Save Order</a>
                      </div>
                  </div>
                </div>
            </div>

            <div role="tabpanel" class="tab-pane" id="files">
              <?php 
$files_model = new ProductFiles();
echo FileInput::widget(['model' => $files_model, 'attribute' => 'file_name', 'options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => Url::to(['/product/upload_file']), 'uploadExtraData' => ['id' => $model->id], 'maxFileCount' => 10, 'allowedFileExtensions' => ['docx', 'doc', 'txt', 'pdf']], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index){
                                $(".product_files_table").append(data.response.view);
                                //$(".uploaded_images").sortable();
                                
                            }', 'filebatchuploadcomplete' => 'function(event, files, extra){
                                $(".fileinput-remove-button").click();
                            }']]);
?>


                <div class="col-md-8">
                    <table class="table product_files_table">
                      <tr>
                        <th>File Name</th>
                        <th>File</th>
                        <th>Actions</th>
                      </tr>
                        <?php 
if (!empty($model->product_files)) {
开发者ID:hsleonis,项目名称:achitecture,代码行数:31,代码来源:_form_update.php

示例7: 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

示例8: FileReader

echo FileInput::widget([
    'name'          => $fieldName . '[][image]',
    'options'       => [
        'accept'   => 'image/*',
        'multiple' => true,
        'class' => 'multiple',
    ],
    'pluginOptions' => [
        'layoutTemplates'         => [
            'footer'       => '<div class="file-thumbnail-footer">
                            <div class="{TAG_CSS_NEW}">{CUSTOM_TAG_NEW}</div>
                            <div class="{TAG_CSS_INIT}">{CUSTOM_TAG_INIT}</div>
                            <div>{actions}</div>
                        </div>',
            'actionUpload' => '',
        ],
        'overwriteInitial'        => false,
        'showClose'               => false,
        'uploadUrl'               => true,
        'showUpload'              => false,
        'showRemove'              => false,
        'initialPreview'          => $initialPreview,
        'initialPreviewConfig'    => $initialPreviewConfig,
        'autoReplace'             => true,
        'maxFileCount'            => 100,
        'language'                => Yii::$app->getModule('radiata')->activeLanguage['code'],
        'previewThumbTags'        => [
            '{CUSTOM_TAG_NEW}' => Html::hiddenInput('GalleryFilesSources[NEW_IND]', '') . $form->field($newsGallery, '[NEW_IND]image_text')->label(Yii::t('b/radiata/common', 'Image text'))->widget(LangInputWidget::classname(), [
                    'options' => [
                        'id'                   => 'galTabsNEW_IND',
                        'type'                 => 'activeTextInput',
                        'additionalCssClasses' => 'kv-input kv-new form-control input-sm',
                    ],
                ]),
            '{CUSTOM_TAG_INIT}' => '',
            '{TAG_CSS_NEW}'     => '',
            '{TAG_CSS_INIT}'    => 'hide',
        ],
        'initialPreviewThumbTags' => $initialPreviewThumbTag,
    ],
    'pluginEvents'  => [
        'fileloaded'    => "function(event, file, previewId, index, reader) {

            if(typeof(galInd) == 'undefined') {
                galInd = -1;
            } else {
                galInd--;
            }

            $('input').each(function(){
                var attrName = $(this).attr('name');
                if(typeof(attrName) != 'undefined' && attrName.indexOf('NEW_IND') > -1) {
                    attrName = attrName.replace('NEW_IND', galInd);
                    $(this).attr('name', attrName);
                    $(this).attr('newindex', galInd);
                }
            });

            $('ul,div').each(function(){
                var attrName = $(this).attr('id');
                if(typeof(attrName) != 'undefined' && attrName.indexOf('NEW_IND') > -1) {
                    attrName = attrName.replace('NEW_IND', galInd);
                    $(this).attr('id', attrName);
                }
            });

            $('a').each(function(){
                var attrName = $(this).attr('href');
                if(typeof(attrName) != 'undefined' && attrName.indexOf('NEW_IND') > -1) {
                    attrName = attrName.replace('NEW_IND', galInd);
                    $(this).attr('href', attrName);
                }
            });

            $('div.file-preview-frame').each(function(){
                if(!$(this).hasClass('file-preview-initial')) {
                    $(this).find('button.kv-file-remove').each(function(){
                        $(this).removeClass('kv-file-remove');
                        $(this).off('click');
                        $(this).click(function(){
                            var key = $(this).parents('.file-thumbnail-footer:first').find('input[type=text]:first').attr('newindex');
                            var input = '<input type=\'hidden\' name=\'GalleryDeletedItems[]\' value=\''+key+'\'>';
                            $('#gallery-deleted-items').append(input);
                            $(this).parents('div.file-preview-frame:first').fadeOut();
                        });
                    });
                }
            });

            // Only process image files.
            if (file.type.match('image.*')) {
                var reader = new FileReader();
                reader.onload = (function(theFile) {
                    var _theFile = theFile;
                    return function (e) {
                        $('input[name=\"GalleryFilesSources['+galInd+']\"]').val(theFile.name + ';' + e.target.result);
                    }
                })(file);
                reader.readAsDataURL(file);
            }
//.........这里部分代码省略.........
开发者ID:radiata-cms,项目名称:radiata,代码行数:101,代码来源:GalleryInput.php

示例9:

echo \talma\widgets\JsTree::widget(['id' => 'cat_tree', 'name' => 'js_tree', 'core' => ['data' => ['url' => \yii\helpers\Url::to(['categories/ajax', 'prod_id' => $product->id])]], 'types' => ['default' => ['icon' => 'fa fa-folder text-warning fa-lg'], 'file' => ['icon' => 'fa fa-file text-warning fa-lg']], 'plugins' => ['types', 'dnd', 'contextmenu', 'wholerow', 'state', 'checkbox']]);
?>
                    </div>
                </div>

            </div>
            <div class="tab-pane fade" id="parameters">
                <br>
                <?php 
echo ProductHelper::getParameterFields($form, $product);
?>
            </div>
            <div class="tab-pane fade" id="images_upload">
                <br>
                <?php 
echo FileInput::widget(['model' => $product_image, 'attribute' => 'image_url[]', 'options' => ['multiple' => true], 'pluginOptions' => ['initialPreview' => ProductHelper::getImages($product), 'initialPreviewConfig' => ProductHelper::getImagesExtra($product), 'initialPreviewShowDelete' => true, 'overwriteInitial' => false]]);
?>
                <br>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-2"></div>
        <div class="col-md-9">
            <?php 
echo Html::submitButton($product->isNewRecord ? StoreCube::t('admincube', 'BUTTON_CREATE') : StoreCube::t('admincube', 'BUTTON_UPDATE'), ['class' => $product->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
        </div>
    </div>
    <?php 
ActiveForm::end();
开发者ID:cubiclab,项目名称:store-cube,代码行数:31,代码来源:_form.php

示例10:

echo $form->field($model, 'price')->textInput();
?>

    <?php 
echo $form->field($model, 'is_sold')->checkbox();
?>

    <?php 
echo $form->field($model, 'is_house')->checkbox();
?>

    <?php 
echo $form->field($model, 'date_ready')->dropDownList(ArrayHelper::map(DateReadyDistrict::find()->all(), 'id', 'date'), ['prompt=' > '- Choose Your Permissions -']);
?>

    <?php 
echo FileInput::widget(['options' => ['accept' => 'image/*'], 'model' => $model, 'attribute' => 'image', 'pluginOptions' => ['initialPreview' => $model->image ? [Html::img($model->thumburl)] : false, 'overwriteInitial' => true]]);
?>

    <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:panickylemon,项目名称:am_zori-yii,代码行数:30,代码来源:_form.php

示例11:

                <?php 
echo $form->field($broadcast, 'content')->widget(CKEditor::className(), ['preset' => 'full', 'clientOptions' => ['height' => 300, 'toolbar' => [['name' => 'row1', 'items' => ['Source', '-', 'Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', 'RemoveFormat', '-', 'TextColor', 'BGColor', '-', 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', 'list', 'indent', 'blocks', 'align', 'bidi', '-', 'Link', 'Unlink', 'Anchor', '-', 'ShowBlocks', 'Maximize']], ['name' => 'row2', 'items' => ['Image', 'Table', 'HorizontalRule', 'SpecialChar', 'Iframe', '-', 'NewPage', 'Print', 'Templates', '-', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo', '-', 'Find', 'SelectAll', 'Format', 'Font', 'FontSize']]]]])->label(false);
?>

                <?php 
echo $form->field($broadcast, 'registered_users')->checkbox();
?>
                <?php 
echo $form->field($broadcast, 'destinations')->textarea();
?>

                <div class="form-group">
                    <?php 
if ($broadcast->id) {
    echo FileInput::widget(['name' => 'attach', 'options' => ['accept' => 'image/*, application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'multiple' => true, 'uploadAsync' => false, 'maxFileCount' => 1], 'pluginOptions' => ['initialPreview' => $broadcast->initialPreviewConfig ? ArrayHelper::getColumn($broadcast->initialPreviewConfig, 'file') : false, 'initialPreviewConfig' => $broadcast->initialPreviewConfig, 'initialPreviewAsData' => true, 'overwriteInitial' => false, 'showPreview' => true, 'showCaption' => false, 'showUpload' => false, 'showRemove' => false, 'showCancel' => false, 'dropZoneEnabled' => true, 'browseClass' => 'btn btn-default btn-sm btn-flat', 'removeClass' => 'btn btn-danger btn-sm btn-flat', 'uploadUrl' => Url::to(['/broadcast/file-upload']), 'uploadExtraData' => ['broadcast_id' => $broadcast->id, 'name' => 'attach'], 'maxFileCount' => 20, 'uploadAsync' => true, 'uploadUrl' => Url::to(['/broadcast/file-manager/file-upload'])], 'pluginEvents' => ['fileimagesloaded' => 'function(event) {
                        $(this).fileinput("upload");
                    }']]);
}
?>
                </div>

                <?php 
echo Html::a('Отмена', ['/broadcast/index'], ['class' => 'btn btn-sm btn-default btn-flat']);
?>
                <?php 
echo Html::submitButton('Сохранить', ['class' => 'btn btn-sm btn-primary btn-flat']);
?>
                <?php 
if (isset($broadcast->id)) {
    echo Html::a('Подготовить к отправке', ['/broadcast/render-send', 'broadcast_id' => $broadcast->id], ['class' => 'btn btn-sm btn-success btn-flat']);
}
开发者ID:mark38,项目名称:yii2-site-mng,代码行数:31,代码来源:manager.php

示例12: foreach

    }
    ?>
                    </ul>
                </div>
            </div>

            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">Разбиение на архивы по компаниям</h3>
                </div>
                <div class="box-body">
                    <ul class="list-unstyled">
                        <?php 
    echo '<label class="control-label">Загрузить файлы</label>';
    echo FileInput::widget(['name' => 'file', 'language' => 'ru', 'options' => ['multiple' => true, 'uploadAsync' => false, 'maxFileCount' => 1], 'pluginOptions' => ['previewFileType' => 'text', 'uploadUrl' => Url::to(['/certificates/txt-upload', 'tasks_id' => $task->id]), 'showPreview' => false, 'showCaption' => true, 'showRemove' => false, 'showUpload' => true], 'pluginEvents' => ['filebatchuploadcomplete' => 'function() {
                                window.location.href = "create-companies-zip?tasks_id=" + ' . $task->id . ';
                            }']]);
    ?>
                    </ul>
                </div>
                <?php 
    if ($companies_zip) {
        ?>
                <div class="box-body">
                    <label>Скачать архив</label>
                    <ul class="list-unstyled">
                        <?php 
        foreach ($companies_zip as $path) {
            echo '<li>' . Html::a($path->name, ['/' . $path->path]) . '</li>';
        }
        ?>
开发者ID:mark38,项目名称:yii2-site-mng,代码行数:31,代码来源:requests.php

示例13: UploadForm

<?php

use yii\helpers\Html;
use yii\grid\GridView;
use kartik\file\FileInput;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'UploadForm';
$this->params['breadcrumbs'][] = $this->title;
use yii\widgets\ActiveForm;
use app\models\UploadForm;
$model = new UploadForm();
echo FileInput::widget(['model' => $model, 'attribute' => 'image', 'name' => 'attachment[]', 'options' => ['multiple' => true, 'accept' => 'image/*'], 'pluginOptions' => ['uploadUrl' => Url::to(['upload-form/upload?id=8']), 'uploadExtraData' => ['album_id' => 20, 'cat_id' => 'Nature'], 'maxFileCount' => 10]]);
开发者ID:skony20,项目名称:olgaz2,代码行数:14,代码来源:index.php

示例14: uploadComplete

    <?php 
$form = ActiveForm::begin(['options' => ['class' => 'form-horizontal', 'enctype' => 'multipart/form-data'], 'enableAjaxValidation' => true, 'validationUrl' => Url::to(['product/validate-form', 'id' => $model->id])]);
?>
    <!-- 图片 -->

    <div class="form-group">

        <label class="col-sm-2 control-label no-padding-right" for="product-sku"><?php 
echo Html::encode(Yii::t('app/product', 'Uploaded Product Image'));
?>
</label>
        <div class="col-sm-5">
          <?php 
echo FileInput::widget(['name' => 'main-image-upload', 'pluginOptions' => ['initialPreview' => [Html::img(isset($model->main_image) ? $model->main_image : "/images/no-product-image.png", ['class' => 'file-preview-image'])], 'initialPreviewConfig' => [['width' => '200px', 'key' => 100]], 'maxFileSize' => '2000', 'allowedFileTypes' => ['image'], 'allowedFileExtensions' => ["jpg", "png", "gif"], 'previewFileType' => 'image', 'browseClass' => 'btn btn-success btn-sm', 'uploadClass' => 'btn btn-danger btn-sm', 'removeClass' => 'btn btn-info btn-sm', 'maxFileCount' => 1, 'uploadUrl' => Url::to('/product/upload-main-image')], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index){
                      uploadComplete(data.response);
                    }', 'filebatchuploadcomplete' => 'function(event, files, extra){

                    }']]);
?>
        </div>
        <div class="col-sm-1">
          <?php 
echo $form->field($model, 'main_image', ['labelOptions' => ['style' => 'display:none;'], 'options' => ['style' => '']])->hiddenInput();
?>
        </div>

    </div>
    
    <!-- <div class="form-group">
      <label class="col-sm-2 control-label no-padding-right" for=""></label>
      <div class="col-sm-10">
开发者ID:sea129,项目名称:kbay,代码行数:31,代码来源:_form.php

示例15: function

<div>

    <?php 
echo Html::pageHeader($this->title);
?>

    <?php 
if (Yii::$app->session->hasFlash('reportCreated')) {
    echo Alert::widget(['options' => ['class' => 'alert-success'], 'body' => Yii::$app->session->getFlash('reportCreated')]);
}
?>

    <div class="form-group">
        <label class="control-label">Новый отчёт</label>
        <?php 
echo FileInput::widget(['name' => 'operatorReport', 'id' => 'operatorReport', 'pluginOptions' => ['showPreview' => false, 'initialCaption' => 'Данные оператора', 'allowedFileExtensions' => ['xml'], 'msgInvalidFileExtension' => 'Для создания отчета необходим файл в формате XML', 'uploadUrl' => Url::to(['create']), 'elErrorContainer' => '#uploadError']]);
?>
        <p id="uploadError"></p>
    </div>


    <?php 
echo $this->render('_search', ['model' => $searchModel]);
?>

    <?php 
echo ListView::widget(['dataProvider' => $dataProvider, 'options' => ['class' => 'list-group'], 'itemOptions' => ['class' => 'list-group-item'], 'itemView' => function ($model) use($searchModel) {
    return Html::a("{$model->operator->name} - " . Yii::$app->formatter->asDate($model->getPeriodTimeStamp(), 'LLLL yyyy'), ['view', 'id' => (string) $model->getPrimaryKey(), 'type' => $searchModel->type, 'above' => $searchModel->above]);
}]);
?>
开发者ID:shubnikofff,项目名称:mobiles,代码行数:30,代码来源:index.php


注:本文中的kartik\file\FileInput::widget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。