123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
- use yii\web\View;
- use app\widgets\CropperjsWidget;
- /** @var yii\web\View $this */
- /** @var app\models\Person $model */
- /** @var yii\widgets\ActiveForm $form */
- $uuid = 'persone_page';
- @session_start();
- $_SESSION['KCFINDER']['admin_news'] = true;
- // CKEditor
- $this->registerJs(
- <<<JS
- CKEDITOR.replace('Person[description]', {
- 'filebrowserBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
- 'filebrowserImageBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=images&uid=$uuid',
- 'filebrowserFlashBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=flash&uid=$uuid',
- 'filebrowserUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=files&uid=$uuid',
- 'filebrowserImageUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=images&uid=$uuid',
- 'filebrowserFlashUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=flash&uid=$uuid',
- 'filebrowserAudioBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
- 'filebrowserlightboxUploadUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
- 'height': 400
- });
- JS
- ,
- View::POS_READY,
- 'ck_editor'
- );
- if($model->id){
- $imageSrc = $model->getImg('hd','jpg')."?r=".rand();
- }else{
- $imageSrc = '/img/e.gif';
- }
- ?>
- <style>
- #image {
- width: 100%;
- aspect-ratio: 16/9;
- background: URL(/img/image.svg) no-repeat 50% 50%;
- background-size: contain;
- background-color: #fff;
- cursor: pointer;
- margin: 10px;
- }
- </style>
- <div class="person-form">
- <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
- <?= $form->field($model, 'name')->textInput() ?>
- <div style="width:30%;">
- <img id="image" src="<?=$imageSrc?>" onClick="$('#modal').modal('show');document.getElementById('inputImage').click();" >
- </div>
- <?
- echo CropperjsWidget::widget(['image' => 'image', 'file' => 'Person[photo]', 'post' => 'cropping', 'aspectRatio' => '16 / 9']);
- ?>
- <?= $form->field($model, 'alias')->textInput([
- 'maxlength' => true,
- 'class' => 'form-control js-word-count-input',
- 'placeholder' => 'URL если не заполнить, то создаётся из имини'
- ])->label('URL часть адреса рездела');
- ?>
- <?= $form->field($model, 'jobtitle')->textarea(['rows' => 2]) ?>
- <?= $form->field($model, 'birthdate')->widget(\yii\jui\DatePicker::className(), [ 'dateFormat' => 'dd-MM-yyyy', 'options' => ['class' => 'form-control', 'placeholder' => 'День рождения персоны (если неизвестно - не заполнять)', 'id'=>'birthdate']]) ?>
- <?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>
- <?= $form->field($model, 'phone')->textInput()->label('<i class="fas fa-lg fa-phone"></i> Телефон'); ?>
- <?= $form->field($model, 'email')->textInput() ?>
- <div class="form-group ml-5">
- <?= $form->field($model, 'show')->checkbox([
- 'uncheck' => 'N',
- 'class' => 'form-check-input',
- 'checked' => ($model->show == 'Y')?true:false,
- 'label' =>'Показывать'
- ]);
- ?>
- </div>
- <div class="form-group">
- <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
- </div>
- <?php ActiveForm::end(); ?>
- </div>
|