本文整理汇总了PHP中CRM_Contact_BAO_Query::_activityRole方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Query::_activityRole方法的具体用法?PHP CRM_Contact_BAO_Query::_activityRole怎么用?PHP CRM_Contact_BAO_Query::_activityRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Query
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Query::_activityRole方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* function which actually does all the work for the constructor
*
* @return void
* @access private
*/
function initialize()
{
$this->_select = array();
$this->_element = array();
$this->_tables = array();
$this->_whereTables = array();
$this->_where = array();
$this->_qill = array();
$this->_options = array();
$this->_cfIDs = array();
$this->_paramLookup = array();
$this->_having = array();
$this->_customQuery = NULL;
//reset cache, CRM-5803
self::$_activityRole = NULL;
self::$_considerCompActivities = NULL;
self::$_withContactActivitiesOnly = NULL;
$this->_select['contact_id'] = 'contact_a.id as contact_id';
$this->_element['contact_id'] = 1;
$this->_tables['civicrm_contact'] = 1;
if (!empty($this->_params)) {
$this->buildParamsLookup();
}
$this->_whereTables = $this->_tables;
$this->selectClause();
$this->_whereClause = $this->whereClause();
$this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode);
$this->_simpleFromClause = self::fromClause($this->_whereTables, NULL, NULL, $this->_primaryLocation, $this->_mode);
$this->openedSearchPanes(TRUE);
}
示例2: whereClauseSingle
/**
* Where clause for a single field.
*
* @param $values
* @param $query
* @return void
*/
public static function whereClauseSingle(&$values, &$query)
{
list($name, $op, $value, $grouping) = $values;
$fields = CRM_Activity_BAO_Activity::exportableFields();
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
if ($query->_mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
$query->_skipDeleteClause = TRUE;
}
switch ($name) {
case 'activity_type_id':
case 'activity_status_id':
case 'activity_engagement_level':
case 'activity_subject':
case 'activity_id':
$qillName = $name;
if (in_array($name, array('activity_engagement_level', 'activity_id'))) {
$name = $qillName = str_replace('activity_', '', $name);
}
if (in_array($name, array('activity_status_id', 'activity_subject'))) {
$name = str_replace('activity_', '', $name);
$qillName = str_replace('_id', '', $qillName);
}
$dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type::typeToString($fields[$qillName]['type']) : 'String';
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.{$name}", $op, $value, $dataType);
list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Activity_DAO_Activity', $name, $value, $op);
$query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$qillName]['title'], 2 => $op, 3 => $value));
break;
case 'activity_type':
case 'activity_status':
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("{$name}.label", $op, $value, 'String');
list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Activity_DAO_Activity', $name, $value, $op);
$query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$name]['title'], 2 => $op, 3 => $value));
$query->_tables[$name] = $query->_whereTables[$name] = 1;
break;
case 'activity_survey_id':
if (!$value) {
break;
}
$value = CRM_Utils_Type::escape($value, 'Integer');
$query->_where[$grouping][] = " civicrm_activity.source_record_id = {$value}";
$query->_qill[$grouping][] = ts('Survey') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $value, 'title');
break;
case 'activity_role':
CRM_Contact_BAO_Query::$_activityRole = $values[2];
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
if ($values[2]) {
$query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
if ($values[2] == 1) {
$query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$sourceID}";
$query->_qill[$grouping][] = ts('Activity created by');
} elseif ($values[2] == 2) {
$query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$assigneeID}";
$query->_qill[$grouping][] = ts('Activity assigned to');
} elseif ($values[2] == 3) {
$query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$targetID}";
$query->_qill[$grouping][] = ts('Activity targeted to');
}
}
break;
case 'activity_test':
// We don't want to include all tests for sql OR CRM-7827
if (!$value || $query->getOperator() != 'OR') {
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.is_test", $op, $value, "Boolean");
if ($value) {
$query->_qill[$grouping][] = ts('Activity is a Test');
}
}
break;
case 'activity_date':
case 'activity_date_low':
case 'activity_date_high':
$query->dateQueryBuilder($values, 'civicrm_activity', 'activity_date', 'activity_date_time', ts('Activity Date'));
break;
case 'activity_taglist':
$taglist = $value;
$value = array();
foreach ($taglist as $val) {
if ($val) {
$val = explode(',', $val);
foreach ($val as $tId) {
if (is_numeric($tId)) {
$value[$tId] = 1;
}
}
}
}
case 'activity_tags':
$value = array_keys($value);
$activityTags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
$names = array();
//.........这里部分代码省略.........
示例3: initialize
/**
* Function which actually does all the work for the constructor.
*/
public function initialize()
{
$this->_select = array();
$this->_element = array();
$this->_tables = array();
$this->_whereTables = array();
$this->_where = array();
$this->_qill = array();
$this->_options = array();
$this->_cfIDs = array();
$this->_paramLookup = array();
$this->_having = array();
$this->_customQuery = NULL;
// reset cached static variables - CRM-5803
self::$_activityRole = NULL;
self::$_considerCompActivities = NULL;
self::$_withContactActivitiesOnly = NULL;
$this->_select['contact_id'] = 'contact_a.id as contact_id';
$this->_element['contact_id'] = 1;
$this->_tables['civicrm_contact'] = 1;
if (!empty($this->_params)) {
$this->buildParamsLookup();
}
$this->_whereTables = $this->_tables;
$this->selectClause();
$this->_whereClause = $this->whereClause();
if (array_key_exists('civicrm_contribution', $this->_whereTables)) {
$component = 'contribution';
}
if (array_key_exists('civicrm_membership', $this->_whereTables)) {
$component = 'membership';
}
if (isset($component)) {
CRM_Financial_BAO_FinancialType::buildPermissionedClause($this->_whereClause, $component);
}
$this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode);
$this->_simpleFromClause = self::fromClause($this->_whereTables, NULL, NULL, $this->_primaryLocation, $this->_mode);
$this->openedSearchPanes(TRUE);
}
示例4: whereClauseSingle
/**
* where clause for a single field
*
* @return void
* @access public
*/
static function whereClauseSingle(&$values, &$query)
{
list($name, $op, $value, $grouping, $wildcard) = $values;
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
if ($query->_mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
$query->_skipDeleteClause = true;
}
switch ($name) {
case 'activity_type_id':
$types = CRM_Core_PseudoConstant::activityType(true, true);
$clause = array();
if (is_array($value)) {
foreach ($value as $id => $dontCare) {
if (array_key_exists($id, $types) && $dontCare) {
$clause[] = "'" . CRM_Utils_Type::escape($types[$id], 'String') . "'";
}
}
$activityTypes = implode(',', array_keys($value));
} else {
$clause[] = "'" . CRM_Utils_Type::escape($value, 'String') . "'";
$activityTypes = $value;
}
$query->_where[$grouping][] = ' civicrm_activity.activity_type_id IN (' . $activityTypes . ')';
$query->_qill[$grouping][] = ts('Activity Type') . ' ' . implode(' ' . ts('or') . ' ', $clause);
break;
case 'activity_survey_id':
if (!$value) {
break;
}
$value = CRM_Utils_Type::escape($value, 'Integer');
$query->_where[$grouping][] = " source_record_id = {$value}";
$query->_qill[$grouping][] = ts('Survey') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $value, 'title');
break;
case 'activity_role':
CRM_Contact_BAO_Query::$_activityRole = $values[2];
//for activity target name
$activityTargetName = $query->getWhereValues('activity_contact_name', $grouping);
if (!$activityTargetName[2]) {
$name = null;
} else {
$name = trim($activityTargetName[2]);
$name = strtolower(CRM_Core_DAO::escapeString($name));
}
$query->_where[$grouping][] = " contact_b.is_deleted = 0 AND contact_b.sort_name LIKE '%{$name}%'";
if ($values[2] == 1) {
$query->_where[$grouping][] = " civicrm_activity.source_contact_id = contact_b.id";
$query->_qill[$grouping][] = ts('Activity created by') . " '{$name}'";
$query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
} else {
if ($values[2] == 2) {
$query->_where[$grouping][] = " civicrm_activity_assignment.activity_id = civicrm_activity.id AND civicrm_activity_assignment.assignee_contact_id = contact_b.id";
$query->_tables['civicrm_activity_assignment'] = $query->_whereTables['civicrm_activity_assignment'] = 1;
$query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
$query->_qill[$grouping][] = ts('Activity assigned to') . " '{$name}'";
}
}
break;
case 'activity_status':
$status = CRM_Core_PseudoConstant::activityStatus();
$clause = array();
if (is_array($value)) {
foreach ($value as $k => $v) {
if ($k) {
$clause[] = "'" . CRM_Utils_Type::escape($status[$k], 'String') . "'";
}
}
} else {
$clause[] = "'" . CRM_Utils_Type::escape($value, 'String') . "'";
}
$query->_where[$grouping][] = ' civicrm_activity.status_id IN (' . implode(',', array_keys($value)) . ')';
$query->_qill[$grouping][] = ts('Activity Status') . ' - ' . implode(' ' . ts('or') . ' ', $clause);
break;
case 'activity_subject':
$n = trim($value);
$value = strtolower(CRM_Core_DAO::escapeString($n));
if ($wildcard) {
if (strpos($value, '%') !== false) {
// only add wild card if not there
$value = "'{$value}'";
} else {
$value = "'%{$value}%'";
}
$op = 'LIKE';
} else {
$value = "'{$value}'";
}
$wc = $op != 'LIKE' ? "LOWER(civicrm_activity.subject)" : "civicrm_activity.subject";
$query->_where[$grouping][] = " {$wc} {$op} {$value}";
$query->_qill[$grouping][] = ts('Subject') . " {$op} - '{$n}'";
break;
case 'activity_test':
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.is_test", $op, $value, "Integer");
if ($value) {
//.........这里部分代码省略.........
示例5: whereClauseSingle
/**
* where clause for a single field
*
* @return void
* @access public
*/
static function whereClauseSingle(&$values, &$query)
{
list($name, $op, $value, $grouping, $wildcard) = $values;
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
if ($query->_mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
$query->_skipDeleteClause = TRUE;
}
switch ($name) {
case 'activity_type_id':
case 'activity_type':
$types = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
//get the component activity types.
$compActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE, TRUE);
$activityTypeIds = self::buildWhereAndQill($query, $value, $types, $op, $grouping, array('Activity Type', 'civicrm_activity.activity_type_id'));
foreach ($activityTypeIds as $activityTypeId) {
if (array_key_exists($activityTypeId, $compActTypes)) {
CRM_Contact_BAO_Query::$_considerCompActivities = TRUE;
break;
}
}
break;
case 'activity_survey_id':
if (!$value) {
break;
}
$value = CRM_Utils_Type::escape($value, 'Integer');
$query->_where[$grouping][] = " source_record_id = {$value}";
$query->_qill[$grouping][] = ts('Survey') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $value, 'title');
break;
case 'activity_engagement_level':
if (!$value) {
break;
}
$value = CRM_Utils_Type::escape($value, 'Integer');
$query->_where[$grouping][] = " engagement_level = {$value}";
$query->_qill[$grouping][] = ts('Engagement Index') . ' - ' . CRM_Core_OptionGroup::getLabel('engagement_index', $value);
break;
case 'activity_role':
CRM_Contact_BAO_Query::$_activityRole = $values[2];
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
if ($values[2]) {
$query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
if ($values[2] == 1) {
$query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$sourceID}";
$query->_qill[$grouping][] = ts('Activity created by');
} else {
if ($values[2] == 2) {
$query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$assigneeID}";
$query->_qill[$grouping][] = ts('Activity assigned to');
} else {
if ($values[2] == 3) {
$query->_where[$grouping][] = " civicrm_activity_contact.record_type_id = {$targetID}";
$query->_qill[$grouping][] = ts('Activity targeted to');
}
}
}
}
break;
case 'activity_status':
$status = CRM_Core_PseudoConstant::activityStatus();
$activityTypeIds = self::buildWhereAndQill($query, $value, $status, $op, $grouping, array('Activity Status', 'civicrm_activity.status_id'));
break;
case 'activity_subject':
$n = trim($value);
$value = strtolower(CRM_Core_DAO::escapeString($n));
if ($wildcard) {
if (strpos($value, '%') !== FALSE) {
// only add wild card if not there
$value = "'{$value}'";
} else {
$value = "'%{$value}%'";
}
$op = 'LIKE';
} else {
$value = "'{$value}'";
}
$wc = $op != 'LIKE' ? "LOWER(civicrm_activity.subject)" : "civicrm_activity.subject";
$query->_where[$grouping][] = " {$wc} {$op} {$value}";
$query->_qill[$grouping][] = ts('Subject') . " {$op} - '{$n}'";
break;
case 'activity_test':
// We dont want to include all tests for sql OR CRM-7827
if (!$value || $query->getOperator() != 'OR') {
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.is_test", $op, $value, "Boolean");
if ($value) {
$query->_qill[$grouping][] = ts('Activity is a Test');
}
}
break;
case 'activity_date':
//.........这里部分代码省略.........
示例6: initialize
/**
* function which actually does all the work for the constructor
*
* @return void
* @access private
*/
function initialize()
{
$this->_select = array();
$this->_element = array();
$this->_tables = array();
$this->_whereTables = array();
$this->_where = array();
$this->_qill = array();
$this->_options = array();
$this->_cfIDs = array();
$this->_paramLookup = array();
$this->_customQuery = null;
//reset cache, CRM-5803
self::$_activityRole = null;
$this->_select['contact_id'] = 'contact_a.id as contact_id';
$this->_element['contact_id'] = 1;
$this->_tables['civicrm_contact'] = 1;
if (!empty($this->_params)) {
$this->buildParamsLookup();
}
$this->_whereTables = $this->_tables;
$this->selectClause();
$this->_whereClause = $this->whereClause();
$this->_fromClause = self::fromClause($this->_tables, null, null, $this->_primaryLocation, $this->_mode);
$this->_simpleFromClause = self::fromClause($this->_whereTables, null, null, $this->_primaryLocation, $this->_mode);
}
示例7: activity
/**
* where / qill clause for open activity types
*
* @return void
* @access public
*/
function activity(&$values)
{
$this->_useDistinct = true;
list($name, $op, $value, $grouping, $wildcard) = $values;
$this->_tables['civicrm_activity'] = $this->_whereTables['civicrm_activity'] = 1;
switch ($name) {
case 'activity_type_id':
$types = CRM_Core_PseudoConstant::activityType(true, true);
$this->_where[$grouping][] = " civicrm_activity.activity_type_id = {$value}";
$this->_qill[$grouping][] = ts('Activity Type') . " {$op} '{$types[$value]}'";
break;
case 'activity_role':
self::$_activityRole = $values[2];
//for activity target name
$activityTargetName = $this->getWhereValues('activity_target_name', $grouping);
if (!$activityTargetName[2]) {
$name = null;
} else {
$name = trim($activityTargetName[2]);
$name = strtolower(CRM_Core_DAO::escapeString($name));
}
$this->_where[$grouping][] = " contact_a.sort_name LIKE '%{$name}%'";
if ($values[2] == 0) {
$this->_where[$grouping][] = " civicrm_activity_target.activity_id = civicrm_activity.id AND civicrm_activity_target.target_contact_id = contact_a.id";
$query->_tables['civicrm_activity_target'] = $query->_whereTables['civicrm_activity_target'] = 1;
$this->_qill[$grouping][] = ts('Activity with') . " '{$name}'";
} else {
if ($values[2] == 1) {
$this->_where[$grouping][] = " civicrm_activity.source_contact_id = contact_a.id";
$this->_qill[$grouping][] = ts('Activity created by') . " '{$name}'";
} else {
$this->_where[$grouping][] = " civicrm_activity_assignment.activity_id = civicrm_activity.id AND civicrm_activity_assignment.assignee_contact_id = contact_a.id";
$query->_tables['civicrm_activity_assignment'] = $query->_whereTables['civicrm_activity_assignment'] = 1;
$this->_qill[$grouping][] = ts('Activity assigned to') . " '{$name}'";
}
}
break;
case 'activity_status':
$status = CRM_Core_PseudoConstant::activityStatus();
$clause = array();
if (is_array($value)) {
foreach ($value as $k => $v) {
if ($k) {
$clause[] = "'" . CRM_Utils_Type::escape($status[$k], 'String') . "'";
}
}
} else {
$clause[] = "'" . CRM_Utils_Type::escape($value, 'String') . "'";
}
$this->_where[$grouping][] = ' civicrm_activity.status_id IN (' . implode(',', array_keys($value)) . ')';
$this->_qill[$grouping][] = ts('Activity Status') . ' - ' . implode(' ' . ts('or') . ' ', $clause);
break;
case 'activity_subject':
$n = trim($value);
$value = strtolower(CRM_Core_DAO::escapeString($n));
if ($wildcard) {
if (strpos($value, '%') !== false) {
// only add wild card if not there
$value = "'{$value}'";
} else {
$value = "'%{$value}%'";
}
$op = 'LIKE';
} else {
$value = "'{$value}'";
}
$wc = $op != 'LIKE' ? "LOWER(civicrm_activity.subject)" : "civicrm_activity.subject";
$this->_where[$grouping][] = " {$wc} {$op} {$value}";
$this->_qill[$grouping][] = ts('Subject') . " {$op} - '{$n}'";
break;
case 'test_activities':
$this->_where[$grouping][] = " civicrm_activity.is_test = {$value}";
$this->_qill[$grouping][] = ts('Find Test Activities');
break;
case 'activity_date':
case 'activity_date_low':
case 'activity_date_high':
$this->dateQueryBuilder($values, 'civicrm_activity', 'activity_date', 'activity_date_time', ts('Activity Date'));
break;
}
}
示例8: whereClauseSingle
/**
* where clause for a single field
*
* @return void
* @access public
*/
static function whereClauseSingle(&$values, &$query)
{
list($name, $op, $value, $grouping, $wildcard) = $values;
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$query->_tables['civicrm_activity'] = $query->_whereTables['civicrm_activity'] = 1;
if ($query->_mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
$query->_skipDeleteClause = TRUE;
}
switch ($name) {
case 'activity_type_id':
$types = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
//get the component activity types.
$compActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE, TRUE);
$clause = array();
if (is_array($value)) {
foreach ($value as $id => $dontCare) {
if (array_key_exists($id, $types) && $dontCare) {
$clause[] = "'" . CRM_Utils_Type::escape($types[$id], 'String') . "'";
if (array_key_exists($id, $compActTypes)) {
CRM_Contact_BAO_Query::$_considerCompActivities = TRUE;
}
}
}
$activityTypes = implode(',', array_keys($value));
} else {
$clause[] = "'" . CRM_Utils_Type::escape($value, 'String') . "'";
$activityTypes = $value;
if (array_key_exists($value, $compActTypes)) {
CRM_Contact_BAO_Query::$_considerCompActivities = TRUE;
}
}
$query->_where[$grouping][] = ' civicrm_activity.activity_type_id IN (' . $activityTypes . ')';
$query->_qill[$grouping][] = ts('Activity Type') . ' ' . implode(' ' . ts('or') . ' ', $clause);
break;
case 'activity_survey_id':
if (!$value) {
break;
}
$value = CRM_Utils_Type::escape($value, 'Integer');
$query->_where[$grouping][] = " source_record_id = {$value}";
$query->_qill[$grouping][] = ts('Survey') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $value, 'title');
break;
case 'activity_engagement_level':
if (!$value) {
break;
}
$value = CRM_Utils_Type::escape($value, 'Integer');
$query->_where[$grouping][] = " engagement_level = {$value}";
$query->_qill[$grouping][] = ts('Engagement Index') . ' - ' . CRM_Core_OptionGroup::getLabel('engagement_index', $value);
break;
case 'activity_role':
CRM_Contact_BAO_Query::$_activityRole = $values[2];
//for activity target name
$activityTargetName = $query->getWhereValues('activity_contact_name', $grouping);
if (!$activityTargetName[2]) {
$name = NULL;
} else {
$name = trim($activityTargetName[2]);
$name = strtolower(CRM_Core_DAO::escapeString($name));
}
$query->_where[$grouping][] = " contact_activity_source.is_deleted = 0 AND contact_activity_source.sort_name LIKE '%{$name}%'";
if ($values[2] == 1) {
$query->_where[$grouping][] = " civicrm_activity.source_contact_id = contact_activity_source.id";
$query->_qill[$grouping][] = ts('Activity created by') . " '{$name}'";
$query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
} elseif ($values[2] == 2) {
$query->_where[$grouping][] = " civicrm_activity_assignment.activity_id = civicrm_activity.id AND civicrm_activity_assignment.assignee_contact_id = contact_activity_source.id";
$query->_tables['civicrm_activity_assignment'] = $query->_whereTables['civicrm_activity_assignment'] = 1;
$query->_tables['civicrm_activity_contact'] = $query->_whereTables['civicrm_activity_contact'] = 1;
$query->_qill[$grouping][] = ts('Activity assigned to') . " '{$name}'";
}
break;
case 'activity_status':
$status = CRM_Core_PseudoConstant::activityStatus();
$clause = array();
if (is_array($value)) {
foreach ($value as $k => $v) {
if ($k) {
$clause[] = "'" . CRM_Utils_Type::escape($status[$k], 'String') . "'";
}
}
} else {
$clause[] = "'" . CRM_Utils_Type::escape($value, 'String') . "'";
}
$query->_where[$grouping][] = ' civicrm_activity.status_id IN (' . implode(',', array_keys($value)) . ')';
$query->_qill[$grouping][] = ts('Activity Status') . ' - ' . implode(' ' . ts('or') . ' ', $clause);
break;
case 'activity_subject':
$n = trim($value);
$value = strtolower(CRM_Core_DAO::escapeString($n));
if ($wildcard) {
if (strpos($value, '%') !== FALSE) {
// only add wild card if not there
$value = "'{$value}'";
//.........这里部分代码省略.........