本文整理汇总了PHP中CRM_Contact_DAO_Contact::selectAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_DAO_Contact::selectAdd方法的具体用法?PHP CRM_Contact_DAO_Contact::selectAdd怎么用?PHP CRM_Contact_DAO_Contact::selectAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_DAO_Contact
的用法示例。
在下文中一共展示了CRM_Contact_DAO_Contact::selectAdd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addActivity
/**
* This method populates the civicrm_activity_history table
*/
private function addActivity()
{
$contactDAO = new CRM_Contact_DAO_Contact();
$contactDAO->contact_type = 'Individual';
$contactDAO->selectAdd();
$contactDAO->selectAdd('id');
$contactDAO->orderBy('sort_name');
$contactDAO->find();
$count = 0;
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
while ($contactDAO->fetch()) {
if ($count++ > 2) {
break;
}
for ($i = 0; $i < self::NUM_ACTIVITY; $i++) {
$activityDAO = new CRM_Activity_DAO_Activity();
$activityId = CRM_Core_OptionGroup::values('activity_type', NULL, NULL, NULL, ' AND v.name IN ("Tell A Friend", "Pledge Acknowledgment")');
$activityTypeID = array_rand($activityId);
$activity = CRM_Core_PseudoConstant::activityType();
$activityDAO->activity_type_id = $activityTypeID;
$activityDAO->subject = "Subject for {$activity[$activityTypeID]}";
$activityDAO->activity_date_time = $this->randomDate();
$activityDAO->status_id = 2;
$this->_insert($activityDAO);
$activityContactDAO = new CRM_Activity_DAO_ActivityContact();
$activityContactDAO->activity_id = $activityDAO->id;
$activityContactDAO->contact_id = $contactDAO->id;
$activityContactDAO->record_type_id = CRM_Utils_Array::key('Activity Source', $activityContacts);
$this->_insert($activityContactDAO);
if ($activityTypeID == 9) {
$activityContactDAO = new CRM_Activity_DAO_ActivityContact();
$activityContactDAO->activity_id = $activityDAO->id;
$activityContactDAO->contact_id = mt_rand(1, 101);
$activityContactDAO->record_type_id = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$this->_insert($activityContactDAO);
}
}
}
}
示例2: addActivity
/**
* This method populates the civicrm_activity_history table
*/
private function addActivity()
{
$contactDAO = new CRM_Contact_DAO_Contact();
$contactDAO->contact_type = 'Individual';
$contactDAO->selectAdd();
$contactDAO->selectAdd('id');
$contactDAO->orderBy('sort_name');
$contactDAO->find();
$count = 0;
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
while ($contactDAO->fetch()) {
if ($count++ > 2) {
break;
}
for ($i = 0; $i < self::NUM_ACTIVITY; $i++) {
$activityDAO = new CRM_Activity_DAO_Activity();
$activityTypeID = mt_rand(7, 10);
$activity = CRM_Core_PseudoConstant::activityType();
$activityDAO->activity_type_id = $activityTypeID;
$activityDAO->subject = "Subject for {$activity[$activityTypeID]}";
$activityDAO->activity_date_time = $this->randomDate();
$activityDAO->duration = mt_rand(1, 6);
$activityDAO->status_id = 2;
$this->_insert($activityDAO);
$activityContactDAO = new CRM_Activity_DAO_ActivityContact();
$activityContactDAO->activity_id = $activityDAO->id;
$activityContactDAO->contact_id = $contactDAO->id;
$activityContactDAO->record_type_id = CRM_Utils_Array::key('Activity Source', $activityContacts);
$this->_insert($activityContactDAO);
if (in_array($activityTypeID, array(6, 9))) {
$activityContactDAO = new CRM_Activity_DAO_ActivityContact();
$activityContactDAO->activity_id = $activityDAO->id;
$activityContactDAO->contact_id = mt_rand(1, 101);
$activityContactDAO->record_type_id = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$this->_insert($activityContactDAO);
}
if ($activityTypeID == 7) {
$activityContactDAO = new CRM_Activity_DAO_ActivityContact();
$activityContactDAO->activity_id = $activityDAO->id;
$activityContactDAO->contact_id = mt_rand(1, 101);
$activityContactDAO->record_type_id = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$this->_insert($activityContactDAO);
}
}
}
}