/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::COPY)) { $formatName = CRM_Core_BAO_LabelFormat::getFieldValue('CRM_Core_BAO_LabelFormat', $this->_id, 'label'); $this->assign('formatName', $formatName); return; } $disabled = array(); $required = TRUE; $is_reserved = $this->_id ? CRM_Core_BAO_LabelFormat::getFieldValue('CRM_Core_BAO_LabelFormat', $this->_id, 'is_reserved') : FALSE; if ($is_reserved) { $disabled['disabled'] = 'disabled'; $required = FALSE; } $attributes = CRM_Core_DAO::getAttribute('CRM_Core_BAO_LabelFormat'); $this->add('text', 'label', ts('Name'), $attributes['label'] + $disabled, $required); $this->add('text', 'description', ts('Description'), array('size' => CRM_Utils_Type::HUGE)); $this->add('checkbox', 'is_default', ts('Is this Label Format the default?')); $this->add('select', 'paper_size', ts('Sheet Size'), array(0 => ts('- default -')) + CRM_Core_BAO_PaperSize::getList(TRUE), FALSE, array('onChange' => "selectPaper( this.value );") + $disabled); $this->add('static', 'paper_dimensions', NULL, ts('Sheet Size (w x h)')); $this->add('select', 'orientation', ts('Orientation'), CRM_Core_BAO_LabelFormat::getPageOrientations(), FALSE, array('onChange' => "updatePaperDimensions();") + $disabled); $this->add('select', 'font_name', ts('Font Name'), CRM_Core_BAO_LabelFormat::getFontNames()); $this->add('select', 'font_size', ts('Font Size'), CRM_Core_BAO_LabelFormat::getFontSizes()); $this->add('static', 'font_style', ts('Font Style')); $this->add('checkbox', 'bold', ts('Bold')); $this->add('checkbox', 'italic', ts('Italic')); $this->add('select', 'metric', ts('Unit of Measure'), CRM_Core_BAO_LabelFormat::getUnits(), FALSE, array('onChange' => "selectMetric( this.value );")); $this->add('text', 'width', ts('Label Width'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'height', ts('Label Height'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'NX', ts('Labels Per Row'), array('size' => 3, 'maxlength' => 3) + $disabled, $required); $this->add('text', 'NY', ts('Labels Per Column'), array('size' => 3, 'maxlength' => 3) + $disabled, $required); $this->add('text', 'tMargin', ts('Top Margin'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'lMargin', ts('Left Margin'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'SpaceX', ts('Horizontal Spacing'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'SpaceY', ts('Vertical Spacing'), array('size' => 8, 'maxlength' => 8) + $disabled, $required); $this->add('text', 'lPadding', ts('Left Padding'), array('size' => 8, 'maxlength' => 8), $required); $this->add('text', 'tPadding', ts('Top Padding'), array('size' => 8, 'maxlength' => 8), $required); $this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_LabelFormat', 'weight'), TRUE); $this->addRule('label', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_BAO_LabelFormat', $this->_id)); $this->addRule('NX', ts('Must be an integer'), 'integer'); $this->addRule('NY', ts('Must be an integer'), 'integer'); $this->addRule('tMargin', ts('Must be numeric'), 'numeric'); $this->addRule('lMargin', ts('Must be numeric'), 'numeric'); $this->addRule('SpaceX', ts('Must be numeric'), 'numeric'); $this->addRule('SpaceY', ts('Must be numeric'), 'numeric'); $this->addRule('lPadding', ts('Must be numeric'), 'numeric'); $this->addRule('tPadding', ts('Must be numeric'), 'numeric'); $this->addRule('width', ts('Must be numeric'), 'numeric'); $this->addRule('height', ts('Must be numeric'), 'numeric'); $this->addRule('weight', ts('Weight must be integer'), 'integer'); }