Ejemplo n.º 1
0
 /**
  * Возвращает модель по ее идентификатору
  * @param int $id
  * @return Education
  */
 protected function findModel($id)
 {
     if (($model = Education::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('Запись не найдена');
     }
 }
Ejemplo n.º 2
0
Archivo: Cv.php Proyecto: marvin255/cv
 /**
  * Связываем модели
  */
 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);
 }
Ejemplo n.º 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>