コード例 #1
0
ファイル: VipFileInput.php プロジェクト: oyoy8629/yii-core
 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();
 }
コード例 #2
0
ファイル: FileInput.php プロジェクト: gromver/yii2-platform
    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 
        }
    }
コード例 #3
0
ファイル: _option.php プロジェクト: darkffh/yii2-lowbase
     // Выключатель
     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:
     // Список пользователя
コード例 #4
0
    <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>
コード例 #5
0
ファイル: Setting.php プロジェクト: navatech/yii2-setting
 /**
  * @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']);
     }
 }
コード例 #6
0
    <?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
コード例 #7
0
ファイル: _form.php プロジェクト: kusma007/one-advanced
    <?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>

コード例 #8
0
ファイル: show.php プロジェクト: KhemPoudel/onlinePaathsaala
                        <?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>
コード例 #9
0
ファイル: _form.php プロジェクト: rcjusto/simplestore
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>
コード例 #10
0
    <?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
コード例 #11
0
                <?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 
}
コード例 #12
0
ファイル: update.php プロジェクト: kmolchanov/qwintry-test
$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>
コード例 #13
0
ファイル: _form.php プロジェクト: kusma007/one-advanced
//                'type'=>Form::INPUT_FILE,
//                'widgetClass'=>'\kartik\widgets\FileInput',
//                'label'=>'Загрузить картинку'
//            ],
//        ]
//    ]);
if ($model->isNewRecord) {
    $model->status_id = 'on';
}
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['category_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\Select2', 'options' => ['data' => ArrayHelper::map($model->getAllCategory(), 'id', 'name')], 'hint' => 'Нажмите и выберите категорию'], 'date_create' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DatePicker', 'hint' => 'Введите дату', 'options' => ['pluginOptions' => ['autoclose' => true, 'format' => 'dd-mm-yyyy']]], 'status_id' => ['type' => Form::INPUT_RADIO_LIST, 'items' => ['on' => 'On', 'off' => 'Off'], 'options' => ['inline' => true]], 'actions' => ['type' => Form::INPUT_RAW, 'value' => '<div style="text-align: right; margin-top: 20px">' . Html::resetButton('Сбросить', ['class' => 'btn btn-default']) . ' ' . Html::submitButton($model->isNewRecord ? 'Создать' : 'Обновить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) . '</div>']]]);
ActiveForm::end();
Panel::end();
if (!$model->isNewRecord) {
    Panel::begin(['header' => 'Изображения', 'icon' => 'photo', 'collapsable' => true]);
    $image = new UploadForm();
    echo FileInput::widget(['model' => $image, 'attribute' => 'file', 'options' => ['multiple' => true], 'pluginOptions' => ['showPreview' => true, 'showCaption' => true, 'showRemove' => true, 'showUpload' => true, 'uploadUrl' => Url::to(['/news/upload-files', 'id' => $model->id])]]);
    $images = $model->getImages();
    if ($images[0]['urlAlias'] != 'placeHolder') {
        echo Html::beginTag('div', ['class' => 'images-news']);
        foreach ($images as $img) {
            echo Html::beginTag('div', ['class' => 'images-news-block']);
            echo Html::a(Html::img($img->getUrl('180x180'), ['alt' => $model->title]), $img->getUrl(), ['class' => 'lightbox']);
            echo Html::beginTag('div', ['class' => 'images-news-box']);
            if (!$img->isMain) {
                echo Html::a('Сделать основной', ['set-main', 'id' => $model->id, 'id_img' => $img->id], ['class' => 'images-news-act']);
            }
            echo Html::a('Удалить', ['remove-image', 'id' => $img->id], ['class' => 'images-news-act']);
            echo Html::endTag('div');
            echo Html::endTag('div');
        }
        echo Html::endTag('div');
コード例 #14
0
ファイル: index.php プロジェクト: santhika29/yakes-app
<?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> ']]);
コード例 #15
0
 /**
  * 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();
 }
コード例 #16
0
ファイル: view_2_2.php プロジェクト: ptrnov/WND-W
	<?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>
コード例 #17
0
$images = $model->getImage();
$itemCarousel = [];
if (!is_null($images)) {
    foreach ($images as $key => $image) {
        $path = "/" . implode('/', [Yii::$app->params['uploadStoragesPath'], $image->getFullPath()]);
        $itemCarousel[$key] = Html::img($path, ['width' => '100%', 'height' => '200px']);
    }
}
?>

 <div class="row">
 	<div class="col-md-12">
	<?php 
if (!empty($itemCarousel)) {
    ?>
		<?php 
    echo Carousel::widget(['items' => $itemCarousel]);
    ?>
	

		<?php 
} else {
    ?>
			<?php 
    echo FileInput::widget(['name' => 'images[]', 'options' => ['multiple' => true, 'class' => 'form-control', 'id' => 'file-input-' . $model->getId()], 'pluginOptions' => ['uploadUrl' => Url::to(['/admin/product/images-upload']), 'uploadExtraData' => ['target' => Yii::$app->formatter->asQuoteTabelName($model::tableName()), 'target_id' => $model->getId()], 'maxFileCount' => 6]]);
    ?>
		<?php 
}
?>
 	</div>
 </div>
コード例 #18
0
ファイル: view_2_3.php プロジェクト: ptrnov/WND-W
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\bootstrap\Modal;
use kartik\widgets\ActiveField;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\icons\Icon;
use kartik\widgets\Growl;
use kartik\widgets\FileInput;
/* @var $this yii\web\View */
/* @var $model app\models\maxi\Maxiprodak */
$this->title = $model->EMP_ID;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Maxiprodaks'), 'url' => ['prodak']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="maxiprodak-view">
<?php 
$form = ActiveForm::begin();
$form2;
//$form2;
ActiveForm::end();
$form1 = FileInput::widget(['model' => $model, 'attribute' => 'EMP_ID', 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png', 'bmp'], 'showUpload' => true, 'initialPreview' => [Html::img("http://192.168.56.101/advanced/lukisongroup/web/css/image/" . $model->EMP_IMG, ['class' => 'file-preview-image', 'alt' => 'The Moon', 'title' => 'The Moon'])], '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}'], 'overwriteInitial' => false]]);
//$form = ActiveForm::begin(['type'=>ActiveForm::TYPE_INLINE]);
$form2 = 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();
?>
</div>
コード例 #19
0
ファイル: sertificate.php プロジェクト: RAPOS/baron-nt
        <?php 
echo $form->field($model, 'title');
?>
		<?php 
echo $form->field($model, 'text')->widget(TinyMce::className(), ['options' => ['rows' => 6], 'language' => 'ru', 'clientOptions' => ['plugins' => ["advlist autolink lists link charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste"], 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"]]);
?>
		<?php 
echo FileInput::widget(['name' => 'image[]', 'language' => 'ru', 'options' => ['multiple' => true, 'accept' => 'image/*'], 'pluginOptions' => ['previewFileType' => 'image', 'previewSettings' => ['image' => ['width' => 'auto', 'height' => '210px']], 'maxFileCount' => 1, 'validateInitialCount' => true, 'overwriteInitial' => false, 'initialPreview' => $array_image, 'initialPreviewConfig' => $array_image_cfg, 'uploadUrl' => '/admin/upload', 'browseClass' => 'btn btn-success', 'uploadClass' => 'btn btn-info', 'removeClass' => 'btn btn-danger', 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i> ', 'showRemove' => false], 'pluginEvents' => ['filepredelete' => 'function(event, key) {
					if($(".file-input .file-preview-frame").length == 1){
						$(".file-input .input-group").show();
					}
				}', 'fileuploaded' => 'function(event, data, previewId, index){
					var form = data.form, files = data.files, extra = data.extra, response = data.response, reader = data.reader;
					$(".file-input").append(\'<input hidden type="text" name="id_img[]" value="\'+response["id_img"]+\'"/>\');
					$(".file-input input[name=\\"id_img[]\\"]").each(function(i, value){
						$(this).attr("data-name", files[i]["name"]);
					});
					if($(".file-input .file-preview-frame").length == 1){
						$(".file-input .input-group").hide();
					}
				}', 'filesuccessremove' => 'function(event, id){
					if($(".file-input .file-preview-frame").length == 1){
						$(".file-input .input-group").show();
					}
				}']]);
?>
		<br>
        <div class="form-group">
			<?php 
echo Html::submitButton('Сохранить', ['class' => 'btn btn-success']);
?>
			<?php 
コード例 #20
0
ファイル: extra_form.php プロジェクト: adem-team/advanced
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\FileInput;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model dpodium\filemanager\models\Folders */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="folders-form">

    <?php 
// echo $form->field($node, 'path')->textInput(['maxlength' => true]);
echo FileInput::widget(['name' => 'attachment_48[]', 'options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => Url::to(['/site/file-upload']), 'uploadExtraData' => ['album_id' => 20, 'cat_id' => 'Nature'], 'maxFileCount' => 10]]);
?>

</div>

コード例 #21
0
    echo $dropped;
    ?>
 fragen doppelt</h3>
    <?php 
}
?>

    <div class="upload-field">
        <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
//important
?>
        <div class="form-group">
            <label for="">Für Sprache</label>
            <?php 
echo Html::dropDownList('lang', null, \app\helpers\InputHelper::getDropdownOptions('app\\models\\Language', 'l_id', 'name', true), ['class' => 'form-control']);
?>
        </div>
        <?php 
echo FileInput::widget(['name' => 'filename', 'options' => ['multiple' => false], 'pluginOptions' => ['showPreview' => false, 'showCaption' => true, 'showRemove' => true, 'showUpload' => false]]);
?>
        <br/>
        <input type="submit" class="btn btn-primary" value="Upload"/>
    </div>
    <?php 
ActiveForm::end();
?>



</div>
コード例 #22
0
ファイル: index.php プロジェクト: ExertisMicro-P/product_api
         <?php 
 if (Yii::$app->user->isGuest) {
     echo "<p>Please " . Html::a('Login', Url::toRoute('site/login'), ['class' => 'btn btn-primary']) . " to use this uploader</p>";
 }
 if (!Yii::$app->user->isGuest) {
     $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
     //echo $form->field($model, 'filename');
     //// your fileinput widget for single file upload
     //echo $form->field($model, 'filename')->widget(FileInput::classname(), [
     //    'options'=>['accept'=>'image/*'],
     //    'pluginOptions'=>[
     //        'allowedFileExtensions'=>['jpg'/*,'gif','png'*/],
     //        'mainClass' => 'input-group-lg'
     //        ]
     //]);
     echo FileInput::widget(['model' => $model, 'attribute' => 'images[]', 'options' => ['multiple' => true]]);
     /**
      * uncomment for multiple file upload
      * RCH 20141121 - couldn't get this to work, wouldn't populate the $_POST
      *
      *
      * echo $form->field($model, 'image[]')->widget(FileInput::classname(), [
      * 'options'=>['accept'=>'image/*', 'multiple'=>true],
      * 'pluginOptions'=>['allowedFileExtensions'=>['jpg','gif','png']
      * ]);
      *
      */
     /*echo Html::submitButton('Upload' , [
           'class'=>'btn btn-success']
       );
        *
コード例 #23
0
ファイル: _form.php プロジェクト: kucheriavij/yii2-adminlte
				<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>	
    

    
	
	
コード例 #24
0
echo $form->field($model, 'social')->inline()->checkboxList(Employee::itemAlias('social'));
?>

  <?php 
echo $form->field($model, 'skill')->widget(Select2::classname(), ['language' => 'de', 'data' => Employee::itemAlias('skill'), 'options' => ['multiple' => true, 'placeholder' => 'เลือกความสามารถ ...'], 'pluginOptions' => ['allowClear' => true]]);
?>

    <?php 
echo $form->field($model, 'resume')->widget(FileInput::classname(), ['pluginOptions' => ['initialPreview' => empty($model->resume) ? [] : [Yii::getAlias('@web') . '/resumes/' . $model->resume], 'allowedFileExtensions' => ['pdf'], 'showPreview' => false, 'showCaption' => true, 'showRemove' => true, 'showUpload' => false]]);
?>

<div class="form-group field-upload_files">
  <label class="control-label" for="upload_files[]"> อัพโหลดไฟล์ต่างๆ </label>
<div>
<?php 
echo FileInput::widget(['name' => 'upload_files[]', 'options' => ['multiple' => true], 'pluginOptions' => ['overwriteInitial' => false, 'initialPreviewShowDelete' => true, 'initialPreview' => $initialPreview, 'initialPreviewConfig' => $initialPreviewConfig, 'previewFileType' => 'any', 'uploadUrl' => Url::to(['/employee/upload']), 'uploadExtraData' => ['request_id' => $model->token_forupload], 'maxFileCount' => 100]]);
?>
</div>
</div>

<br>
    <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();
?>
コード例 #25
0
ファイル: choose.php プロジェクト: jcesarrc/cobertura
use yii\helpers\Url;
$this->title = Yii::t('app', 'Cargar archivo DPA');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="divipola-index">

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

    <div class="row">
        <div class="col-md-6">
            <?php 
echo '<label class="control-label">Subir archivo en formato separado por comas (.csv)</label><br>';
echo FileInput::widget(['name' => 'attachment', 'options' => ['accept' => 'text/csv', 'multiple' => false], 'pluginOptions' => ['uploadUrl' => Url::to(['divipola/file-upload'])]]);
?>
        </div>
        <div class="col-md-6 instructions">
                <h1>Requisitos</h1>
                <ol>
                    <li>Sólo se permite subir archivos en formato CSV (separados por comas)</li>
                    <li>Puede usar el botón seleccionar o arrastrar el archivo al área designada</li>
                    <li>Asegúrese de guardar el archivo como "archivo separado por comas *.csv"</li>
                    <li>Los registros cuyo codigo de Departamento y Municipio existan se omitirán de la carga</li>
                    <li>El archivo a subir debe tener los siguientes campos (columnas) en este estricto orden:</li>
                    <ul>
                        <li>
                            <code>Codigo de Departamento</code>
                        </li>
                        <li>
コード例 #26
0
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use kartik\widgets\SwitchInput;
use kartik\widgets\Select2;
use kartik\widgets\FileInput;
?>
<div class="tab-content images-tab">

    <?php 
if (Yii::$app->getModule('pages')->enableImage) {
    ?>

    <?php 
    echo FileInput::widget(['name' => 'ImageUploadForm[image]', 'options' => ['accept' => 'image/*'], 'pluginOptions' => ['initialPreview' => $model->image->fileInputWidgetPreview, 'initialCaption' => $model->image->name, 'showPreview' => true, 'showCaption' => true, 'showRemove' => true, 'showUpload' => false, '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')], 'pluginEvents' => ["fileclear" => "function() {\n                var request = \$.post({$model->removeRequest});\n                //request.done(function(response) {});\n            }"]]);
    ?>

    <?php 
}
?>
</div>
コード例 #27
0
ファイル: _form.php プロジェクト: jaradsee/faktharm
?>

    <?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>
コード例 #28
0
ファイル: view.php プロジェクト: kusma007/one-advanced
    </p>
    <?php 
$images = $model->getImages();
$allImg = [];
$allImgConfig = [];
if ($images[0]['urlAlias'] != 'placeHolder') {
    foreach ($images as $img) {
        $allImg[] = Html::a(Html::img($img->getUrl('160x130'), ['alt' => $model->name]), $img->getUrl(), ['target' => '_blank']);
        //            $allImg[] = Html::img($img->getUrl('200x200'),['alt' => $model->name]);
        //            var_dump($img);
        $allImgConfig[] = ['url' => Url::to(['/gallery/remove-image', 'id' => $img->id])];
        //            echo $_SERVER['HTTP_HOST'].$img->getUrl();
    }
}
//    var_dump($allImg);
echo FileInput::widget(['name' => 'gallery', 'options' => ['multiple' => true], 'pluginOptions' => ['initialPreview' => $allImg, 'initialPreviewConfig' => $allImgConfig, 'overwriteInitial' => false, 'showPreview' => true, 'showCaption' => true, 'showRemove' => true, 'showUpload' => true, 'removeClass' => 'btn btn-danger', 'previewFileType' => 'any', 'uploadUrl' => Url::to(['/gallery/upload-files', 'id' => $model->id])]]);
?>
<!--    --><?php 
//echo DetailView::widget([
//        'model' => $model,
//        'attributes' => [
//            'id',
//            'name',
//            'description',
//            'status',
//        ],
//    ])
?>

</div>
コード例 #29
0
ファイル: _form.php プロジェクト: poykub/wph
                    </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, 'showRemove' => false, 'showUpload' => false, 'browseClass' => 'btn btn-default btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => 'เลือกรูปภาพ', 'initialPreview' => $initialPreviewPhotos, 'initialPreviewConfig' => $initialPreviewPhotosConfig, 'uploadUrl' => Url::to(['/uploads/photos']), 'uploadExtraData' => ['ref' => $model->ref]], 'options' => ['multiple' => true, 'accept' => 'image/*']]);
?>
                        </div>
                    </div>

                    <div class="form-group">
                        <?php 
echo $form->field($model, 'ref')->hiddenInput(['maxlength' => 50])->label(false);
?>
                        <?php 
echo Html::submitButton($model->isNewRecord ? 'บันทึกข้อมูล' : 'แก้ไขข้อมูล', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>

                        <?php 
echo Html::a('Cancel', ['article/index'], ['class' => 'btn btn-default']);
?>
コード例 #30
0
ファイル: _form.php プロジェクト: BillsOfHealth/yii2-2015
<div class="user-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_VERTICAL]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['username' => ['type' => Form::INPUT_TEXT], 'email' => ['type' => Form::INPUT_TEXT]]]);
echo MaskedInput::widget(['name' => 'input-1', 'mask' => '(999) 999-9999']);
echo '<p><h3>Additional Info</h3></p>';
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 3, 'attributes' => ['first_name' => ['type' => Form::INPUT_TEXT], 'mid_name' => ['type' => Form::INPUT_TEXT], 'last_name' => ['type' => Form::INPUT_TEXT]]]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['address_1' => ['type' => Form::INPUT_TEXT], 'address_2' => ['type' => Form::INPUT_TEXT]]]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 3, 'attributes' => ['city' => ['type' => Form::INPUT_TEXT], 'state' => ['type' => Form::INPUT_TEXT], 'zipcode' => ['type' => Form::INPUT_TEXT]]]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['home_phone' => ['type' => Form::INPUT_TEXT, 'prepend' => '<span class="input-group-addon glyphicon glyphicon-phone" 
             id="yourId1"></span>'], 'cell_phone' => ['type' => Form::INPUT_TEXT, 'prepend' => '<span class="input-group-addon glyphicon glyphicon-phone" 
             id="yourId2"></span>']]]);
echo '<label class="control-label">Upload File</label>';
echo FileInput::widget(['name' => 'attachments', 'options' => ['multiple' => false], 'pluginOptions' => ['previewFileType' => 'any']]);
//$form->field($model, 'auth_key')->textInput(['maxlength' => true])
//$form->field($model, 'password_hash')->textInput(['maxlength' => true])
//$form->field($model, 'password_reset_token')->textInput(['maxlength' => true])
//$form->field($model, 'status')->textInput()
//$form->field($model, 'created_at')->textInput()
//$form->field($model, 'updated_at')->textInput()
?>


    
    

    <div class="form-group">
        <BR>
        <?php