public function renderText($text, $return = false) { if (Yii::app()->request->isAjaxRequest) { $text = $this->processOutput($text); if ($return) { return $text; } else { echo $text; } } else { return parent::renderText($text, $return); } }
/** * Initializes the pager by setting some default property values. * @param string $html * @param string $title * @param mixed $format * @param string $orientation */ public function __construct($html, $title = '', $format = 'A4', $orientation = 'P') { parent::__construct($this->mode, $format, $this->defaultFontSize, $this->defaultFont, $this->marginLeft, $this->marginRight, $this->marginTop, $this->marginBottom, $this->marginHeader, $this->marginFooter, $orientation); $controller = new CController('PDF'); $controller->layout = $this->layouts; $html = $controller->renderText($html, true); $this->SetCreator($this->creator); $this->SetTitle($title); if (!UserWeb::instance()->isGuest) { $this->SetFooter(sprintf('Berkas dicetak oleh %s, %s||{PAGENO}', UserWeb::instance()->user()->username, date('Y-m-d H:i:s'))); } else { throw new CHttpException(403, 'Anda tidak memiliki otoritas untuk mengakses halaman ini'); } $this->writeHTML($html); }