/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionExportPDF($id) { AnswerPDFRenderer::renderAnswer($this->loadModel($id)); }
/** * render an answer group. * @param type $answer * @param type $answers_group * @param type $lang * @return string */ public function renderAnswerGroupPDF($pdf, $answer, $group, $lang) { $pdf->Ln(10); //en par defaut $title = $group->title; if ($lang == "fr") { $title = $group->title_fr; } if ($lang == "both") { $title = "<i>" . $group->title . "</i> / " . $group->title_fr; } $pdf->SetFont('helvetica', 'B', 12); $pdf->SetFillColor(211, 211, 211); $pdf->Cell(0, 5, $title, 0, 2, 'L', true); $pdf->Ln(5); $pdf->SetFont('helvetica', '', 12); if (isset($group->answers)) { foreach ($group->answers as $ans) { $pdf = AnswerPDFRenderer::renderAnswerPDF($pdf, $group->id, $ans, $lang); } } //add question groups that have parents for this group $groups = $answer->answers_group; foreach ($groups as $qg) { if ($qg->parent_group == $group->id) { $pdf = AnswerPDFRenderer::renderAnswerGroupPDF($pdf, $answer, $qg, $lang); } } return $pdf; }