Вот мой экшн:
Код: Выделить всё
public function actionPrint($id) {
$model=Deps::model()->findAll($department);
$pdf = Yii::createComponent('application.extensions.tcpdf.ETcPdf', 'P', 'cm', 'A6', true, 'UTF-8');
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor("Author Here");
$pdf->SetTitle("Title Here");
$pdf->SetSubject("TCPDF Tutorial");
$pdf->SetKeywords("TCPDF, PDF, example, test, guide");
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->AddPage();
$pdf->SetFont("times_", "", 14);
$tbl = "" . date('d.m.Y', time()) . "<br><br>";
$tbl .= '<table style="border:1px solid #000000; padding: 8px;"><tbody><tr bgcolor="#cccccc"><th ><strong>Пользователь</strong></th><th><strong>Отделение</strong></th><th><strong>Док</strong></th><th><strong>Дата</strong></th><th ><strong>Время</strong></th><th ><strong>Номер</strong></th></tr>';
$tbl .= "<tr><td>";
$tbl .= "{$model->user_id}";
$tbl .= "</td><td>";
$tbl .= "{$model->deps_id}";
$tbl .= "</td><td>";
$tbl .= "{$model->staff_id}";
$tbl .= "</td><td>";
$tbl .= "{$model->meetdate}";
$tbl .= "</td><td>";
$tbl .= "{$model->meettime}";
$tbl .= "</td><td>";
$tbl .= "{$model->office_num}";
$tbl .='</td></tr></tbody></table>';
$pdf->writeHTML($tbl, true, true, false, false, '');
$pdf->Output("example.pdf", "I");
}
Код: Выделить всё
...
array(
'class'=>'CButtonColumn',
'template' => '{print}',
'buttons'=>array(
'print' => array(
'label'=>'PDF', // text label of the button
'url' => 'Yii::app()->createUrl("admin/mednotes/print")'
),
//'imageUrl'=>'/path/to/copy.gif', // image URL of the button. If not set or false, a text link is used
'options' => array('class'=>'print'), // HTML options for the button
),
),
...
При нажатии на "Распечатать" выдает ошибку "Error 400 Некорректный запрос."
Делаю по примеру, который видел здесь, на форуме.
Не могу понять, что не так делаю.