本文整理汇总了PHP中CRM_Contact_BAO_ContactType::setIsActive方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_ContactType::setIsActive方法的具体用法?PHP CRM_Contact_BAO_ContactType::setIsActive怎么用?PHP CRM_Contact_BAO_ContactType::setIsActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_ContactType
的用法示例。
在下文中一共展示了CRM_Contact_BAO_ContactType::setIsActive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hrjobcontract_civicrm_install
/**
* Implementation of hook_civicrm_install
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
*/
function hrjobcontract_civicrm_install()
{
$cType = CRM_Contact_BAO_ContactType::basicTypePairs(false, 'id');
$org_id = array_search('Organization', $cType);
$sub_type_name = array('Health Insurance Provider', 'Life Insurance Provider');
$orgSubType = CRM_Contact_BAO_ContactType::subTypes('Organization', true);
$orgSubType = CRM_Contact_BAO_ContactType::subTypeInfo('Organization');
$params['parent_id'] = $org_id;
$params['is_active'] = 1;
if ($org_id) {
foreach ($sub_type_name as $sub_type_name) {
$subTypeName = ucfirst(CRM_Utils_String::munge($sub_type_name));
$subID = array_key_exists($subTypeName, $orgSubType);
if (!$subID) {
$params['name'] = $subTypeName;
$params['label'] = $sub_type_name;
CRM_Contact_BAO_ContactType::add($params);
} elseif ($subID && $orgSubType[$subTypeName]['is_active'] == 0) {
CRM_Contact_BAO_ContactType::setIsActive($orgSubType[$subTypeName]['id'], 1);
}
}
}
// Add Job Contract top menu
$jobContractNavigation = new CRM_Core_DAO_Navigation();
$jobContractNavigation->name = 'job_contracts';
$jobContractNavigationResult = $jobContractNavigation->find();
if (!$jobContractNavigationResult) {
$contactsWeight = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Contacts', 'weight', 'name');
$jobContractNavigation = new CRM_Core_DAO_Navigation();
$params = array('domain_id' => CRM_Core_Config::domainID(), 'label' => ts('Job Contracts'), 'name' => 'job_contracts', 'url' => null, 'operator' => null, 'weight' => $contactsWeight + 1, 'is_active' => 1);
$jobContractNavigation->copyValues($params);
$jobContractNavigation->save();
$jobContractMenuTree = array(array('label' => ts('Import / Export'), 'name' => 'import_export_job_contracts'));
foreach ($jobContractMenuTree as $key => $menuItems) {
$menuItems['is_active'] = 1;
$menuItems['parent_id'] = $jobContractNavigation->id;
$menuItems['weight'] = $key;
CRM_Core_BAO_Navigation::add($menuItems);
}
}
return _hrjobcontract_civix_civicrm_install();
}
示例2: hrjob_civicrm_install
/**
* Implementation of hook_civicrm_install
*/
function hrjob_civicrm_install()
{
$cType = CRM_Contact_BAO_ContactType::basicTypePairs(false, 'id');
$org_id = array_search('Organization', $cType);
$sub_type_name = array('Health Insurance Provider', 'Life Insurance Provider');
$orgSubType = CRM_Contact_BAO_ContactType::subTypes('Organization', true);
$orgSubType = CRM_Contact_BAO_ContactType::subTypeInfo('Organization');
$params['parent_id'] = $org_id;
$params['is_active'] = 1;
if ($org_id) {
foreach ($sub_type_name as $sub_type_name) {
$subTypeName = ucfirst(CRM_Utils_String::munge($sub_type_name));
$subID = array_key_exists($subTypeName, $orgSubType);
if (!$subID) {
$params['name'] = $subTypeName;
$params['label'] = $sub_type_name;
CRM_Contact_BAO_ContactType::add($params);
} elseif ($subID && $orgSubType[$subTypeName]['is_active'] == 0) {
CRM_Contact_BAO_ContactType::setIsActive($orgSubType[$subTypeName]['id'], 1);
}
}
}
//Add job import navigation menu
$weight = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Import Contacts', 'weight', 'name');
$contactNavId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Contacts', 'id', 'name');
$administerNavId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Dropdown Options', 'id', 'name');
$importJobNavigation = new CRM_Core_DAO_Navigation();
$params = array('domain_id' => CRM_Core_Config::domainID(), 'label' => ts('Import Jobs'), 'name' => 'jobImport', 'url' => null, 'parent_id' => $contactNavId, 'weight' => $weight + 1, 'permission' => 'access HRJobs', 'separator' => 1, 'is_active' => 1);
$importJobNavigation->copyValues($params);
$importJobNavigation->save();
$importJobMenuTree = array(array('label' => ts('Hours Types'), 'name' => 'hoursType', 'url' => 'civicrm/hour/editoption', 'permission' => 'administer CiviCRM', 'parent_id' => $administerNavId));
foreach ($importJobMenuTree as $key => $menuItems) {
$menuItems['is_active'] = 1;
CRM_Core_BAO_Navigation::add($menuItems);
}
CRM_Core_BAO_Navigation::resetNavigation();
return _hrjob_civix_civicrm_install();
}