本文整理汇总了PHP中CRM_Admin_Form::buildQuickForm方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Admin_Form::buildQuickForm方法的具体用法?PHP CRM_Admin_Form::buildQuickForm怎么用?PHP CRM_Admin_Form::buildQuickForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Admin_Form
的用法示例。
在下文中一共展示了CRM_Admin_Form::buildQuickForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm($check = FALSE)
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$types = CRM_Booking_BAO_Resource::buildOptions('type_id', 'create');
$this->add('select', 'type_id', ts('Resource type'), array('' => ts('- select -')) + $types, TRUE, array());
$this->add('text', 'label', ts('Label'), array('size' => 50, 'maxlength' => 255), TRUE);
$this->add('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'description'), FALSE);
/*
$this->addWysiwyg('description',
ts('Description'),
CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'description')
);*/
$this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'weight'), TRUE);
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->add('checkbox', 'is_unlimited', ts('Is Unlimited?'));
$configSets = array('' => ts('- select -'));
try {
$activeSets = civicrm_api3('ResourceConfigSet', 'get', array('is_active' => 1, 'is_deleted' => 0));
foreach ($activeSets['values'] as $key => $set) {
$configSets[$key] = $set['title'];
}
} catch (CiviCRM_API3_Exception $e) {
}
$this->add('select', 'set_id', ts('Resource configuration set'), $configSets, TRUE);
$locations = CRM_Booking_BAO_Resource::buildOptions('location_id', 'create');
$this->add('select', 'location_id', ts('Resource Location'), array('' => ts('- select -')) + $locations, FALSE, array());
$this->addFormRule(array('CRM_Admin_Form_Resource', 'formRule'), $this);
$cancelURL = CRM_Utils_System::url('civicrm/admin/resource', "&reset=1");
$cancelURL = str_replace('&', '&', $cancelURL);
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'), 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"))));
}
示例2: buildQuickForm
/**
* Build the form object.
*
* @param bool $check
*
* @return void
*/
public function buildQuickForm($check = FALSE)
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Job');
$this->add('text', 'name', ts('Name'), $attributes['name'], TRUE);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Job', $this->_id));
$this->add('text', 'description', ts('Description'), $attributes['description']);
$this->add('text', 'api_entity', ts('API Call Entity'), $attributes['api_entity'], TRUE);
$this->add('text', 'api_action', ts('API Call Action'), $attributes['api_action'], TRUE);
$this->add('select', 'run_frequency', ts('Run frequency'), CRM_Core_SelectValues::getJobFrequency());
/************************************
* begin com.klangsoft.flexiblejobs *
************************************/
$this->addDateTime('schedule_at', ts(($this->_id ? 'Next' : 'First') . ' Run Date / Time'), FALSE, array('formatType' => 'activityDateTime'));
$this->assign('schedule_at', $this->_id ? 'run next' : 'first be run');
/**********************************
* end com.klangsoft.flexiblejobs *
**********************************/
$this->add('textarea', 'parameters', ts('Command parameters'), "cols=50 rows=6");
// is this job active ?
$this->add('checkbox', 'is_active', ts('Is this Scheduled Job active?'));
$this->addFormRule(array('CRM_Admin_Form_Job', 'formRule'));
}
示例3: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
CRM_Utils_System::setTitle(ts('Dropdown Options'));
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'name'), TRUE);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_OptionGroup', $this->_id));
$this->add('text', 'title', ts('Group Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'title'));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'description'));
$element = $this->add('checkbox', 'is_active', ts('Enabled?'));
if ($this->_action & CRM_Core_Action::UPDATE) {
if (in_array($this->_values['name'], array('encounter_medium', 'case_type', 'case_status'))) {
static $caseCount = NULL;
if (!isset($caseCount)) {
$caseCount = CRM_Case_BAO_Case::caseCount(NULL, FALSE);
}
if ($caseCount > 0) {
$element->freeze();
}
}
if (!empty($this->_values['is_reserved'])) {
$this->freeze(array('name', 'is_active'));
}
}
$this->assign('id', $this->_id);
}
示例4: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
$formatName = CRM_Core_BAO_PdfFormat::getFieldValue('CRM_Core_BAO_PdfFormat', $this->_id, 'name');
$this->assign('formatName', $formatName);
return;
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat');
$this->add('text', 'name', ts('Name'), $attributes['name'], TRUE);
$this->add('text', 'description', ts('Description'), array('size' => CRM_Utils_Type::HUGE));
$this->add('checkbox', 'is_default', ts('Is this PDF Page Format the default?'));
$this->add('select', 'paper_size', ts('Paper Size'), array(0 => ts('- default -')) + CRM_Core_BAO_PaperSize::getList(TRUE), FALSE, array('onChange' => "selectPaper( this.value );"));
$this->add('static', 'paper_dimensions', NULL, ts('Width x Height'));
$this->add('select', 'orientation', ts('Orientation'), CRM_Core_BAO_PdfFormat::getPageOrientations(), FALSE, array('onChange' => "updatePaperDimensions();"));
$this->add('select', 'metric', ts('Unit of Measure'), CRM_Core_BAO_PdfFormat::getUnits(), FALSE, array('onChange' => "selectMetric( this.value );"));
$this->add('text', 'margin_left', ts('Left Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
$this->add('text', 'margin_right', ts('Right Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
$this->add('text', 'margin_top', ts('Top Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
$this->add('text', 'margin_bottom', ts('Bottom Margin'), array('size' => 8, 'maxlength' => 8), TRUE);
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_BAO_PdfFormat', 'weight'), TRUE);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_BAO_PdfFormat', $this->_id));
$this->addRule('margin_left', ts('Margin must be numeric'), 'numeric');
$this->addRule('margin_right', ts('Margin must be numeric'), 'numeric');
$this->addRule('margin_top', ts('Margin must be numeric'), 'numeric');
$this->addRule('margin_bottom', ts('Margin must be numeric'), 'numeric');
$this->addRule('weight', ts('Weight must be integer'), 'integer');
}
示例5: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$this->setPageTitle(ts('Location Type'));
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_LocationType', 'name'), TRUE);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_LocationType', $this->_id));
$this->addRule('name', ts('Name can only consist of alpha-numeric characters'), 'variable');
$this->add('text', 'display_name', ts('Display Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_LocationType', 'display_name'), TRUE);
$this->add('text', 'vcard_name', ts('vCard Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_LocationType', 'vcard_name'));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_LocationType', 'description'));
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->add('checkbox', 'is_default', ts('Default?'));
if ($this->_action & CRM_Core_Action::UPDATE) {
if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_reserved')) {
$this->freeze(array('name', 'description', 'is_active'));
}
if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', $this->_id, 'is_default')) {
$this->freeze(array('is_default'));
}
}
}
示例6: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$this->setPageTitle(ts('Relationship Type'));
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'label_a_b', ts('Relationship Label-A to B'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'label_a_b'), TRUE);
$this->addRule('label_a_b', ts('Label already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'label_a_b'));
$this->add('text', 'label_b_a', ts('Relationship Label-B to A'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'label_b_a'));
$this->addRule('label_b_a', ts('Label already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'label_b_a'));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'description'));
$contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, '__');
// add select for contact type
$contactTypeA =& $this->add('select', 'contact_types_a', ts('Contact Type A') . ' ', array('' => ts('All Contacts')) + $contactTypes);
$contactTypeB =& $this->add('select', 'contact_types_b', ts('Contact Type B') . ' ', array('' => ts('All Contacts')) + $contactTypes);
$isActive =& $this->add('checkbox', 'is_active', ts('Enabled?'));
//only selected field should be allow for edit, CRM-4888
if ($this->_id && CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $this->_id, 'is_reserved')) {
foreach (array('contactTypeA', 'contactTypeB', 'isActive') as $field) {
${$field}->freeze();
}
}
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
}
}
示例7: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'label_a_b', ts('Relationship Label-A to B'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'label_a_b'), true);
$this->addRule('label_a_b', ts('Label already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'label_a_b'));
$this->add('text', 'label_b_a', ts('Relationship Label-B to A'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'label_b_a'));
$this->addRule('label_b_a', ts('Label already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_RelationshipType', $this->_id, 'label_b_a'));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'description'));
require_once 'CRM/Contact/BAO/ContactType.php';
$contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
// add select for contact type
$contactTypeA =& $this->add('select', 'contact_types_a', ts('Contact Type A') . ' ', array('' => ts('- select -')) + $contactTypes);
$contactTypeB =& $this->add('select', 'contact_types_b', ts('Contact Type B') . ' ', array('' => ts('- select -')) + $contactTypes);
$isActive =& $this->add('checkbox', 'is_active', ts('Enabled?'));
//only selected field should be allow for edit, CRM-4888
if ($this->_id && CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $this->_id, 'is_reserved')) {
foreach (array('contactTypeA', 'contactTypeB', 'isActive') as $field) {
${$field}->freeze();
}
}
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
$url = CRM_Utils_System::url('civicrm/admin/reltype&reset=1');
$location = "window.location='{$url}'";
$this->addElement('button', 'done', ts('Done'), array('onclick' => $location));
}
}
示例8: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$this->setPageTitle(ts('Contact Type'));
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'label', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_ContactType', 'label'), TRUE);
$contactType = $this->add('select', 'parent_id', ts('Basic Contact Type'), CRM_Contact_BAO_ContactType::basicTypePairs(FALSE, 'id'));
$enabled = $this->add('checkbox', 'is_active', ts('Enabled?'));
if ($this->_action & CRM_Core_Action::UPDATE) {
$contactType->freeze();
// We'll display actual "name" for built-in types (for reference) when editing their label / image_URL
$contactTypeName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $this->_id, 'name');
$this->assign('contactTypeName', $contactTypeName);
$this->_parentId = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_ContactType', $this->_id, 'parent_id');
// Freeze Enabled field for built-in contact types (parent_id is NULL for these)
if (is_null($this->_parentId)) {
$enabled->freeze();
}
}
$this->addElement('text', 'image_URL', ts('Image URL'));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_ContactType', 'description'));
$this->assign('cid', $this->_id);
$this->addFormRule(array('CRM_Admin_Form_ContactType', 'formRule'), $this);
}
示例9: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
if (isset($this->_id)) {
$params = array('id' => $this->_id);
CRM_Core_BAO_Navigation::retrieve($params, $this->_defaults);
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'label', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'label'), true);
$this->add('text', 'url', ts('Url'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'url'));
require_once 'CRM/Core/Permission.php';
$permissions = CRM_Core_Permission::basicPermissions(true);
$include =& $this->addElement('advmultiselect', 'permission', ts('Permission') . ' ', $permissions, array('size' => 5, 'style' => 'width:150px', 'class' => 'advmultiselect'));
$include->setButtonAttributes('add', array('value' => ts('Add >>')));
$include->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$operators = array('AND' => 'AND', 'OR' => 'OR');
$this->add('select', 'permission_operator', ts('Operator'), $operators);
$this->add('checkbox', 'has_separator', ts('Separator?'));
$active = $this->add('checkbox', 'is_active', ts('Enabled?'));
if ($this->_defaults['name'] == 'Home') {
$active->freeze();
} else {
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
if (isset($this->_id)) {
unset($parentMenu[$this->_id]);
}
// also unset home.
$homeMenuId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Home', 'id', 'name');
unset($parentMenu[$homeMenuId]);
$parent = $this->add('select', 'parent_id', ts('Parent'), array('' => ts('-- select --')) + $parentMenu);
}
}
示例10: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
//get the attributes.
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_MailSettings');
//build setting form
$this->add('text', 'name', ts('Name'), $attributes['name'], true);
$this->add('text', 'domain', ts('Email Domain'), $attributes['domain'], true);
$this->addRule('domain', ts('Email domain must use a valid internet domain format (e.g. \'example.org\').'), 'domain');
$this->add('text', 'localpart', ts('Localpart'), $attributes['localpart']);
$this->add('text', 'return_path', ts('Return-Path'), $attributes['return_path']);
$this->addRule('return_path', ts('Return-Path must use a valid email address format.'), 'email');
require_once 'CRM/Core/PseudoConstant.php';
$this->add('select', 'protocol', ts('Protocol'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::mailProtocol(), true);
$this->add('text', 'server', ts('Server'), $attributes['server']);
$this->add('text', 'username', ts('Username'), array('autocomplete' => 'off'));
$this->add('password', 'password', ts('Password'), array('autocomplete' => 'off'));
$this->add('text', 'source', ts('Source'), $attributes['source']);
$this->add('checkbox', 'is_ssl', ts('Use SSL?'));
$this->add('checkbox', 'is_default', ts('Default Option?'));
}
示例11: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_PreferencesDate');
$this->applyFilter('__ALL__', 'trim');
$name =& $this->add('text', 'name', ts('Name'), $attributes['name'], true);
$name->freeze();
$this->add('text', 'description', ts('Description'), $attributes['description'], false);
$this->add('text', 'start', ts('Start Offset'), $attributes['start'], true);
$this->add('text', 'end', ts('End Offset'), $attributes['end'], true);
$formatType = CRM_Core_Dao::getFieldValue('CRM_Core_DAO_PreferencesDate', $this->_id, 'name');
if ($formatType == 'creditCard') {
$this->add('text', 'date_format', ts('Format'), $attributes['date_format'], true);
} else {
$this->add('select', 'date_format', ts('Format'), array('' => ts('- default input format -')) + CRM_Core_SelectValues::getDatePluginInputFormats());
$this->add('select', 'time_format', ts('Time'), array('' => ts('- none -')) + CRM_Core_SelectValues::getTimeFormats());
}
$this->addRule('start', ts('Value should be a positive number'), 'positiveInteger');
$this->addRule('end', ts('Value should be a positive number'), 'positiveInteger');
// add a form rule
$this->addFormRule(array('CRM_Admin_Form_PreferencesDate', 'formRule'));
}
示例12: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'name'), true);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_OptionGroup', $this->_id));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionGroup', 'description'));
$element = $this->add('checkbox', 'is_active', ts('Enabled?'));
if ($this->_action & CRM_Core_Action::UPDATE) {
if (in_array($this->_values['name'], array('encounter_medium', 'case_type', 'case_status'))) {
static $caseCount = null;
require_once 'CRM/Case/BAO/Case.php';
if (!isset($caseCount)) {
$caseCount = CRM_Case_BAO_Case::caseCount(null, false);
}
if ($caseCount > 0) {
$element->freeze();
}
}
if ($this->_values['is_reserved']) {
$this->freeze(array('name', 'description', 'is_active'));
}
}
$this->assign('id', $this->_id);
}
示例13: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
if ($this->_action == CRM_Core_Action::DELETE) {
if ($this->_id && ($tag = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Tag', $this->_id, 'name', 'parent_id'))) {
CRM_Core_Session::setStatus(ts("This tag cannot be deleted! You must Delete all its child tags ('%1', etc) prior to deleting this tag.", array(1 => $tag)));
$url = CRM_Utils_System::url('civicrm/admin/tag', "reset=1");
CRM_Utils_System::redirect($url);
return true;
} else {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
} else {
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'name'), true);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Tag', $this->_id));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'description'));
//@lobo haven't a clue why the checkbox isn't displayed (it should be checked by default
$this->add('checkbox', 'is_selectable', ts("If it's a tag or a category"));
$allTag = array('' => '- ' . ts('select') . ' -') + CRM_Core_PseudoConstant::tag();
if ($this->_id) {
unset($allTag[$this->_id]);
}
$this->add('select', 'parent_id', ts('Parent Tag'), $allTag);
parent::buildQuickForm();
}
}
示例14: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$this->setPageTitle(ts('Mail Account'));
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
//get the attributes.
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_MailSettings');
//build setting form
$this->add('text', 'name', ts('Name'), $attributes['name'], TRUE);
$this->add('text', 'domain', ts('Email Domain'), $attributes['domain'], TRUE);
$this->addRule('domain', ts('Email domain must use a valid internet domain format (e.g. \'example.org\').'), 'domain');
$this->add('text', 'localpart', ts('Localpart'), $attributes['localpart']);
$this->add('text', 'return_path', ts('Return-Path'), $attributes['return_path']);
$this->addRule('return_path', ts('Return-Path must use a valid email address format.'), 'email');
$this->add('select', 'protocol', ts('Protocol'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol'), TRUE);
$this->add('text', 'server', ts('Server'), $attributes['server']);
$this->add('text', 'username', ts('Username'), array('autocomplete' => 'off'));
$this->add('password', 'password', ts('Password'), array('autocomplete' => 'off'));
$this->add('text', 'source', ts('Source'), $attributes['source']);
$this->add('checkbox', 'is_ssl', ts('Use SSL?'));
$usedfor = array(1 => ts('Bounce Processing'), 0 => ts('Email-to-Activity Processing'));
$this->add('select', 'is_default', ts('Used For?'), $usedfor);
}
示例15: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_CORE_ACTION_DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_IMProvider', 'name'));
$this->addRule('name', ts('Please enter a valid name.'), 'required');
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_IMProvider', $this->_id));
$this->add('checkbox', 'is_active', ts('Enabled?'));
}