/** * Build the form * * @access public * * @return void */ static function buildQuickForm(&$form) { $form->add('static', 'pdf_format_header', NULL, ts('Page Format')); $form->add('select', 'format_id', ts('Select Format'), array(0 => ts('- default -')) + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE, array('onChange' => "selectFormat( this.value, false );")); $form->add('select', 'paper_size', ts('Paper Size'), array(0 => ts('- default -')) + CRM_Core_BAO_PaperSize::getList(TRUE), FALSE, array('onChange' => "selectPaper( this.value ); showUpdateFormatChkBox();")); $form->add('static', 'paper_dimensions', NULL, ts('Width x Height')); $form->add('select', 'orientation', ts('Orientation'), CRM_Core_BAO_PdfFormat::getPageOrientations(), FALSE, array('onChange' => "updatePaperDimensions(); showUpdateFormatChkBox();")); $form->add('select', 'metric', ts('Unit of Measure'), CRM_Core_BAO_PdfFormat::getUnits(), FALSE, array('onChange' => "selectMetric( this.value );")); $form->add('text', 'margin_left', ts('Left Margin'), array('size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), TRUE); $form->add('text', 'margin_right', ts('Right Margin'), array('size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), TRUE); $form->add('text', 'margin_top', ts('Top Margin'), array('size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), TRUE); $form->add('text', 'margin_bottom', ts('Bottom Margin'), array('size' => 8, 'maxlength' => 8, 'onkeyup' => "showUpdateFormatChkBox();"), TRUE); $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)')); $form->assign('useThisPageFormat', ts('Always use this Page Format with the new template?')); $form->assign('useSelectedPageFormat', ts('Should the new template always use the selected Page Format?')); $form->assign('totalSelectedContacts', count($form->_contactIds)); 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); 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->addDefaultButtons(ts('Make PDF Letters')); } $form->addFormRule(array('CRM_Contact_Form_Task_PDFLetterCommon', 'formRule'), $form); }
/** * Build the form object. */ public function buildQuickForm() { $this->addElement('radio', 'output', NULL, ts('Email Receipts'), 'email_receipt', array('onClick' => "document.getElementById('selectPdfFormat').style.display = 'none';")); $this->addElement('radio', 'output', NULL, ts('PDF Receipts'), 'pdf_receipt', array('onClick' => "document.getElementById('selectPdfFormat').style.display = 'block';")); $this->addRule('output', ts('Selection required'), 'required'); $this->add('select', 'pdf_format_id', ts('Page Format'), array(0 => ts('- default -')) + CRM_Core_BAO_PdfFormat::getList(TRUE)); $this->add('checkbox', 'receipt_update', ts('Update receipt dates for these contributions'), FALSE); $this->add('checkbox', 'override_privacy', ts('Override privacy setting? (Do no email / Do not mail)'), FALSE); $this->addButtons(array(array('type' => 'next', 'name' => ts('Process Receipt(s)'), 'isDefault' => TRUE), array('type' => 'back', 'name' => ts('Cancel')))); }
/** * Build the form object. * * @return void */ public function buildQuickForm() { // For VIEW we only want Done button if ($this->_action & CRM_Core_Action::VIEW) { // currently, the above action is used solely for previewing default workflow templates $cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1'); $cancelURL = str_replace('&', '&', $cancelURL); $this->addButtons(array(array('type' => 'cancel', 'name' => ts('Done'), 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"), 'isDefault' => TRUE))); } else { parent::buildQuickForm(); } if ($this->_action & CRM_Core_Action::DELETE) { return; } $breadCrumb = array(array('title' => ts('Message Templates'), 'url' => CRM_Utils_System::url('civicrm/admin/messageTemplates', 'action=browse&reset=1'))); CRM_Utils_System::appendBreadCrumb($breadCrumb); $this->applyFilter('__ALL__', 'trim'); $this->add('text', 'msg_title', ts('Message Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplate', 'msg_title'), TRUE); $this->add('text', 'msg_subject', ts('Message Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplate', 'msg_subject')); //get the tokens. $tokens = CRM_Core_SelectValues::contactTokens(); $this->assign('tokens', CRM_Utils_Token::formatTokensForDisplay($tokens)); // if not a system message use a wysiwyg editor, CRM-5971 if ($this->_id && CRM_Core_DAO::getFieldValue('CRM_Core_DAO_MessageTemplate', $this->_id, 'workflow_id')) { $this->add('textarea', 'msg_html', ts('HTML Message'), "cols=50 rows=6"); } else { $this->addWysiwyg('msg_html', ts('HTML Message'), array('cols' => '80', 'rows' => '8', 'onkeyup' => "return verify(this)")); } $this->add('textarea', 'msg_text', ts('Text Message'), "cols=50 rows=6"); $this->add('select', 'pdf_format_id', ts('PDF Page Format'), array('null' => ts('- default -')) + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE); $this->add('checkbox', 'is_active', ts('Enabled?')); if ($this->_action & CRM_Core_Action::VIEW) { $this->freeze(); CRM_Utils_System::setTitle(ts('View System Default Message Template')); } }
/** * Build the form * * @access public * * @return void */ public function buildQuickForm() { $this->addElement('radio', 'output', NULL, ts('Email Receipts'), 'email_receipt', array('onClick' => "document.getElementById('selectPdfFormat').style.display = 'none';")); $this->addElement('radio', 'output', NULL, ts('PDF Receipts'), 'pdf_receipt', array('onClick' => "document.getElementById('selectPdfFormat').style.display = 'block';")); $this->addRule('output', ts('Selection required'), 'required'); $this->add('select', 'pdf_format_id', ts('Page Format'), array(0 => ts('- default -')) + CRM_Core_BAO_PdfFormat::getList(TRUE)); $this->addButtons(array(array('type' => 'next', 'name' => ts('Process Receipt(s)'), 'isDefault' => TRUE), array('type' => 'back', 'name' => ts('Cancel')))); }
/** * Browse all PDF Page Formats. * * @param null $action * * @return void */ public function browse($action = NULL) { // Get list of configured PDF Page Formats $pdfFormatList = CRM_Core_BAO_PdfFormat::getList(); // Add action links to each of the PDF Page Formats $action = array_sum(array_keys($this->links())); foreach ($pdfFormatList as &$format) { $format['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $format['id']), ts('more'), FALSE, 'pdfFormat.manage.action', 'PdfFormat', $format['id']); } // Order Label Formats by weight $returnURL = CRM_Utils_System::url(self::userContext()); CRM_Core_BAO_PdfFormat::addOrder($pdfFormatList, $returnURL); $this->assign('rows', $pdfFormatList); }