當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_SelectValues::participantTokens方法代碼示例

本文整理匯總了PHP中CRM_Core_SelectValues::participantTokens方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_SelectValues::participantTokens方法的具體用法?PHP CRM_Core_SelectValues::participantTokens怎麽用?PHP CRM_Core_SelectValues::participantTokens使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Core_SelectValues的用法示例。


在下文中一共展示了CRM_Core_SelectValues::participantTokens方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildQuickForm

 /**
  * Function to build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     $config = CRM_Core_Config::singleton();
     $resources = CRM_Core_Resources::singleton();
     $resources->addSetting(array('kcfinderPath' => $config->userFrameworkResourceURL . 'packages' . DIRECTORY_SEPARATOR));
     $resources->addScriptFile('civicrm', 'templates/CRM/Badge/Form/Layout.js');
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'), true);
     $labelStyle = CRM_Core_BAO_LabelFormat::getList(TRUE, 'name_badge');
     $this->add('select', 'label_format_name', ts('Label Format'), array('' => ts('- select -')) + $labelStyle, TRUE);
     $this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'));
     // get the tokens
     $contactTokens = CRM_Core_SelectValues::contactTokens();
     $eventTokens = array('{event.event_id}' => ts('Event ID'), '{event.title}' => ts('Event Title'), '{event.start_date}' => ts('Event Start Date'), '{event.end_date}' => ts('Event End Date'));
     $participantTokens = CRM_Core_SelectValues::participantTokens();
     $tokens = array_merge($contactTokens, $eventTokens, $participantTokens);
     asort($tokens);
     $tokens = array_merge(array('spacer' => ts('- spacer -')) + $tokens);
     $fontSizes = CRM_Core_BAO_LabelFormat::getFontSizes();
     $fontStyles = CRM_Core_BAO_LabelFormat::getFontStyles();
     $fontNames = CRM_Core_BAO_LabelFormat::getFontNames('name_badge');
     $textAlignment = CRM_Core_BAO_LabelFormat::getTextAlignments();
     $rowCount = self::FIELD_ROWCOUNT;
     for ($i = 1; $i <= $rowCount; $i++) {
         $this->add('select', "token[{$i}]", ts('Token'), array('' => ts('- skip -')) + $tokens);
         $this->add('select', "font_name[{$i}]", ts('Font Name'), $fontNames);
         $this->add('select', "font_size[{$i}]", ts('Font Size'), $fontSizes);
         $this->add('select', "font_style[{$i}]", ts('Font Style'), $fontStyles);
         $this->add('select', "text_alignment[{$i}]", ts('Alignment'), $textAlignment);
     }
     $rowCount++;
     $this->assign('rowCount', $rowCount);
     $barcodeTypes = CRM_Core_SelectValues::getBarcodeTypes();
     $this->add('checkbox', 'add_barcode', ts('Barcode?'));
     $this->add('select', "barcode_type", ts('Type'), $barcodeTypes);
     $this->add('select', "barcode_alignment", ts('Alignment'), $textAlignment);
     $attributes = array('readonly' => true);
     $this->add('text', 'image_1', ts('Image (top left)'), $attributes + CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'));
     $this->add('text', 'width_image_1', ts('Width (mm)'), array('size' => 6));
     $this->add('text', 'height_image_1', ts('Height (mm)'), array('size' => 6));
     $this->add('text', 'image_2', ts('Image (top right)'), $attributes + CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'));
     $this->add('text', 'width_image_2', ts('Width (mm)'), array('size' => 6));
     $this->add('text', 'height_image_2', ts('Height (mm)'), array('size' => 6));
     $this->add('checkbox', 'is_default', ts('Default?'));
     $this->add('checkbox', 'is_active', ts('Enabled?'));
     $this->add('checkbox', 'is_reserved', ts('Reserved?'));
     $this->addRule('width_image_1', ts('Enter valid width'), 'positiveInteger');
     $this->addRule('width_image_2', ts('Enter valid width'), 'positiveInteger');
     $this->addRule('height_image_1', ts('Enter valid height'), 'positiveInteger');
     $this->addRule('height_image_2', ts('Enter valid height'), 'positiveInteger');
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'refresh', 'name' => ts('Save and Preview')), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
開發者ID:archcidburnziso,項目名稱:civicrm-core,代碼行數:62,代碼來源:Layout.php


注:本文中的CRM_Core_SelectValues::participantTokens方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。