Exemple #1
0
 /**
  * Возвращает модель по ее идентификатору
  * @param int $id
  * @return Skills
  */
 protected function findModel($id)
 {
     if (($model = Skills::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('Запись не найдена');
     }
 }
Exemple #2
0
 /**
  * Связываем модели
  */
 public function afterSave()
 {
     if ($this->_worksIds !== null) {
         $this->unlinkAll('works', true);
         $list = Work::find()->where(['id' => $this->_worksIds])->all();
         foreach ($list as $item) {
             $this->link('works', $item);
         }
     }
     if ($this->_educationsIds !== null) {
         $this->unlinkAll('educations', true);
         $list = Education::find()->where(['id' => $this->_educationsIds])->all();
         foreach ($list as $item) {
             $this->link('educations', $item);
         }
     }
     if ($this->_skillsIds !== null) {
         $this->unlinkAll('skills', true);
         $list = Skills::find()->where(['id' => $this->_skillsIds])->all();
         foreach ($list as $item) {
             $this->link('skills', $item);
         }
     }
     //создаем pdf
     Yii::$app->pdf->renderCvToFile($this);
 }
Exemple #3
0
<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
use app\models\cv\Work;
use app\models\cv\Education;
use app\models\cv\Skills;
$works = ArrayHelper::map(Work::find()->all(), 'id', 'title');
$educations = ArrayHelper::map(Education::find()->all(), 'id', 'title');
$skills = ArrayHelper::map(Skills::find()->all(), 'id', 'title');
$form = ActiveForm::begin(['method' => 'post', 'enableClientScript' => false, 'options' => ['enctype' => 'multipart/form-data']]);
?>

	<?php 
echo $form->field($model, 'is_active')->checkbox();
?>

	<?php 
echo $form->field($model, 'title');
?>
	
	<?php 
echo $form->field($model, 'language');
?>

	<?php 
if (!empty($model->photo)) {
    ?>
		<p>