public function buildQuickForm() { parent::buildQuickForm(); if ($this->_action & CRM_Core_Action::DELETE) { return; } $this->applyFilter('__ALL__', 'trim'); $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_ParticipantStatusType'); $this->add('text', 'name', ts('Name'), NULL, TRUE); $this->add('text', 'label', ts('Label'), $attributes['label'], TRUE); $classes = array(); foreach (array('Positive', 'Pending', 'Waiting', 'Negative') as $class) { $classes[$class] = CRM_Event_DAO_ParticipantStatusType::tsEnum('class', $class); } $this->add('select', 'class', ts('Class'), $classes, TRUE); $this->add('checkbox', 'is_active', ts('Active?')); $this->add('checkbox', 'is_counted', ts('Counted?')); $this->add('text', 'weight', ts('Weight'), $attributes['weight'], TRUE); $this->add('select', 'visibility_id', ts('Visibility'), CRM_Core_PseudoConstant::visibility(), TRUE); }
/** * adds $value['foo_display'] for each $value['foo'] enum from civicrm_participant_status_type * * @param array $values (reference) the array up for enhancing * @return void */ static function addDisplayEnums(&$values) { $enumFields =& CRM_Event_DAO_ParticipantStatusType::getEnums(); foreach ($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Event_DAO_ParticipantStatusType::tsEnum($enum, $values[$enum]); } } }