本文整理汇总了PHP中CRM_Core_ShowHideBlocks::links方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_ShowHideBlocks::links方法的具体用法?PHP CRM_Core_ShowHideBlocks::links怎么用?PHP CRM_Core_ShowHideBlocks::links使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_ShowHideBlocks
的用法示例。
在下文中一共展示了CRM_Core_ShowHideBlocks::links方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* @return string
*/
function run()
{
$errorMessage = '';
// ensure that all CiviCRM tables are InnoDB, else abort
// this is not a very fast operation, so we do it randomly 10% of the times
// but we do it for most / all tables
// http://bugs.mysql.com/bug.php?id=43664
if (rand(1, 10) == 3 && CRM_Core_DAO::isDBMyISAM(150)) {
$errorMessage = ts('Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues.');
CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert");
}
if (!CRM_Utils_System::isDBVersionValid($errorMessage)) {
CRM_Core_Session::setStatus($errorMessage, ts('Warning'), "alert", array('expires' => 0));
}
$groups = array('Customize Data and Screens' => ts('Customize Data and Screens'), 'Communications' => ts('Communications'), 'Localization' => ts('Localization'), 'Users and Permissions' => ts('Users and Permissions'), 'System Settings' => ts('System Settings'));
$config = CRM_Core_Config::singleton();
if (in_array('CiviContribute', $config->enableComponents)) {
$groups['CiviContribute'] = ts('CiviContribute');
}
if (in_array('CiviMember', $config->enableComponents)) {
$groups['CiviMember'] = ts('CiviMember');
}
if (in_array('CiviEvent', $config->enableComponents)) {
$groups['CiviEvent'] = ts('CiviEvent');
}
if (in_array('CiviMail', $config->enableComponents)) {
$groups['CiviMail'] = ts('CiviMail');
}
if (in_array('CiviCase', $config->enableComponents)) {
$groups['CiviCase'] = ts('CiviCase');
}
if (in_array('CiviReport', $config->enableComponents)) {
$groups['CiviReport'] = ts('CiviReport');
}
if (in_array('CiviCampaign', $config->enableComponents)) {
$groups['CiviCampaign'] = ts('CiviCampaign');
}
$values = CRM_Core_Menu::getAdminLinks();
$this->_showHide = new CRM_Core_ShowHideBlocks();
foreach ($groups as $group => $title) {
$groupId = str_replace(' ', '_', $group);
$this->_showHide->addShow("id_{$groupId}_show");
$this->_showHide->addHide("id_{$groupId}");
$v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
if (isset($values[$group])) {
$adminPanel[$groupId] = $values[$group];
$adminPanel[$groupId]['show'] = $v['show'];
$adminPanel[$groupId]['hide'] = $v['hide'];
$adminPanel[$groupId]['title'] = $title;
} else {
$adminPanel[$groupId] = array();
$adminPanel[$groupId]['show'] = '';
$adminPanel[$groupId]['hide'] = '';
$adminPanel[$groupId]['title'] = $title;
}
}
$this->assign('adminPanel', $adminPanel);
$this->_showHide->addToTemplate();
return parent::run();
}
示例2: run
function run()
{
// ensure that all CiviCRM tables are InnoDB, else abort
if (CRM_Core_DAO::isDBMyISAM()) {
$errorMessage = 'Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues. This will be a fatal error in CiviCRM v2.1.';
require_once 'CRM/Core/Session.php';
CRM_Core_Session::setStatus($errorMessage);
}
if (!CRM_Utils_System::isDBVersionValid($errorMessage)) {
CRM_Core_Session::setStatus($errorMessage);
}
$groups = array('Customize' => ts('Customize'), 'Configure' => ts('Configure'), 'Manage' => ts('Manage'), 'Option Lists' => ts('Option Lists'));
$config = CRM_Core_Config::singleton();
if (in_array("CiviContribute", $config->enableComponents)) {
$groups['CiviContribute'] = ts('CiviContribute');
}
if (in_array("CiviMember", $config->enableComponents)) {
$groups['CiviMember'] = ts('CiviMember');
}
if (in_array("CiviEvent", $config->enableComponents)) {
$groups['CiviEvent'] = ts('CiviEvent');
}
if (in_array("CiviMail", $config->enableComponents)) {
$groups['CiviMail'] = ts('CiviMail');
}
if (in_array("CiviCase", $config->enableComponents)) {
$groups['CiviCase'] = ts('CiviCase');
}
if (in_array("CiviReport", $config->enableComponents)) {
$groups['CiviReport'] = ts('CiviReport');
}
if (in_array("CiviCampaign", $config->enableComponents)) {
$groups['CiviCampaign'] = ts('CiviCampaign');
}
require_once 'CRM/Core/Menu.php';
$values =& CRM_Core_Menu::getAdminLinks();
require_once 'CRM/Core/ShowHideBlocks.php';
$this->_showHide = new CRM_Core_ShowHideBlocks();
foreach ($groups as $group => $title) {
$this->_showHide->addShow("id_{$group}_show");
$this->_showHide->addHide("id_{$group}");
$v = CRM_Core_ShowHideBlocks::links($this, $group, '', '', false);
$adminPanel[$group] = $values[$group];
$adminPanel[$group]['show'] = $v['show'];
$adminPanel[$group]['hide'] = $v['hide'];
$adminPanel[$group]['title'] = $title;
}
require_once 'CRM/Utils/VersionCheck.php';
$versionCheck =& CRM_Utils_VersionCheck::singleton();
$this->assign('newVersion', $versionCheck->newerVersion());
$this->assign('localVersion', $versionCheck->localVersion);
$this->assign('adminPanel', $adminPanel);
$this->_showHide->addToTemplate();
return parent::run();
}
示例3: run
/**
* Run page.
*
* @return string
*/
public function run()
{
Civi::resources()->addStyleFile('civicrm', 'css/admin.css');
$this->assign('registerSite', htmlspecialchars('https://civicrm.org/register-your-site?src=iam&sid=' . CRM_Utils_System::getSiteID()));
$groups = array('Customize Data and Screens' => ts('Customize Data and Screens'), 'Communications' => ts('Communications'), 'Localization' => ts('Localization'), 'Users and Permissions' => ts('Users and Permissions'), 'System Settings' => ts('System Settings'));
$config = CRM_Core_Config::singleton();
if (in_array('CiviContribute', $config->enableComponents)) {
$groups['CiviContribute'] = ts('CiviContribute');
}
if (in_array('CiviMember', $config->enableComponents)) {
$groups['CiviMember'] = ts('CiviMember');
}
if (in_array('CiviEvent', $config->enableComponents)) {
$groups['CiviEvent'] = ts('CiviEvent');
}
if (in_array('CiviMail', $config->enableComponents)) {
$groups['CiviMail'] = ts('CiviMail');
}
if (in_array('CiviCase', $config->enableComponents)) {
$groups['CiviCase'] = ts('CiviCase');
}
if (in_array('CiviReport', $config->enableComponents)) {
$groups['CiviReport'] = ts('CiviReport');
}
if (in_array('CiviCampaign', $config->enableComponents)) {
$groups['CiviCampaign'] = ts('CiviCampaign');
}
$values = CRM_Core_Menu::getAdminLinks();
$this->_showHide = new CRM_Core_ShowHideBlocks();
foreach ($groups as $group => $title) {
$groupId = str_replace(' ', '_', $group);
$this->_showHide->addShow("id_{$groupId}_show");
$this->_showHide->addHide("id_{$groupId}");
$v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
if (isset($values[$group])) {
$adminPanel[$groupId] = $values[$group];
$adminPanel[$groupId]['show'] = $v['show'];
$adminPanel[$groupId]['hide'] = $v['hide'];
$adminPanel[$groupId]['title'] = $title;
} else {
$adminPanel[$groupId] = array();
$adminPanel[$groupId]['show'] = '';
$adminPanel[$groupId]['hide'] = '';
$adminPanel[$groupId]['title'] = $title;
}
}
$this->assign('adminPanel', $adminPanel);
$this->_showHide->addToTemplate();
return parent::run();
}
示例4: run
/**
* @return string
*/
public function run()
{
$groups = array('Customize Data and Screens' => ts('Customize Data and Screens'), 'Communications' => ts('Communications'), 'Localization' => ts('Localization'), 'Users and Permissions' => ts('Users and Permissions'), 'System Settings' => ts('System Settings'));
$config = CRM_Core_Config::singleton();
if (in_array('CiviContribute', $config->enableComponents)) {
$groups['CiviContribute'] = ts('CiviContribute');
}
if (in_array('CiviMember', $config->enableComponents)) {
$groups['CiviMember'] = ts('CiviMember');
}
if (in_array('CiviEvent', $config->enableComponents)) {
$groups['CiviEvent'] = ts('CiviEvent');
}
if (in_array('CiviMail', $config->enableComponents)) {
$groups['CiviMail'] = ts('CiviMail');
}
if (in_array('CiviCase', $config->enableComponents)) {
$groups['CiviCase'] = ts('CiviCase');
}
if (in_array('CiviReport', $config->enableComponents)) {
$groups['CiviReport'] = ts('CiviReport');
}
if (in_array('CiviCampaign', $config->enableComponents)) {
$groups['CiviCampaign'] = ts('CiviCampaign');
}
$values = CRM_Core_Menu::getAdminLinks();
$this->_showHide = new CRM_Core_ShowHideBlocks();
foreach ($groups as $group => $title) {
$groupId = str_replace(' ', '_', $group);
$this->_showHide->addShow("id_{$groupId}_show");
$this->_showHide->addHide("id_{$groupId}");
$v = CRM_Core_ShowHideBlocks::links($this, $groupId, '', '', FALSE);
if (isset($values[$group])) {
$adminPanel[$groupId] = $values[$group];
$adminPanel[$groupId]['show'] = $v['show'];
$adminPanel[$groupId]['hide'] = $v['hide'];
$adminPanel[$groupId]['title'] = $title;
} else {
$adminPanel[$groupId] = array();
$adminPanel[$groupId]['show'] = '';
$adminPanel[$groupId]['hide'] = '';
$adminPanel[$groupId]['title'] = $title;
}
}
$this->assign('adminPanel', $adminPanel);
$this->_showHide->addToTemplate();
return parent::run();
}
示例5: custom
/**
* Generate the custom Data Fields based
* on the is_searchable
*
*
* @param $form
*
* @return void
*/
public static function custom(&$form)
{
$form->add('hidden', 'hidden_custom', 1);
$extends = array('Relationship');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
$form->assign('groupTree', $groupDetails);
foreach ($groupDetails as $key => $group) {
$_groupTitle[$key] = $group['name'];
CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
$groupId = $group['id'];
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
示例6: buildQuickForm
/**
* This function provides the HTML form elements that are specific to the Individual Contact Type
*
* @access public
* @return None
*/
function buildQuickForm(&$form)
{
$form->applyFilter('__ALL__', 'trim');
// prefix
$form->addElement('select', 'prefix_id', ts('Prefix'), array('' => ts('- prefix -')) + CRM_Core_PseudoConstant::individualPrefix());
$attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Individual');
// first_name
$form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']);
//middle_name
$form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']);
// last_name
$form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']);
// suffix
$form->addElement('select', 'suffix_id', ts('Suffix'), array('' => ts('- suffix -')) + CRM_Core_PseudoConstant::individualSuffix());
// nick_name
$form->addElement('text', 'nick_name', ts('Nick Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'nick_name'));
// greeting type
$form->addElement('select', 'greeting_type', ts('Greeting'), CRM_Core_SelectValues::greeting());
// job title
$form->addElement('text', 'job_title', ts('Job title'), $attributes['job_title']);
// radio button for gender
$genderOptions = array();
$gender = CRM_Core_PseudoConstant::gender();
foreach ($gender as $key => $var) {
$genderOptions[$key] = HTML_QuickForm::createElement('radio', null, ts('Gender'), $var, $key);
}
$form->addGroup($genderOptions, 'gender_id', ts('Gender'));
$form->addElement('checkbox', 'is_deceased', null, ts('Contact is deceased'));
$form->addElement('date', 'birth_date', ts('Date of birth'), CRM_Core_SelectValues::date('birth'));
$form->addRule('birth_date', ts('Select a valid date.'), 'qfDate');
$form->addElement('text', 'home_URL', ts('Website'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'home_URL'));
$form->addRule('home_URL', ts('Enter a valid Website.'), 'url');
$config =& CRM_Core_Config::singleton();
CRM_Core_ShowHideBlocks::links($this, 'demographics', '', '');
}
示例7: buildQuickForm
/**
* Generic function to build all the form elements for a specific group tree.
*
* @param CRM_Core_Form $form
* The form object.
* @param array $groupTree
* The group tree object.
* @param bool $inactiveNeeded
* Return inactive custom groups.
* @param string $prefix
* Prefix for custom grouptree assigned to template.
*/
public static function buildQuickForm(&$form, &$groupTree, $inactiveNeeded = FALSE, $prefix = '')
{
$form->assign_by_ref("{$prefix}groupTree", $groupTree);
foreach ($groupTree as $id => $group) {
CRM_Core_ShowHideBlocks::links($form, $group['title'], '', '');
foreach ($group['fields'] as $field) {
$required = CRM_Utils_Array::value('is_required', $field);
//fix for CRM-1620
if ($field['data_type'] == 'File') {
if (!empty($field['element_value']['data'])) {
$required = 0;
}
}
$fieldId = $field['id'];
$elementName = $field['element_name'];
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, $required);
}
}
}
示例8: buildQuickForm
/**
* generic function to build all the form elements for a specific group tree
*
* @param CRM_Core_Form $form the form object
* @param array $groupTree the group tree object
* @param string $showName
* @param string $hideName
*
* @return void
* @access public
* @static
*/
function buildQuickForm(&$form, &$groupTree, $showName = 'showBlocks', $hideName = 'hideBlocks')
{
//this is fix for calendar for date field
foreach ($groupTree as $key1 => $group) {
foreach ($group['fields'] as $key2 => $field) {
if ($field['data_type'] == 'Date' && $field['date_parts']) {
$datePart = explode(CRM_CORE_BAO_CUSTOMOPTION_VALUE_SEPERATOR, $field['date_parts']);
if (count($datePart) < 3) {
$groupTree[$key1]['fields'][$key2]['skip_calendar'] = true;
}
}
}
}
$form->assign_by_ref('groupTree', $groupTree);
$sBlocks = array();
$hBlocks = array();
// this is fix for date field
$form->assign('currentYear', date('Y'));
require_once 'CRM/Core/ShowHideBlocks.php';
foreach ($groupTree as $group) {
CRM_Core_ShowHideBlocks::links($form, $group['title'], '', '');
$groupId = $group['id'];
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, $inactiveNeeded, $group['is_required']);
}
if ($group['collapse_display']) {
$sBlocks[] = "'" . $group['title'] . "[show]'";
$hBlocks[] = "'" . $group['title'] . "'";
} else {
$hBlocks[] = "'" . $group['title'] . "[show]'";
$sBlocks[] = "'" . $group['title'] . "'";
}
}
$showBlocks = implode(",", $sBlocks);
$hideBlocks = implode(",", $hBlocks);
$form->assign($showName, $showBlocks);
$form->assign($hideName, $hideBlocks);
}
示例9: buildQuickForm
/**
* generic function to build all the form elements for a specific group tree
*
* @param CRM_Core_Form $form the form object
* @param array $groupTree the group tree object
* @param string $showName
* @param string $hideName
*
* @return void
* @access public
* @static
*/
static function buildQuickForm(&$form, &$groupTree, $inactiveNeeded = false, $groupCount = 1, $prefix = '')
{
require_once 'CRM/Core/BAO/CustomField.php';
require_once 'CRM/Core/BAO/CustomOption.php';
$form->assign_by_ref("{$prefix}groupTree", $groupTree);
$sBlocks = array();
$hBlocks = array();
// this is fix for date field
$form->assign('currentYear', date('Y'));
require_once 'CRM/Core/ShowHideBlocks.php';
foreach ($groupTree as $id => $group) {
CRM_Core_ShowHideBlocks::links($form, $group['title'], '', '');
$groupId = CRM_Utils_Array::value('id', $group);
foreach ($group['fields'] as $field) {
// skip all view fields
if (CRM_Utils_Array::value('is_view', $field)) {
continue;
}
$required = CRM_Utils_Array::value('is_required', $field);
//fix for CRM-1620
if ($field['data_type'] == 'File') {
if (isset($field['customValue']['data'])) {
$required = 0;
}
}
$fieldId = $field['id'];
$elementName = $field['element_name'];
require_once "CRM/Core/BAO/CustomField.php";
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, $inactiveNeeded, $required);
}
}
}
示例10: buildQuickForm
/**
* This function provides the HTML form elements that are specific to the Individual Contact Type
*
* @access public
* @return None
*/
public function buildQuickForm(&$form, $action = null)
{
$form->applyFilter('__ALL__', 'trim');
//prefix
$prefix = CRM_Core_PseudoConstant::individualPrefix();
if (!empty($prefix)) {
$form->addElement('select', 'prefix_id', ts('Prefix'), array('' => '') + $prefix);
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact');
// first_name
$form->addElement('text', 'first_name', ts('First Name'), $attributes['first_name']);
//middle_name
$form->addElement('text', 'middle_name', ts('Middle Name'), $attributes['middle_name']);
// last_name
$form->addElement('text', 'last_name', ts('Last Name'), $attributes['last_name']);
// suffix
$suffix = CRM_Core_PseudoConstant::individualSuffix();
if ($suffix) {
$form->addElement('select', 'suffix_id', ts('Suffix'), array('' => '') + $suffix);
}
// nick_name
$form->addElement('text', 'nick_name', ts('Nick Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'nick_name'));
// job title
// override the size for UI to look better
$attributes['job_title']['size'] = 30;
$form->addElement('text', 'job_title', ts('Job title'), $attributes['job_title'], 'size="30"');
//Current Employer Element
$employerDataURL = CRM_Utils_System::url('civicrm/ajax/rest', 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=contact&org=1', false, null, false);
$form->assign('employerDataURL', $employerDataURL);
$form->addElement('text', 'current_employer', ts('Current Employer'), '');
$form->addElement('hidden', 'current_employer_id', '', array('id' => 'current_employer_id'));
$form->addElement('text', 'contact_source', ts('Source'));
$checkSimilar = defined('CIVICRM_CONTACT_AJAX_CHECK_SIMILAR') ? CIVICRM_CONTACT_AJAX_CHECK_SIMILAR : true;
$form->assign('checkSimilar', $checkSimilar);
//External Identifier Element
$form->add('text', 'external_identifier', ts('External Id'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'external_identifier'), false);
$form->addRule('external_identifier', ts('External ID already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Contact', $form->_contactId, 'external_identifier'));
$config = CRM_Core_Config::singleton();
CRM_Core_ShowHideBlocks::links($form, 'demographics', '', '');
}
示例11: custom
/**
* Generate the custom Data Fields based
* on the is_searchable
*
*
* @param $form
*
* @return void
*/
public static function custom(&$form)
{
$form->add('hidden', 'hidden_custom', 1);
$extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'), CRM_Contact_BAO_ContactType::subTypes());
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
$form->assign('groupTree', $groupDetails);
foreach ($groupDetails as $key => $group) {
$_groupTitle[$key] = $group['name'];
CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
$groupId = $group['id'];
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
if ($field['data_type'] == 'Date' && $field['is_search_range']) {
CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
} else {
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
//TODO: validate for only one state if prox_distance isset
}
示例12: custom
/**
* Generate the custom Data Fields based
* on the is_searchable
*
* @access private
* @return void
*/
static function custom(&$form)
{
$form->add('hidden', 'hidden_custom', 1);
$extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'), CRM_Contact_BAO_ContactType::subTypes());
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(null, true, $extends);
$form->assign('groupTree', $groupDetails);
foreach ($groupDetails as $key => $group) {
$_groupTitle[$key] = $group['name'];
CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
$groupId = $group['id'];
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, false, false, true);
}
}
}
示例13: buildQuickForm
/**
* This function provides the HTML form elements that are specific to the Individual Contact Type.
*
* @param CRM_Core_Form $form
* Form object.
* @param int $inlineEditMode
* ( 1 for contact summary.
* top bar form and 2 for display name edit )
*/
public static function buildQuickForm(&$form, $inlineEditMode = NULL)
{
$form->applyFilter('__ALL__', 'trim');
if (!$inlineEditMode || $inlineEditMode == 1) {
$nameFields = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_edit_options', TRUE, NULL, FALSE, 'name', TRUE, 'AND v.filter = 2');
// Fixme: dear god why? these come out in a format that is NOT the name of the fields.
foreach ($nameFields as &$fix) {
$fix = str_replace(' ', '_', strtolower($fix));
if ($fix == 'prefix' || $fix == 'suffix') {
// God, why god?
$fix .= '_id';
}
}
foreach ($nameFields as $name) {
$props = array();
if ($name == 'prefix_id' || $name == 'suffix_id') {
$options = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', $name);
// Skip if we have no options available
if (!CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', $name)) {
//continue;
}
$props = array('class' => 'eight', 'placeholder' => ' ', 'label' => $name == 'prefix_id' ? ts('Prefix') : ts('Suffix'));
}
$form->addField($name, $props);
}
}
if (!$inlineEditMode || $inlineEditMode == 2) {
// nick_name
$form->addField('nick_name');
// job title
// override the size for UI to look better
$form->addField('job_title', array('size' => '30'));
//Current Employer Element
$props = array('api' => array('params' => array('contact_type' => 'Organization')), 'create' => TRUE);
$form->addField('employer_id', $props);
$form->addField('contact_source', array('class' => 'big'));
}
if (!$inlineEditMode) {
$checkSimilar = Civi::settings()->get('contact_ajax_check_similar');
if ($checkSimilar == NULL) {
$checkSimilar = 0;
}
$form->assign('checkSimilar', $checkSimilar);
//External Identifier Element
$form->addField('external_identifier', array('label' => 'External ID'));
$form->addRule('external_identifier', ts('External ID already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Contact', $form->_contactId, 'external_identifier'));
CRM_Core_ShowHideBlocks::links($form, 'demographics', '', '');
}
}
示例14: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
function buildQuickForm()
{
// assign a few constants used by all display elements
// we can obsolete this when smarty can access class constans directly
$this->assign('locationCount', CRM_CONTACT_FORM_EDIT_LOCATION_BLOCKS + 1);
$this->assign('blockCount', CRM_CONTACT_FORM_LOCATION_BLOCKS + 1);
$this->assign('contact_type', $this->_contactType);
require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_" . $this->_contactType) . ".php";
eval('CRM_Contact_Form_' . $this->_contactType . '::buildQuickForm( $this );');
// add the communications block
CRM_Contact_Form_Edit::buildCommunicationBlock($this);
/* Entering the compact location engine */
$location =& CRM_Contact_Form_Location::buildLocationBlock($this, CRM_CONTACT_FORM_EDIT_LOCATION_BLOCKS);
/* End of locations */
// add note block
if ($this->_action & CRM_CORE_ACTION_ADD) {
$note =& CRM_Contact_Form_Note::buildNoteBlock($this);
}
//add tags and groups block
$groupTag =& CRM_Contact_Form_GroupTag::buildGroupTagBlock($this, $this->_contactId, CRM_CONTACT_FORM_GROUPTAG_ALL);
//Custom Group Inline Edit form
$this->_groupTree =& CRM_Core_BAO_CustomGroup::getTree($this->_contactType, $this->_contactId);
CRM_Core_BAO_CustomGroup::buildQuickForm($this, $this->_groupTree, 'showBlocks1', 'hideBlocks1');
$config =& CRM_Core_Config::singleton();
CRM_Core_ShowHideBlocks::links($this, 'notes', '', '');
// add the dedupe button
$this->addElement('submit', $this->_dedupeButtonName, ts('Check for Matching Contact(s)'));
$this->addElement('submit', $this->_duplicateButtonName, ts('Save Duplicate Contact'));
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'subName' => 'view', 'isDefault' => true), array('type' => 'next', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例15: customDataSearch
/**
* Generate the custom Data Fields based
* on the is_searchable
*
* @access private
* @return void
*/
function customDataSearch()
{
// expand on search result if criteria entered
$customDataSearch = $this->get('customDataSearch');
if (!empty($customDataSearch)) {
$customAssignHide = array();
$customAssignShow = array();
foreach (array_unique($customDataSearch) as $v) {
$customAssignHide[] = $v . '[show]';
$customAssignShow[] = $v;
}
$customShow = '"' . implode("\",\"", $customAssignShow) . '"';
$customHide = '"' . implode("\",\"", $customAssignHide) . '"';
$this->assign('customShow', $customShow);
$this->assign('customHide', $customHide);
}
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(null, true, array('Contact', 'Individual', 'Household', 'Organization'));
$this->assign('groupTree', $groupDetails);
foreach ($groupDetails as $group) {
$_groupTitle[] = $group['title'];
CRM_Core_ShowHideBlocks::links($this, $group['title'], '', '');
$groupId = $group['id'];
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($this, $elementName, $fieldId, false, false, true);
}
}
$this->setShowHide($_groupTitle);
}