class CRM_Contact_Form_Task_PDFLetterCommon {
/**
- * build all the data structures needed to build the form
+ * Build all the data structures needed to build the form
*
- * @param $form
+ * @param CRM_Core_Form $form
*
* @return void
* @access public
}
/**
- * @param $form
- * @param $cid
+ * @param CRM_Core_Form $form
+ * @param int $cid
*/
static function preProcessSingle(&$form, $cid) {
$form->_contactIds = array($cid);
}
/**
- * Build the form
+ * Build the form object
*
* @var CRM_Core_Form $form
*
array('size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"),
TRUE
);
+
+ $config = CRM_Core_Config::singleton();
+ if ($config->wkhtmltopdfPath == false) {
+ $form->add(
+ 'text',
+ 'stationery',
+ ts('Stationery (relative path to PDF you wish to use as the background)'),
+ array('size' => 25, 'maxlength' => 900, 'onkeyup' => "showUpdateFormatChkBox();"),
+ FALSE
+ );
+ }
$form->add('checkbox', 'bind_format', ts('Always use this Page Format with the selected Template'));
$form->add('checkbox', 'update_format', ts('Update Page Format (this will affect all templates that use this format)'));
CRM_Mailing_BAO_Mailing::commonLetterCompose($form);
- if ($form->_single) {
- $cancelURL = CRM_Utils_System::url(
- 'civicrm/contact/view',
- "reset=1&cid={$form->_cid}&selectedChild=activity",
- FALSE,
- NULL,
- FALSE
+ $buttons = array();
+ if ($form->get('action') != CRM_Core_Action::VIEW) {
+ $buttons[] = array(
+ 'type' => 'submit',
+ 'name' => $form->_single ? ts('Make PDF') : ts('Make PDFs'),
+ 'isDefault' => TRUE,
);
- if ($form->get('action') == CRM_Core_Action::VIEW) {
- $form->addButtons(array(
- array(
- 'type' => 'cancel',
- 'name' => ts('Done'),
- 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"),
- ),
- )
- );
- }
- else {
- $form->addButtons(array(
- array(
- 'type' => 'submit',
- 'name' => ts('Make PDF Letter'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Done'),
- 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"),
- ),
- )
- );
- }
- }
- else {
- $form->addButtons(array(
- array(
- 'type' => 'submit',
- 'name' => ts('Make PDF Letters'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Done'),
- ),
- ));
}
+ $buttons[] = array(
+ 'type' => 'cancel',
+ 'name' => $form->get('action') == CRM_Core_Action::VIEW ? ts('Done') : ts('Cancel'),
+ );
+ $form->addButtons($buttons);
$form->addFormRule(array('CRM_Contact_Form_Task_PDFLetterCommon', 'formRule'), $form);
}
}
/**
- * form rule
+ * Form rule
*
* @param array $fields the input form values
* @param array $dontCare
}
/**
- * part of the post process which prepare and extract information from the template
+ * Part of the post process which prepare and extract information from the template
*
* @access protected
*
- * @param $form
+ * @param CRM_Core_Form $form
*
* @return array( $categories, $html_message, $messageToken, $returnProperties )
*/
}
/**
- * process the form after the input has been submitted and validated
+ * Process the form after the input has been submitted and validated
*
* @access public
*
- * @param $form
+ * @param CRM_Core_Form $form
*
* @return void
*/
}
/**
- * @param $form
+ * @param CRM_Core_Form $form
* @param $html_message
* @param $contactIds
*