/** * Finds the GivenTask model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return GivenTask the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = GivenTask::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionPdfTask($id) { $model = GivenTask::findOne($id); return $this->render('pdf-task', ['model' => $model]); $content = $this->renderPartial('pdf-task', ['model' => $model]); $pdf = Yii::$app->pdf; $pdf->options = ['title' => $model->task->name]; //$content = preg_replace("/$$([^&]*)$$/", 1488,$content); //preg_match("/($$)(.*)($$)/", $content, $eq); $pdf->content = $content; $pdf->render(); //return $this->render('pdf-task-view',['mod' => $pdf]); }