/** * wyświetlanie pdf z reklamacją */ public function pdfAction() { $request = $this->getRequest(); $id = $this->_helper->IdConvert->hexToStr($request->getParam('id')); $c = new Logic_Complaint(); $rendered = Logic_Complaint::renderOne($c->getComplaint($id)); Logic_Complaint::renderPdf($rendered); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout->disableLayout(); }
/** * Wysyłanie reklamacji mailsoap * @param type $values */ public function sendComplaint($values, $complaint_id) { $sgm = new WsServiceGroup(); $sgid = $sgm->fetchRow(array('ghost = false', "code ilike 'complaint_mail_group'"))->id; $client = Logic_Client::getInstance(); $service = $client->getMailService($sgid); $c = new Logic_Complaint(); $complaint = $c->getComplaint($complaint_id); $rendered = Logic_Complaint::renderOne($complaint); $fn = 'formularz_reklamacji_' . date('Y-m-d') . '_' . $complaint['special_id'] . '.pdf'; $path = '/tmp/' . $fn; Logic_Complaint::renderPdf($rendered, 'F', $path); $attachments = array(0 => array('name' => $fn, 'type' => 'application/pdf;', 'content' => base64_encode(file_get_contents($path)), 'id' => $complaint['special_id'])); $http = new Zend_Controller_Request_Http(); $ip = $http->getServer('SERVER_ADDR'); $mail = new Logic_Mail($service, $ip); $mail->mail($values['recipient_mail'], array(), array(), $values['mail_subject'], $values['mail_content'], $attachments, 'UTF-8', false, $values['replyto']); }