本文整理汇总了PHP中CRM_Contact_BAO_ContactType::isActive方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_ContactType::isActive方法的具体用法?PHP CRM_Contact_BAO_ContactType::isActive怎么用?PHP CRM_Contact_BAO_ContactType::isActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_ContactType
的用法示例。
在下文中一共展示了CRM_Contact_BAO_ContactType::isActive方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initTasks
static function initTasks()
{
if (!self::$_tasks) {
self::$_tasks = array(1 => array('title' => ts('Add Contacts to Group'), 'class' => 'CRM_Contact_Form_Task_AddToGroup', 'result' => true), 2 => array('title' => ts('Remove Contacts from Group'), 'class' => 'CRM_Contact_Form_Task_RemoveFromGroup', 'result' => true), 3 => array('title' => ts('Tag Contacts (assign tags)'), 'class' => 'CRM_Contact_Form_Task_AddToTag', 'result' => true), 4 => array('title' => ts('Untag Contacts (remove tags)'), 'class' => 'CRM_Contact_Form_Task_RemoveFromTag', 'result' => true), 5 => array('title' => ts('Export Contacts'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => false), 6 => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contact_Form_Task_Email', 'result' => false), 7 => array('title' => ts('Send SMS to Contacts'), 'class' => 'CRM_Contact_Form_Task_SMS', 'result' => true), 8 => array('title' => ts('Delete Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => false), 11 => array('title' => ts('Record Activity for Contacts'), 'class' => 'CRM_Activity_Form_Activity', 'result' => true), 13 => array('title' => ts('New Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch', 'result' => true), 14 => array('title' => ts('Update Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch_Update', 'result' => true), 15 => array('title' => ts('Print Contacts'), 'class' => 'CRM_Contact_Form_Task_Print', 'result' => false), 16 => array('title' => ts('Mailing Labels'), 'class' => 'CRM_Contact_Form_Task_Label', 'result' => true), 17 => array('title' => ts('Batch Update via Profile'), 'class' => array('CRM_Contact_Form_Task_PickProfile', 'CRM_Contact_Form_Task_Batch'), 'result' => true), 19 => array('title' => ts('Print PDF Letter for Contacts'), 'class' => 'CRM_Contact_Form_Task_PDF', 'result' => true), 21 => array('title' => ts('Merge Contacts'), 'class' => 'CRM_Contact_Form_Task_Merge', 'result' => true));
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$label = CRM_Contact_BAO_ContactType::getLabel('Household');
self::$_tasks[9] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToHousehold', 'result' => true);
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$label = CRM_Contact_BAO_ContactType::getLabel('Organization');
self::$_tasks[10] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToOrganization', 'result' => true);
}
//CRM-4418, check for delete
if (!CRM_Core_Permission::check('delete contacts')) {
unset(self::$_tasks[8]);
}
//show map action only if map provider and key is set
$config =& CRM_Core_Config::singleton();
if ($config->mapProvider && $config->mapAPIKey) {
self::$_tasks[12] = array('title' => ts('Map Contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => false);
}
if (CRM_Core_Permission::access('CiviEvent')) {
self::$_tasks[18] = array('title' => ts('Add Contacts to Event'), 'class' => 'CRM_Event_Form_Participant', 'result' => true);
}
if (CRM_Core_Permission::access('CiviMail')) {
self::$_tasks[20] = array('title' => ts('Schedule/Send a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test', 'CRM_Mailing_Form_Schedule'), 'result' => false);
}
self::$_tasks += CRM_Core_Component::taskList();
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::searchTasks('contact', self::$_tasks);
asort(self::$_tasks);
}
}
示例2: 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"');
if ($action & CRM_Core_Action::UPDATE) {
$mailToHouseholdID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $form->_contactId, 'mail_to_household_id', 'id');
$form->assign('mailToHouseholdID', $mailToHouseholdID);
}
//Shared Address Element
require_once 'CRM/Contact/BAO/ContactType.php';
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$label = CRM_Contact_BAO_ContactType::getLabel('Household');
$form->addElement('checkbox', 'use_household_address', null, ts('Use %1 Address', array(1 => $label)));
}
$housholdDataURL = CRM_Utils_System::url('civicrm/ajax/search', "hh=1", false, null, false);
$form->assign('housholdDataURL', $housholdDataURL);
$form->add('text', 'shared_household', ts('Select Household'));
$form->add('hidden', 'shared_household_id', '', array('id' => 'shared_household_id'));
//Home Url Element
$form->addElement('text', 'home_URL', ts('Website'), array_merge(CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'home_URL'), array('onfocus' => "if (!this.value) this.value='http://'; else return false", 'onblur' => "if ( this.value == 'http://') this.value=''; else return false")));
$form->addRule('home_URL', ts('Enter a valid web location beginning with \'http://\' or \'https://\'. EXAMPLE: http://www.mysite.org/'), 'url');
//Current Employer Element
$employerDataURL = CRM_Utils_System::url('civicrm/ajax/contactlist', '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'));
//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', '', '');
}
示例3: initTasks
public static function initTasks()
{
if (!self::$_tasks) {
self::$_tasks = array(self::GROUP_CONTACTS => array('title' => ts('Add Contacts to Group'), 'class' => 'CRM_Contact_Form_Task_AddToGroup'), self::REMOVE_CONTACTS => array('title' => ts('Remove Contacts from Group'), 'class' => 'CRM_Contact_Form_Task_RemoveFromGroup'), self::TAG_CONTACTS => array('title' => ts('Tag Contacts (assign tags)'), 'class' => 'CRM_Contact_Form_Task_AddToTag'), self::REMOVE_TAGS => array('title' => ts('Untag Contacts (remove tags)'), 'class' => 'CRM_Contact_Form_Task_RemoveFromTag'), self::EXPORT_CONTACTS => array('title' => ts('Export Contacts'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => FALSE), self::EMAIL_CONTACTS => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contact_Form_Task_Email', 'result' => TRUE), self::DELETE_CONTACTS => array('title' => ts('Delete Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::RECORD_CONTACTS => array('title' => ts('Record Activity for Contacts'), 'class' => 'CRM_Activity_Form_Activity'), self::SAVE_SEARCH => array('title' => ts('New Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch', 'result' => TRUE), self::SAVE_SEARCH_UPDATE => array('title' => ts('Update Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch_Update', 'result' => TRUE), self::PRINT_CONTACTS => array('title' => ts('Print Selected Rows'), 'class' => 'CRM_Contact_Form_Task_Print', 'result' => FALSE), self::LABEL_CONTACTS => array('title' => ts('Mailing Labels'), 'class' => 'CRM_Contact_Form_Task_Label', 'result' => TRUE), self::BATCH_UPDATE => array('title' => ts('Batch Update via Profile'), 'class' => array('CRM_Contact_Form_Task_PickProfile', 'CRM_Contact_Form_Task_Batch'), 'result' => TRUE), self::PRINT_FOR_CONTACTS => array('title' => ts('Print PDF Letter for Contacts'), 'class' => 'CRM_Contact_Form_Task_PDF', 'result' => TRUE), self::EMAIL_UNHOLD => array('title' => ts('Unhold Emails'), 'class' => 'CRM_Contact_Form_Task_Unhold'), self::COMMUNICATION_PREFS => array('title' => ts('Alter Contact Communication Preferences'), 'class' => 'CRM_Contact_Form_Task_AlterPreferences'), self::RESTORE => array('title' => ts('Restore Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::DELETE_PERMANENTLY => array('title' => ts('Delete Permanently'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE));
//CRM-16329, if SMS provider is configured show sms action.
$providersCount = CRM_SMS_BAO_Provider::activeProviderCount();
if ($providersCount) {
self::$_tasks[self::SMS_CONTACTS] = array('title' => ts('Send SMS to Contacts'), 'class' => 'CRM_Contact_Form_Task_SMS', 'result' => TRUE);
}
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$label = CRM_Contact_BAO_ContactType::getLabel('Household');
self::$_tasks[self::HOUSEHOLD_CONTACTS] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToHousehold');
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$label = CRM_Contact_BAO_ContactType::getLabel('Organization');
self::$_tasks[self::ORGANIZATION_CONTACTS] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToOrganization');
}
if (CRM_Core_Permission::check('merge duplicate contacts')) {
self::$_tasks[self::MERGE_CONTACTS] = array('title' => ts('Merge Contacts'), 'class' => 'CRM_Contact_Form_Task_Merge', 'result' => TRUE);
}
//CRM-4418, check for delete
if (!CRM_Core_Permission::check('delete contacts')) {
unset(self::$_tasks[self::DELETE_CONTACTS]);
}
//show map action only if map provider and geoprovider are set (Google doesn't need geoprovider)
// should fix this to be more flexible as providers are added ??
$config = CRM_Core_Config::singleton();
if ($config->mapProvider && ($config->mapProvider == 'Google' || ($config->mapProvider == 'OpenStreetMaps' || $config->geoProvider == 'Google'))) {
self::$_tasks[self::MAP_CONTACTS] = array('title' => ts('Map Contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => FALSE);
}
if (CRM_Core_Permission::access('CiviEvent')) {
self::$_tasks[self::ADD_EVENT] = array('title' => ts('Add Contacts to Event'), 'class' => 'CRM_Event_Form_Participant');
}
if (defined('CIVICRM_CIVIMAIL_UI_LEGACY')) {
if (CRM_Core_Permission::access('CiviMail')) {
self::$_tasks[self::CREATE_MAILING] = array('title' => ts('Schedule/Send a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test', 'CRM_Mailing_Form_Schedule'), 'result' => FALSE);
} elseif (CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings')) {
self::$_tasks[self::CREATE_MAILING] = array('title' => ts('Create a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test'), 'result' => FALSE);
}
} else {
if (CRM_Core_Permission::access('CiviMail') || CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings')) {
self::$_tasks[self::CREATE_MAILING] = array('title' => ts('Schedule/Send a Mass Mailing'), 'class' => 'CRM_Mailing_Form_Task_AdhocMailing', 'result' => FALSE);
}
}
self::$_tasks += CRM_Core_Component::taskList();
CRM_Utils_Hook::searchTasks('contact', self::$_tasks);
asort(self::$_tasks);
}
}
示例4: initTasks
public static function initTasks()
{
if (!self::$_tasks) {
self::$_tasks = array(self::GROUP_CONTACTS => array('title' => ts('Group - add contacts'), 'class' => 'CRM_Contact_Form_Task_AddToGroup'), self::REMOVE_CONTACTS => array('title' => ts('Group - remove contacts'), 'class' => 'CRM_Contact_Form_Task_RemoveFromGroup'), self::TAG_CONTACTS => array('title' => ts('Tag - add to contacts'), 'class' => 'CRM_Contact_Form_Task_AddToTag'), self::REMOVE_TAGS => array('title' => ts('Tag - remove from contacts'), 'class' => 'CRM_Contact_Form_Task_RemoveFromTag'), self::EXPORT_CONTACTS => array('title' => ts('Export contacts'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => FALSE), self::EMAIL_CONTACTS => array('title' => ts('Email - send now (to 50 or less)'), 'class' => 'CRM_Contact_Form_Task_Email', 'result' => TRUE), self::DELETE_CONTACTS => array('title' => ts('Delete contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::RECORD_CONTACTS => array('title' => ts('Add activity'), 'class' => 'CRM_Activity_Form_Activity'), self::SAVE_SEARCH => array('title' => ts('Smart group - create'), 'class' => 'CRM_Contact_Form_Task_SaveSearch', 'result' => TRUE), self::SAVE_SEARCH_UPDATE => array('title' => ts('Smart group - update'), 'class' => 'CRM_Contact_Form_Task_SaveSearch_Update', 'result' => TRUE), self::PRINT_CONTACTS => array('title' => ts('Print selected rows'), 'class' => 'CRM_Contact_Form_Task_Print', 'result' => FALSE), self::LABEL_CONTACTS => array('title' => ts('Mailing labels - print'), 'class' => 'CRM_Contact_Form_Task_Label', 'result' => TRUE), self::BATCH_UPDATE => array('title' => ts('Batch update contacts via profile'), 'class' => array('CRM_Contact_Form_Task_PickProfile', 'CRM_Contact_Form_Task_Batch'), 'result' => TRUE), self::PRINT_FOR_CONTACTS => array('title' => ts('PDF letters - print'), 'class' => 'CRM_Contact_Form_Task_PDF', 'result' => TRUE), self::EMAIL_UNHOLD => array('title' => ts('Email - unhold addresses'), 'class' => 'CRM_Contact_Form_Task_Unhold'), self::COMMUNICATION_PREFS => array('title' => ts('Communication preferences - alter'), 'class' => 'CRM_Contact_Form_Task_AlterPreferences'), self::RESTORE => array('title' => ts('Restore contacts from trash'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::DELETE_PERMANENTLY => array('title' => ts('Delete permanently'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE));
//CRM-16329, if SMS provider is configured show sms action.
$providersCount = CRM_SMS_BAO_Provider::activeProviderCount();
if ($providersCount) {
self::$_tasks[self::SMS_CONTACTS] = array('title' => ts('SMS - schedule/send'), 'class' => 'CRM_Contact_Form_Task_SMS', 'result' => TRUE);
}
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$label = CRM_Contact_BAO_ContactType::getLabel('household');
self::$_tasks[self::HOUSEHOLD_CONTACTS] = array('title' => ts('Add relationship - to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToHousehold');
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$label = CRM_Contact_BAO_ContactType::getLabel('organization');
self::$_tasks[self::ORGANIZATION_CONTACTS] = array('title' => ts('Add relationship - to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToOrganization');
}
if (CRM_Core_Permission::check('merge duplicate contacts')) {
self::$_tasks[self::MERGE_CONTACTS] = array('title' => ts('Merge contacts'), 'class' => 'CRM_Contact_Form_Task_Merge', 'result' => TRUE);
}
//CRM-4418, check for delete
if (!CRM_Core_Permission::check('delete contacts')) {
unset(self::$_tasks[self::DELETE_CONTACTS]);
}
//show map action only if map provider and geoprovider are set (Google doesn't need geoprovider)
// should fix this to be more flexible as providers are added ??
$config = CRM_Core_Config::singleton();
if ($config->mapProvider && ($config->mapProvider == 'Google' || ($config->mapProvider == 'OpenStreetMaps' || $config->geoProvider == 'Google'))) {
self::$_tasks[self::MAP_CONTACTS] = array('title' => ts('Map contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => FALSE);
}
if (CRM_Core_Permission::access('CiviEvent')) {
self::$_tasks[self::ADD_EVENT] = array('title' => ts('Register participants for event'), 'class' => 'CRM_Event_Form_Participant');
}
if (CRM_Core_Permission::access('CiviMail') || CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings')) {
self::$_tasks[self::CREATE_MAILING] = array('title' => ts('Email - schedule/send via CiviMail'), 'class' => 'CRM_Mailing_Form_Task_AdhocMailing', 'result' => FALSE);
}
self::$_tasks += CRM_Core_Component::taskList();
CRM_Utils_Hook::searchTasks('contact', self::$_tasks);
asort(self::$_tasks);
}
}
示例5: initTasks
static function initTasks()
{
if (!self::$_tasks) {
self::$_tasks = array(1 => array('title' => ts('Add Contacts to Group'), 'class' => 'CRM_Contact_Form_Task_AddToGroup'), 2 => array('title' => ts('Remove Contacts from Group'), 'class' => 'CRM_Contact_Form_Task_RemoveFromGroup'), 3 => array('title' => ts('Tag Contacts (assign tags)'), 'class' => 'CRM_Contact_Form_Task_AddToTag'), 4 => array('title' => ts('Untag Contacts (remove tags)'), 'class' => 'CRM_Contact_Form_Task_RemoveFromTag'), 5 => array('title' => ts('Export Contacts'), 'class' => array('CRM_Export_Form_Select', 'CRM_Export_Form_Map'), 'result' => FALSE), 6 => array('title' => ts('Send Email to Contacts'), 'class' => 'CRM_Contact_Form_Task_Email', 'result' => TRUE), 7 => array('title' => ts('Send SMS to Contacts'), 'class' => 'CRM_Contact_Form_Task_SMS', 'result' => TRUE), 8 => array('title' => ts('Delete Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), 11 => array('title' => ts('Record Activity for Contacts'), 'class' => 'CRM_Activity_Form_Activity'), 13 => array('title' => ts('New Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch', 'result' => TRUE), 14 => array('title' => ts('Update Smart Group'), 'class' => 'CRM_Contact_Form_Task_SaveSearch_Update', 'result' => TRUE), 15 => array('title' => ts('Print Contacts'), 'class' => 'CRM_Contact_Form_Task_Print', 'result' => FALSE), 16 => array('title' => ts('Mailing Labels'), 'class' => 'CRM_Contact_Form_Task_Label', 'result' => TRUE), 17 => array('title' => ts('Batch Update via Profile'), 'class' => array('CRM_Contact_Form_Task_PickProfile', 'CRM_Contact_Form_Task_Batch'), 'result' => TRUE), 19 => array('title' => ts('Print PDF Letter for Contacts'), 'class' => 'CRM_Contact_Form_Task_PDF', 'result' => TRUE), 22 => array('title' => ts('Unhold Emails'), 'class' => 'CRM_Contact_Form_Task_Unhold'), 25 => array('title' => ts('Alter Contact Communication Preferences'), 'class' => 'CRM_Contact_Form_Task_AlterPreferences'), self::RESTORE => array('title' => ts('Restore Contacts'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE), self::DELETE_PERMANENTLY => array('title' => ts('Delete Permanently'), 'class' => 'CRM_Contact_Form_Task_Delete', 'result' => FALSE));
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$label = CRM_Contact_BAO_ContactType::getLabel('Household');
self::$_tasks[9] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToHousehold');
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$label = CRM_Contact_BAO_ContactType::getLabel('Organization');
self::$_tasks[10] = array('title' => ts('Add Contacts to %1', array(1 => $label)), 'class' => 'CRM_Contact_Form_Task_AddToOrganization');
}
if (CRM_Core_Permission::check('merge duplicate contacts')) {
self::$_tasks[21] = array('title' => ts('Merge Contacts'), 'class' => 'CRM_Contact_Form_Task_Merge', 'result' => TRUE);
}
//CRM-4418, check for delete
if (!CRM_Core_Permission::check('delete contacts')) {
unset(self::$_tasks[8]);
}
//show map action only if map provider and geoprovider are set (Google doesn't need geoprovider)
// should fix this to be more flexible as providers are added ??
$config = CRM_Core_Config::singleton();
if ($config->mapProvider && ($config->mapProvider == 'Google' || ($config->mapProvider == 'OpenStreetMaps' || $config->geoProvider == 'Google'))) {
self::$_tasks[12] = array('title' => ts('Map Contacts'), 'class' => 'CRM_Contact_Form_Task_Map', 'result' => FALSE);
}
if (CRM_Core_Permission::access('CiviEvent')) {
self::$_tasks[18] = array('title' => ts('Add Contacts to Event'), 'class' => 'CRM_Event_Form_Participant');
}
if (CRM_Core_Permission::access('CiviMail')) {
self::$_tasks[20] = array('title' => ts('Schedule/Send a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test', 'CRM_Mailing_Form_Schedule'), 'result' => FALSE);
} elseif (CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings')) {
self::$_tasks[20] = array('title' => ts('Create a Mass Mailing'), 'class' => array('CRM_Mailing_Form_Group', 'CRM_Mailing_Form_Settings', 'CRM_Mailing_Form_Upload', 'CRM_Mailing_Form_Test'), 'result' => FALSE);
}
self::$_tasks += CRM_Core_Component::taskList();
CRM_Utils_Hook::searchTasks('contact', self::$_tasks);
asort(self::$_tasks);
}
}
示例6: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
// If there's a dataSource in the query string, we need to load
// the form from the chosen DataSource class
if ($this->_dataSourceIsValid) {
$this->_dataSourceClassFile = str_replace('_', '/', $this->_dataSource) . ".php";
require_once $this->_dataSourceClassFile;
$this->_dataSourceClass = new $this->_dataSource();
$this->_dataSourceClass->buildQuickForm($this);
}
// Get list of data sources and display them as options
$dataSources = $this->_getDataSources();
$this->assign('urlPath', "civicrm/import");
$this->assign('urlPathVar', 'snippet=4');
$this->add('select', 'dataSource', ts('Data Source'), $dataSources, TRUE, array('onchange' => 'buildDataSourceFormBlock(this.value);'));
// duplicate handling options
$duplicateOptions = array();
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Fill'), CRM_Import_Parser::DUPLICATE_FILL);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('No Duplicate Checking'), CRM_Import_Parser::DUPLICATE_NOCHECK);
$this->addGroup($duplicateOptions, 'onDuplicate', ts('For Duplicate Contacts'));
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import Contact', 'name'));
$this->assign('savedMapping', $mappingArray);
$this->addElement('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
$js = array('onClick' => "buildSubTypes();buildDedupeRules();");
// contact types option
$contactOptions = array();
if (CRM_Contact_BAO_ContactType::isActive('Individual')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Individual'), CRM_Import_Parser::CONTACT_INDIVIDUAL, $js);
}
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Household'), CRM_Import_Parser::CONTACT_HOUSEHOLD, $js);
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Organization'), CRM_Import_Parser::CONTACT_ORGANIZATION, $js);
}
$this->addGroup($contactOptions, 'contactType', ts('Contact Type'));
$this->addElement('select', 'subType', ts('Subtype'));
$this->addElement('select', 'dedupe', ts('Dedupe Rule'));
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$config = CRM_Core_Config::singleton();
$geoCode = FALSE;
if (!empty($config->geocodeMethod)) {
$geoCode = TRUE;
$this->addElement('checkbox', 'doGeocodeAddress', ts('Lookup mapping info during import?'));
}
$this->assign('geoCode', $geoCode);
$this->addElement('text', 'fieldSeparator', ts('Import Field Separator'), array('size' => 2));
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例7: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
//Setting Upload File Size
$config = CRM_Core_Config::singleton();
if ($config->maxImportFileSize >= 8388608) {
$uploadFileSize = 8388608;
} else {
$uploadFileSize = $config->maxImportFileSize;
}
$uploadSize = round($uploadFileSize / (1024 * 1024), 2);
$this->assign('uploadSize', $uploadSize);
$this->add('file', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
$this->setMaxFileSize($uploadFileSize);
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
$duplicateOptions = array();
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE);
$duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('No Duplicate Checking'), CRM_Import_Parser::DUPLICATE_NOCHECK);
// for contributions NOCHECK == SKIP
// $duplicateOptions[] = $this->createElement('radio',
// null, null, ts('No Duplicate Checking'), CRM_Import_Parser::DUPLICATE_NOCHECK);
$this->addGroup($duplicateOptions, 'onDuplicate', ts('On Duplicate Entries'));
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import Participant', 'name'));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
if ($loadeMapping = $this->get('loadedMapping')) {
$this->assign('loadedMapping', $loadeMapping);
$this->setDefaults(array('savedMapping' => $loadeMapping));
}
$this->setDefaults(array('onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP));
//contact types option
$contactOptions = array();
if (CRM_Contact_BAO_ContactType::isActive('Individual')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Individual'), CRM_Import_Parser::CONTACT_INDIVIDUAL);
}
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Household'), CRM_Import_Parser::CONTACT_HOUSEHOLD);
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Organization'), CRM_Import_Parser::CONTACT_ORGANIZATION);
}
$this->addGroup($contactOptions, 'contactType', ts('Contact Type'));
$this->setDefaults(array('contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例8: getReservedProfiles
/**
* Function to retrieve reserved profiles
*
* @param string $name name if the reserve profile
*
* @return array $reservedProfiles returns associated array
* @static
*/
static function getReservedProfiles($type = 'Contact')
{
$reservedProfiles = array();
$profileNames = array();
if ($type == 'Contact') {
require_once 'CRM/Contact/BAO/ContactType.php';
$whereClause = 'name IN ( "new_individual", "new_organization", "new_household" )';
if (CRM_Contact_BAO_ContactType::isActive('Individual')) {
$profileNames[] = '"new_individual"';
}
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$profileNames[] = '"new_household"';
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$profileNames[] = '"new_organization"';
}
}
if (!empty($profileNames)) {
$whereClause = 'name IN ( ' . implode(',', $profileNames) . ' ) AND is_reserved = 1';
} else {
$whereClause = 'is_reserved = 1';
}
$query = "SELECT id, title FROM civicrm_uf_group WHERE {$whereClause}";
$dao =& CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$reservedProfiles[$dao->id] = $dao->title;
}
return $reservedProfiles;
}
示例9: addContactTypeSelector
/**
* A long-winded way to add one radio element to the form.
*/
protected function addContactTypeSelector()
{
//contact types option
$contactOptions = array();
if (CRM_Contact_BAO_ContactType::isActive('Individual')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Individual'), CRM_Import_Parser::CONTACT_INDIVIDUAL);
}
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Household'), CRM_Import_Parser::CONTACT_HOUSEHOLD);
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Organization'), CRM_Import_Parser::CONTACT_ORGANIZATION);
}
$this->addGroup($contactOptions, 'contactType', ts('Contact Type'));
$this->setDefaults(array('contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL));
}
示例10: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
$multipleCustomData = CRM_Core_BAO_CustomGroup::getMultipleFieldGroup();
$this->add('select', 'multipleCustomData', ts('Multi-value Custom Data'), array('' => ts('- select -')) + $multipleCustomData, TRUE);
//Setting Upload File Size
$config = CRM_Core_Config::singleton();
$uploadFileSize = CRM_Core_Config_Defaults::formatUnitSize($config->maxFileSize . 'm', TRUE);
$uploadSize = round($uploadFileSize / (1024 * 1024), 2);
$this->assign('uploadSize', $uploadSize);
$this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->setMaxFileSize($uploadFileSize);
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
//get the saved mapping details
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import Multi value custom data', 'name'));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
if ($loadeMapping = $this->get('loadedMapping')) {
$this->assign('loadedMapping', $loadeMapping);
$this->setDefaults(array('savedMapping' => $loadeMapping));
}
//contact types option
$contactOptions = array();
if (CRM_Contact_BAO_ContactType::isActive('Individual')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Individual'), CRM_Import_Parser::CONTACT_INDIVIDUAL);
}
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Household'), CRM_Import_Parser::CONTACT_HOUSEHOLD);
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$contactOptions[] = $this->createElement('radio', NULL, NULL, ts('Organization'), CRM_Import_Parser::CONTACT_ORGANIZATION);
}
$this->addGroup($contactOptions, 'contactType', ts('Contact Type'));
$this->setDefaults(array('contactType' => CRM_Import_Parser::CONTACT_INDIVIDUAL));
//build date formats
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例11: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
//Setting Upload File Size
$config =& CRM_Core_Config::singleton();
if ($config->maxImportFileSize >= 8388608) {
$uploadFileSize = 8388608;
} else {
$uploadFileSize = $config->maxImportFileSize;
}
$uploadSize = round($uploadFileSize / (1024 * 1024), 2);
$this->assign('uploadSize', $uploadSize);
$this->add('file', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=60', true);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
$this->setMaxFileSize($uploadFileSize);
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
$duplicateOptions = array();
$duplicateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Insert new Membership'), CRM_Member_Import_Parser::DUPLICATE_SKIP);
$duplicateOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Update existing Membership'), CRM_Member_Import_Parser::DUPLICATE_UPDATE);
$this->addGroup($duplicateOptions, 'onDuplicate', ts('Import mode'));
$this->setDefaults(array('onDuplicate' => CRM_Member_Import_Parser::DUPLICATE_SKIP));
//get the saved mapping details
require_once "CRM/Core/BAO/Mapping.php";
require_once "CRM/Core/OptionGroup.php";
$mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import Membership', 'name'));
$this->assign('savedMapping', $mappingArray);
$this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
if ($loadeMapping = $this->get('loadedMapping')) {
$this->assign('loadedMapping', $loadeMapping);
$this->setDefaults(array('savedMapping' => $loadeMapping));
}
//contact types option
require_once 'CRM/Contact/BAO/ContactType.php';
$contactOptions = array();
if (CRM_Contact_BAO_ContactType::isActive('Individual')) {
$contactOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Individual'), CRM_Member_Import_Parser::CONTACT_INDIVIDUAL);
}
if (CRM_Contact_BAO_ContactType::isActive('Household')) {
$contactOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Household'), CRM_Member_Import_Parser::CONTACT_HOUSEHOLD);
}
if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
$contactOptions[] = HTML_QuickForm::createElement('radio', null, null, ts('Organization'), CRM_Member_Import_Parser::CONTACT_ORGANIZATION);
}
$this->addGroup($contactOptions, 'contactType', ts('Contact Type'));
$this->setDefaults(array('contactType' => CRM_Member_Import_Parser::CONTACT_INDIVIDUAL));
//build date formats
require_once 'CRM/Core/Form/Date.php';
CRM_Core_Form_Date::buildAllowedDateFormats($this);
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
}