vc text short

This commit is contained in:
andrey 2021-07-13 13:45:44 +03:00
parent fef3f26ae3
commit ca64e6741f
5 changed files with 39 additions and 2 deletions

View File

@ -154,6 +154,12 @@ use yii\widgets\ActiveForm;
</div> </div>
</div> </div>
<div class="row">
<div class="col-xs-12">
<?= $form->field($model, 'vc_text_short')->textarea() ?>
</div>
</div>
<?= $form->field($model, 'vc_text')->widget(EditorClassic::className(),[ <?= $form->field($model, 'vc_text')->widget(EditorClassic::className(),[
'clientOptions' => [ 'clientOptions' => [
'language' => 'ru', 'language' => 'ru',

View File

@ -75,6 +75,7 @@ $this->params['breadcrumbs'][] = $this->title;
], ],
'created_at', 'created_at',
'updated_at', 'updated_at',
'vc_text_short',
[ [
'attribute' => 'vc_text', 'attribute' => 'vc_text',
'format' => 'raw' 'format' => 'raw'

View File

@ -27,6 +27,7 @@ use yii\helpers\ArrayHelper;
* @property string $resume * @property string $resume
* @property string $salary * @property string $salary
* @property string $vc_text * @property string $vc_text
* @property string $vc_text_short
* @property int $position_id * @property int $position_id
* @property int $city * @property int $city
* @property int $level * @property int $level
@ -96,7 +97,7 @@ class UserCard extends \yii\db\ActiveRecord
return [ return [
[['fio', 'status', 'gender', 'email', 'level', 'position_id'], 'required'], [['fio', 'status', 'gender', 'email', 'level', 'position_id'], 'required'],
[['gender', 'status', 'position_id', 'id_user', 'level'], 'integer'], [['gender', 'status', 'position_id', 'id_user', 'level'], 'integer'],
[['dob', 'created_at', 'updated_at', 'deleted_at', 'vc_text'], 'safe'], [['dob', 'created_at', 'updated_at', 'deleted_at', 'vc_text', 'vc_text_short'], 'safe'],
[['fio', 'passport', 'photo', 'email', 'resume', 'city', 'link_vk', 'link_telegram'], 'string', 'max' => 255], [['fio', 'passport', 'photo', 'email', 'resume', 'city', 'link_vk', 'link_telegram'], 'string', 'max' => 255],
[['salary'], 'string', 'max' => 100], [['salary'], 'string', 'max' => 100],
[['position_id'], 'exist', 'skipOnError' => true, 'targetClass' => Position::class, 'targetAttribute' => ['position_id' => 'id']], [['position_id'], 'exist', 'skipOnError' => true, 'targetClass' => Position::class, 'targetAttribute' => ['position_id' => 'id']],
@ -129,6 +130,7 @@ class UserCard extends \yii\db\ActiveRecord
'link_vk' => 'VK', 'link_vk' => 'VK',
'link_telegram' => 'Telegram', 'link_telegram' => 'Telegram',
'vc_text' => 'Резюме текст', 'vc_text' => 'Резюме текст',
'vc_text_short' => 'Резюме короткий текст',
'level' => 'Уровень' 'level' => 'Уровень'
]; ];
} }

View File

@ -0,0 +1,25 @@
<?php
use yii\db\Migration;
/**
* Handles adding columns to table `{{%user_card}}`.
*/
class m210713_103749_add_vc_text_short_column_to_user_card_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('{{%user_card}}', 'vc_text_short', $this->text());
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('{{%user_card}}', 'vc_text_short');
}
}

View File

@ -60,14 +60,17 @@ class ProfileSearchForm extends Model
$model->joinWith(['skillValues']); $model->joinWith(['skillValues']);
$this->skills = explode(',', $this->skills); $this->skills = explode(',', $this->skills);
$model->where(['card_skill.skill_id' => $this->skills]); $model->where(['card_skill.skill_id' => $this->skills]);
$model->having('COUNT(DISTINCT skill_id) = ' . count($this->skills));
} }
else{ else{
$model->with('skillValues'); $model->joinWith('skillValues');
} }
$model->andWhere(['status' => [4, 12]]); $model->andWhere(['status' => [4, 12]]);
$model->andWhere(['deleted_at' => null]); $model->andWhere(['deleted_at' => null]);
$model->groupBy('card_skill.card_id');
return $model->limit($this->limit) return $model->limit($this->limit)
->offset($this->offset)->orderBy('id DESC')->asArray()->all(); ->offset($this->offset)->orderBy('id DESC')->asArray()->all();
} }