本文整理匯總了PHP中CRM_Activity_DAO_Activity::selectAdd方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Activity_DAO_Activity::selectAdd方法的具體用法?PHP CRM_Activity_DAO_Activity::selectAdd怎麽用?PHP CRM_Activity_DAO_Activity::selectAdd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Activity_DAO_Activity
的用法示例。
在下文中一共展示了CRM_Activity_DAO_Activity::selectAdd方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isSurveyActivity
/**
* check survey activity.
*
* @param int $activityId
* Activity id.
* @return bool
*/
public static function isSurveyActivity($activityId)
{
$isSurveyActivity = FALSE;
if (!$activityId) {
return $isSurveyActivity;
}
$activity = new CRM_Activity_DAO_Activity();
$activity->id = $activityId;
$activity->selectAdd('source_record_id, activity_type_id');
if ($activity->find(TRUE) && $activity->source_record_id) {
$surveyActTypes = self::getSurveyActivityType();
if (array_key_exists($activity->activity_type_id, $surveyActTypes)) {
$isSurveyActivity = TRUE;
}
}
return $isSurveyActivity;
}
示例2: registerInterview
/**
* @param array $params
*
* @return mixed
*/
public static function registerInterview($params)
{
$activityId = CRM_Utils_Array::value('activity_id', $params);
$surveyTypeId = CRM_Utils_Array::value('activity_type_id', $params);
if (!is_array($params) || !$surveyTypeId || !$activityId) {
return FALSE;
}
static $surveyFields;
if (!is_array($surveyFields)) {
$surveyFields = CRM_Core_BAO_CustomField::getFields('Activity', FALSE, FALSE, $surveyTypeId, NULL, FALSE, TRUE);
}
static $statusId;
if (!$statusId) {
$statusId = array_search('Completed', CRM_Core_PseudoConstant::activityStatus('name'));
}
//format custom fields.
$customParams = CRM_Core_BAO_CustomField::postProcess($params, $activityId, 'Activity');
CRM_Core_BAO_CustomValueTable::store($customParams, 'civicrm_activity', $activityId);
//process contact data.
$contactParams = $fields = array();
$contactFieldTypes = array_merge(array('Contact'), CRM_Contact_BAO_ContactType::basicTypes());
$responseFields = CRM_Campaign_BAO_Survey::getSurveyResponseFields($params['survey_id']);
if (!empty($responseFields)) {
foreach ($params as $key => $value) {
if (array_key_exists($key, $responseFields)) {
if (in_array($responseFields[$key]['field_type'], $contactFieldTypes)) {
$fields[$key] = $responseFields[$key];
$contactParams[$key] = $value;
if (isset($params["{$key}_id"])) {
$contactParams["{$key}_id"] = $params["{$key}_id"];
}
}
}
}
}
$contactId = CRM_Utils_Array::value('voter_id', $params);
if ($contactId && !empty($contactParams)) {
CRM_Contact_BAO_Contact::createProfileContact($contactParams, $fields, $contactId);
}
//update activity record.
$activity = new CRM_Activity_DAO_Activity();
$activity->id = $activityId;
$activity->selectAdd();
$activity->selectAdd('activity_date_time, status_id, result, subject');
$activity->find(TRUE);
$activity->activity_date_time = date('YmdHis');
$activity->status_id = $statusId;
if (!empty($params['activity_date_time'])) {
$activity->activity_date_time = CRM_Utils_Date::processDate($params['activity_date_time'], $params['activity_date_time_time']);
}
$subject = '';
$surveyTitle = CRM_Utils_Array::value('surveyTitle', $params);
if ($surveyTitle) {
$subject = $surveyTitle . ' - ';
}
$subject .= ts('Respondent Interview');
$activity->subject = $subject;
$activityParams = array('details' => 'details', 'result' => 'result', 'engagement_level' => 'activity_engagement_level', 'subject' => 'activity_subject', 'status_id' => 'activity_status_id', 'source_contact_id' => 'source_contact', 'location' => 'activity_location', 'campaign_id' => 'activity_campaign_id', 'duration' => 'activity_duration');
foreach ($activityParams as $key => $field) {
if (!empty($params[$field])) {
$activity->{$key} = $params[$field];
}
}
$activity->save();
//really this should use Activity BAO& not be here but refactoring will have to be later
//actually the whole ajax call could be done as an api ajax call & post hook would be sorted
CRM_Utils_Hook::post('edit', 'Activity', $activity->id, $activity);
$activity->free();
return $activityId;
}
示例3: registerInterview
static function registerInterview($params)
{
$activityId = CRM_Utils_Array::value('activity_id', $params);
$surveyTypeId = CRM_Utils_Array::value('activity_type_id', $params);
if (!is_array($params) || !$surveyTypeId || !$activityId) {
return false;
}
static $surveyFields;
if (!is_array($surveyFields)) {
require_once 'CRM/Core/BAO/CustomField.php';
$surveyFields = CRM_Core_BAO_CustomField::getFields('Activity', false, false, $surveyTypeId, null, false, true);
}
static $statusId;
if (!$statusId) {
require_once 'CRM/Core/PseudoConstant.php';
$statusId = array_search('Completed', CRM_Core_PseudoConstant::activityStatus('name'));
}
//format custom fields.
$customParams = CRM_Core_BAO_CustomField::postProcess($params, $surveyFields, $activityId, 'Activity');
require_once 'CRM/Core/BAO/CustomValueTable.php';
CRM_Core_BAO_CustomValueTable::store($customParams, 'civicrm_activity', $activityId);
//update activity record.
require_once 'CRM/Activity/DAO/Activity.php';
$activity = new CRM_Activity_DAO_Activity();
$activity->id = $activityId;
$activity->selectAdd();
$activity->selectAdd('activity_date_time, status_id, result, subject');
$activity->find(true);
$activity->activity_date_time = date('Ymdhis');
$activity->status_id = $statusId;
if (CRM_Utils_Array::value('details', $params)) {
$activity->details = $params['details'];
}
if ($result = CRM_Utils_Array::value('result', $params)) {
$activity->result = $result;
}
$subject = '';
$surveyTitle = CRM_Utils_Array::value('surveyTitle', $params);
if ($surveyTitle) {
$subject = ts('%1', array(1 => $surveyTitle));
$subject .= ' - ';
}
$subject .= ts('Respondent Interview');
$activity->subject = $subject;
$activity->save();
$activity->free();
return $activityId;
}
示例4: isSurveyActivity
static function isSurveyActivity($activityId)
{
$isSurveyActivity = false;
if (!$activityId) {
return $isSurveyActivity;
}
require_once 'CRM/Activity/DAO/Activity.php';
$activity = new CRM_Activity_DAO_Activity();
$activity->id = $activityId;
$activity->selectAdd('source_record_id, activity_type_id');
if ($activity->find(true) && $activity->source_record_id) {
$surveyActTypes = self::getSurveyActivityType();
if (array_key_exists($activity->activity_type_id, $surveyActTypes)) {
$isSurveyActivity = true;
}
}
return $isSurveyActivity;
}