MP_Email::get_pdf_content( array $pdf_data )

Get PDF content.


Parameters Parameters

$pdf_data

(array) (Required) calculate data.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: mortgage-platform/Inc/MP_Email.php

	protected function get_pdf_content( $pdf_data ) {

		$html = '<style>
					td.alt {
                       background-color: #eeeeee;
                      }
                      .details td {
                        border: 1px solid #cccccc;
                      }
                      .schedule td {
                       border-bottom: 1px solid #eeeeee;
                      }
                   </style>';

		if ( isset( $this->options_email['email_logo'] ) ) {  // Override set logo url
			// check for image post id from visual composer
			if ( preg_match( '/^\d+$/', $this->options_email['email_logo'], $matches ) ) {
				$logo_id  = $this->options_email['email_logo'];
				$logo_url = wp_get_attachment_url( $logo_id );
			} else {
				$logo_url = $this->options_email['email_logo'];
			}
		} else {    // settings set logo
			$logo_id  = isset( $this->options_email['attachment_id'] ) ? $this->options_email['attachment_id'] : '';
			$logo_url = wp_get_attachment_url( $logo_id );
		}

		if ( $logo_url ) {
			$html .= '<div style="text-align:center">'
					 . '<img src="' . $logo_url . '" border="0" />'
					 . '</div>';
		}

		if ( isset( $this->options_email['pdf_title'] ) && '' !== $this->options_email['pdf_title'] ) {
			$html .= '<h1 style="text-align: center;">' . $this->options_email['pdf_title'] . '</h1>';
		}

		$html .= '<div><div><h2>' . $pdf_data['titleTableOne'] . '</h2></div>';
		$html .= '<table  class="details" cellpadding="5">';
		$html .= '<tr><td>' . $pdf_data['original'] . ': <br /><strong>' . $pdf_data['loanAmount'] . '</strong></td>';
		$html .= '<td>' . $pdf_data['down_payment'] . ': <br /><strong>' . $pdf_data['downPayment'] . '</strong></td>';
		$html .= '<td>' . $pdf_data['interest'] . ': <br /><strong>' . $pdf_data['interestvalue'] . ' </strong></td>';
		$html .= '<td>' . $pdf_data['term'] . ': <br /><strong>' . $pdf_data['termvalue'] . '</strong></td>';
		$html .= '</tr>';
		$html .= '<tr><td>' . $pdf_data['loan_after_down'] . ': <br /><strong>' . $pdf_data['loanAfterDown'];
		$html .= '</strong></td>';
		$html .= '<td>' . $pdf_data['down_payment_amount'] . ': <br /><strong>' . $pdf_data['downPaymentAmount'];
		$html .= '</strong></td>';
		$html .= '<td>' . $pdf_data['monthly_payment'] . ': <br /><strong>' . $pdf_data['monthlyPayment'];
		$html .= '</strong></td>';
		$html .= '<td>' . $pdf_data['total_payments'] . ': <br /><strong>' . $pdf_data['totalPayments'];
		$html .= '</strong></td>';
		$html .= '</tr></table>';

		$html .= '<div>';
		$html .= '<p>' . $pdf_data['otherfactors'] . '</p>';
		$html .= '<p>' . $pdf_data['insurance_text'] . '</p>';
		$html .= '<p>' . $pdf_data['pmi_text'] . '</p>';
		$html .= '<p>' . $pdf_data['tax_text'] . '</p>';
		$html .= '<p>' . $pdf_data['total_monthlies'] . '</p>';
		$html .= '</div>';

		$html              .= '<div>';
		$img_base64_encoded = $pdf_data['chartImage'];
		$img                = '<img src="@' . preg_replace( '#^data:image/[^;]+;base64,#', '', $img_base64_encoded ) . '">';
		$html              .= $img;
		$html              .= '</div>';

		$html .= '<div><h2>' . $pdf_data['titleTableTwo'] . '</h2></div>';
		$html .= '<table class="schedule" cellpadding="5"><thead><tr style="color:' . $this->options_email['primary_email_color'] . '"><th>' . $pdf_data['payment'] . '</th> <th>' . $pdf_data['payment_amount'] . '</th>  <th>' . $pdf_data['interest'] . '</th>  <th>' . $pdf_data['total_interest'] . '</th>  <th>' . $pdf_data['principal'] . '</th>  <th>' . $pdf_data['balance'] . '</th></tr></thead>';

		$html .= $pdf_data['remainingBalance'];
		$html .= '<div><p style="text-align:center;"><small>' . $pdf_data['notice'] . '</small></p></div>';

		$html .= '</table>';

		return $html;

	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.