* Build all the data structures needed to build the form
*
* @return void
- * @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->set('contactIds', $this->_contactIds);
parent::preProcess();
}
/**
* Build the form object
*
- * @access public
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Make Mailing Labels'));
//add select for label
* @param null
*
* @return array array of default values
- * @access public
*/
- function setDefaultValues() {
+ public function setDefaultValues() {
$defaults = array();
$format = CRM_Core_BAO_LabelFormat::getDefaultValues();
$defaults['label_name'] = CRM_Utils_Array::value('name', $format);
/**
* Process the form after the input has been submitted and validated
*
- * @access public
*
* @return void
*/
$mailingFormatProperties = array();
if ($mailingFormat) {
- $mailingFormatProperties = self::getReturnProperties($mailingFormat);
+ $mailingFormatProperties = CRM_Utils_Token::getReturnProperties($mailingFormat);
$returnProperties = array_merge($returnProperties, $mailingFormatProperties);
}
//we should not consider addressee for data exists, CRM-6025
*
* @return bool
*/
- function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) {
+ public function tokenIsFound($contact, $mailingFormatProperties, $tokenFields) {
foreach (array_merge($mailingFormatProperties, array_fill_keys($tokenFields, 1)) as $key => $dontCare) {
if (!empty($contact[$key])) {
return TRUE;
* @param string $fileName The name of the file to save the label in
*
* @return null
- * @access public
*/
- function createLabel(&$contactRows, &$format, $fileName = 'MailingLabels_CiviCRM.pdf') {
+ public function createLabel(&$contactRows, &$format, $fileName = 'MailingLabels_CiviCRM.pdf') {
$pdf = new CRM_Utils_PDF_Label($format, 'mm');
$pdf->Open();
$pdf->AddPage();
$pdf->Output($fileName, 'D');
}
- /**
- * Create the array of returnProperties
- *
- * @param string $format format for which return properties build
- *
- * @return array of returnProperties
- * @access public
- */
- function getReturnProperties(&$format) {
- $returnProperties = array();
- $matches = array();
- preg_match_all('/(?<!\{|\\\\)\{(\w+\.\w+)\}(?!\})/',
- $format,
- $matches,
- PREG_PATTERN_ORDER
- );
- if ($matches[1]) {
- foreach ($matches[1] as $token) {
- list($type, $name) = preg_split('/\./', $token, 2);
- if ($name) {
- $returnProperties["{$name}"] = 1;
- }
- }
- }
-
- return $returnProperties;
- }
-
/**
* @param $rows
*/
- function mergeSameAddress(&$rows) {
+ public function mergeSameAddress(&$rows) {
$uniqueAddress = array();
foreach (array_keys($rows) as $rowID) {
// load complete address as array key
}
}
}
-