コード例 #1
0
 /**
  * This function sets the default values for the form.
  *
  * @param null
  *
  * @return array   array of default values
  * @access public
  */
 function setDefaultValues()
 {
     $defaults = array();
     $format = CRM_Core_BAO_LabelFormat::getDefaultValues();
     $defaults['label_name'] = CRM_Utils_Array::value('name', $format);
     $defaults['do_not_mail'] = 1;
     return $defaults;
 }
コード例 #2
0
ファイル: Label.php プロジェクト: nielosz/civicrm-core
 /**
  * Set default values for the form.
  *
  * @return array
  *   array of default values
  */
 public function setDefaultValues()
 {
     $defaults = array();
     $format = CRM_Core_BAO_LabelFormat::getDefaultValues();
     $defaults['label_name'] = CRM_Utils_Array::value('name', $format);
     $defaults['merge_same_address'] = 0;
     $defaults['merge_same_household'] = 0;
     $defaults['do_not_mail'] = 1;
     return $defaults;
 }
コード例 #3
0
 /**
  * @return int
  */
 public function setDefaultValues()
 {
     if ($this->_action & CRM_Core_Action::ADD) {
         $defaults['weight'] = CRM_Utils_Array::value('weight', CRM_Core_BAO_LabelFormat::getDefaultValues($this->_group), 0);
     } else {
         $defaults = $this->_values;
         // Convert field names that are illegal PHP/SMARTY variable names
         $defaults['paper_size'] = $defaults['paper-size'];
         unset($defaults['paper-size']);
         $defaults['font_name'] = $defaults['font-name'];
         unset($defaults['font-name']);
         $defaults['font_size'] = $defaults['font-size'];
         unset($defaults['font-size']);
         $defaults['bold'] = stripos($defaults['font-style'], 'B') !== FALSE;
         $defaults['italic'] = stripos($defaults['font-style'], 'I') !== FALSE;
         unset($defaults['font-style']);
     }
     $defaults['label_type'] = $this->_group;
     return $defaults;
 }
コード例 #4
0
ファイル: Label.php プロジェクト: nganivet/civicrm-core
 /**
  * initialize label format settings.
  *
  * @param $format
  * @param $unit
  */
 public function LabelSetFormat(&$format, $unit)
 {
     $this->defaults = CRM_Core_BAO_LabelFormat::getDefaultValues();
     $this->format =& $format;
     $this->formatName = $this->getFormatValue('name');
     $this->paperSize = $this->getFormatValue('paper-size');
     $this->orientation = $this->getFormatValue('orientation');
     $this->fontName = $this->getFormatValue('font-name');
     $this->charSize = $this->getFormatValue('font-size');
     $this->fontStyle = $this->getFormatValue('font-style');
     $this->xNumber = $this->getFormatValue('NX');
     $this->yNumber = $this->getFormatValue('NY');
     $this->metricDoc = $unit;
     $this->marginLeft = $this->getFormatValue('lMargin', TRUE);
     $this->marginTop = $this->getFormatValue('tMargin', TRUE);
     $this->xSpace = $this->getFormatValue('SpaceX', TRUE);
     $this->ySpace = $this->getFormatValue('SpaceY', TRUE);
     $this->width = $this->getFormatValue('width', TRUE);
     $this->height = $this->getFormatValue('height', TRUE);
     $this->paddingLeft = $this->getFormatValue('lPadding', TRUE);
     $this->paddingTop = $this->getFormatValue('tPadding', TRUE);
     $paperSize = CRM_Core_BAO_PaperSize::getByName($this->paperSize);
     $w = CRM_Utils_PDF_Utils::convertMetric($paperSize['width'], $paperSize['metric'], $this->metricDoc);
     $h = CRM_Utils_PDF_Utils::convertMetric($paperSize['height'], $paperSize['metric'], $this->metricDoc);
     $this->paper_dimensions = array($w, $h);
 }