本文整理汇总了PHP中kartik\widgets\FileInput::classname方法的典型用法代码示例。如果您正苦于以下问题:PHP FileInput::classname方法的具体用法?PHP FileInput::classname怎么用?PHP FileInput::classname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\widgets\FileInput
的用法示例。
在下文中一共展示了FileInput::classname方法的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>';
}
}
示例2: 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();
}
}
示例3:
echo Html::submitButton(Icon::show('save') . Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'name' => 'action', 'value' => 'save']);
?>
</div>
<?php
$this->endBlock('submit');
?>
<section id="widget-grid">
<div class="row">
<article class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<?php
BackendWidget::begin(['title' => Yii::t('app', 'Watermark'), 'icon' => 'list-ul', 'footer' => $this->blocks['submit']]);
$options = [];
if ($model->isNewRecord === false) {
$this->registerCss('span.file-input > div.file-preview {display:block;}');
$this->registerCss('.file-preview img {max-width:100%;}');
$options = ['initialPreview' => [Html::img($model->file)]];
}
echo $form->field($model, 'image')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => $options]);
echo $form->field($model, 'position')->dropDownList(Watermark::getPositions());
BackendWidget::end();
?>
</article>
</div>
</section>
<?php
ActiveForm::end();
示例4:
?>
<?php
echo $form->field($jobModel, 'agent_job_industry')->listBox(\app\modules\job\models\Job::getCategoryOptions(), ['multiple' => true])->hint(Yii::t('job', 'Please Use CTR to select multiple options. (Select up to 3)'));
?>
<?php
echo $form->field($jobModel, 'agent_job_function')->listBox(\app\modules\job\models\JobFunction::getOptions(), ['multiple' => true])->hint(Yii::t('job', 'Please Use CTR to select multiple options. (Select up to 3)'));
?>
<?php
echo $form->field($jobModel, 'agent_summary')->textarea();
?>
<?php
$imageConfig = ['options' => ['accept' => 'uploads/*'], 'pluginOptions' => ['previewFileType' => 'image', 'showCaption' => FALSE, 'showRemove' => TRUE, 'showUpload' => FALSE, 'browseClass' => 'btn btn-primary btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => 'Select Photo', 'removeClass' => 'btn btn-danger', 'removeLabel' => "Delete", 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i>', 'allowedFileExtensions' => ['jpg', 'gif', 'png', 'jpeg']]];
if (!empty($model->image)) {
$imageConfig['pluginOptions']['initialPreview'] = [Html::img(\app\helpers\LetHelper::getFileUploaded($model->image), ['class' => 'file-preview-image'])];
}
echo $form->field($model, 'image')->widget(FileInput::classname(), $imageConfig);
?>
<div class="checkbox policy_check">
<?php
echo $form->field($jobModel, 'accept')->checkbox(['label' => 'I have read, understand, and I accept the <a href="#" target="_blank">terms of use</a> and <a href="#" target="_blank">privacy policy</a>.']);
?>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-3">
<?php
echo Html::submitButton(Yii::t('account', 'Sign up'), ['class' => 'button button-primary']);
?>
</div>
</div>
示例5: foreach
?>
<?php
echo $form->field($model, 'published')->widget(SwitchInput::classname(), ['pluginOptions' => ['size' => 'normal'], 'inlineLabel' => false]);
echo $form->field($model, 'startdate')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'เริ่มวันที่', 'style' => 'width: 160px;'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
echo $form->field($model, 'finishdate')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'สิ้นสุดวันที่', 'style' => 'width: 160px;'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
?>
</div>
</div>
<?php
if (Yii::$app->user->can('Administrator')) {
?>
<div class="row">
<div class="col-md-12">
<?php
echo $form->field($model, 'upload_files[]')->widget(FileInput::classname(), ['options' => ['multiple' => true], 'pluginOptions' => ['showPreview' => true, 'showUpload' => false, 'showCaption' => false, 'uploadClass' => 'btn btn-info', 'removeClass' => 'btn btn-danger', 'elCaptionText' => '#customCaption']]);
?>
<div class="file-input">
<div class="file-preview-thumbnails">
<?php
$mPath = \Yii::getAlias('@webroot') . '/images/article/news_' . $model->id;
$mUrl = \Yii::getAlias('@web') . '/images/article/news_' . $model->id;
if (!is_dir($mPath)) {
\yii\helpers\BaseFileHelper::createDirectory($mPath);
}
foreach (scandir($mPath) as $img) {
if ($img != '.' && $img != '..' && $img != 'thumb') {
$mThumb = $mUrl . '/thumb/' . $img;
//ตรวจสอบภาพตัวอย่าง ว่าถูกสร้างขึ้นมาหรือยัง
if (!file_exists($mThumb)) {
//ตรวจสอบโฟลเดอร์ภาพตัวอย่าง
示例6:
<div class="sales-road-image-form">
<?php
$form = ActiveForm::begin(['id' => $model->formName(), 'enableClientValidation' => true]);
?>
<?php
echo $form->field($model, 'ID_ROAD')->widget(Select2::classname(), ['data' => $data_road, 'options' => ['placeholder' => 'Select a Road ...'], 'pluginOptions' => ['allowClear' => true]])->label('Road');
?>
<?php
echo $form->field($model, 'IMGBASE64')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*']]);
?>
<?php
echo $form->field($model, 'IMG_NAME')->textarea(['rows' => 6]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
示例7: function
<?php
use dpodium\filemanager\FilemanagerAsset;
use kartik\widgets\ActiveForm;
use kartik\widgets\FileInput;
use yii\helpers\Url;
if ($uploadType == \dpodium\filemanager\components\Filemanager::TYPE_MODAL) {
FilemanagerAsset::register($this);
}
$form = ActiveForm::begin(['action' => \Yii::$app->urlManager->createUrl(['/filemanager/files/upload']), 'id' => 'fm-upload-form', 'options' => ['enctype' => 'multipart/form-data']]);
if (!empty($folderArray)) {
echo $form->field($model, 'folder_id')->dropDownList($folderArray);
}
$script = <<<SCRIPT
function (event, params) {
params.form.append('uploadType', {$uploadType});
if(jQuery('select[name="Files[folder_id]"]').val() != undefined) {
params.form.append('uploadTo', jQuery('select[name="Files[folder_id]"]').val());
} else {
params.form.append('uploadTo', '{$model->folder_id}');
}
}
SCRIPT;
echo $form->field($model, 'upload_file[]')->widget(FileInput::classname(), ['options' => ['multiple' => $multiple, 'accept' => implode(',', \Yii::$app->controller->module->acceptedFilesType)], 'pluginOptions' => ['uploadUrl' => Url::to(['/filemanager/files/upload']), 'browseClass' => 'btn btn-sm btn-success', 'uploadClass' => 'btn btn-sm btn-info', 'removeClass' => 'btn btn-sm btn-danger', 'maxFileCount' => $maxFileCount], 'pluginEvents' => ['filepreupload' => $script]]);
ActiveForm::end();
示例8: 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>
示例9:
<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>
示例10:
use yii\helpers\Html;
use kartik\form\ActiveForm;
use kartik\widgets\FileInput;
?>
<div class="profile-form">
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'method' => 'post', 'id' => $model->formName(), 'enableClientValidation' => true, 'options' => ['enctype' => 'multipart/form-data']]);
?>
<div class="row">
<div class="col-sm-6">
<?php
echo $form->field($model, 'image')->widget(FileInput::classname(), ['pluginOptions' => ['browseIcon' => '<i class="glyphicon glyphicon-folder-open"></i>', 'overwriteInitial' => true, 'showCaption' => false, 'showClose' => false, 'browseLabel' => '', 'removeLabel' => '', 'removeIcon' => '<i class="glyphicon glyphicon-remove"></i>', 'removeTitle' => 'Cancel or reset changes', 'showUpload' => false, 'defaultPreviewContent' => '<img src="https://www.mautic.org/media/images/default_avatar.png" alt="Your Avatar" style="width:160px">']])->label(false);
?>
</div>
<div class="col-sm-6">
<?php
echo $form->field($model, 'NM_FIRST')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'NM_MIDDLE')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'NM_END')->textInput(['maxlength' => true]);
?>
</div>
</div>
示例11:
echo $form->field($model, 'ciudad')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'estado')->textInput();
?>
<?php
echo $form->field($model, 'pais')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'cp')->textInput();
?>
<?php
echo $form->field($model, 'imagenes[]')->widget(FileInput::classname(), ['options' => ['multiple' => true, 'accept' => 'image/*'], 'pluginOptions' => ['showCaption' => false, 'showRemove' => false, 'showUpload' => false, 'browseClass' => 'btn btn-info btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => 'Examinar...', 'previewFileType' => 'image']]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Crear' : 'Actualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
示例12: isset
?>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="">
<div class="panel panel-danger dummy-data">
<div class="panel-heading bg-red">
<h3 class="panel-title">ภาพประกอบโครงการ</h3>
</div>
<div class="panel-body search-result-contents">
<div class="row">
<?php
echo $form->field($imageUploadForm, 'file')->widget(FileInput::classname(), ['disabled' => $model->PROJECT_ID == null ? true : false, 'options' => ['class' => 'document-upload-input', 'multiple' => true, 'disabled' => $mode == 'view' ? true : false], 'pluginOptions' => ['uploadUrl' => Url::to(["image-upload"]), 'uploadAsync' => true, 'minFileCount' => 1, 'maxFileCount' => 5, 'overwriteInitial' => false, 'initialPreview' => isset($imageUploadFormConfigs['initialPreview']) ? $imageUploadFormConfigs['initialPreview'] : [], 'initialPreviewConfig' => isset($imageUploadFormConfigs['initialPreviewConfig']) ? $imageUploadFormConfigs['initialPreviewConfig'] : [], 'uploadExtraData' => ['project_id' => $model->PROJECT_ID], 'allowedFileExtensions' => ['jpg', 'gif', 'png']], 'pluginEvents' => ['filepredelete' => "function(event, key) {\n\t\t\t\t\t\t\t\t\t\t\t return (!confirm('Are you sure you want to delete ?'));\n\t\t\t\t\t\t\t\t\t\t\t }"]])->label(false);
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
if ($mode != 'view') {
?>
<div class="form-group" style="text-align:center;">
<?php
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
示例13: empty
</div>
<div class="page-header">
<h4>ความสามารถ </h4>
</div>
<?php
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']);
示例14:
<div class="btn-group pull-right">
<?php
echo $buttons;
?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5><?php
echo Yii::t('common', 'Information');
?>
</h5>
</div>
<div class="ibox-content">
<?php
$form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10', 'error' => 'help-block m-b-none', 'hint' => '']]]);
echo $form->field($model, 'file_path')->widget(FileInput::classname(), $fileConfig);
echo $form->field($model, 'model_namespace')->widget(app\modules\common\components\FieldNamespace::className(), []);
ActiveForm::end();
?>
</div>
</div>
</div>
</div>
</div>
示例15:
<?php
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\builder\TabularForm;
use kartik\widgets\FileInput;
/**
* @var yii\web\View $this
* @var common\models\Osusuarios $model
* @var yii\widgets\ActiveForm $form
*/
$model->usu_activo = $model->isNewRecord ? 1 : $model->usu_activo;
?>
<div class="osusuarios-form">
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['usu_nomusu' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Nombre de Usuario...', 'maxlength' => 64]], 'usu_activo' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => 'Estado del Usuario...']], 'usu_nombre' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Nombre Completo del Usuario...', 'maxlength' => 64]], 'usu_clave' => ['type' => Form::INPUT_PASSWORD, 'options' => ['placeholder' => 'Contraseña...', 'maxlength' => 64]]]]);
echo $form->field($model, 'uploadedFile')->widget(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/*']]);
echo Html::submitButton($model->isNewRecord ? Yii::t('yii', 'Create') : Yii::t('yii', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
ActiveForm::end();
?>
</div>