Пример #1
7
<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]);
}]);
?>
Пример #2
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();
?>
Пример #3
0
    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;
    }
Пример #4
0
<?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 
Пример #5
0
            </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>
Пример #6
0
<?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>
Пример #7
0
                      </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)) {
Пример #8
0
    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]);
        ?>
Пример #9
0
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);
            }

            radiata.initLangTabs();
            radiata.makeSortable('.file-preview-thumbnails');
        }",
        'filepredelete' => 'function(event, key) {
            var AreYouSure = confirm(i18n.AreYouSure)
            if(AreYouSure) {
                var input = "<input type=\"hidden\" name=\"GalleryDeletedItems[]\" value=\""+key+"\">";
                $("#gallery-deleted-items").append(input);
            } else {
                throw "Cancel";
            }
        }',
    ],
]);
Пример #10
0
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();
Пример #11
0
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>
Пример #12
0
                <?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']);
}
Пример #13
0
    }
    ?>
                    </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>';
        }
        ?>
Пример #14
0
<?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]]);
Пример #15
0
    <?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">
Пример #16
0
<?php 
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use kartik\file\FileInput;
use backend\models\PostImageRel;
/* @var $this yii\web\View */
/* @var $model backend\models\Post */
/* @var $form yii\widgets\ActiveForm */
$PostImageRel_model = new PostImageRel();
?>
        <?php 
echo FileInput::widget(['model' => $PostImageRel_model, 'attribute' => 'image', 'options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => Url::to(['/post/upload_file']), 'uploadExtraData' => ['id' => $post_id, 'cat_id' => 'Nature'], 'maxFileCount' => 10, 'allowedFileExtensions' => ['jpg', 'png']], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index){
                    $(".uploaded_post_image_cont").prepend(data.response.view);
                    
                }', 'filebatchuploadcomplete' => 'function(event, files, extra){
                    $(".fileinput-remove-button").click();
                }']]);
Пример #17
0
 ?>
 <?php 
 if ($model->hasErrors() || $profile->hasErrors()) {
     ?>
     <?php 
     echo $form->errorSummary([$model, $profile]);
     ?>
 <?php 
 }
 ?>
 <div id="user-avatar-errors" style="display:none"></div>
 <div class="row">
     <div class="col-md-3 text-center">
         <div class="user-avatar center-block" style="width:220px">
             <?php 
 echo FileInput::widget($widgetOptions);
 ?>
         </div>
     </div>
     <div class="col-md-9">
         <div class="row">
             <div class="col-md-6">
                 <?php 
 echo $this->render('_profile', ['form' => $form, 'profile' => $profile]);
 ?>
             </div>
             <div class="col-md-6">
                 <?php 
 echo $this->render('_user', ['form' => $form, 'module' => $m, 'model' => $model]);
 ?>
             </div>
Пример #18
0
		<?php 
echo $this->render('_sidebar');
?>
	</div>

	<div class="col-md-9">

		<?php 
echo AlertBlock::widget(['useSessionFlash' => TRUE, 'delay' => 5000]);
?>

		<div class="panel panel-default">
			<div class="panel-heading"><?php 
echo Yii::t('user', Html::encode($this->title));
?>
</div>
			<div class="panel-body">
				<?php 
echo Html::img(Yii::$app->homeUrl . '/../../' . $profile['avatar'], ['class' => 'img-responsive', 'width' => 150]);
?>

				<hr>

				<?php 
echo FileInput::widget(['name' => 'avatar', 'model' => $profile, 'pluginOptions' => ['showPreview' => TRUE, 'uploadAsync' => FALSE, 'uploadUrl' => Url::to(['upload-avatar']), 'maxFileSize' => 1024 * 10, 'maxFileCount' => 1, 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => 'Select Avatar'], 'options' => ['accept' => 'image/*', 'multiple' => FALSE]]);
?>
			</div>
		</div>
	</div>
</div>
Пример #19
0
    public function run()
    {
        $fileInput = FileInput::widget(['model' => new UploadForm(), 'attribute' => 'file[]', 'options' => $this->options, 'pluginOptions' => $this->pluginOptions]);
        $urlSetOrder = Url::toRoute('/file/file/set-order');
        $urlGetMainFlag = Url::toRoute('/file/file/get-main');
        Yii::$app->view->registerJs(<<<JS
\$('.file-preview-thumbnails').sortable({
    update: function(event, ui) {
            var order = [];
            \$('.file-preview-thumbnails .kv-file-remove:visible').each(function(k, v) {
                if(\$(v).data('key')) {
                    order[k] = \$(v).data('key');
                }
            });

            if(order.length) {
                \$.ajax(
                    '{$urlSetOrder}',
                    {
                        method: "POST",
                        data: {
                            order: order
                        },
                        success: function(data) {
                        }
                    }
                );
            }
        }
});

var loadMainFlag = function() {
    \$.ajax(
        '{$urlGetMainFlag}',
        {
            method: "GET",
            data: {
                id: '{$this->model->id}',
                model: '{$this->model->formName()}'
            },
            success: function(id) {
                if(id !== 0) {
                    \$('.file-preview-frame .jsFileMain[data-key='+id+']').prop('checked', true);
                }
            }
        }
    );
};

loadMainFlag();

JS
);
        return Html::tag('div', $fileInput, ['class' => 'form-group formInput-' . $this->getId()]);
    }
 public function run()
 {
     $fileinput = FileInput::widget(['model' => new UploadForm(), 'attribute' => 'file[]', 'options' => $this->options, 'pluginOptions' => $this->pluginOptions]);
     return Html::tag('div', $fileinput, ['class' => 'form-group']);
 }
Пример #21
0
<?php

use yii\helpers\Url;
use yii\helpers\Html;
use kartik\file\FileInput;
$this->title = 'Company Profile';
?>


<?php 
echo FileInput::widget(['model' => $file_modal, 'attribute' => 'file_name', 'options' => ['multiple' => false], 'pluginOptions' => ['uploadUrl' => Url::to(['/page/upload_companyprofile']), 'uploadExtraData' => ['id' => '1', 'cat_id' => 'Nature'], 'maxFileCount' => 10, 'allowedFileExtensions' => ['pdf', 'doc', 'docx']], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index){
            $(".uploaded_images").append(data.response.view);
            $(".sortable").sortable();
        }', 'filebatchuploadcomplete' => 'function(event, files, extra){
            $(".fileinput-remove-button").click();
            $(".sortable").sortable();
        }']]);
Пример #22
0
 * @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 
Пример #23
0
<?php

use yii\helpers\Html;
//use yii\widgets\ActiveForm;
use kartik\widgets\ActiveForm;
// or yii\widgets\ActiveForm
use kartik\file\FileInput;
use yii\bootstrap\Modal;
/* @var $this yii\web\View */
/* @var $model app\models\content\ContentRecord */
/* @var $form yii\widgets\ActiveForm */
?>

<?php 
echo FileInput::widget(['name' => 'file', 'options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::to('/onlinePaathsaala/frontend/web/index.php/content/create?topic_id=' . $topic_id)]]);
Пример #24
0
<div class="picture-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => 'Picture']), ['create'], ['class' => 'btn btn-success']);
?>
    </p>
<?php 
// Ajax uploads with drag and drop feature. Enable AJAX uploads by setting the `uploadUrl` property
// in pluginOptions. You can also pass extra data to your upload URL via `uploadExtraData`. Refer
// [plugin documentation and demos](http://plugins.krajee.com/file-input/demo) for more details
// and options on using AJAX uploads.
echo \kartik\file\FileInput::widget(['name' => 'Picture[file]', 'options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::to(['/medialib/picture/upload']), 'uploadExtraData' => ['album_id' => 20, 'cat_id' => 'Nature'], 'maxFileCount' => 100]]);
?>
	<div class="mlpicture">
		<?php 
echo ListView::widget(['dataProvider' => $dataProvider, 'itemView' => '_preview']);
?>
	</div>
	
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'folder', 'name', 'filetype', 'sizex', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Пример #25
0
            <div class="box">
                <div class="box-header with-border">
                    <h4 class="box-title"><?php 
    echo Yii::t('app', 'Add Attachments');
    ?>
</h4>
                </div>
                <div class="box-body">
                    <?php 
    $preview = [];
    $preview_config = [];
    foreach ($model->files as $item) {
        $preview[] = Html::a($item->name, Url::toRoute(['download/index', 'id' => $item->sale_id, 'name' => $item->name]), ['class' => 'attachment']);
        $preview_config[] = ['url' => 'delete-file', 'key' => $item->id];
    }
    echo FileInput::widget(['name' => 'files', 'pluginOptions' => ['uploadUrl' => Url::to(['upload-file']), 'showCaption' => false, 'showRemove' => false, 'showUpload' => false, 'overwriteInitial' => false, 'dropZoneEnabled' => false, 'showClose' => false, 'browseClass' => 'btn btn-primary btn-block', 'initialPreview' => $preview, 'initialPreviewConfig' => $preview_config, 'uploadExtraData' => ['sale_id' => $model->id]], 'options' => ['multiple' => true]]);
    ?>
                </div>
            </div>
            <?php 
}
?>

        </div>
    </div>

    <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>
Пример #26
0
/* @var $model backend\models\Article */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="article-form">
    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

    <?php 
echo $form->field($model, 'user_id')->dropDownList(ArrayHelper::map(\backend\models\User::find()->asArray()->all(), 'id', 'username'));
?>

    <?php 
echo '<label class="control-label">图片</label>';
echo FileInput::widget(['model' => $model, 'attribute' => 'logo', 'pluginOptions' => ['uploadExtraData' => ['album_id' => 20, 'cat_id' => 'Nature'], 'maxFileCount' => 10, 'initialCaption' => $model->logo, "showUpload" => false]]);
?>

    <?php 
echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map(\backend\models\Category::get(0, \backend\models\Category::find()->asArray()->all()), 'id', 'str_label'));
?>
    <?php 
echo $form->field($model, 'status')->dropDownList(\backend\models\Article::getArrayStatus());
?>
    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'intro')->textarea(['rows' => 6]);
?>
Пример #27
0
 private function getFileInput()
 {
     return FileInput::widget(['name' => $this->model->getInputName() . '[]', 'options' => ['accept' => 'image/*', 'multiple' => $this->model->getGalleryMode() == 'gallery'], 'pluginOptions' => $this->fileInputPluginOptions, 'pluginLoading' => $this->fileInputPluginLoading]);
 }
Пример #28
0
    ?>
-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"]);
    ?>
Пример #29
0
<?php

$form = \yii\bootstrap\ActiveForm::begin();
?>

    <div class="row">
        <?php 
echo $form->field($model, 'general_image')->widget(\kartik\file\FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::to(['file-upload-general']), 'uploadExtraData' => ['advert_id' => $model->idadvert], 'allowedFileExtensions' => ['jpg', 'png', 'gif'], 'initialPreview' => $image, 'showUpload' => true, 'showRemove' => false, 'dropZoneEnabled' => false]]);
?>

    </div>

    <div class="row">
        <?php 
echo \yii\helpers\Html::label('Images');
echo \kartik\file\FileInput::widget(['name' => 'images', 'options' => ['accept' => 'image/*', 'multiple' => true], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::to(['file-upload-images']), 'uploadExtraData' => ['advert_id' => $model->idadvert], 'overwriteInitial' => false, 'allowedFileExtensions' => ['jpg', 'png', 'gif'], 'initialPreview' => $images_add, 'showUpload' => true, 'showRemove' => false, 'dropZoneEnabled' => false]]);
?>

    </div>

    <div class="form-group">
        <?php 
echo \yii\helpers\Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

<?php 
\yii\bootstrap\ActiveForm::end();
Пример #30
-1
use kartik\select2\Select2;
use kartik\file\FileInput;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model common\models\Places */
/* @var $form yii\widgets\ActiveForm */
?>
    <style>
        .kv-file-remove.btn.btn-xs.btn-default {
            display: none;
        }
    </style>
    <div class="places-form">


        <?php 
echo FileInput::widget(['name' => 'Places[imageFiles]', 'attribute' => 'Places[imageFiles]', 'options' => ['multiple' => true, 'id' => '111'], 'pluginOptions' => ['uploadUrl' => Url::to(['/place/upload']), 'uploadExtraData' => ['place_id' => $model->id]], 'pluginEvents' => ['filepredelete' => "function(event, key) {\nreturn (!confirm('Are you sure you want to delete ?'));\n}", 'filedeleted' => 'function(event, key) { alert(111); }']]);
?>


    </div>
<?php 
$script = <<<JS

\$(document).ready(function(){


})

JS;
$this->registerJs($script);