</div> <div class="panel-body"> <?php $form = \yii\widgets\ActiveForm::begin(['id' => 'profile-form', 'options' => ['class' => 'form-horizontal'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-9\">{input}</div>\n<div class=\"col-sm-offset-3 col-lg-9\">{error}\n{hint}</div>", 'labelOptions' => ['class' => 'col-lg-3 control-label']], 'enableAjaxValidation' => true, 'enableClientValidation' => false, 'validateOnBlur' => false]); ?> <?php echo $form->field($model, 'name'); ?> <?php echo $form->field($model, 'location'); ?> <?php echo $form->field($uploadForm, 'imageFile')->label(Yii::t('user', 'Profile image'))->widget(\dosamigos\fileupload\FileUpload::className(), ['model' => $uploadForm, 'attribute' => 'imageFile', 'url' => ['settings/profile-image-upload', 'user_id' => $model->user_id], 'options' => ['accept' => 'image/*'], 'clientOptions' => ['maxFileSize' => 2000000], 'clientEvents' => ['fileuploaddone' => 'function(e, data) { if (\'undefined\' != typeof data.result.image_url) { var profileImageElement = $(\'#profile-image\'); profileImageElement.attr(\'src\', data.result.image_url).show(); profileImageElement.removeClass(\'hidden\'); } }']]); ?> <div class="form-group"> <div class="col-lg-offset-3 col-lg-9"> <?php echo \yii\helpers\Html::submitButton(Yii::t('user', 'Save'), ['class' => 'btn btn-block btn-success']); ?> <br> </div>
<!--?php if($propertyName == 'attachedId'): ?--> <?php if ($field['type'] == ProcessDefinitionForm::TYPE_FILE) { ?> <div class="fileinput-button"> <button type="button" class="btn btn-success js-upload-btn" data-loading-text="Завантаження..." class="btn btn-primary" autocomplete="off"> <span class="glyphicon glyphicon-file" aria-hidden="true"></span> Завантажити файл </button> <?php echo FileUpload::widget(['name' => 'file', 'url' => ['/site/upload'], 'options' => ['accept' => '*', 'class' => ''], 'clientOptions' => ['maxFileSize' => 2000000, 'autoUpload' => true], 'clientEvents' => ['fileuploadsubmit' => 'function(e, data) { $(".js-upload-btn").button("loading"); }', 'fileuploaddone' => 'function(e, data) { $(".js-upload-btn").button("reset"); $(".js-attached-id").val(data.result.id); $(".js-filename").html(data.result.name); }', 'fileuploadfail' => 'function(e, data) { $(".js-upload-btn").button("reset"); //$(".js-filename").html(data.textStatus); $(".js-filename").html("При завантаженні файлу виникла помилка"); }']]); ?> </div> <div class="filename js-filename"></div> <br> <?php } ?> <?php } ?>
" alt="image_description"> <?php } else { ?> <img id="profile-info-mage" src="/images/profile-img.png" alt="image_description"> <?php } ?> <?php echo FileUpload::widget(['model' => $imageModel, 'attribute' => 'fullPath', 'url' => ['profile/upload'], 'options' => ['accept' => 'image/*'], 'clientOptions' => ['maxFileSize' => 5000000], 'clientEvents' => ['fileuploaddone' => 'function(e, data) { if(data.result.success){ $("#profile-info-mage").attr("src",data.result.image); } if(data.result.error){ $("#image-erros").html(data.result.error); } }', 'fileuploadadd' => 'function(e, data) { if(data.originalFiles[0]["size"] != undefined && data.originalFiles[0]["size"] > 5000000) { $("#image-erros").html("Max file size: 5Mb"); return false; } }']]); ?> </div> <div class="right-section"> <div class="profile-info"> <h2><?php echo Html::encode($this->title); ?> </h2> <span>Level: <span class="highlight" <?php
<div class="form-group chunk-upload-input required"> <label class="col-lg-3 control-label" for="record-<?php echo $attribute; ?> "><?php echo $model->getAttributeLabel($attribute); ?> </label> <div style="float: left; padding-left: 15px; padding-right: 15px; position: relative;"> <span class="btn btn-default fileinput-button" style="float: left"> <i class="glyphicon glyphicon-plus"></i> <span>Add File...</span> <?php echo FileUpload::widget(['id' => $attribute, 'name' => 'image', 'url' => $uploadUrl, 'options' => ['accept' => $acceptMimeTypes], 'clientOptions' => ['maxFileSize' => $maxFileSize, 'maxChunkSize' => $maxChunkSize, 'dropZone' => $dropZone], 'clientEvents' => ['fileuploadadd' => "function(e, data) {\n \$('#progress_{$attribute}').show();\n }", 'fileuploadprogress' => "function(e, data) {\n var progress = parseInt(data.loaded / data.total * 100, 10);\n \$('#progress_{$attribute} .progress-bar').css( 'width', progress + '%');\n \$('#progress_{$attribute} .progress-bar span').replaceWith('<span>' + progress + '% ' + 'Uploading file' + '</span>')\n }", 'fileuploaddone' => "function(e, data, jqXHR) {\n \$('#progress_{$attribute} .progress-bar').css( 'width', '100%');\n \$('#progress_{$attribute} .progress-bar span').replaceWith('<span>100% ' + 'Processing file' + '</span>')\n \$.ajax({\n type: 'POST',\n url: '{$handleUrl}',\n data: {\n file: data.jqXHR.responseText\n },\n dataType: 'json',\n error: function(jqXHR, textStatus, errorThrown){\n \$.notify('Error occurred' + jqXHR.responseText, 5000);\n }\n }).done(function (resp) {\n \$.notify('Upload complete', 'success');\n \$('input[name=\"Record[{$attributeHidden}]\"]').val(resp.id);\n });\n\n }", 'fileuploadfail' => "function(e, data) {\n \$.notify('Upload failed');\n }"]]); ?> </span> </div> <div class="col-lg-5" style="padding: 2px 0 0;width: 135px;"> <div id="progress_<?php echo $attribute; ?> " class="progress" style="display: none"> <div class="progress-bar progress-bar-success"><span></span></div> </div> </div> <?php echo $form->field($model, $attributeHidden, ['options' => ['class' => 'hidden-upload-wrapper']])->hiddenInput()->label(false); ?>
<div id="tracks"> <?php foreach ($tracks as $index => $track) { echo "<div id='track-{$index}' class='track-block form-group'>"; echoTrack($form, $track, $index); echo '</div>'; } ?> </div> <div class="form-group"> <span class="btn btn-primary fileinput-button default-button"> <span class="glyphicon glyphicon-plus"></span> Upload Tracks <?php echo FileUpload::widget(['name' => 'File[uploadedFiles][]', 'url' => ['file/upload'], 'options' => ['accept' => 'audio/*', 'multiple' => true], 'clientOptions' => ['maxFileSize' => 5000000, 'singleFileUploads' => false], 'clientEvents' => ['fileuploadstart' => "function (e) {\n \$('#progress-audio').removeClass('invisible');\n }", 'fileuploaddone' => "function(e, data) {\n \$('#progress-audio').addClass('invisible');\n \$('#progress-audio .bar').css('width', '0%');\n\n for (var i = 0; i < data.result.length; i++) {\n var item = data.result[i];\n var index = \$('.track-block').length;\n\n \$('<div>').attr({\n id: 'track-' + index,\n class: 'track-block track-container'\n }).append(\n \$('<div>').append(\n \$('<audio>').attr({\n id: item.id,\n class: 'track-audio',\n src: item.url,\n type: item.type,\n preload: 'none',\n controls: true,\n onended: 'playNextTrack(this)',\n onplay: 'onPlayTrack(this)',\n onvolumechange: 'saveVolume(this)'\n })\n ),\n \$('#track-proto').clone().html().replace(/0/g, index)\n ).appendTo('#tracks');\n\n \$('#track-' + index + '-original_name').val(item.meta.title);\n \$('#track-' + index + '-number').val(item.meta.number);\n \$('#track-' + index + '-disc').val(item.meta.disc);\n \$('#track-' + index + '-lyric').val(item.meta.lyric);\n \$('#track-' + index + '-info').val(item.meta.info);\n \$('#track-' + index + '-file_id').val(item.id);\n }\n }", 'fileuploadfail' => "function(e, data) {\n bootbox.alert('Error.');\n }", 'fileuploadprogressall' => "function (e, data) {\n var progress = parseInt(data.loaded / data.total * 100, 10);\n \$('#progress-audio .bar').css('width', progress + '%');\n }"]]); ?> </span> </div> <div class="form-group"> <?php echo Html::submitButton('Create', ['class' => 'btn btn-success default-button']); ?> </div> <?php ActiveForm::end(); ?> <div id="track-proto" class="invisible">
echo \app\components\GalleryWidget::widget(['isNew' => false, 'images' => $model->getCovers()->addOrderBy('is_main DESC')->all(), 'ownerClass' => 'Cover', 'ownerId' => $model->id]); ?> </div> <div class="col-md-4"> <div class="tracks"><?php foreach ($model->tracks as $track) { echoTrack($track); } ?> </div> <span class="btn btn-default btn-xs fileinput-button" style="margin-top: 10px;"> <span class="glyphicon glyphicon-plus"></span> Add Tracks <?php echo FileUpload::widget(['name' => 'File[uploadedFiles][]', 'url' => ['file/upload', 'rid' => $model->id], 'options' => ['accept' => 'audio/*', 'multiple' => true], 'clientOptions' => ['maxFileSize' => 5000000, 'singleFileUploads' => false], 'clientEvents' => ['fileuploadstart' => "function (e) {\n \$('#progress-audio').removeClass('invisible');\n }", 'fileuploaddone' => "function(e, data) {\n \$('#progress-audio').addClass('invisible');\n \$('#progress-audio .bar').css('width', '0%');\n\n var trackTpl = Handlebars.compile(\$('#track-tpl').html());\n for (var i = 0; i < data.result.length; i++) {\n var item = data.result[i];\n \$('.tracks').append(trackTpl({\n id: item.track_id,\n comname: item.comname,\n number: item.number,\n url: item.url\n })).children().last().fadeIn();\n }\n }", 'fileuploadfail' => "function(e, data) {\n bootbox.alert('Error');\n }", 'fileuploadprogressall' => "function (e, data) {\n var progress = parseInt(data.loaded / data.total * 100, 10);\n \$('#progress-audio .bar').css('width', progress + '%');\n }"]]); ?> </span> <div id="progress-audio" class="progress invisible" style="margin-top: 10px;"> <div class="bar progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div> </div> </div> <div class="col-md-4" style="margin-top: 10px;"> <table class="table table-condensed"> <tr> <th>Date</th> <td><?php echo XeditableWidget::widget(['type' => 'rdate', 'model' => $model, 'attribute' => 'date']);
<div class="row"> <div class="col-md-4"> <div id="gallery_message"></div> <?php $attachmentForm = ActiveForm::begin(['id' => $attachment->formName()]); ?> <?php echo $attachmentForm->field($attachment, 'title')->textInput(); ?> <?php echo FileUpload::widget(['model' => $attachment, 'attribute' => 'attachment', 'url' => ['adver/attachment-add', 'id' => $adverModel->id], 'clientOptions' => ['dataType' => 'json', 'autoUpload' => false, 'maxFileSize' => Yii::$app->params['maxAttachmentSize']], 'clientEvents' => ['fileuploaddone' => 'function(e, data) { $("#attachment_message").html(data.result.message); if (!data.result.error){ reloadPjax("attachment-pjax"); } $("#attachment-upload-container").html(""); }', 'fileuploadfail' => 'function(e, data) { $("#attachment_message").addClass("alert alert-danger").html("' . Yii::t('app', 'Error!') . '"); }', 'fileuploadsubmit' => 'function(e, data) { $("#attachment_message").removeClass().html(""); data.formData = {"Attachment[title]": $("#attachment-title").val()}; }', 'fileuploadadd' => "function(e, data) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$('#attachment-upload-container').html('');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t data.context = \$('<button/>').text('" . Yii::t('app', 'Upload') . "').addClass('btn btn-primary')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.appendTo('#attachment-upload-container')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.click(function () {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata.context = \$('<p/>').text('" . Yii::t('app', 'Uploading...') . "').replaceAll(\$(this));\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata.submit();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}"]]); ?> <?php ActiveForm::end(); ?> <div id="attachment-upload-container" class="form-group"></div> </div> </div> <?php } ?>
<div class="folders"> <h3>Все каталоги</h3> </div> <div class="content"> <h3>Заголовок</h3> <div class="descr">Описание</div> <div class="imglist"></div> <div class="form"> <?php echo \dosamigos\fileupload\FileUpload::widget(['model' => $model, 'attribute' => 'file', 'url' => ['/medialib/picture/upload'], 'options' => ['accept' => 'image/*'], 'clientOptions' => ['maxFileSize' => 2000000], 'clientEvents' => ['fileuploaddone' => 'function(e, data) { console.log(e); console.log(data); }', 'fileuploadfail' => 'function(e, data) { console.log(e); console.log(data); }']]); ?> </div> </div> <div class="info"> <h3>Описание</h3> </div>
$delete = "function () {\n bootbox.confirm('Are you sure you want to delete this image?', function(result) {\n if (result) \$.post(\n '" . Url::toRoute('file/delete', true) . "' + '?id=' + \$('.fotorama').data('fotorama').activeFrame.id,\n function () {\n var fotorama = \$('.fotorama').data('fotorama');\n \$('#image-' + fotorama.activeFrame.id + '-file_id').remove();\n \$('#image-' + fotorama.activeFrame.id + '-is_main').remove();\n fotorama.splice(fotorama.activeIndex, 1);\n if (fotorama.data) \$('#image-' + fotorama.data[0].id + '-is_main').val(1);\n if (fotorama.size == 0) {\n \$('#image-as_main, #image-delete').prop('disabled', true);\n fotorama.push({img: '{$defImgUrl}', id: 'default'});\n }\n }\n );\n });\n }"; } else { $owner = strtolower($widget->ownerClass); $term = $owner == 'cover' ? 'rid' : 'aid'; $uploadUrl = ['file/upload', "{$term}" => $widget->ownerId]; $fileUploadDone = "function(e, data) {\n \$('#progress-image').addClass('invisible');\n \$('#progress-image .bar').css('width', '0%');\n\n var fotorama = \$('.fotorama').data('fotorama');\n\n for (var i = 0; i < data.result.length; i++) {\n var item = data.result[i];\n if (fotorama.data[0].id == 'default') {\n \$('#image-as_main, #image-delete').prop('disabled', false);\n fotorama.shift();\n }\n fotorama.push({img: item.url, id: item.image_id});\n if (i == 0) fotorama.show(fotorama.size - 1);\n }\n }"; $asMain = "function () {\n var fotorama = \$('.fotorama').data('fotorama');\n var frame = {\n img: fotorama.activeFrame.img,\n id: fotorama.activeFrame.id\n };\n fotorama.splice(fotorama.activeIndex, 1);\n fotorama.unshift(frame);\n fotorama.show(0);\n \$.post(\n '" . Url::toRoute("update/{$owner}", true) . "',\n {\n pk: frame.id,\n name: 'is_main',\n value: 1\n }\n );\n }"; $delete = "function () {\n bootbox.confirm('Are you sure you want to delete this image?', function(result) {\n if (result) \$.post(\n '" . Url::toRoute("{$owner}/delete", true) . "' + '?id=' + \$('.fotorama').data('fotorama').activeFrame.id,\n function () {\n var fotorama = \$('.fotorama').data('fotorama');\n fotorama.splice(fotorama.activeIndex, 1);\n if (fotorama.size == 0) {\n \$('#image-as_main, #image-delete').prop('disabled', true);\n fotorama.push({img: '{$defImgUrl}', id: 'default'});\n }\n }\n );\n });\n }"; } ?> <div class="text-center" style="margin-bottom: 2px;"> <span class="btn btn-primary btn-xs fileinput-button image_button"> <span class="glyphicon glyphicon-plus"></span> Upload <?php echo FileUpload::widget(['name' => 'File[uploadedFiles][]', 'url' => $uploadUrl, 'options' => ['accept' => 'image/*', 'multiple' => true], 'clientOptions' => ['maxFileSize' => 5000000, 'singleFileUploads' => false], 'clientEvents' => ['fileuploadstart' => "function (e) {\n \$('#progress-image').removeClass('invisible');\n }", 'fileuploaddone' => $fileUploadDone, 'fileuploadfail' => "function(e, data) {\n bootbox.alert('Error');\n }", 'fileuploadprogressall' => "function (e, data) {\n var progress = parseInt(data.loaded / data.total * 100, 10);\n \$('#progress-image .bar').css('width', progress + '%');\n }"]]); ?> </span> <button id="image-as_main" class="btn btn-success btn-xs image_button"<?php echo $widget->images ? '' : ' disabled'; ?> > <span class="glyphicon glyphicon-check" aria-hidden="true"></span> As Main </button> <button id="image-delete" class="btn btn-danger btn-xs image_button"<?php echo $widget->images ? '' : ' disabled'; ?> > <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete </button> <script>