4 * This class provides the common functionality for creating PDF letter for
7 class CRM_Member_Form_Task_PDFLetterCommon
extends CRM_Contact_Form_Task_PDFLetterCommon
{
10 * process the form after the input has been submitted and validated
11 * @todo this is horrible copy & paste code because there is so much risk of breakage
12 * in fixing the existing pdfLetter classes to be suitably generic
16 * @param $membershipIDs
18 * @param $skipDeceased
23 static function postProcessMembers(&$form, $membershipIDs, $skipOnHold, $skipDeceased, $contactIDs) {
25 list($formValues, $categories, $html_message, $messageToken, $returnProperties) =
26 self
::processMessageTemplate($form);
38 self
::createActivities($form, $html_message, $contactIDs);
40 CRM_Utils_PDF_Utils
::html2pdf($html, "CiviLetter.pdf", FALSE, $formValues);
42 $form->postProcessHook();
44 CRM_Utils_System
::civiExit(1);
49 * generate htmlfor pdf letters
50 * @param unknown_type $membershipIDs
51 * @param unknown_type $returnProperties
52 * @param unknown_type $skipOnHold
53 * @param unknown_type $skipDeceased
54 * @param unknown_type $messageToken
57 static function generateHTML($membershipIDs, $returnProperties, $skipOnHold, $skipDeceased, $messageToken, $html_message, $categories) {
58 $memberships = CRM_Utils_Token
::getMembershipTokenDetails($membershipIDs);
60 foreach ($membershipIDs as $membershipID) {
61 $membership = $memberships[$membershipID];
62 // get contact information
63 $contactId = $membership['contact_id'];
64 $params = array('contact_id' => $contactId);
65 //getTokenDetails is much like calling the api contact.get function - but - with some minor
66 // special handlings. It preceeds the existance of the api
67 list($contacts) = CRM_Utils_Token
::getTokenDetails(
74 'CRM_Contribution_Form_Task_PDFLetterCommon'
77 $tokenHtml = CRM_Utils_Token
::replaceContactTokens($html_message, $contacts[$contactId], TRUE, $messageToken);
78 $tokenHtml = CRM_Utils_Token
::replaceEntityTokens('membership', $membership, $tokenHtml, $messageToken);
79 $tokenHtml = CRM_Utils_Token
::replaceHookTokens($tokenHtml, $contacts[$contactId], $categories, TRUE);
80 $tokenHtml = CRM_Utils_Token
::parseThroughSmarty($tokenHtml, $contacts[$contactId]);