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


PHP FileInput::widget方法代码示例

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


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

示例1: init

 public function init()
 {
     echo Html::activeHiddenInput($this->model, $this->attribute, $this->options);
     echo Html::error($this->model, $this->attribute, $this->options);
     $id = Html::getInputId($this->model, $this->attribute);
     echo FileInput::widget(['name' => 'file', 'options' => ['accept' => 'image/*', 'multiple' => false], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index) {
                 $("#' . $id . '").val(data.response.url);
             }'], 'pluginOptions' => ['initialPreview' => $this->model->{$this->attribute} ? [Html::img($this->model->{$this->attribute}, ['class' => 'file-preview-image'])] : false, 'maxFileCount' => 1, 'minFileCount' => 1, 'previewFileType' => 'image', 'multiple' => false, 'showPreview' => true, 'showUploadedThumbs' => false, 'uploadUrl' => \yii\helpers\Url::to(['/system/image/upload'])]]);
     parent::init();
 }
开发者ID:oyoy8629,项目名称:yii-core,代码行数:10,代码来源:VipFileInput.php

示例2: run

    public function run()
    {
        if ($imageUrl = $this->model->getFileUrl($this->attribute)) {
            ?>
            <div class="file-input">
                <div class="file-preview">
                    <div class="file-preview-thumbnails">
                        <div class="file-preview-frame">
                            <?php 
            echo Html::img($imageUrl, ['class' => 'file-preview-image', 'alt' => \Yii::t('gromver.platform', 'File not found.')]);
            ?>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        <?php 
        }
        if ($imageUrl == null) {
            // to show FileInput only for new upload
            echo KartikFileInput::widget(['model' => $this->model, 'attribute' => $this->attribute, 'options' => $this->options, 'pluginOptions' => $this->pluginOptions]);
        } else {
            FileInputAsset::register($this->getView());
            ?>
            <div class="file-input">
                <div class="input-group">
                    <div class="form-control file-caption ">
                        <span class="glyphicon glyphicon-file"></span> <span class="file-caption-name"><?php 
            echo $this->model->getFileName($this->attribute);
            ?>
</span>
                    </div>
                    <div class="input-group-btn">
                        <?php 
            echo Html::a('Remove Image', [$this->deleteAction, 'pk' => $this->model->getPrimaryKey(), 'attribute' => $this->attribute], ['class' => 'btn btn-danger', 'data-method' => 'post']);
            ?>
                    </div>
                </div>

            </div>
        <?php 
        }
    }
开发者ID:gromver,项目名称:yii2-platform,代码行数:43,代码来源:FileInput.php

示例3:

     // Выключатель
     echo "<div class='{$class}'><div>" . Html::activeLabel($model, $option, ['class' => 'control-label', 'id' => 'document-option_' . $i]) . "</div><div>" . Html::activeCheckbox($model, 'option_' . $i, ['label' => null]) . "</div><div class='help-block'>" . $error . "</div></div>";
     break;
 case 5:
     // Текст
     echo "<div class='{$class}'><div>" . Html::activeLabel($model, $option, ['class' => 'control-label']) . "</div><div>" . Html::activeTextarea($model, $option, $options_attributes) . "</div><div class='help-block'>" . $error . "</div></div>";
     break;
 case 6:
     // Файл (выбор)
     echo "<div class='{$class}'><div>" . Html::activeLabel($model, $option, ['class' => 'control-label']) . "</div><div>" . InputFile::widget(['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'template' => '<div class="input-group">
                                     {input}<span class="input-group-btn">{button}</span>
                                 </div>', 'options' => $options_attributes, 'buttonOptions' => ['class' => 'btn btn-default'], 'buttonName' => 'Выбрать файл', 'name' => 'Document[option_' . $i . ']', 'value' => $model->{$option}]) . "</div><div class='help-block'>" . $error . "</div></div>";
     break;
 case 7:
     // Изображение (загрузка)
     echo "<div class='{$class}'>" . Html::activeLabel($model, $option, ['class' => 'control-label']) . FileInput::widget(['model' => $model, 'attribute' => $option_file, 'pluginOptions' => ['browseClass' => 'btn btn-default', 'browseLabel' => 'Загрузить файл', 'removeLabel' => 'Удалить', 'removeClass' => 'btn btn-default', 'browseIcon' => '', 'removeIcon' => '', 'showUpload' => false]]) . Html::activeHiddenInput($model, $option_file, $options_attributes);
     if (!$model->isNewRecord && $model->{$option} && $model->last_template_id == $model->template_id) {
         echo Html::img($model->{$option}, ['class' => 'doc_img img-thumbnail']) . "<p>" . Html::a('Удалить изображение', ['/document/deleteimg', 'document_id' => $model->id, 'option_id' => $i], ['class' => 'lnk delete_photo']) . "</p>";
     }
     echo "<div class='help-block'>" . $error . "</div></div>";
     break;
 case 8:
     // Список дочерних документов
     echo "<div class='{$class}'>" . Html::activeLabel($model, $option, ['class' => 'control-label']) . Select2::widget(['model' => $model, 'attribute' => $option, 'data' => Document::getChilds($template->{$option_param}, true), 'options' => ['placeholder' => ''], 'pluginOptions' => $options_attributes]) . "<div class='help-block'>" . $error . "</div></div>";
     break;
 case 9:
     // Список потомков документов
     echo "<div class='{$class}'>" . Html::activeLabel($model, $option, ['class' => 'control-label']) . Select2::widget(['model' => $model, 'attribute' => $option, 'data' => Document::getChilds($template->{$option_param}, false), 'options' => ['placeholder' => ''], 'pluginOptions' => $options_attributes]) . "<div class='help-block'>" . $error . "</div></div>";
     break;
 case 10:
     // Список пользователя
开发者ID:darkffh,项目名称:yii2-lowbase,代码行数:31,代码来源:_option.php

示例4: uniqid

    <div class="col-sm-8 col-xs-6 media-library-window-items">
        <h4>Библиотека медиафайлов</h4>
        <?php 
$field_id = uniqid("field");
$options = ['name' => 'files', 'id' => $field_id, 'options' => ['multiple' => true], 'pluginOptions' => ['uploadAsync' => true, "previewFileType" => "image", 'id' => uniqid("field"), "showClose" => false, "showPreview" => false, "showCaption" => false, "showUpload" => false, "browseClass" => "btn btn-primary btn-sm", "browseLabel" => "Добавить файлы", "layoutTemplates" => ["footer" => "", "main2" => '{browse}'], "overwriteInitial" => true, "uploadExtraData" => ['name' => 'files'], "removeClass" => "btn btn-danger btn-sm", "removeLabel" => "", "removeIcon" => "<i class=\"fa fa-trash\"></i>", "previewSettings" => ["image" => ["width" => "auto", "height" => "50px"]], 'uploadUrl' => \yii\helpers\Url::toRoute(['/media/default/upload']), "allowedPreviewTypes" => ['image'], "dropZoneEnabled" => false], 'pluginEvents' => ['filebatchselected' => "function(event, files) {\n            \$.fancybox.showLoading();\n            \$('#" . $field_id . "').fileinput('upload');\n        }", "filebatchuploadcomplete" => "function(event, files, extra) {\n            \$.fancybox.hideLoading();\n            \$.pjax.reload('#window-media-items', {push:false, pushState: false, url : '/backend/media/default/wysiwyg-window'});\n        }"]];
echo \kartik\widgets\FileInput::widget($options);
?>
<br>
        <?php 
\yii\widgets\Pjax::begin(['id' => 'window-media-items', 'enablePushState' => false]);
?>
        <?php 
echo \yii\widgets\ListView::widget(['layout' => "<div class='clearfix'>{items}</div>\n{pager}", 'dataProvider' => $dataProvider, 'pager' => ['options' => ['class' => 'pagination pagination-sm'], 'maxButtonCount' => 3], 'itemOptions' => ['class' => 'media-item col-lg-1 col-md-2 col-sm-2 col-xs-6', 'data-url' => \yii\helpers\Url::toRoute(['window'])], 'itemView' => function ($model, $key, $index, $widget) {
    $image = false;
    if (lenarx\media\models\Media::isImage($model->mime_type)) {
        $image = true;
    }
    $model->data = $model->data ? unserialize($model->data) : [];
    $filesize = lenarx\media\helpers\MediaLib::filesize_formatted($model->data['size']);
    return $this->render('media-item', ['model' => $model, 'image' => $image, 'filesize' => $filesize]);
}]);
?>
        <?php 
\yii\widgets\Pjax::end();
?>
    </div>
    <div class="col-sm-4 col-xs-6 media-library-insert">
        <div class="media-insert hide">
            <div class="block info">
                <h4>Параметры файла</h4>
                <p class="filename">Weddell-Sea-Antarctica.jpg</p>
开发者ID:lenarx,项目名称:yii2-cms-media,代码行数:31,代码来源:media-library.php

示例5: getItem

 /**
  * @param null $options
  * @param null $pluginOptions
  *
  * @return string
  * @throws \Exception
  */
 public function getItem($options = null, $pluginOptions = null)
 {
     switch ($this->type) {
         case self::TYPE_TEXT:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_EMAIL:
             return Html::input('email', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_NUMBER:
             return Html::input('number', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_TEXTAREA:
             return Html::textarea('Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
         case self::TYPE_COLOR:
             return ColorInput::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'options' => $options != null ? $options : ['class' => 'form-control']]);
         case self::TYPE_DATE:
             return DatePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['format' => 'yyyy-mm-dd', 'todayHighlight' => true]]);
         case self::TYPE_TIME:
             return TimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['minuteStep' => 1, 'showSeconds' => true, 'showMeridian' => false]]);
         case self::TYPE_DATETIME:
             return DateTimePicker::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['format' => 'yyyy-mm-dd H:i:s', 'todayHighlight' => true]]);
         case self::TYPE_PASSWORD:
             return PasswordInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['showMeter' => true, 'toggleMask' => false]]);
         case self::TYPE_ROXYMCE:
             return RoxyMceWidget::widget(['id' => 'Setting_' . $this->code, 'name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'action' => Url::to(['roxymce/default']), 'options' => $options != null ? $options : ['title' => $this->getName()], 'clientOptions' => $pluginOptions != null ? $pluginOptions : []]);
         case self::TYPE_SELECT:
             return Select2::widget(['value' => $this->value, 'name' => 'Setting[' . $this->code . ']', 'data' => $this->getStoreRange(), 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_MULTI_SELECT:
             $options['multiple'] = true;
             if (!isset($options['class'])) {
                 $options['class'] = 'form-control';
             }
             return Select2::widget(['name' => 'Setting[' . $this->code . ']', 'value' => explode(",", $this->value), 'data' => $this->getStoreRange(), 'options' => $options, 'pluginOptions' => ['allowClear' => true]]);
         case self::TYPE_FILE_PATH:
             $value = Yii::getAlias($this->store_dir) . DIRECTORY_SEPARATOR . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control', 'multiple' => false], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreview' => !$this->isNewRecord ? [$this->value] : []]]);
         case self::TYPE_FILE_URL:
             $value = $this->store_url . '/' . $this->value;
             return FileInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $value, 'options' => $options != null ? $options : ['class' => 'form-control'], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['previewFileType' => 'any', 'showRemove' => false, 'showUpload' => false, 'initialPreviewAsData' => true, 'initialPreviewFileType' => self::fileType(pathinfo($this->value, PATHINFO_EXTENSION)), 'initialPreview' => !$this->isNewRecord ? $value : [], 'initialCaption' => $this->value]]);
         case self::TYPE_PERCENT:
             return RangeInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $this->value, 'html5Options' => ['min' => 0, 'max' => 100, 'step' => 1], 'options' => $options != null ? $options : ['class' => 'form-control'], 'addon' => ['append' => ['content' => '%']]]);
         case self::TYPE_SWITCH:
             $selector = explode(',', $this->store_range);
             if (count($selector) != 2) {
                 throw new ErrorException(Yii::t('setting', 'Switch Field should have store with 2 value, and negative is first. Example: no,yes'), 500);
             }
             return Html::hiddenInput('Setting[' . $this->code . ']', $selector[0]) . SwitchInput::widget(['name' => 'Setting[' . $this->code . ']', 'value' => $selector[1], 'containerOptions' => ['class' => 'nv-switch-container'], 'options' => $options != null ? $options : [], 'pluginOptions' => $pluginOptions != null ? $pluginOptions : ['state' => $this->value == $selector[1], 'size' => 'small', 'offText' => ucfirst($selector[0]), 'onText' => ucfirst($selector[1])]]);
         case self::TYPE_CHECKBOX:
             $random = rand(1000, 9999);
             return Html::checkboxList('Setting[' . $this->code . ']', explode(",", $this->value), $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list checkbox', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::checkbox($name, $checked, ['id' => 'Setting_checkbox_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_checkbox_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_RADIO:
             $random = rand(1000, 9999);
             return Html::radioList('Setting[' . $this->code . ']', $this->value, $this->getStoreRange(), $options != null ? $options : ['class' => 'nv-checkbox-list radio', 'item' => function ($index, $label, $name, $checked, $value) use($random) {
                 $html = Html::beginTag('div');
                 $html .= Html::radio($name, $checked, ['id' => 'Setting_radio_' . $label . '_' . $index . '_' . $random, 'value' => $value]);
                 $html .= Html::label($label, 'Setting_radio_' . $label . '_' . $index . '_' . $random);
                 $html .= Html::endTag('div');
                 return $html;
             }]);
         case self::TYPE_SEPARATOR:
             return '<hr>';
         default:
             return Html::input('text', 'Setting[' . $this->code . ']', $this->value, $options != null ? $options : ['placeholder' => $this->getName(), 'class' => 'form-control']);
     }
 }
开发者ID:navatech,项目名称:yii2-setting,代码行数:76,代码来源:Setting.php

示例6:

    <?php 
echo Html::hiddenInput('sliderId', $slider->id);
?>

    <?php 
if ($slider->hasErrors()) {
    //it is necessary to see all the errors for all the files. @todo Show growl message
    echo '<pre>';
    print_r($slider->getErrors());
    echo '</pre>';
}
?>

    <?php 
echo FileInput::widget(['id' => 'file-upload', 'name' => 'ImageUploadForm[images][]', 'options' => ['multiple' => true, 'style' => 'margin-bottom: 30px'], 'pluginOptions' => ['previewFileType' => 'any', 'mainClass' => 'input-group-lg', 'uploadUrl' => Url::to(['/sliders/images/upload']), 'maxFileCount' => 100, 'overwriteInitial' => false, 'uploadAsync' => false, 'dropZoneTitle' => Yii::t('app', 'Drag & drop files here ...'), 'fileActionSettings' => ['uploadClass' => 'hide', 'removeTitle' => Yii::t('app', 'Remove file'), 'uploadTitle' => Yii::t('app', 'Upload file'), 'indicatorNewTitle' => Yii::t('app', 'Not uploaded yet'), 'indicatorSuccessTitle' => Yii::t('app', 'Uploaded'), 'indicatorErrorTitle' => Yii::t('app', 'Upload Error'), 'indicatorLoadingTitle' => Yii::t('app', 'Uploading ...')], 'browseLabel' => Yii::t('app', 'Browse'), 'removeLabel' => Yii::t('app', 'Remove'), 'removeTitle' => Yii::t('app', 'Remove selected files'), 'uploadLabel' => Yii::t('app', 'Upload'), 'uploadTitle' => Yii::t('app', 'Upload selected files'), 'cancelLabel' => Yii::t('app', 'Cancel')]]);
?>

    <?php 
ActiveForm::end();
?>

    <?php 
// Title
?>
    <h1>
        <?php 
echo $this->title;
?>
        <?php 
// Buttons
开发者ID:infoweb-internet-solutions,项目名称:yii2-cms-sliders,代码行数:30,代码来源:index.php

示例7: UploadForm

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

    <?php 
$image = new UploadForm();
?>

<!--    --><?php 
//echo $form->field($image, 'file')->fileInput()->label('Upload image')
?>
    <div class="row">
        <div class="col-xs-4">
            <?php 
echo '<label>Лого</label>';
echo FileInput::widget(['model' => $image, 'attribute' => 'file', 'options' => ['multiple' => false], 'pluginOptions' => ['showPreview' => false, 'showCaption' => true, 'showRemove' => true, 'showUpload' => false]]);
?>
        </div>
        <?php 
if ($model->name != Yii::$app->params['main-team']) {
    echo Html::tag('div', $form->field($model, 'name')->textInput(['maxlength' => true, 'placeholder' => 'Введите имя команды...']), ['class' => 'col-xs-4']);
}
?>
        <div class="col-xs-4">
            <?php 
echo $form->field($model, 'slug')->textInput(['maxlength' => true, 'placeholder' => 'Введите Url...']);
?>
        </div>
    </div>

开发者ID:kusma007,项目名称:one-advanced,代码行数:29,代码来源:_form.php

示例8: rgb

                        <?php 
echo Html::img('@web/images/' . $profile->name, ['class' => 'img-responsive', 'style' => "text-shadow: none; font-size: 80px; color: rgb(255, 255, 255); height: 136px; width: 136px; line-height: 136px; border-radius: 50%; text-align: center; background-color: rgb(12, 27, 38);", 'data-toggle' => 'modal', 'data-target' => '#myModal']);
?>
                    </div>
                    <div class="modal fade" id="myModal" role="dialog">
                        <div class="modal-dialog">

                            <!-- Modal content-->
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                                    <h4 class="modal-title">Upload Profile Picture</h4>
                                </div>
                                <div class="modal-body">
                                    <?php 
echo FileInput::widget(['name' => 'file', 'options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::to('/onlinePaathsaala/frontend/web/index.php/user/admin/updatefromuser')]]);
?>
                                </div>
                            </div>

                        </div>
                    </div>
                    <!--/.Avatar-->

                    <!--Content-->
                    <div class="col-sm-9">
                        <h5 class="author-name"><?php 
echo Html::encode($profile->user->username);
?>
</h5>
开发者ID:KhemPoudel,项目名称:onlinePaathsaala,代码行数:30,代码来源:show.php

示例9:

echo $form->field($model, 'target')->dropDownList(\app\models\Banner::$targets);
?>
        </div>
    </div>

    <?php 
foreach (\app\models\Property::getLanguages() as $lang) {
    ?>
        <div class="row">
            <div class="col-lg-6">
                <label>Image <?php 
    echo $lang;
    ?>
</label>
                <?php 
    echo FileInput::widget(['name' => 'image_' . $lang, 'options' => ['multiple' => false, 'accept' => 'image/*'], 'pluginOptions' => ['showUpload' => false]]);
    ?>

            </div>
            <div class="col-lg-6">
                <?php 
    if (!$model->isNewRecord) {
        $img = $model->getImage($lang);
        ?>
                    <?php 
        echo !empty($img) ? Html::img($img, ['style' => 'max-width:100%;']) : '';
        ?>
                <?php 
    }
    ?>
                <span>&nbsp;</span>
开发者ID:rcjusto,项目名称:simplestore,代码行数:31,代码来源:_form.php

示例10:

    <?php 
echo Html::hiddenInput('sliderId', $slider->id);
?>

    <?php 
if ($slider->hasErrors()) {
    //it is necessary to see all the errors for all the files. @todo Show growl message
    echo '<pre>';
    print_r($slider->getErrors());
    echo '</pre>';
}
?>

    <?php 
echo FileInput::widget(['name' => 'ImageUploadForm[images][]', 'options' => ['multiple' => true], 'pluginOptions' => ['previewFileType' => 'any', 'mainClass' => 'input-group-lg', 'browseLabel' => Yii::t('app', 'Browse'), 'removeLabel' => Yii::t('app', 'Remove'), 'removeTitle' => Yii::t('app', 'Remove selected files'), 'uploadLabel' => Yii::t('app', 'Upload'), 'uploadTitle' => Yii::t('app', 'Upload selected files'), 'cancelLabel' => Yii::t('app', 'Cancel')]]);
?>

    <?php 
ActiveForm::end();
?>

    <?php 
// Title
?>
    <h1>
        <?php 
echo $this->title;
?>
        <?php 
// Buttons
开发者ID:highestgoodlikewater,项目名称:yii2-cms-sliders,代码行数:30,代码来源:index.php

示例11: calculatePositions

                <?php 
if ($model->isNewRecord) {
    ?>
                    <div class="alert alert-info alert-dismissible" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <?php 
    echo Module::t('default', 'ATTENTION_SAVE_MODEL');
    ?>
                    </div>
                <?php 
} else {
    ?>
                    <?php 
    echo FileInput::widget(['name' => 'files[]', 'language' => Yii::$app->language, 'options' => ['multiple' => true, 'accept' => 'image/*'], 'pluginOptions' => ['uploadAsync' => true, 'uploadUrl' => Yii::$app->urlManager->createUrl(['/gallery/gallery/upload']), 'uploadExtraData' => ['galleryId' => $model->id]], 'pluginEvents' => ['fileuploaded' => 'function (event, data, previewId, index) {
                                    $("#images").append(data.response.html);

                                    calculatePositions();
                                }']]);
    ?>

                    <div id="images" class="row">
                        <?php 
    if (count($model->files)) {
        foreach ($model->files as $key => $value) {
            echo $this->render('_image', ['model' => $value]);
        }
    }
    ?>
                    </div>
                <?php 
}
开发者ID:sadovojav,项目名称:yii2-gallery-module,代码行数:31,代码来源:_form.php

示例12: function

$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['update', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="document-update">

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

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

    <?php 
echo FileInput::widget(['name' => 'files[]', 'options' => ['multiple' => true], 'pluginOptions' => ['showPreview' => false, 'showRemove' => false, 'uploadUrl' => Url::to(['/document/upload']), 'uploadExtraData' => ['id' => $model->id], 'maxFileCount' => 10], 'pluginEvents' => ['fileuploaded' => 'function() { $.pjax.reload({container:"#attachments-list-pjax"}); }']]);
?>

    <?php 
\yii\widgets\Pjax::begin(['id' => 'attachments-list-pjax']);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => \kotchuprik\sortable\grid\Column::className()], ['attribute' => 'original_name', 'enableSorting' => false], ['attribute' => 'size', 'enableSorting' => false], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}', 'buttons' => ['delete' => function ($url, $model) {
    return Html::tag('span', Html::a('<span class="glyphicon glyphicon-trash"></span>', ['delete-attachment', 'id' => $model->id]));
}]]], 'options' => ['data' => ['sortable-widget' => 1, 'sortable-url' => \yii\helpers\Url::toRoute(['sorting'])]]]);
?>
    <?php 
\yii\widgets\Pjax::end();
?>
</div>
开发者ID:kmolchanov,项目名称:qwintry-test,代码行数:30,代码来源:update.php

示例13:

<?php

use kartik\widgets\FileInput;
use kartik\helpers\Html;
/* @var $this yii\web\View */
?>

<?php 
echo FileInput::widget(['name' => 'attachment_52', 'pluginOptions' => ['browseClass' => 'btn btn-success', 'uploadClass' => 'btn btn-info', 'removeClass' => 'btn btn-danger', 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i> ']]);
开发者ID:santhika29,项目名称:yakes-app,代码行数:9,代码来源:index.php

示例14: renderImportUpload

 /**
  * Renders the import menu
  *
  * @return string the import menu markup
  */
 public function renderImportUpload()
 {
     $modal = Modal::begin(['options' => ['id' => "import-modal"], 'header' => '<h2>' . Yii::t('ltimport', 'Import data') . '</h2>', 'footer' => '<button type="button" class="btn btn-default pull-right" data-dismiss="modal">Close</button>']);
     $form = ActiveForm::begin(['action' => ['import/import'], 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data']]);
     echo Html::hiddenInput('tableName', $this->tableName);
     if ($this->uploadFolderZip) {
         echo Html::label(Yii::t('ltimport', 'Import Zip File')) . '<br>';
         echo \kartik\widgets\FileInput::widget(['name' => 'importFolderZip', 'options' => ['multiple' => false], 'pluginOptions' => ['previewFileType' => 'any']]) . '<br><br>';
     }
     echo Html::label(Yii::t('ltimport', 'Import data in selected format')) . '<br>';
     echo \kartik\widgets\FileInput::widget(['name' => 'importFile', 'options' => ['multiple' => false], 'pluginOptions' => ['previewFileType' => 'any']]) . '<br><br>';
     $form::end();
     Modal::end();
 }
开发者ID:lonelythinker,项目名称:yii2-import,代码行数:19,代码来源:ImportMenu.php

示例15:

	<?php 
/*	
composer
detail view
form builder
*/
// mengunakan modal
//Modal::begin([
// 'header' => '<h4 class="modal-title">Detail View Demo</h4>',
//  'toggleButton' => ['label' => '<i class="glyphicon glyphicon-th-list"></i> Detail View in Modal', 'class' => 'btn btn-primary']
//]);
//use kartik\builder\Form;
//Bulider Standard
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_INLINE]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => $model->FormAttribs]);
ActiveForm::end();
//Bulder Grid
use kartik\builder\FormGrid;
$form = ActiveForm::begin();
echo FormGrid::widget(['model' => $model, 'form' => $form, 'autoGenerateColumns' => true, 'rows' => [['attributes' => ['EMP_ID' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter username...']], 'EMP_NM' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter password...']]]], ['attributes' => ['EMP_ID' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter username...']], 'EMP_NM' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter password...']]]]]]);
ActiveForm::end();
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_INLINE]);
echo Growl::widget(['type' => Growl::TYPE_MINIMALIST, 'title' => 'Kartik Visweswaran', 'icon' => 'http://placeimg.com/200/150/people/2', 'iconOptions' => ['class' => 'img-circle pull-left'], 'body' => 'Momentum reduce child mortality effectiveness incubation empowerment connect.', 'showSeparator' => false, 'delay' => 700, 'pluginOptions' => ['icon_type' => 'image', 'showProgressbar' => false, 'placement' => ['from' => 'top', 'align' => 'right']]]);
ActiveForm::end();
use kartik\widgets\FileInput;
$form = ActiveForm::begin();
echo FileInput::widget(['name' => 'attachment_49[]', 'options' => ['multiple' => true], 'pluginOptions' => ['initialPreview' => [Html::img("http://placeimg.com/200/150/people/1.jpg", ['class' => 'file-preview-image', 'alt' => 'The Moon', 'title' => 'The Moon']), Html::img("http://placeimg.com/200/150/people/2.jpg", ['class' => 'file-preview-image', 'alt' => 'The Earth', 'title' => 'The Earth'])], 'initialPreviewConfig' => ['{caption: "People-1.jpg", width: "20px", url: "/site/file-delete", key: 1}', '{caption: "People-2.jpg", width: "20px", url: "/site/file-delete", key: 2}'], 'initialCaption' => "The Moon and the Earth", 'overwriteInitial' => false]]);
ActiveForm::end();
?>
</div>
开发者ID:ptrnov,项目名称:WND-W,代码行数:30,代码来源:view_2_2.php


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