<?php
Yii::import('application.vendors.*');
require_once('digitaljunkies/dompdf/dompdf_config.inc.php');
spl_autoload_unregister(array('YiiBase','autoload'));
// this makes the php engine unhappy, likely incorrect syntax
//spl_autoload_register(array('DOMPDF_autoload','autoload'));
spl_autoload_register(array('YiiBase','autoload'));
class RecruitmentController extends CController
{
/**
* @var string specifies the default action to be 'list'.
*/
public $defaultAction='show';
/**
* Shows a particular model.
*/
public function actionShow()
{
$this->render('show');
}
/**
* Generates a printable recruitment pdf.
*/
public function actionPrint()
{
$html =
'<html><body>'.
'<div style="width:5in; height:5in; background-color:green;">'.
getcwd().'<br>'.
'localhost/images/ispies/recruitment/russia1.jpg'.
'<img src="'.Yii::app()->request->baseUrl.'/images/ispies/
recruitment/russia1.jpg" alt="iSpies" border=0>'.
'</div>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->base_path = Yii::app()->request->baseUrl;
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");
}
}