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


PHP widgets\FileInput类代码示例

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


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

示例1: run

 public function run()
 {
     echo $this->form->field($this->model, $this->attr)->widget(FileInput::classname(), ['options' => ['accept' => ''], 'pluginOptions' => ['showPreview' => false, 'showCaption' => true, 'showRemove' => true, 'showUpload' => false]]);
     if ($this->model->getAttribute($this->attr) !== null) {
         echo '<div class="file-upload-update"><label class="col-sm-2"> </label>' . Html::a($this->model->getAttribute($this->attr), ['/uploads/' . $this->model->getAttribute($this->attr)]) . '</div>';
     }
 }
开发者ID:pipekung,项目名称:yii2-widgets,代码行数:7,代码来源:FileUpload.php

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

示例3: run

 public function run()
 {
     if (isset($this->modelId) && isset($this->model) && !$this->model->isNewRecord) {
         /** @var  $fileModel File*/
         $fileModel = \Yii::createObject(File::className());
         $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
         $files = $fileModel->find()->where(['model' => get_class($this->model), 'model_id' => $this->modelId])->all();
         $initialPreview = $initialPreviewConfig = [];
         foreach ($files as $file) {
             $initialPreview[] = "<img src='" . \Yii::$app->params['imageDomain'] . '/' . $file->url . "' class='file-preview-image'>";
             $initialPreviewConfig[] = ['caption' => $file->name, 'url' => Url::to(['/system/widgets/file-upload/delete', 'id' => $file->file_id])];
         }
         echo $form->field($fileModel, 'files[]')->widget(FileInput::classname(), ['options' => ['multiple' => true], 'pluginOptions' => ['initialPreview' => $initialPreview, 'initialPreviewConfig' => $initialPreviewConfig, 'overwriteInitial' => false, 'uploadUrl' => Url::to(['/system/widgets/file-upload/upload']), 'uploadExtraData' => ['model' => get_class($this->model), 'modelId' => $this->modelId], 'maxFileCount' => 10, 'allowedFileExtensions' => ['jpg', 'gif', 'png']]]);
         $form::end();
     }
 }
开发者ID:shuangjie,项目名称:galaxy,代码行数:16,代码来源:FileUploadWidget.php

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

示例5:

/* @var $model \common\modulse\article\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, 'title')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'image')->widget(FileInput::classname(), ['pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png'], 'language' => 'de', 'showCaption' => false, 'showRemove' => false, 'showUpload' => false, 'browseClass' => 'btn btn-primary btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => 'Select Image', 'initialPreview' => [$model->getImageTag('thumb')]], 'options' => ['accept' => 'image/*']]);
?>

    <?php 
echo $form->field($model, 'content')->widget('common\\widgets\\Redactor');
?>

    <?php 
echo $form->field($model, 'status')->widget(CheckboxX::classname(['initInputType' => CheckboxX::INPUT_CHECKBOX]), ['pluginOptions' => ['threeState' => false]]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('Article', 'Create') : Yii::t('Article', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
开发者ID:mickeyur,项目名称:yii2-article,代码行数:31,代码来源:_form.php

示例6: function

            <?php 
$usr = User::find()->all();
$usrs = ArrayHelper::map($usr, function ($model) {
    return $model->_id->{'$id'};
}, 'username');
echo $form->field($model, 'share_to')->label('Share To')->widget(Select2::classname(), ['data' => $usrs, 'options' => ['placeholder' => 'Select User', 'id' => 'file_id'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
    </div>
    <div class="row">
        <div class="col-md-8">

                    <!--?= $form->field($model, 'file')->fileInput() ?-->
                    <?php 
echo $form->field($model, 'file')->widget(FileInput::classname(), ['options' => ['accept' => 'file/*'], 'pluginOptions' => ['previewFileType' => 'image', 'showUpload' => false]]);
?>
        </div>
        <?php 
$model->status = 1;
?>
    <?php 
echo $form->field($model, 'status')->hiddenInput()->label(false);
?>
    </div>
    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
开发者ID:jaibabu9,项目名称:987654321,代码行数:29,代码来源:_form.php

示例7:

<?php

use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\widgets\ActiveField;
use yii\helpers\ArrayHelper;
use kartik\widgets\FileInput;
$message = '';
?>
<div class="wrapper headline" style="">
    <label class="head">
        <span class="badge">2</span>&nbsp;
        <i class="fa fa-image fa-lg"></i>&nbsp;
        <?php 
echo Yii::t('app', 'Avatar');
?>
    </label>
    <i class="fa fa-chevron-right chevron"></i>
</div>
<div class="wrapper body notshown fadeIn animated" style="border-top:none;">
<?php 
echo $this->render('../_hint.php', ['message' => $message]);
?>
	<?php 
echo $form->field($model, 'user_avatar')->widget(FileInput::classname(), ['options' => ['multiple' => false, 'accept' => 'image/*'], 'pluginOptions' => ['previewFileType' => 'any', 'showCaption' => false, 'showUpload' => false, 'browseClass' => 'btn btn-info shadow', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => Yii::t('app', 'Izaberite profilnu sliku'), 'removeLabel' => Yii::t('app', 'Izbaci'), 'resizeImage' => true, 'maxImageWidth' => 200, 'maxImageHeight' => 200, 'resizePreference' => 'width']]);
echo $this->render('_submitButton.php');
?>
</div>
开发者ID:bokko79,项目名称:servicemapp,代码行数:28,代码来源:avatar.php

示例8:

echo $form->field($model, 'notifications')->checkbox();
?>

                    <div class = 'form-group field-old_avatar'>
                        <div class = "row">
                            <div class="col-xs-12">
                                <label class="control-label" for="old_avatar">Ваш аватар</label>
                            </div>
                        </div>
                        <?php 
echo Html::img($model->fileUrl, ['id' => 'old_avatar', 'width' => 100]);
?>
                    </div>

                    <?php 
echo $form->field($model, 'avatar')->widget(FileInput::className(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['showRemove' => false, 'showUpload' => false]]);
?>

                    <h3>Смена пароля</h3>

                    <?php 
echo $form->field($model, 'password', ['options' => ['class' => 'form-group has-feedback']])->passwordInput(['placeholder' => 'Новый пароль'])->label(false);
?>

                    <?php 
echo $form->field($model, 'password_repeat', ['options' => ['class' => 'form-group has-feedback']])->passwordInput(['placeholder' => 'Повторите пароль'])->label(false);
?>

                    <div class="form-group">
                        <?php 
echo Html::submitButton('Сохранить', ['class' => 'btn btn-primary', 'name' => 'contact-button']);
开发者ID:Andrewkha,项目名称:sportforecast,代码行数:31,代码来源:profile.php

示例9:

<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use kartik\widgets\FileInput;
$this->title = Yii::t('app', 'Загрузка');
?>
<div class="container">
	<div class="col-md-6">
		<?php 
$form = ActiveForm::begin(['class' => 'form-horisontal', 'options' => ['enctype' => 'multipart/form-data']]);
?>
		
		<?php 
echo $form->field($model, 'file')->widget(FileInput::classname(), ['options' => ['multiple' => false, 'accept' => 'image/*'], 'pluginOptions' => ['showPreview' => true, 'showCaption' => true, 'showRemove' => false, 'showUpload' => false]]);
?>
		
		<?php 
echo $form->field($model, 'name');
?>
		
		<?php 
echo $form->field($model, 'tags');
?>
		
		<div class="form-group">
			<div class="col-lg-offset-1 col-lg-11">
				<?php 
echo Html::submitButton(\Yii::t('app', 'Загрузить'), ['class' => 'btn btn-primary', 'name' => 'login-button']);
?>
开发者ID:kazachka,项目名称:photo-yii-site,代码行数:31,代码来源:load.php

示例10:

?>

    <?php 
echo $form->field($model, 'last_staff')->textInput(['maxlength' => true]);
?>

<?php 
echo $form->field($model, 'risk_status')->widget(Select2::classname(), ['data' => ArrayHelper::map(Status::find()->all(), 'STATUS_ID', 'STATUS_NAME'), 'options' => ['placeholder' => 'เลือกสถานะของรายการ ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
   
      </div>  
        <div class="form-group field-upload_files">
      <label class="control-label" for="upload_files[]"> ภาพถ่าย </label>
    <div>
    <?php 
echo FileInput::widget(['name' => 'upload_ajax[]', 'options' => ['multiple' => true, 'accept' => 'image/*'], 'pluginOptions' => ['overwriteInitial' => false, 'initialPreviewShowDelete' => true, 'initialPreview' => $initialPreview, 'initialPreviewConfig' => $initialPreviewConfig, 'uploadUrl' => Url::to(['/priskhead/upload-ajax']), 'uploadExtraData' => ['ref' => $model->ref], 'maxFileCount' => 100]]);
?>
    </div>
    </div>

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

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

</div>
开发者ID:jaradsee,项目名称:faktharm,代码行数:31,代码来源:_form.php

示例11:

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

示例12:

<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
/**
 * @var yii\web\View $this
 * @var common\models\SliderImage $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="slider-image-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['publish_flag' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Опубликовано...']], 'slider' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Слайдер...']], 'href' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Ссылка...', 'maxlength' => 255]], 'body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => \vova07\imperavi\Widget::className(), 'options' => ['settings' => ['toolbarFixed' => false, 'minHeight' => 100]]], 'menu_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('menu_image') ? Html::img($model->getUploadUrl('menu_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]], 'href_enabled_flag' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Показывать кнопку перейти...']], 'created_date' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATE]], 'iframe_href' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Ссылка на iframе(если указан изображения игнорируются)...', 'maxlength' => 255]], 'banner_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('banner_image') ? Html::img($model->getUploadUrl('banner_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]], 'banner_phone_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('banner_phone_image') ? Html::img($model->getUploadUrl('banner_phone_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]], 'banner_tablet_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('banner_tablet_image') ? Html::img($model->getUploadUrl('banner_tablet_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]]]]);
echo Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'style' => 'margin-right: 20px', 'onclick' => 'window.location = "' . Url::to(['index']) . '"']);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 10px', 'name' => 'goto', 'value' => 'list']);
echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 0px']);
ActiveForm::end();
?>

</div>
开发者ID:kibercoder,项目名称:bilious-octo-fibula,代码行数:29,代码来源:_form.php

示例13: isset

use kartik\widgets\FileInput;
use kartik\icons\Icon;
use kartik\popover\PopoverX;
use kartik\password\PasswordInput;
/**
 * @var yii\web\View $this
 * @var common\models\Osusuarios $model
 */
$this->title = $model->usu_nombre;
$this->params['breadcrumbs'][] = ['label' => Yii::t('admin', 'Osusuarios'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $model->usu_nomusu;
?>
<div class="osusuarios-view">
    <!--<div class="page-header">
        <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    </div>-->


    <?php 
echo DetailView::widget(['model' => $model, 'condensed' => false, 'hover' => true, 'mode' => Yii::$app->request->get('edit') == 't' ? DetailView::MODE_EDIT : DetailView::MODE_VIEW, 'panel' => ['heading' => $this->title, 'type' => DetailView::TYPE_INFO], 'formOptions' => ['options' => ['enctype' => 'multipart/form-data']], 'attributes' => [['attribute' => 'uploadedFile', 'format' => 'raw', 'value' => $model->usu_type ? '<a href="#" class="thumbnail">
                        <img src="data:' . $model->usu_type . ';base64,' . base64_encode($model->usu_foto) . '" alt="" class="">
                    </a>' : '<a href="#" class="thumbnail">
                        <img src="' . Yii::$app->params['assetUrl'] . 'images/noavatar_man.png" alt="" class="">
                    </a>', 'type' => DetailView::INPUT_WIDGET, 'widgetOptions' => ['class' => FileInput::classname(), 'pluginOptions' => ['showCaption' => false, 'showRemove' => false, 'showUpload' => false, 'browseClass' => 'btn btn-primary btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => Yii::t('admin', 'Select Photo')], 'options' => ['accept' => 'image/*']]], 'usu_nomusu', 'usu_nombre', ['attribute' => 'usu_feccre', 'format' => ['datetime', isset(Yii::$app->modules['datecontrol']['displaySettings']['datetime']) ? Yii::$app->modules['datecontrol']['displaySettings']['datetime'] : 'd-m-Y H:i:s A'], 'type' => DetailView::INPUT_WIDGET, 'displayOnly' => true, 'widgetOptions' => ['class' => DateControl::classname(), 'type' => DateControl::FORMAT_DATETIME]], ['attribute' => 'usu_ulting', 'format' => ['datetime', isset(Yii::$app->modules['datecontrol']['displaySettings']['datetime']) ? Yii::$app->modules['datecontrol']['displaySettings']['datetime'] : 'd-m-Y H:i:s A'], 'type' => DetailView::INPUT_WIDGET, 'displayOnly' => true, 'widgetOptions' => ['class' => DateControl::classname(), 'type' => DateControl::FORMAT_DATETIME]], ['attribute' => 'usu_activo', 'format' => 'raw', 'value' => $model->usu_activo ? '<span class="label label-success">Activo</span>' : '<span class="label label-danger">Inactivo</span>', 'type' => DetailView::INPUT_SWITCH], ['attribute' => 'usu_ultemp', 'displayOnly' => true]], 'deleteOptions' => ['url' => ['delete', 'id' => $model->usu_id], 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']], 'enableEditMode' => true, 'buttons' => [['label' => Icon::show('key'), 'title' => Yii::t('admin', 'Change Password'), 'html' => PopoverX::widget(['header' => '<i class="glyphicon glyphicon-lock"></i> ' . Yii::t('admin', 'Change Password'), 'placement' => PopoverX::ALIGN_BOTTOM_RIGHT, 'size' => PopoverX::SIZE_LARGE, 'footer' => Html::submitButton(Yii::t('admin', 'Enviar'), ['class' => 'btn btn-sm btn-primary']), 'content' => '<label class="control-label">' . Yii::t('admin', 'Password') . '</label>' . PasswordInput::widget(['model' => $model, 'attribute' => 'passwd']), 'toggleButton' => ['label' => Icon::show('key'), 'class' => 'btn btn-xs btn-info', 'data-toggle' => 'tooltip', 'data-original-title' => Yii::t('admin', 'Change Password')]])]]]);
?>

</div>
开发者ID:orcsis,项目名称:yii2-admin,代码行数:30,代码来源:view.php

示例14: jQuery

    $initialPreview[] = $_preview . Html::hiddenInput($model->formName() . '[' . $property_key . '][]', $file);
    $initialPreviewConfig[] = ['caption' => $file, 'url' => $urlDelete, 'key' => $property_key, 'extra' => ['value' => $file]];
}
$modelArrayMode = $model->setArrayMode(false);
// @TODO: maybe it's a good to replace fileuploaded with fileloaded (and this part of code for it)
//    $_js = <<< 'JSCODE'
//    function(event, file, previewId, index, reader) {
//        var name = file.name;
//        var hi = $('<input type="hidden" name="%s" />').val(name);
//        $('div.file-preview-frame[title="'+name+'"]').append(hi);
//    }
//JSCODE;
?>
<div class="file_input_preview">
<?php 
echo $form->field($model, $prop)->widget(\kartik\widgets\FileInput::classname(), ['options' => ['multiple' => $multiple], 'pluginOptions' => ['uploadUrl' => $urlUpload, 'multiple' => $multiple, 'initialPreview' => $initialPreview, 'initialPreviewConfig' => $initialPreviewConfig, 'initialPreviewShowDelete' => true, 'maxFileCount' => $multiple ? 0 : 1, 'showPreview' => true, 'showCaption' => true, 'showRemove' => true, 'showUpload' => true, 'overwriteInitial' => false, 'uploadAsync' => true, 'layoutTemplates' => $layoutTemplates, 'allowedPreviewTypes' => ['image']], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index) {
                    var name = data.files[index]["name"];
                    try {
                        jQuery(".file-thumbnail-footer input[value=\\"" + name + "\\"]")
                            .last()
                            .attr("name", event.target.name)
                            .val(data.response[name]["fileName"]);
                    } catch ($e) {}
                }']]);
?>
</div>
<?php 
$model->setArrayMode($modelArrayMode);
?>

<style>
开发者ID:lzpfmh,项目名称:dotplant2,代码行数:31,代码来源:backend-edit.php

示例15:

      <h4 class="panel-title">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseSix" aria-expanded="false" aria-controls="collapseSix">
          Documenten
        </a>
      </h4>
    </div>
    <div id="collapseSix" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingSix">
      <div class="panel-body">
          
       <div class="panel panel-warning">
  <div class="panel-heading">
    <h3 class="panel-title">Upload documenten</h3>
  </div>
  <div class="panel-body">
          <?php 
echo $form->field($user, 'documentfile')->widget(FileInput::classname(), ['pluginOptions' => ['showPreview' => false, 'showCaption' => true, 'showRemove' => true, 'showUpload' => true, 'allowedFileExtensions' => ['pdf']]]);
?>
 
   </div>
</div>

      
</div>
</div>
</div>
<!--END   tariefReizen ------------------------------------------>


</div>

开发者ID:jaccos,项目名称:wrkmtspr_prd,代码行数:29,代码来源:update.php


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