• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP widgets\FileInput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16:

				<div>
					<?php 
$path = !empty(Yii::$app->params['uploaddir']) ? Yii::$app->params['uploaddir'] : Yii::getAlias("@app/files/");
if (file_exists($path . 'users/' . $model->id . '.jpg')) {
    echo Html::img(Url::to(['site/download', 'file' => 'users/' . $model->id . '.jpg', 'preview' => true]), ['class' => 'img-rounded']);
} else {
    $AdminLTEAsset = hscstudio\adminlte\assets\AdminLTEAsset::register($this);
    $defaultPhoto = $AdminLTEAsset->baseUrl . '/img/user2-160x160.jpg';
    echo Html::img($defaultPhoto, ['class' => 'img-rounded']);
}
?>
					<hr>
				</div>
				<label class="control-label" for="user-gender">Photo</label>	
			    <?php 
echo \kartik\widgets\FileInput::widget(['name' => 'photo', 'options' => ['accept' => 'image/*'], 'pluginOptions' => ['previewFileType' => 'image', 'uploadLabel' => 'Upload', 'showUpload' => false]]);
?>
	
				</div> 
			</div>	
			
    	</div>
    </div>
    <div class="row">
    	
    </div>	
    

    
	
	
开发者ID:kucheriavij,项目名称:yii2-adminlte,代码行数:26,代码来源:_form.php


示例17:

<div class="test-form">

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


            <div class="row">
        <div class="col-md-6">
        <?php 
$plugins = ["options" => ["accept" => "image/*"]];
if ($model->image) {
    $plugins = ["options" => ["accept" => "image/*"], "pluginOptions" => ["initialPreview" => [kartik\helpers\Html::img($model->thumbnailTrue, ["class" => "file-preview-image"])]]];
}
echo $form->field($model, "image")->widget(FileInput::classname(), $plugins);
?>
        </div>

        <div class="col-md-6">
        
            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
echo $form->field($model, "description")->widget(CKEditor::className(), ["editorOptions" => ["preset" => "full", "inline" => false]]);
?>
        </div>

    </div>

    <div class="row">
        <div class="col-md-10 col-md-offset-1">
开发者ID:sintret,项目名称:yii2-basic-sintret,代码行数:30,代码来源:_form.php


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


示例19:

                    </div>

                    <div class="row">
                        <div class="col-md-12">
                            <?php 
/*
    <?= $form->field($model, 'photos[]')->fileInput(['multiple' => true]) ?>
    <div class="well">
        <?= $model->getPhotosViewer(); ?>
    </div>
*/
?>
                            <label class="control-label" for="photos[]"> อัลบั้มรูปภาพ </label>

                            <?php 
echo FileInput::widget(['name' => 'photos[]', 'pluginOptions' => ['showCaption' => false, 'showRemov 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP widgets\Select2类代码示例发布时间:2022-05-23
下一篇:
PHP widgets\DepDrop类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap