本文整理汇总了PHP中CRM_Contact_BAO_ContactType::basicTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_ContactType::basicTypes方法的具体用法?PHP CRM_Contact_BAO_ContactType::basicTypes怎么用?PHP CRM_Contact_BAO_ContactType::basicTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_ContactType
的用法示例。
在下文中一共展示了CRM_Contact_BAO_ContactType::basicTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filterVoterIds
public function filterVoterIds()
{
//do the cleanup later on.
if (!is_array($this->_contactIds)) {
return;
}
$profileId = CRM_Campaign_BAO_Survey::getSurveyProfileId($this->_surveyId);
if ($profileId) {
$profileType = CRM_Core_BAO_UFField::getProfileType($profileId);
if (in_array($profileType, CRM_Contact_BAO_ContactType::basicTypes())) {
$voterIdCount = count($this->_contactIds);
//create temporary table to store voter ids.
$tempTableName = CRM_Core_DAO::createTempTableName('civicrm_survey_respondent');
CRM_Core_DAO::executeQuery("DROP TEMPORARY TABLE IF EXISTS {$tempTableName}");
$query = "\n CREATE TEMPORARY TABLE {$tempTableName} (\n id int unsigned NOT NULL AUTO_INCREMENT,\n survey_contact_id int unsigned NOT NULL,\n PRIMARY KEY ( id )\n);\n";
CRM_Core_DAO::executeQuery($query);
$batch = 100;
$insertedCount = 0;
do {
$processIds = $this->_contactIds;
$insertIds = array_splice($processIds, $insertedCount, $batch);
if (!empty($insertIds)) {
$insertSQL = "INSERT IGNORE INTO {$tempTableName}( survey_contact_id )\n VALUES (" . implode('),(', $insertIds) . ');';
CRM_Core_DAO::executeQuery($insertSQL);
}
$insertedCount += $batch;
} while ($insertedCount < $voterIdCount);
$query = "\n SELECT contact.id as id\n FROM civicrm_contact contact\nINNER JOIN {$tempTableName} ON ( {$tempTableName}.survey_contact_id = contact.id )\n WHERE contact.contact_type != %1";
$removeContact = CRM_Core_DAO::executeQuery($query, array(1 => array($profileType, 'String')));
while ($removeContact->fetch()) {
unset($this->_contactIds[$removeContact->id]);
}
}
}
}
示例2: surveyProfileTypes
/**
* Get survey supportable profile types.
*/
public static function surveyProfileTypes()
{
static $profileTypes;
if (!isset($profileTypes)) {
$profileTypes = array_merge(array('Activity', 'Contact'), CRM_Contact_BAO_ContactType::basicTypes());
$profileTypes = array_diff($profileTypes, array('Organization', 'Household'));
}
return $profileTypes;
}
示例3: surveyProfileTypes
/**
* Function to get survey supportable profile types
*
*/
public static function surveyProfileTypes()
{
static $profileTypes;
if (!isset($profileTypes)) {
$profileTypes = array_merge(array('Activity', 'Contact'), CRM_Contact_BAO_ContactType::basicTypes());
}
return $profileTypes;
}