public function MakePDF($sender, $param) { $stringJob = $this->formatJob($param->Item->IDJobColumn->Text); $job = TblStringingJobs::finder()->findBy_id($param->Item->IDJobColumn->Text); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor("www.stringtools.it"); $pdf->SetTitle($stringJob); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set font $pdf->SetFont('times', '', 13); // add a page $pdf->AddPage(); //immagine utente $urlJpg = 'themes/White/images/logo/' . $this->User->UserDB->id . ".jpg"; //$urlPng = 'themes/White/images/logo/'.$this->User->UserDB->id.".png"; if (file_exists($urlJpg)) { $pdf->Image($urlJpg, 10, 6, 40, 15, 'JPG', 'www.stringtools.it', '', true, 150, '', false, false, 0); } else { $pdf->Image('themes/White/images/logo-st-www.jpg', 10, 6, 40, 15, 'JPG', 'www.stringtools.it', '', true, 150, '', false, false, 0); } //$pdf->Image('themes/White/images/logo-st-www.jpg',10,6,40, '', '', 'http://www.tcpdf.org', '', false, 300); $pdf->Ln(15); $pdf->Cell(0, 0, $this->User->UserDB->surname . " " . $this->User->UserDB->name, 0, 1, 'L', 0, '', 0); if ($this->User->UserDB->telephone != "") { $pdf->Cell(0, 0, $this->User->UserDB->telephone, 0, 1, 'L', 0, '', 1); } if ($this->User->UserDB->mobile_telephone != "") { $pdf->Cell(0, 0, $this->User->UserDB->mobile_telephone, 0, 1, 'L', 0, '', 1); } if ($this->User->UserDB->email != "") { $pdf->Cell(0, 0, $this->User->UserDB->email, 0, 1, 'L', 0, '', 1); } $pdf->Ln(10); $pdf->Cell(0, 0, date("d-m-Y"), 0, 1, 'R', 0, '', 1); $pdf->Ln(10); $pdf->SetFont('times', '', 16); $pdf->Cell(0, 0, Prado::localize('CLAIM_CHECK'), 0, 1, 'C', 0, '', 1); $pdf->Ln(10); $pdf->SetFont('times', '', 13); $pdf->writeHTML($this->makeHtmlJob($job), true, false, true, false, ''); header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="' . $stringJob . '.pdf"'); $pdf->Output($stringJob . '.pdf', 'D'); }
public function MakePDF($sender, $param) { $stringJob = $this->formatJob($param->Item->IDJobColumn->Text); $job = TblStringingJobs::finder()->findBy_id($param->Item->IDJobColumn->Text); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor("www.stringtools.it"); $pdf->SetTitle($stringJob); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set font $pdf->SetFont('times', '', 13); // add a page $pdf->AddPage(); //immagine utente $urlJpg = 'themes/White/images/logo/' . $this->User->UserDB->id . ".jpg"; //$urlPng = 'themes/White/images/logo/'.$this->User->UserDB->id.".png"; if (file_exists($urlJpg)) { $pdf->Image($urlJpg, 10, 6, 40, 15, 'JPG', 'www.stringtools.it', '', true, 150, '', false, false, 0); } else { $pdf->Image('themes/White/images/logo-st-www.jpg', 10, 6, 40, 15, 'JPG', 'www.stringtools.it', '', true, 150, '', false, false, 0); } //$pdf->Image('themes/White/images/logo-st-www.jpg',10,6,40, '', '', 'http://www.tcpdf.org', '', false, 300); $pdf->Ln(15); $pdf->Cell(0, 0, $this->User->UserDB->surname . " " . $this->User->UserDB->name, 0, 1, 'L', 0, '', 0); if ($this->User->UserDB->telephone != "") { $pdf->Cell(0, 0, $this->User->UserDB->telephone, 0, 1, 'L', 0, '', 1); } if ($this->User->UserDB->mobile_telephone != "") { $pdf->Cell(0, 0, $this->User->UserDB->mobile_telephone, 0, 1, 'L', 0, '', 1); } if ($this->User->UserDB->email != "") { $pdf->Cell(0, 0, $this->User->UserDB->email, 0, 1, 'L', 0, '', 1); } $pdf->Ln(10); $pdf->Cell(0, 0, date("d-m-Y"), 0, 1, 'R', 0, '', 1); $pdf->Ln(10); $pdf->SetFont('times', '', 16); $pdf->Cell(0, 0, Prado::localize('CLAIM_CHECK'), 0, 1, 'C', 0, '', 1); $pdf->Ln(10); $pdf->SetFont('times', '', 13); $pdf->writeHTML($this->makeHtmlJob($job), true, false, true, false, ''); $filename = $stringJob . '.pdf'; header("Content-Description: File Transfer"); header('Content-Type: application/octet-stream'); header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename=' . $filename); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header("Cache-Control: private", false); // required for certain browsers header('Pragma: public'); //header('Content-Length: ' . filesize($filename)); $pdf->Output($filename, 'D'); }
public function SendMail() { $stringJob = $this->formatJob((int) $this->Request['idJob']); $job = TblStringingJobs::finder()->findBy_id((int) $this->Request['idJob']); $racquetCustomer = TblRacquetsUser::finder()->findBy_id($job->tbl_racquets_user_id); $customer = TblUsers::finder()->findBy_id($racquetCustomer->tbl_users_id); $mail = new PHPMailer(); $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; $mail->Host = $this->Application->Parameters['SMTP_HOST']; $mail->Port = $this->Application->Parameters['SMTP_PORT']; $mail->Username = $this->Application->Parameters['SMTP_USERNAME']; $mail->Password = $this->Application->Parameters['SMTP_PASSWORD']; $mail->SetFrom($this->User->UserDB->email, $this->User->UserDB->surname . " " . $this->User->UserDB->name); $mail->Subject = Prado::localize("StringingMailSubject"); $body = "Dear " . $customer->name . " " . $customer->surname . "<br>"; /*$body .= "Thank you for registering at the StringTools. Before we can activate your account one last step must be taken to complete your registration."; $body .= "<br><br>"; $body .= "Please note - you must complete this last step to become a registered member. You will only need to visit this URL once to activate your account."; $body .= "<br><br>"; $body .= "To complete your registration, please visit this URL:"; $body .= "<br>"; $body .= $this->Application->Parameters['SITE_LINK']."/index.php?page=User.Confirm&id=".$userRecord->id."&code=".$userRecord->confirm_code; $body .= "<br><br>"; $body .= "Please be sure not to add extra spaces. You will need to type in your username and activation number on the page that appears when you visit the URL."; $body .= "<br><br>"; $body .= "Your Username is: ".$userRecord->username; $body .= "<br>"; $body .= "Your Activation ID is: ".$userRecord->confirm_code; $body .= "<br><br>"; $body .= "If you are still having problems signing up please contact a member of our support staff at ".$this->Application->Parameters['EMAIL_ADMIN']; $body .= "<br><br>"; $body .= "All the best,"; $body .= $this->Application->Parameters['SITE_LINK']; $mail->IsHTML(true); $mail->Body =$body; $mail->AddAddress($customer->email); if(!$mail->Send()) { echo "errore SendMail:".$mail->ErrorInfo; $error = 'Mail error: '.$mail->ErrorInfo; return false; } else { //echo " SendMail ok"; $error = 'Message sent!'; return true; }*/ }
public function DeleteJob() { $idJob = null; $idJob = (int) $this->Request['idJob']; $job = null; if ($idJob != null) { $job = TblStringingJobs::finder()->findBy_id($idJob); } $job->delete(); $this->Response->redirect($this->Service->constructUrl('Job.ListJobs', array('idUser' => $this->getViewState('customer', null)->id), false)); }