本文整理汇总了PHP中kartik\file\FileInput::classname方法的典型用法代码示例。如果您正苦于以下问题:PHP FileInput::classname方法的具体用法?PHP FileInput::classname怎么用?PHP FileInput::classname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\file\FileInput
的用法示例。
在下文中一共展示了FileInput::classname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
for(var i = 0; i < arr.length; i++){
if(arr[i] === fileName){
arr.splice(i, 1);
}
}
$("#tour-smallimg").val("");
}']]);
?>
<?php
echo $form->field($model, 'smallimg')->label("")->textInput(['maxlength' => true, 'class' => 'sr-only']);
?>
<?php
echo $form->field($model, 'limg', ['options' => ['name' => 'limg', 'class' => 'form-group']])->label('Largeimg')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*', 'multiple' => true, 'name' => 'smallimg'], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::to(['/file-upload/upload']), 'maxFileCount' => 10], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index){
var lag = $("#tour-largeimg").val().split(" "),
//fileName = data.files[index].name.replace(" (Copy)", "1").replace(" ", "_");
fileName = data.response.files.name;
for(var i = 0; i < lag.length; i++){
if(lag[i] === ""){
lag.splice(i, 1);
}
}
lag.push(fileName);
$("#tour-largeimg").val(lag.join(" "));
}', 'filesuccessremove' => 'function(event, id){
var name = $("#" + id + " img").attr("title"),
fileName = name.replace(" ", "_");
示例2: run
/**
* @inheritdoc
*/
public function run()
{
$id = Html::getInputId($this->model, 'image_deleted');
$options = ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['showUpload' => false], 'pluginEvents' => ['fileclear' => "function() { \$('#{$id}').val(1);}"]];
if ($this->model->imageUrl !== null) {
$options['pluginOptions']['initialPreview'] = [Html::img($this->model->imageUrl, ['class' => 'file-preview-image'])];
}
echo $this->form->field($this->model, 'image_deleted', ['template' => '{input}'])->hiddenInput();
echo $this->form->field($this->model, 'image')->widget(FileInput::classname(), $options);
}
示例3: UploadedFiles
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
use kartik\dynagrid\DynaGrid;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel app\models\Fregat\DocfilesSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Загруженные файлы';
$this->params['breadcrumbs'] = Proc::Breadcrumbs($this);
?>
<div class="docfiles-index">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'docFile')->widget(FileInput::classname(), ['pluginOptions' => ['uploadUrl' => Url::to(['Fregat/docfiles/create']), 'dropZoneEnabled' => false, 'previewZoomSettings' => ['image' => ['width' => 'auto', 'height' => '100%']]], 'pluginEvents' => ["fileuploaded" => 'function(event, data, previewId, index) { UploadedFiles("docfilesgrid", event, data); }']]);
?>
<?php
ActiveForm::end();
?>
<?php
$result = Proc::GetLastBreadcrumbsFromSession();
$foreign = isset($result['dopparams']['foreign']) ? $result['dopparams']['foreign'] : '';
echo DynaGrid::widget(Proc::DGopts(['options' => ['id' => 'docfilesgrid'], 'columns' => Proc::DGcols(['columns' => [['attribute' => 'docfiles_ext', 'format' => 'raw', 'value' => 'docfiles_iconshow', 'contentOptions' => ['style' => 'width: 40px; text-align: center;'], 'filter' => false], ['attribute' => 'docfiles_name', 'format' => 'raw', 'value' => 'docfiles_name_html'], ['attribute' => 'docfiles_hash', 'visible' => false]], 'buttons' => array_merge(empty($foreign) ? [] : ['chooseajax' => ['Fregat/docfiles/assign-to-select2']], Yii::$app->user->can('DocfilesEdit') ? ['deleteajax' => ['Fregat/docfiles/delete']] : [])]), 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'panel' => ['heading' => '<i class="glyphicon glyphicon-file"></i> ' . $this->title]]]));
?>
</div>
示例4: isset
<li>Size image: 1024x100</li>
</ul>
<label>Update Advertise</label>
<ul>
<li>Type: image/flash/html</li>
<li>Position: right</li>
<li>Size: 400x350</li>
</ul>
</div>
<div class='col-md-8 center-block '>
<?php
$title = isset($model->name) && !empty($model->name) ? $model->name : 'Advertise';
echo Html::img($model->getImageUrl(), ['class' => 'img-thumbnail center-block', 'alt' => $title, 'title' => $title]);
?>
<?php
echo $form->field($model, 'img')->widget(FileInput::classname(), ['name' => 'image-member', 'pluginOptions' => ['showCaption' => false, 'showRemove' => false, 'showUpload' => false, 'browseClass' => 'btn btn-primary btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => yii::t('advertise', 'Select Photo')], 'options' => ['accept' => 'image/*']]);
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'start_at')->widget(DateTimePicker::classname(), ['type' => DateTimePicker::TYPE_COMPONENT_PREPEND, 'options' => ['placeholder' => 'Enter event time ...'], 'value' => '23-Feb-1982 01:10', 'layout' => '{picker}{input}', 'pluginOptions' => ['autoclose' => true, 'todayHighlight' => true, 'todayBtn' => true, 'format' => 'mm/dd/yyyy hh:ii:ss']]);
?>
<?php
echo $form->field($model, 'end_at')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => 'Enter event time ...'], 'layout' => '{picker}{input}', 'pluginOptions' => ['autoclose' => true, 'todayHighlight' => true, 'todayBtn' => true, 'format' => 'mm/dd/yyyy hh:ii:ss']]);
?>
<?php
echo $form->field($model, 'is_show')->widget(CheckboxX::classname(), ['autoLabel' => false, 'pluginOptions' => ['threeState' => false, 'size' => 'md']])->label("Is Show");
?>
示例5: array
<?php
$language_items = [];
foreach ($languages as $key => $language) {
$field = $form->field($model, "name_{$language->url}")->textInput(['maxlength' => true])->label('Name');
if ($languageDefault->url == $language->url) {
$field = $form->field($model, "name")->textInput(['maxlength' => true]);
}
$language_items[] = ['label' => Yii::t('backend', $language->name), 'content' => "<p>{$field}</p>", 'active' => $key == 0];
}
echo Tabs::widget(['items' => $language_items]);
?>
<?php
echo $form->field($model, 'file')->widget(FileInput::classname(), ['options' => ['multiple' => false, 'accept' => 'pdf/*'], 'pluginOptions' => ['previewFileType' => 'image', 'showUpload' => false]])->label(Yii::t('backend', 'PDF File'));
?>
<?php
echo Html::a($model->file, $model->getUploadedFileUrl('file'), array('target' => '_blank'));
?>
<br/><br/>
<?php
echo $form->field($model, 'order')->textInput();
?>
<?php
echo $form->field($model, 'id')->hiddenInput();
?>
示例6:
</div>
</div>
<div class="row">
<div class="col-md-4"><?php
echo $form->field($model, 'drivers_passport')->textInput(['maxlength' => true]);
?>
</div>
<div class="col-md-4"> <?php
echo $form->field($model, 'drivers_licence')->textInput(['maxlength' => true]);
?>
</div>
</div>
<div class="row">
<div class=" col-md-12">
<?php
echo $form->field($model, 'docs[]')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*', 'multiple' => true], 'pluginOptions' => ['initialPreview' => $model->initialPreview($model->docs, 'docs', 'file'), 'initialPreviewConfig' => $model->initialPreview($model->docs, 'docs', 'config'), 'allowedFileExtensions' => ['pdf', 'jpg'], 'showPreview' => true, 'showCaption' => true, 'showRemove' => true, 'showUpload' => true, 'overwriteInitial' => false]])->label(false);
?>
</div>
</div>
<?php
if ($model->isNewRecord) {
echo $form->field($model, 'appilcant_id')->hiddenInput(['maxlength' => true, 'value' => $id])->label(false);
} else {
echo $form->field($model, 'appilcant_id')->hiddenInput(['maxlength' => true])->label(false);
}
?>
<?php
//$form->field($model, 'appilcant_id')->textInput(['maxlength' => true, 'value' => $id])->label(false)
?>
示例7:
echo $form->field($profile, 'full_name')->textInput(['placeholder' => Yii::t('app', 'Enter user full name...')]);
?>
</div>
<div class="col-sm-6">
<?php
echo $form->field($profile, 'company')->textInput(['placeholder' => Yii::t('app', 'Enter user company...')]);
?>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<?php
if ($profile->avatar) {
echo $form->field($profile, 'image')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => Yii::t("app", "Select Picture"), 'initialPreview' => [Html::img($profile->getAvatarUrl(), ['class' => 'file-preview-image', 'alt' => $profile->full_name, 'title' => $profile->full_name])], 'overwriteInitial' => true, 'showRemove' => false, 'showUpload' => false]]);
} else {
echo $form->field($profile, 'image')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => Yii::t("app", "Select Photo"), 'showRemove' => false, 'showUpload' => false]]);
}
?>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<?php
echo $form->field($profile, 'timezone')->dropDownList($timezones)->label(Yii::t("app", "Timezone"));
?>
</div>
<div class="col-sm-6">
<?php
echo $form->field($profile, 'language')->dropDownList($languages)->label(Yii::t("app", "Language"));
?>
</div>
示例8:
/* @var $this yii\web\View */
/* @var $model common\models\User */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="user-form">
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
<?//= $form->field($model, 'status')->textInput() ?>
<div class="row">
<div class="col-md-6">
<?php
echo $form->field($model, 'photo')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['initialPreview' => $model->photo ? [Html::img($model->photoUrl, ['class' => 'file-preview-image', 'alt' => $model->username, 'title' => $model->username])] : false, 'showUpload' => false, 'allowedFileExtensions' => ['jpg', 'gif', 'png', 'bmp']]]);
?>
<?php
echo $form->field($model, 'category_id')->dropDownList($model->categoryList());
?>
<?php
echo $form->field($model, 'tagIds')->checkboxList(ArrayHelper::map(\common\models\Tag::find()->all(), 'id', 'title'));
?>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<?php
echo $form->field($model, 'first_name')->textInput();
?>
</div>
示例9:
* @copyright Copyright (c) 2015 kangqingfei
* @license MIT
*/
use yii\helpers\Html;
use kartik\form\ActiveForm;
use kartik\file\FileInput;
?>
<div class="container-fluid">
<div class="row">
<?php
$form = ActiveForm::begin(['id' => 'form-register', 'options' => ['enctype' => 'multipart/form-data']]);
?>
<div class="col-md-3 col-md-offset-1">
<?php
echo $form->field($model, 'avatar')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'showMessage' => true, 'pluginOptions' => ['previewFileType' => 'image', 'showCaption' => false, 'showUpload' => false, 'showRemove' => false, 'browseClass' => 'btn btn-primary btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-picture"></i> ', 'browseLabel' => '更换头像', 'initialPreview' => [Html::img($model['avatar'] ? $model['avatar'] : Yii::$app->params['defaultAvatar'] . '?imageView2/1/w/200/h/200', ['class' => 'file-preview-image', 'alt' => '没找到默认头像', 'title' => '头像'])]]]);
?>
</div>
<div class="col-md-4 col-md-offset-1">
<br/>
<?php
echo $form->field($model, 'username', ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-user"></i>']], 'showLabels' => false, 'enableAjaxValidation' => true])->textInput(['placeholder' => '请输入用户名']);
?>
<br/>
<?php
echo $form->field($model, 'email', ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-envelope"></i>']], 'showLabels' => false, 'enableAjaxValidation' => true])->textInput(['placeholder' => '请输入邮箱']);
?>
<br/>
示例10:
}
?>
<?php
echo $form->field($model, 'bn')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => $pluginOptions, 'pluginEvents' => ['fileclear' => 'function(){$("#bnChanged").val("true")}', 'fileloaded' => 'function(){$("#bnChanged").val("true")}']]);
?>
<input type="hidden" name="titleChanged" value="false" id="titleChanged">
<?php
if ($model->isNewRecord) {
$pluginOptions = ['showUpload' => false, 'initialPreviewShowDelete' => true, 'previewFileType' => 'image'];
} else {
$pluginOptions = ['showUpload' => false, 'initialPreview' => [Html::img(Yii::getAlias('@web') . "/img/titulo/" . $model->picture, ['class' => 'file-preview-image', 'alt' => $model->picture])], 'initialPreviewShowDelete' => true, 'previewFileType' => 'image'];
}
?>
<?php
echo $form->field($model, 'title')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => $pluginOptions, 'pluginEvents' => ['fileclear' => 'function(){$("#titleChanged").val("true")}', 'fileloaded' => 'function(){$("#titleChanged").val("true")}']]);
?>
<?php
echo $form->field($model, 'color')->widget(ColorInput::classname(), ['options' => ['placeholder' => 'Selecciona un color...']]);
?>
<?php
echo $form->field($model, 'status')->dropDownList(['ACTIVE' => 'ACTIVE', 'INACTIVE' => 'INACTIVE'], ['prompt' => '']);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
示例11: ActiveDataProvider
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Button;
use kartik\file\FileInput;
// @var $this yii\web\View
// @var $form yii\bootstrap\ActiveForm
// @var $model \common\models\UploadForm
$this->title = 'Firmwares';
$this->params['breadcrumbs'][] = $this->title;
$dataProvider = new ActiveDataProvider(['query' => Yii::$app->user->can('admin') ? Firmware::find() : Firmware::findByUser(Yii::$app->user->identity->username), 'pagination' => ['pageSize' => 20]]);
?>
<div class="box">
<div class="box-body">
<?php
$form = ActiveForm::begin(['id' => 'upload-form', 'action' => '/firmware/upload', 'options' => ['enctype' => 'multipart/form-data', 'class' => 'form-inline']]);
echo $form->field($model = new UploadForm(), 'file')->widget(FileInput::classname(), ['pluginOptions' => ['showPreview' => false, 'showCaption' => true, 'showRemove' => true, 'showUpload' => true, 'browseLabel' => 'Add firmware']]);
ActiveForm::end();
?>
</div>
</div>
<div class="box">
<div class="box-body">
<?php
if (Yii::$app->user->can('listResources')) {
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'description'], ['attribute' => 'manufacturer_id', 'value' => function ($model, $index, $widget) {
return $model->manufacturer ? $model->manufacturer->name : '';
}], ['attribute' => 'model_number_id', 'value' => function ($model, $index, $widget) {
return $model->modelNumber ? $model->modelNumber->value : '';
}], ['attribute' => 'device_type_id', 'value' => function ($model, $index, $widget) {
return $model->deviceType ? $model->deviceType->name : '';
示例12:
<?php
use kartik\file\FileInput;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model app\modules\images\models\ImgImage */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="img-image-form">
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
echo $form->field($model, 'image')->widget(FileInput::classname(), ['options' => ['multiple' => true], 'pluginOptions' => ['uploadUrl' => Url::to(['/images/images/upload']), 'uploadExtraData' => ['album_id' => 20, 'cat_id' => 'Nature'], 'maxFileCount' => 10]]);
?>
<?php
ActiveForm::end();
?>
</div>
示例13:
/* @var $form yii\widgets\ActiveForm */
?>
<?php
foreach (Yii::$app->session->getAllFlashes() as $key => $message) {
echo '<div class="alert alert-' . $key . '">' . $message . '</div>';
}
?>
<div class="anexos-form">
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
echo $form->field($model, 'file')->widget(FileInput::classname(), ['options' => ['accept' => '.pdf'], 'language' => 'pt', 'pluginOptions' => ['showRemove' => false, 'showUpload' => false, 'initialCaption' => $model->anexo]]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Inserir' : 'Atualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
示例14:
?>
<?php
echo $form->field($model, 'data_nasc')->input("date");
?>
<?php
echo $form->field($model, 'funcao')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'setor')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'foto')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'jpeg', 'png', 'tif', 'tiff'], 'showUpload' => false]]);
?>
<?php
echo $form->field($model, 'email')->input("email");
?>
<?php
echo $form->field($model, 'password')->passwordInput();
?>
<?php
echo $form->field($model, 'password_repeat')->passwordInput();
?>
<?php
示例15:
<h2><i class="fa fa-pencil"></i> General</h2>
</div>
<!-- END General Data Title -->
<!-- General Data Content -->
<?php
$form = ActiveForm::begin(['id' => 'client-form', 'layout' => 'horizontal', 'options' => ['class' => 'form-horizontal form-bordered', 'enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-md-3 control-label']]]);
?>
<?php
echo $form->field($client, 'active')->checkbox(['template' => "{label}<div class='col-md-9'><label class='switch switch-primary'>{input}<span></span></label></div>\n"])->label('Active?', ['class' => 'col-md-3 control-label']);
?>
<?php
if (!empty($client->avatar)) {
echo $form->field($client, 'avatar', ['template' => "{label}<div class='col-md-9'>{input}</div>\n{hint}\n{error}"])->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['initialPreview' => [Html::img("/web/upload/avatar/{$client->avatar}", ['class' => 'file-preview-image'])], 'previewFileType' => 'image', 'showUpload' => false, 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'overwriteInitial' => true]]);
} else {
echo $form->field($client, 'avatar', ['template' => "{label}<div class='col-md-9'>{input}</div>\n{hint}\n{error}"])->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['initialPreview' => [Html::img("/web/upload/avatar/noavatar.jpg", ['class' => 'file-preview-image'])], 'previewFileType' => 'image', 'showUpload' => false, 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'overwriteInitial' => true]]);
}
?>
<?php
echo $form->field($client, 'company', ['template' => "{label}<div class='col-md-9'>{input}</div>\n{hint}\n{error}"])->textInput(array('placeholder' => 'Company Name', 'class' => 'form-control'));
?>
<?php
echo $form->field($client, 'firstname', ['template' => "{label}<div class='col-md-9'>{input}</div>\n{hint}\n{error}"])->textInput(array('placeholder' => 'First Name', 'class' => 'form-control'));
?>
<?php